nvmem: set nvmem->owner to nvmem->dev->driver->owner if unset
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 20 Oct 2017 16:57:42 +0000 (01:57 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Nov 2017 12:54:17 +0000 (13:54 +0100)
All nvmem drivers are supposed to set the owner field of struct
nvmem_config, but this matches nvmem->dev->driver->owner.

As far as I see in drivers/nvmem/ directory, all the drivers are
the case.  So, make nvmem_register() set the nvmem's owner to the
associated driver's owner unless nvmem_config sets otherwise.

Remove .owner settings in the drivers that are now redundant.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 files changed:
drivers/nvmem/bcm-ocotp.c
drivers/nvmem/core.c
drivers/nvmem/imx-iim.c
drivers/nvmem/imx-ocotp.c
drivers/nvmem/lpc18xx_eeprom.c
drivers/nvmem/lpc18xx_otp.c
drivers/nvmem/meson-efuse.c
drivers/nvmem/mtk-efuse.c
drivers/nvmem/mxs-ocotp.c
drivers/nvmem/qfprom.c
drivers/nvmem/rockchip-efuse.c
drivers/nvmem/sunxi_sid.c
drivers/nvmem/vf610-ocotp.c

index 3c56e3b2bd65fcd244bb6a5e438033a22d54da1e..5e9e324427f9186ceea6d16e33116bb9d919cf21 100644 (file)
@@ -232,7 +232,6 @@ static struct nvmem_config bcm_otpc_nvmem_config = {
        .read_only = false,
        .word_size = 4,
        .stride = 4,
-       .owner = THIS_MODULE,
        .reg_read = bcm_otpc_read,
        .reg_write = bcm_otpc_write,
 };
index 86490459406325643af306e0139c3617e71fc3c6..5a5cefd12153af7fe8ec3ae114e41a2cb17383a3 100644 (file)
@@ -462,6 +462,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
 
        nvmem->id = rval;
        nvmem->owner = config->owner;
+       if (!nvmem->owner && config->dev->driver)
+               nvmem->owner = config->dev->driver->owner;
        nvmem->stride = config->stride;
        nvmem->word_size = config->word_size;
        nvmem->size = config->size;
index a5992602709ac74bdd8bf8f6343d35b9f016449c..52cfe91d976292c465c464e394d5b4231f257443 100644 (file)
@@ -133,7 +133,6 @@ static int imx_iim_probe(struct platform_device *pdev)
        cfg.read_only = true,
        cfg.word_size = 1,
        cfg.stride = 1,
-       cfg.owner = THIS_MODULE,
        cfg.reg_read = imx_iim_read,
        cfg.dev = dev;
        cfg.size = drvdata->nregs;
index 193ca8fd350a428356cfd7120b5394d36161bdad..e57e2a57aa3f39cdbdf6a0790c9dac95d0696b77 100644 (file)
@@ -303,7 +303,6 @@ static struct nvmem_config imx_ocotp_nvmem_config = {
        .read_only = false,
        .word_size = 4,
        .stride = 4,
-       .owner = THIS_MODULE,
        .reg_read = imx_ocotp_read,
        .reg_write = imx_ocotp_write,
 };
index 6c7e2c424a4e84e340fb380d18a2abb11b0153d8..b1af966206a67c7a6c5de8b5a2920b373a3fa327 100644 (file)
@@ -159,7 +159,6 @@ static struct nvmem_config lpc18xx_nvmem_config = {
        .word_size = 4,
        .reg_read = lpc18xx_eeprom_read,
        .reg_write = lpc18xx_eeprom_gather_write,
-       .owner = THIS_MODULE,
 };
 
 static int lpc18xx_eeprom_probe(struct platform_device *pdev)
index be8d07403ffc9bf50074cc132235b1fc4aca0339..95268db155e9c9333bda35ab6416594c0892223a 100644 (file)
@@ -64,7 +64,6 @@ static struct nvmem_config lpc18xx_otp_nvmem_config = {
        .read_only = true,
        .word_size = LPC18XX_OTP_WORD_SIZE,
        .stride = LPC18XX_OTP_WORD_SIZE,
-       .owner = THIS_MODULE,
        .reg_read = lpc18xx_otp_read,
 };
 
index 1ea3cd24a5082f25d1df6c2a4a5faa95f966acc3..a43c68f909373a03c173ed1f52c79ec55e713aeb 100644 (file)
@@ -37,7 +37,6 @@ static int meson_efuse_read(void *context, unsigned int offset,
 
 static struct nvmem_config econfig = {
        .name = "meson-efuse",
-       .owner = THIS_MODULE,
        .stride = 1,
        .word_size = 1,
        .read_only = true,
index c4058b598703adcdc13f578d7dc9a749ca53fece..9ee3479cfc7b2cedcbffe5950f3e3d7051c4e172 100644 (file)
@@ -72,7 +72,6 @@ static int mtk_efuse_probe(struct platform_device *pdev)
        econfig.size = resource_size(res);
        econfig.priv = priv;
        econfig.dev = dev;
-       econfig.owner = THIS_MODULE;
        nvmem = nvmem_register(&econfig);
        if (IS_ERR(nvmem))
                return PTR_ERR(nvmem);
index d26dd03cec80fbd3310a8ad33e626f7d28d117b9..7018e2ef57147179b75deca13a3e0663158fcec1 100644 (file)
@@ -118,7 +118,6 @@ static struct nvmem_config ocotp_config = {
        .name = "mxs-ocotp",
        .stride = 16,
        .word_size = 4,
-       .owner = THIS_MODULE,
        .reg_read = mxs_ocotp_read,
 };
 
index b96730e9958008ea22b79bafb7c6817ecfbf3f67..cb3b48b47d649ac986f4c9597fc2d1a633f3db5a 100644 (file)
@@ -56,7 +56,6 @@ static int qfprom_remove(struct platform_device *pdev)
 
 static struct nvmem_config econfig = {
        .name = "qfprom",
-       .owner = THIS_MODULE,
        .stride = 1,
        .word_size = 1,
        .reg_read = qfprom_reg_read,
index eb4c530c256424bcc295090a004b27447e67f15b..123de77ca5d6033646b7266922128056510705b1 100644 (file)
@@ -149,7 +149,6 @@ static int rockchip_rk3399_efuse_read(void *context, unsigned int offset,
 
 static struct nvmem_config econfig = {
        .name = "rockchip-efuse",
-       .owner = THIS_MODULE,
        .stride = 1,
        .word_size = 1,
        .read_only = true,
index 0d6648be93b8ed539203c0892fc6a8107d1e8f67..1c3b5cf892123db41f65e7e2bad4109ccfadfe2d 100644 (file)
@@ -40,7 +40,6 @@ static struct nvmem_config econfig = {
        .read_only = true,
        .stride = 4,
        .word_size = 1,
-       .owner = THIS_MODULE,
 };
 
 struct sunxi_sid_cfg {
index 72e4faabce299c382ce7662a1d62b942289ef722..5ae9e002f1959972c52a257e49761546a2e039d3 100644 (file)
@@ -206,7 +206,6 @@ static int vf610_ocotp_read(void *context, unsigned int offset,
 
 static struct nvmem_config ocotp_config = {
        .name = "ocotp",
-       .owner = THIS_MODULE,
        .stride = 4,
        .word_size = 4,
        .reg_read = vf610_ocotp_read,