Skip to content
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

drivers: eeprom: at2x: streamline codebase #80660

Merged

Conversation

ndrs-pst
Copy link
Contributor

@ndrs-pst ndrs-pst commented Oct 31, 2024

This PR includes 2 changes to the eeprom_at2x.c file as follows:

  • Remove '&' when assigning init_fn in DEVICE_DT_INST_DEFINE macro
  • Remove orphaned k_mutex_unlock in eeprom_at25_read

To maintain consistency in `init_fn` parameter passing,
remove the address-of operator ('&') when assigning the `init_fn`
function pointer in the `DEVICE_DT_INST_DEFINE` macro.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
Remove orphaned `k_mutex_unlock` in `eeprom_at25_read` as
the lock/unlock pair is handled in `eeprom_at2x_read` instead.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
const struct spi_buf tx_buf = {
.buf = &cmd,
static const uint8_t cmd = EEPROM_AT25_WREN;
static const struct spi_buf tx_buf = {
Copy link
Member

Choose a reason for hiding this comment

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

Not sure the static const changes are okay. Some SPI-controller drivers may be using DMA yet unable to DMA transfer from flash. I'd prefer to leave these as-is.

@henrikbrixandersen
Copy link
Member

@ndrs-pst Any plans for picking up this PR and addressing the requested change?

@ndrs-pst
Copy link
Contributor Author

That means, even if it uses synchronous APIs and does not involve DMA transfers, it would not be justified.
Therefore, I will address the requested change. 😃

@ndrs-pst ndrs-pst force-pushed the pr_drivers_eeprom_at2x_refactor branch from 4c68fd3 to ed9048c Compare December 16, 2024 15:22
@kartben kartben merged commit 997f6d4 into zephyrproject-rtos:main Dec 20, 2024
25 checks passed
@ndrs-pst ndrs-pst deleted the pr_drivers_eeprom_at2x_refactor branch December 20, 2024 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants