From patchwork Fri Oct 20 16:57:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 116516 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1906867qgn; Fri, 20 Oct 2017 10:01:41 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TjbI0cl0rdZUNUa6upJHU1LPgNzoNlIxvcuM62eXQdgbB9vYFpVXgPG4x29idpVqoVAigO X-Received: by 10.159.229.136 with SMTP id az8mr4677899plb.59.1508518901149; Fri, 20 Oct 2017 10:01:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508518901; cv=none; d=google.com; s=arc-20160816; b=vg2adW/7Cn3ZukA8w4SCjK8sGCQpb1igQoq0J/sJQGPfDv1Uhw0bekWIjmziu41Ygb 9inZ7JR8AwiLldUOIdOX2zbqv9fBtCpDgngHqwhANvzVzWNGbjpiWn+etXp5Cdb636Hu xydhT2WUxl3quq7bUgAnG7OH1RMpgsHIv0tEYOIRarvjY3jwAUclzVTDzcfzZuhcgyie uZEDMwjK+PX30AYAJU96v7SOoI7lV1Lt9ZSdJj+bciy/IKkL/a6DoBytxaDEfPzuHFk5 Bvs9xvqPUf5T7tB3BKvLPr5SAMyymChUCp/BD/kRL6z6W4ZG63wvSPyyX1dPtqdCZ2od xcWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=4Wf+g+uwk+HpGkW1M6tWZXSoAsWEQoPEcf3PXrAsDJo=; b=orY1IKiuqlzVnvRBmuN0uWLOS+A7X5IGmGhL69RSZ6qMkwe12LXcrcZOkhMj6DgZcY /GrR9Vbcd1o2mCjomgPRuPfUG77AAkLjE2Ml1lNPzWKxxD1XKdMlr77bOLXBcETh8JDG PvfmW2cvncRQApOUFgDzboMUW+E0Q80E3s4ulB2tY69+TVYB9FU76WOSyynzzTLxLfYQ v35JL0EWAGbSyDQjv82hRkYGgNaqO8/OrGB9EDhXa/5/G3Mbkf+t7sxqbLUi1PCftSyE GtN8Fmik02ES3EwgJXcg3pQVXGthrZjYJcIIC3Rw0ppWwyQsS57BXAvOtojVSnL/FEdE ZQ4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Iex8rcsb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x10si795874plm.259.2017.10.20.10.01.40; Fri, 20 Oct 2017 10:01:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Iex8rcsb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753376AbdJTQ7E (ORCPT + 27 others); Fri, 20 Oct 2017 12:59:04 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:25129 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753252AbdJTQ64 (ORCPT ); Fri, 20 Oct 2017 12:58:56 -0400 Received: from grover.sesame (FL1-122-131-185-176.osk.mesh.ad.jp [122.131.185.176]) (authenticated) by conuserg-07.nifty.com with ESMTP id v9KGwC3d005656; Sat, 21 Oct 2017 01:58:15 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v9KGwC3d005656 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1508518695; bh=4Wf+g+uwk+HpGkW1M6tWZXSoAsWEQoPEcf3PXrAsDJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iex8rcsbSAcuSMYhp54HGracJADDCD8sEoObdn/WjAZnHUlizJ9P9kqGRZ7BY6qs3 Gv2Nv1igVmpHteh1qn0MOULoKgbT2BfyWDSunEmy4QzRxbtsdvK5AsfqUJjGjJBXJT Udg3doVeWxEQ2G7xrln8X7aJU82IKVdB6lgo4OX2L6QewxdC3iwstuQ26hJibOHe1q CQ5HDkuZxtlXnUdUO9mQCnQ4P/fS+BcrfolqniS1JP8MJybEyHRHVtkO5sqYFs3HKi ouivksa51aXyiUdVsq7HOYAzSNvN2sVdUA4DAtkdEdlaLaud8DuMfMxFiniXpq4GHb EDQEFuqy3kiNA== X-Nifty-SrcIP: [122.131.185.176] From: Masahiro Yamada To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: Srinivas Kandagatla , Masahiro Yamada Subject: [RESEND PATCH 5/5] nvmem: set nvmem->owner to nvmem->dev->driver->owner if unset Date: Sat, 21 Oct 2017 01:57:42 +0900 Message-Id: <1508518662-8800-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508518662-8800-1-git-send-email-yamada.masahiro@socionext.com> References: <1508518662-8800-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/bcm-ocotp.c | 1 - drivers/nvmem/core.c | 2 ++ drivers/nvmem/imx-iim.c | 1 - drivers/nvmem/imx-ocotp.c | 1 - drivers/nvmem/lpc18xx_eeprom.c | 1 - drivers/nvmem/lpc18xx_otp.c | 1 - drivers/nvmem/meson-efuse.c | 1 - drivers/nvmem/mtk-efuse.c | 1 - drivers/nvmem/mxs-ocotp.c | 1 - drivers/nvmem/qfprom.c | 1 - drivers/nvmem/rockchip-efuse.c | 1 - drivers/nvmem/sunxi_sid.c | 1 - drivers/nvmem/vf610-ocotp.c | 1 - 13 files changed, 2 insertions(+), 12 deletions(-) -- 2.7.4 diff --git a/drivers/nvmem/bcm-ocotp.c b/drivers/nvmem/bcm-ocotp.c index 3c56e3b..5e9e324 100644 --- a/drivers/nvmem/bcm-ocotp.c +++ b/drivers/nvmem/bcm-ocotp.c @@ -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, }; diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 8649045..5a5cefd 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -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; diff --git a/drivers/nvmem/imx-iim.c b/drivers/nvmem/imx-iim.c index a599260..52cfe91d 100644 --- a/drivers/nvmem/imx-iim.c +++ b/drivers/nvmem/imx-iim.c @@ -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; diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index 193ca8f..e57e2a5 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -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, }; diff --git a/drivers/nvmem/lpc18xx_eeprom.c b/drivers/nvmem/lpc18xx_eeprom.c index 6c7e2c4..b1af966 100644 --- a/drivers/nvmem/lpc18xx_eeprom.c +++ b/drivers/nvmem/lpc18xx_eeprom.c @@ -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) diff --git a/drivers/nvmem/lpc18xx_otp.c b/drivers/nvmem/lpc18xx_otp.c index be8d074..95268db 100644 --- a/drivers/nvmem/lpc18xx_otp.c +++ b/drivers/nvmem/lpc18xx_otp.c @@ -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, }; diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c index 1ea3cd2..a43c68f 100644 --- a/drivers/nvmem/meson-efuse.c +++ b/drivers/nvmem/meson-efuse.c @@ -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, diff --git a/drivers/nvmem/mtk-efuse.c b/drivers/nvmem/mtk-efuse.c index c4058b5..9ee3479 100644 --- a/drivers/nvmem/mtk-efuse.c +++ b/drivers/nvmem/mtk-efuse.c @@ -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); diff --git a/drivers/nvmem/mxs-ocotp.c b/drivers/nvmem/mxs-ocotp.c index d26dd03..7018e2e 100644 --- a/drivers/nvmem/mxs-ocotp.c +++ b/drivers/nvmem/mxs-ocotp.c @@ -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, }; diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c index b96730e..cb3b48b 100644 --- a/drivers/nvmem/qfprom.c +++ b/drivers/nvmem/qfprom.c @@ -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, diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c index eb4c530..123de77 100644 --- a/drivers/nvmem/rockchip-efuse.c +++ b/drivers/nvmem/rockchip-efuse.c @@ -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, diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c index 0d6648b..1c3b5cf 100644 --- a/drivers/nvmem/sunxi_sid.c +++ b/drivers/nvmem/sunxi_sid.c @@ -40,7 +40,6 @@ static struct nvmem_config econfig = { .read_only = true, .stride = 4, .word_size = 1, - .owner = THIS_MODULE, }; struct sunxi_sid_cfg { diff --git a/drivers/nvmem/vf610-ocotp.c b/drivers/nvmem/vf610-ocotp.c index 72e4faa..5ae9e00 100644 --- a/drivers/nvmem/vf610-ocotp.c +++ b/drivers/nvmem/vf610-ocotp.c @@ -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,