From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9647CC433E1 for ; Tue, 4 Aug 2020 14:15:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83EE121744 for ; Tue, 4 Aug 2020 14:15:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728724AbgHDOPL (ORCPT ); Tue, 4 Aug 2020 10:15:11 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:9467 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726948AbgHDOPG (ORCPT ); Tue, 4 Aug 2020 10:15:06 -0400 Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 04 Aug 2020 07:15:04 -0700 Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 04 Aug 2020 07:15:03 -0700 Received: from gkohli-linux.qualcomm.com ([10.204.78.26]) by ironmsg01-blr.qualcomm.com with ESMTP; 04 Aug 2020 19:44:50 +0530 Received: by gkohli-linux.qualcomm.com (Postfix, from userid 427023) id 73D3B486B; Tue, 4 Aug 2020 19:44:49 +0530 (IST) From: Gaurav Kohli To: will@kernel.org, linux-arm-kernel@lists.infradead.org, maz@kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, neeraju@codeaurora.org, Srinivas Kandagatla Subject: [PATCH] nvmem: core: add support to NVMEM_NO_SYSFS_ENTRY Date: Tue, 4 Aug 2020 19:44:43 +0530 Message-Id: <1596550484-11029-2-git-send-email-gkohli@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1596550484-11029-1-git-send-email-gkohli@codeaurora.org> References: <1596550484-11029-1-git-send-email-gkohli@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Srinivas Kandagatla Some users might not want to expose nvmem entry to sysfs and only intend to use kernel interface so add such provision. Signed-off-by: Srinivas Kandagatla --- Documentation/ABI/stable/sysfs-bus-nvmem | 2 ++ drivers/nvmem/Kconfig | 5 +++++ drivers/nvmem/core.c | 11 ++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Documentation/ABI/stable/sysfs-bus-nvmem b/Documentation/ABI/stable/sysfs-bus-nvmem index 5923ab4620c5..12aab0a85fea 100644 --- a/Documentation/ABI/stable/sysfs-bus-nvmem +++ b/Documentation/ABI/stable/sysfs-bus-nvmem @@ -6,6 +6,8 @@ Description: This file allows user to read/write the raw NVMEM contents. Permissions for write to this file depends on the nvmem provider configuration. + Note: This file is not present if CONFIG_NVMEM_NO_SYSFS_ENTRY + is enabled ex: hexdump /sys/bus/nvmem/devices/qfprom0/nvmem diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index 0a7a470ee859..6ab3276d287c 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -192,4 +192,9 @@ config SC27XX_EFUSE This driver can also be built as a module. If so, the module will be called nvmem-sc27xx-efuse. +config NVMEM_NO_SYSFS_ENTRY + bool "No nvmem sysfs entry" + + help + Say Yes if you do not want to add nvmem entry to sysfs. endif diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index b9a0270883a0..c70f183fe379 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -216,7 +216,7 @@ static const struct attribute_group nvmem_bin_rw_group = { .attrs = nvmem_attrs, }; -static const struct attribute_group *nvmem_rw_dev_groups[] = { +static const __maybe_unused struct attribute_group *nvmem_rw_dev_groups[] = { &nvmem_bin_rw_group, NULL, }; @@ -240,7 +240,7 @@ static const struct attribute_group nvmem_bin_ro_group = { .attrs = nvmem_attrs, }; -static const struct attribute_group *nvmem_ro_dev_groups[] = { +static const __maybe_unused struct attribute_group *nvmem_ro_dev_groups[] = { &nvmem_bin_ro_group, NULL, }; @@ -265,7 +265,7 @@ static const struct attribute_group nvmem_bin_rw_root_group = { .attrs = nvmem_attrs, }; -static const struct attribute_group *nvmem_rw_root_dev_groups[] = { +static const __maybe_unused struct attribute_group *nvmem_rw_root_dev_groups[] = { &nvmem_bin_rw_root_group, NULL, }; @@ -289,7 +289,7 @@ static const struct attribute_group nvmem_bin_ro_root_group = { .attrs = nvmem_attrs, }; -static const struct attribute_group *nvmem_ro_root_dev_groups[] = { +static const __maybe_unused struct attribute_group *nvmem_ro_root_dev_groups[] = { &nvmem_bin_ro_root_group, NULL, }; @@ -688,6 +688,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) nvmem->read_only = device_property_present(config->dev, "read-only") | config->read_only; +#if !defined(CONFIG_NVMEM_NO_SYSFS_ENTRY) if (config->root_only) nvmem->dev.groups = nvmem->read_only ? nvmem_ro_root_dev_groups : @@ -696,7 +697,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) nvmem->dev.groups = nvmem->read_only ? nvmem_ro_dev_groups : nvmem_rw_dev_groups; - +#endif device_initialize(&nvmem->dev); dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); -- 2.21.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 320B2C433E1 for ; Tue, 4 Aug 2020 14:16:38 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B7F922B40 for ; Tue, 4 Aug 2020 14:16:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xIqibaq/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B7F922B40 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fXbnccoH7mBT8nGuXqsJdCnZbLtLFzAkYLXiTSLJtY4=; b=xIqibaq/FBlcuviOy2unN5Eyx1 jK/GV/8leVfWLiCGjVOBzM2sJ83j2j5uCeFd5NUIgfAOuxDxWsJUOIBfi44GZBw2qjbn/Bc2jXPld EeYJwu2RffUgGtYIF4LCfRi9esPM2iM596ZFXRJ1ABBRE2qEiasEYf3I2wz5HK03op8AI6eUb81kV ANfcPc+Ke1ekD2OP8V76snSTGfNwm4FKws69lufEB7mbzoEzE7h4VpFs0SxlIxutaDDNgtNtxa8mX II5/GPXZ465VxBxN/JlQ8YSwzHvCkzWYNdcWlrjrKDf3ROxgBAPI9XyATrs7mkBRypciUPV8sLcw/ zdwoNr9Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2xih-00034h-S5; Tue, 04 Aug 2020 14:15:11 +0000 Received: from alexa-out.qualcomm.com ([129.46.98.28]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2xid-00033K-JE for linux-arm-kernel@lists.infradead.org; Tue, 04 Aug 2020 14:15:08 +0000 Received: from ironmsg07-lv.qualcomm.com (HELO ironmsg07-lv.qulacomm.com) ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 04 Aug 2020 07:15:04 -0700 Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg07-lv.qulacomm.com with ESMTP/TLS/AES256-SHA; 04 Aug 2020 07:15:02 -0700 Received: from gkohli-linux.qualcomm.com ([10.204.78.26]) by ironmsg01-blr.qualcomm.com with ESMTP; 04 Aug 2020 19:44:50 +0530 Received: by gkohli-linux.qualcomm.com (Postfix, from userid 427023) id 73D3B486B; Tue, 4 Aug 2020 19:44:49 +0530 (IST) From: Gaurav Kohli To: will@kernel.org, linux-arm-kernel@lists.infradead.org, maz@kernel.org Subject: [PATCH] nvmem: core: add support to NVMEM_NO_SYSFS_ENTRY Date: Tue, 4 Aug 2020 19:44:43 +0530 Message-Id: <1596550484-11029-2-git-send-email-gkohli@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1596550484-11029-1-git-send-email-gkohli@codeaurora.org> References: <1596550484-11029-1-git-send-email-gkohli@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200804_101507_774133_3D960DFD X-CRM114-Status: GOOD ( 15.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, Srinivas Kandagatla , linux-kernel@vger.kernel.org, neeraju@codeaurora.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Srinivas Kandagatla Some users might not want to expose nvmem entry to sysfs and only intend to use kernel interface so add such provision. Signed-off-by: Srinivas Kandagatla --- Documentation/ABI/stable/sysfs-bus-nvmem | 2 ++ drivers/nvmem/Kconfig | 5 +++++ drivers/nvmem/core.c | 11 ++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Documentation/ABI/stable/sysfs-bus-nvmem b/Documentation/ABI/stable/sysfs-bus-nvmem index 5923ab4620c5..12aab0a85fea 100644 --- a/Documentation/ABI/stable/sysfs-bus-nvmem +++ b/Documentation/ABI/stable/sysfs-bus-nvmem @@ -6,6 +6,8 @@ Description: This file allows user to read/write the raw NVMEM contents. Permissions for write to this file depends on the nvmem provider configuration. + Note: This file is not present if CONFIG_NVMEM_NO_SYSFS_ENTRY + is enabled ex: hexdump /sys/bus/nvmem/devices/qfprom0/nvmem diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index 0a7a470ee859..6ab3276d287c 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -192,4 +192,9 @@ config SC27XX_EFUSE This driver can also be built as a module. If so, the module will be called nvmem-sc27xx-efuse. +config NVMEM_NO_SYSFS_ENTRY + bool "No nvmem sysfs entry" + + help + Say Yes if you do not want to add nvmem entry to sysfs. endif diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index b9a0270883a0..c70f183fe379 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -216,7 +216,7 @@ static const struct attribute_group nvmem_bin_rw_group = { .attrs = nvmem_attrs, }; -static const struct attribute_group *nvmem_rw_dev_groups[] = { +static const __maybe_unused struct attribute_group *nvmem_rw_dev_groups[] = { &nvmem_bin_rw_group, NULL, }; @@ -240,7 +240,7 @@ static const struct attribute_group nvmem_bin_ro_group = { .attrs = nvmem_attrs, }; -static const struct attribute_group *nvmem_ro_dev_groups[] = { +static const __maybe_unused struct attribute_group *nvmem_ro_dev_groups[] = { &nvmem_bin_ro_group, NULL, }; @@ -265,7 +265,7 @@ static const struct attribute_group nvmem_bin_rw_root_group = { .attrs = nvmem_attrs, }; -static const struct attribute_group *nvmem_rw_root_dev_groups[] = { +static const __maybe_unused struct attribute_group *nvmem_rw_root_dev_groups[] = { &nvmem_bin_rw_root_group, NULL, }; @@ -289,7 +289,7 @@ static const struct attribute_group nvmem_bin_ro_root_group = { .attrs = nvmem_attrs, }; -static const struct attribute_group *nvmem_ro_root_dev_groups[] = { +static const __maybe_unused struct attribute_group *nvmem_ro_root_dev_groups[] = { &nvmem_bin_ro_root_group, NULL, }; @@ -688,6 +688,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) nvmem->read_only = device_property_present(config->dev, "read-only") | config->read_only; +#if !defined(CONFIG_NVMEM_NO_SYSFS_ENTRY) if (config->root_only) nvmem->dev.groups = nvmem->read_only ? nvmem_ro_root_dev_groups : @@ -696,7 +697,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) nvmem->dev.groups = nvmem->read_only ? nvmem_ro_dev_groups : nvmem_rw_dev_groups; - +#endif device_initialize(&nvmem->dev); dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); -- 2.21.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel