From patchwork Wed Oct 7 11:01:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 54580 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id C76F022FF8 for ; Wed, 7 Oct 2015 11:01:20 +0000 (UTC) Received: by wisv5 with SMTP id v5sf6487043wis.0 for ; Wed, 07 Oct 2015 04:01:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=wSPk/wXbN6TaIzRCl2XXxTkD1daS+MgqcwIZeP3JiLo=; b=L2Z6B4NEyWkiKjAn+LGD7PzITaaZHKeQhGpjQbp7sHhdJvpVaZI/V6fy4/qiOfaxbX zZAUlsiWiTqIFPvaPg1q5kzV8trtyUtpJ8fsyEj2/R3v+mYC7L86YE0/0M93XNNqoOnj y1vEr5Qw0jK1d9kT0+gcO8J8x0ailH/MG034oQfnCdD+F2HKunNh8sNra0BGMnEnTaUT Je63USuiGOerY23OpxbKTloaYbspjlwMjbrx2GfwXbszCOSxDZXOWneLEpJHp/+EFK3V oG8oQI0/nuA1MkMY7EPG1hbm1HZA++/R6JvHUMlgKw2vqrEuD25r8pDw/ONwIivOR/Ge P6TQ== X-Gm-Message-State: ALoCoQlIJbI+JaitAw/eALrxxn0/7J7u2zrZT2AHJcPK+i9jgZM/bBzgFP6A8XeKAWUsrdqVIiuc X-Received: by 10.180.9.104 with SMTP id y8mr4686720wia.7.1444215680131; Wed, 07 Oct 2015 04:01:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.15.40 with SMTP id e40ls48943lfi.14.gmail; Wed, 07 Oct 2015 04:01:19 -0700 (PDT) X-Received: by 10.112.198.97 with SMTP id jb1mr242981lbc.8.1444215679949; Wed, 07 Oct 2015 04:01:19 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id wm1si24659281lbb.165.2015.10.07.04.01.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Oct 2015 04:01:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by labzv5 with SMTP id zv5so7882823lab.1 for ; Wed, 07 Oct 2015 04:01:19 -0700 (PDT) X-Received: by 10.25.20.80 with SMTP id k77mr131235lfi.117.1444215679674; Wed, 07 Oct 2015 04:01:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2373546lbq; Wed, 7 Oct 2015 04:01:18 -0700 (PDT) X-Received: by 10.66.155.231 with SMTP id vz7mr495313pab.58.1444215678336; Wed, 07 Oct 2015 04:01:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r9si56908882pap.24.2015.10.07.04.01.18; Wed, 07 Oct 2015 04:01:18 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753650AbbJGLBN (ORCPT + 30 others); Wed, 7 Oct 2015 07:01:13 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:37982 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753562AbbJGLBI (ORCPT ); Wed, 7 Oct 2015 07:01:08 -0400 Received: by wiclk2 with SMTP id lk2so22562000wic.1 for ; Wed, 07 Oct 2015 04:01:07 -0700 (PDT) X-Received: by 10.180.221.193 with SMTP id qg1mr21776000wic.87.1444215666989; Wed, 07 Oct 2015 04:01:06 -0700 (PDT) Received: from localhost.localdomain (host-92-13-246-184.as43234.net. [92.13.246.184]) by smtp.gmail.com with ESMTPSA id 12sm3653416wjw.15.2015.10.07.04.01.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Oct 2015 04:01:06 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: maxime.ripard@free-electrons.com, linux-kernel@vger.kernel.org, andrew@lunn.ch, wxt@rock-chips.com, stefan.wahren@i2se.com, pantelis.antoniou@konsulko.com, maitysanchayan@gmail.com, p.zabel@pengutronix.de, s.hauer@pengutronix.de, srinivas.kandagatla@linaro.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/3] nvmem: core: add sysfs file mode flag in nvmem_config Date: Wed, 7 Oct 2015 12:01:04 +0100 Message-Id: <1444215664-10921-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444215536-10783-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1444215536-10783-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srinivas.kandagatla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch adds mode variable to nvmem_config structure which will allow providers to specify the permissions for the sysfs binary file. This mode is applied on top of root-only access permissions set by the core. Having this flag would give more flexibility to providers to decide which permissions to set on the sysfs binary file entry. 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 737fa75..4b6f219 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -315,6 +315,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) if (!nvmem->read_only) nvmem->bin.attr.mode |= S_IWUSR; + nvmem->bin.attr.mode |= config->mode; 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..3f22caa 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; + umode_t mode; /* visibility in sysfs */ }; #if IS_ENABLED(CONFIG_NVMEM)