-
Notifications
You must be signed in to change notification settings - Fork 907
Small adrv9002 improvements #2976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There's no reason for that buffer to not be const. Furthermore jsmn_parse() indeed expects a const buffer. Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Given that adi_adrv9001_profileutil_Parse() now accepts a const buffer and that the bounce buffer was mainly to avoid hacky casts from const to non const buffers, simplify adrv9002_profile_load() by directly passing the fw->data to adi_adrv9001_profileutil_Parse(). Signed-off-by: Nuno Sá <nuno.sa@analog.com>
ADRV9002_PORT_MASK() already takes care between RX vs TX differences when dealing with port masks. Hence the if() else is useless and in fact the statements in each branch are the same. Caught by coccinelle (through CI). Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Use __free(firmware) in order to automatically release the requested firmware and simplify code paths. Note that adrv9002_init_cals_handle() we do not use as that functions makes use of goto jumps which does not properly work with the cleanup stuff (see cleanup.h for more details). Signed-off-by: Nuno Sá <nuno.sa@analog.com>
814f894 to
ae5d019
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- iio: adc: adrv9002: profileutil: Constify jsonbuffer
OK, Constify is just a weird word - iio: adc: adrv9002: Drop profile bounce buffer
OK - iio: adc: adrv9002: Drop useless if() condition
OK, yes, the lines in the if are identical, probably older than the macron itself. - iio: adc: adrv9002: Use firmware auto cleanup
OK, makes things simpler
| unsigned long *prate) | ||
| { | ||
| struct adrv9002_clock *clk_priv = to_clk_priv(hw); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the deadcode for dev_dbg occurs for if the DEBUG symbols are missing and the method is optimized away.
Adding to the todo-list to see if really the case, and enable in adi_ci_defconfig if so.
The already enabled flags are
CONFIG_MODULE_DEBUG=y
CONFIG_DEBUG_DRIVER=y
CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_FS=y
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, most likely. I'll actually evaluate to drop those dev_dbg(). Not that useful anyways
| else | ||
| profile = phy->chip->lvd_profile; | ||
|
|
||
| const struct firmware *fw __free(firmware) = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool
| #define ADI_ADRV9001_TOKEN_MAX_LENGTH 32 | ||
|
|
||
| int32_t adi_adrv9001_profileutil_Parse(adi_adrv9001_Device_t *device, adi_adrv9001_Init_t *init, char * jsonBuffer, uint32_t length) | ||
| int32_t adi_adrv9001_profileutil_Parse(adi_adrv9001_Device_t *device, adi_adrv9001_Init_t *init, const char * jsonBuffer, uint32_t length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since already fixing trailing whitespace, could fix the space between the pointer operator and the var name
| int32_t adi_adrv9001_profileutil_Parse(adi_adrv9001_Device_t *device, adi_adrv9001_Init_t *init, const char * jsonBuffer, uint32_t length) | |
| int32_t adi_adrv9001_profileutil_Parse(adi_adrv9001_Device_t *device, adi_adrv9001_Init_t *init, const char *jsonBuffer, uint32_t length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is API stuff and all the white spaces will be lost anyways (since when I send the PR to the BU I only take the real change into account). The whites spaces in here is because I have my editor to automatically trim them on save and I'm lazy to care about it 😅
PR Description
Minor code simplifications for the adrv9002 driver.
PR Type
PR Checklist