From patchwork Tue Aug 11 11:03:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 6991581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8417A9F358 for ; Tue, 11 Aug 2015 11:06:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA2D1205BE for ; Tue, 11 Aug 2015 11:06:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C647D20430 for ; Tue, 11 Aug 2015 11:06:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZP7Lu-0002cV-MU; Tue, 11 Aug 2015 11:04:18 +0000 Received: from mail-wi0-f172.google.com ([209.85.212.172]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZP7Lm-0002RC-2O for linux-arm-kernel@lists.infradead.org; Tue, 11 Aug 2015 11:04:11 +0000 Received: by wicja10 with SMTP id ja10so70545744wic.1 for ; Tue, 11 Aug 2015 04:03:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lsXAr3pblCg5RcjkL18WXU1qWMk3KLKoCOwn02SmKn4=; b=erkZj5/OHD+3ybJaaeoP0yibPkY3msSO6m0OE4rY1/9Jw2nX90xoVtNU82xhJ2fuVH jknszbna0X+3yxc0ZMrVUXDtjpaWeJqc2qIAOd/ZqqVFq3YrhjqECbtWEJs+C8dCZkuS MP8NHx3bdLCnDt/aKUqr41YApV5OthmNE2WdpNhiXK+nRGkNCDqpH1eEwEpGuIN6KFgt 8kM+UTxPxJJUcKmL6MnVgS42SCEF0cMEtYm2XI98U8vurQXjCaJ0+UcKyPHeHTkH8ODx OUuRZBz5iSva/uAUBBYdjN7LjGSDA4VPmVzBQdvXpAb0QtB2KN7sy8xdTuW2FvP3G65W D41A== X-Gm-Message-State: ALoCoQn1IJ/QS5GZEtTm+2Get/Suykt9rX8lSOsvyo+osXF2jR5aQmZoNfRBbD1N1+3pvWbXRqls X-Received: by 10.194.209.167 with SMTP id mn7mr52935272wjc.64.1439291028392; Tue, 11 Aug 2015 04:03:48 -0700 (PDT) Received: from localhost.localdomain (host-92-13-246-184.as43234.net. [92.13.246.184]) by smtp.gmail.com with ESMTPSA id gj13sm2841255wic.22.2015.08.11.04.03.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Aug 2015 04:03:47 -0700 (PDT) From: Srinivas Kandagatla To: Greg Kroah-Hartman Subject: [PATCH RFC 3/3] nvmem: add permission flags in nvmem_config Date: Tue, 11 Aug 2015 12:03:44 +0100 Message-Id: <1439291024-18375-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439290931-18232-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1439290931-18232-1-git-send-email-srinivas.kandagatla@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150811_040410_352908_3679DDB3 X-CRM114-Status: GOOD ( 13.59 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , arnd@arndb.de, khilman@kernel.org, devicetree@vger.kernel.org, linux-api@vger.kernel.org, s.hauer@pengutronix.de, sboyd@codeaurora.org, linux-kernel@vger.kernel.org, maitysanchayan@gmail.com, pantelis.antoniou@konsulko.com, Rob Herring , Srinivas Kandagatla , Mark Brown , p.zabel@pengutronix.de, linux-arm-msm@vger.kernel.org, mporter@konsulko.com, linux-arm-kernel@lists.infradead.org, wxt@rock-chips.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds perm variable to nvmem_config structure which will allow providers to specify the permissions required for the sysfs binary file. This permission is applied on top of root-only access permissions set by the core. Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 1 + include/linux/nvmem-provider.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 414ed23..7481387 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -312,6 +312,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) config->read_only; nvmem->bin = bin_attr_template; nvmem->bin.attr.mode = nvmem->read_only ? : (S_IRUSR | S_IWUSR); + nvmem->bin.attr.mode |= config->perm; nvmem->bin.size = nvmem->size; device_initialize(&nvmem->dev); diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 0b68caf..de9a61f 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -23,6 +23,7 @@ struct nvmem_config { const struct nvmem_cell_info *cells; int ncells; bool read_only; + u16 perm; /* visibility in sysfs */ }; #if IS_ENABLED(CONFIG_NVMEM)