From e94dddebbccd1d8fe4901dbc84d9bcde20f9039d Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 31 May 2021 09:24:04 +0200 Subject: 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 Link: https://lore.barebox.org/20210531072406.5630-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- include/linux/nvmem-provider.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'include/linux') 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) -- cgit v1.2.3