diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-05-31 09:24:04 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-06-02 10:16:08 +0200 |
commit | e94dddebbccd1d8fe4901dbc84d9bcde20f9039d (patch) | |
tree | 3662c0635143a1c6dc3996f8c52ec2fe9bdb1caa /include/linux | |
parent | 2a2c65fa6fead0daa79bd3d6667b9f63b3b2106b (diff) | |
download | barebox-e94dddebbccd1d8fe4901dbc84d9bcde20f9039d.tar.gz barebox-e94dddebbccd1d8fe4901dbc84d9bcde20f9039d.tar.xz |
nvmem: provider: align read/write callback prototype with upstream
barebox allocates a NVMEM device as part of nvmem_register, which it
passes along to the callbacks. Callbacks then use dev->parent->priv
to retrieve the driver private data. This indirection makes definition
of nvmem helpers inconvenient, because they would need to hijack the
->priv member of the hardware device. Avoid this by passing along
some private data pointer defined at registration time, just like Linux
does. This will be used in a follow up commit.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210531072406.5630-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/nvmem-provider.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 6ef5ea6854..ac9ad21711 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -18,10 +18,8 @@ struct nvmem_device; struct nvmem_bus { - int (*write)(struct device_d *dev, const int reg, const void *val, - int val_size); - int (*read)(struct device_d *dev, const int reg, void *val, - int val_size); + int (*write)(void *ctx, unsigned int reg, const void *val, size_t val_size); + int (*read)(void *ctx, unsigned int reg, void *val, size_t val_size); }; struct nvmem_config { @@ -32,6 +30,7 @@ struct nvmem_config { int word_size; int size; const struct nvmem_bus *bus; + void *priv; }; #if IS_ENABLED(CONFIG_NVMEM) |