Skip to content

drivers/adxl345: fixes & cleanup#7067

Merged
aabadie merged 1 commit intoRIOT-OS:masterfrom
dylad:adxl345_fix
Aug 22, 2018
Merged

drivers/adxl345: fixes & cleanup#7067
aabadie merged 1 commit intoRIOT-OS:masterfrom
dylad:adxl345_fix

Conversation

@dylad
Copy link
Copy Markdown
Member

@dylad dylad commented May 16, 2017

@haukepetersen As promised, this PR should address all your missing reviews from #6799
I hope I didn't forget something.

@aabadie aabadie added Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Area: drivers Area: Device drivers labels May 17, 2017
@aabadie aabadie added this to the Release 2017.07 milestone May 17, 2017
@smlng smlng added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label May 31, 2017
Copy link
Copy Markdown
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor comment, otherwise look good. @haukepetersen what do you think ?

adxl345_params->i2c);

if (adxl345_init(&dev, (adxl345_params_t*)adxl345_params) == ADXL345_OK) {
if (adxl345_init(&dev, adxl345_params) == ADXL345_OK) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be &adxl345_params[0], since ADXL_PARAMS macro may contain a list (defined by user).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aabadie I'll address your comment after @haukepetersen's review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am with @aabadie on this.

Copy link
Copy Markdown
Contributor

@haukepetersen haukepetersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, two minor things and this PR is good to go.

puts("ADXL345 test application");
printf("Initializing ADXL345 accelerometer at I2C_DEV(%i)... ",
dev.i2c);
adxl345_params->i2c);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be adx11345_params[0].i2c if I am not mistaken. Comes down to the same thing, but would semantically the right thing to do here.

adxl345_params->i2c);

if (adxl345_init(&dev, (adxl345_params_t*)adxl345_params) == ADXL345_OK) {
if (adxl345_init(&dev, adxl345_params) == ADXL345_OK) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am with @aabadie on this.

@haukepetersen
Copy link
Copy Markdown
Contributor

and sorry for the long reaction time...

@dylad
Copy link
Copy Markdown
Member Author

dylad commented Aug 28, 2017

@aabadie @haukepetersen
I addressed your comments and rebased.
Waiting for ACK :)

@dylad
Copy link
Copy Markdown
Member Author

dylad commented Oct 10, 2017

ping

@dylad
Copy link
Copy Markdown
Member Author

dylad commented Nov 10, 2017

Rebased on lastest master.
This PR is still looking for ACK so we can push the green button :)


#define BUS (dev->i2c)
#define ADDR (dev->addr)
#define BUS (dev->params->i2c)
Copy link
Copy Markdown
Contributor

@aabadie aabadie Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be dev->params.i2c instead of dev->params->i2c, same issue on the line below.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params is a pointer, hence params->i2c

typedef struct {
i2c_t i2c; /**< I2C device which is used */
uint8_t addr; /**< I2C address */
adxl345_params_t *params; /**< Device configuration */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to use a pointer for params (was already the case)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it was requested by @haukepetersen in #6799 to save a bit of RAM.
The idea was the keep the often used data in RAM and let the rest in ROM.

Copy link
Copy Markdown
Contributor

@aabadie aabadie Nov 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through #6799 but couldn't find any reference of that. Looking at the device driver implementation (especially this paragraph), the params attribute shouldn't be a pointer (it's called p in the wiki)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ACK if you change that @dylad ;)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aabadie see #6799 (comment)
@haukepetersen what should we do ?

Copy link
Copy Markdown
Contributor

@aabadie aabadie Nov 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haukepetersen, what's your opinion here ? (You wrote the wiki and gave the pointer advice)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with using a pointer. This lets us put the configuration constants in ROM instead of in RAM. adxl345_params_t is significantly larger than a single pointer and I doubt the double dereference will cause any measurable performance delays when communicating with a I2C device.

@kaspar030
Copy link
Copy Markdown
Contributor

ping

@dylad
Copy link
Copy Markdown
Member Author

dylad commented Apr 16, 2018

@haukepetersen ping

@kaspar030 kaspar030 removed this from the Release 2018.04 milestone Apr 20, 2018
@kaspar030
Copy link
Copy Markdown
Contributor

postponed

@tcschmidt
Copy link
Copy Markdown
Member

@haukepetersen ping

@dylad
Copy link
Copy Markdown
Member Author

dylad commented Jun 21, 2018

I guess we will never have @haukepetersen 's response here. Should I close ?

@tcschmidt
Copy link
Copy Markdown
Member

We can look for other reviewers and clear the request of @haukepetersen - what about your requests @aabadie ?

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Jun 22, 2018

The problem here is not about clearing @haukepetersen's review but rather having his opinion on this comment and the associated thread.

@tcschmidt
Copy link
Copy Markdown
Member

@aabadie if @haukepetersen is not sharing his opinion we need someone else to evaluate the case. Unresponsiveness is a DoS to the process, and this has been almost a year by now.

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Jun 26, 2018

Unresponsiveness is a DoS to the process, and this has been almost a year by now.

Agreed @tcschmidt, let's ask @gebart who commented somewhere else about a similar problem.

Copy link
Copy Markdown
Member

@jnohlgard jnohlgard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, untested ACK

typedef struct {
i2c_t i2c; /**< I2C device which is used */
uint8_t addr; /**< I2C address */
adxl345_params_t *params; /**< Device configuration */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with using a pointer. This lets us put the configuration constants in ROM instead of in RAM. adxl345_params_t is significantly larger than a single pointer and I doubt the double dereference will cause any measurable performance delays when communicating with a I2C device.


#define BUS (dev->i2c)
#define ADDR (dev->addr)
#define BUS (dev->params->i2c)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params is a pointer, hence params->i2c

@tcschmidt
Copy link
Copy Markdown
Member

@aabadie are your concerns addressed ?

@dylad
Copy link
Copy Markdown
Member Author

dylad commented Jul 5, 2018

This PR is blocked as long as the I2C embargo remains so no need to hurry.

@kaspar030
Copy link
Copy Markdown
Contributor

This PR is blocked as long as the I2C embargo remains so no need to hurry.

Maybe we need a label for that?

@dylad dylad added the State: waiting for other PR State: The PR requires another PR to be merged first label Jul 5, 2018
@dylad dylad removed the State: waiting for other PR State: The PR requires another PR to be merged first label Aug 3, 2018
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
@dylad
Copy link
Copy Markdown
Member Author

dylad commented Aug 3, 2018

I resolved a conflict introduces by the I2C rework, now the embargo is over we can handle this PR :)

@tcschmidt
Copy link
Copy Markdown
Member

Yep - but now @aabadie is gone. Is it easy to resolve @PeterKietzmann or shall we wait for Alex?

@dylad
Copy link
Copy Markdown
Member Author

dylad commented Aug 3, 2018

We can wait for @aabadie to come back I guess. I don't mind.

@PeterKietzmann
Copy link
Copy Markdown
Member

The PR is ACKed and only waits for testing. Unfortunately I don't have such a device available. @aabadie do you? Then, you can directly remove your change request :-). As I see it, the question about using a pointer to params seems to be answered.

@tcschmidt
Copy link
Copy Markdown
Member

@aabadie ping

Copy link
Copy Markdown
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with this one. ACK

Other drivers need to be adapted the same way.

@aabadie aabadie merged commit 463b04a into RIOT-OS:master Aug 22, 2018
@jia200x jia200x modified the milestone: Release 2018.10 Oct 4, 2018
@dylad dylad deleted the adxl345_fix branch May 8, 2019 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants