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: 52304 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 8719422DD6 for ; Tue, 11 Aug 2015 11:04:12 +0000 (UTC) Received: by lagz9 with SMTP id z9sf52010496lag.3 for ; Tue, 11 Aug 2015 04:04:11 -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=nlFeHIDjzSdJ41Bka0DPhPlhPJEfHcTBIU0v/lol8Fc=; b=R8xCYqH5bsJkrDVcD2xx5XoRIim4FHRHu5BAXxCFgL4CuTGF9mKdnozW1bixln0A0b 2YG5iqZ68Xt5nzAtCLjA4Za26ThZV87yhRG2t4hwSmTGGOJuIXSAo26Q+qLxA/L6uiRJ ZsISpRTOToBFwZS2C2xTl+A+QTKfXmPf+D3nhBilgtajsw2PWoxTi6s5dy4HyKrTQ5R4 9tS3rwz3gIugxNhI31lFzEhVe/siee8m73gpVgdKuQTEQlxsDGUkKC/UKSjMxqNM8UrZ DTHSx7i4KvjDrD/fFixCf+hGzYaFrdorIzitAy/oQp+y3jUSe10rZGCR42M8USS+d2tP IsBA== X-Gm-Message-State: ALoCoQngmRVS3pDWyNdb1fBYKyCdj2iX2FuHteyowzzC03G0LROMU1MyijA1WovJoDBTOfrFCYyZ X-Received: by 10.180.216.12 with SMTP id om12mr5184038wic.1.1439291051500; Tue, 11 Aug 2015 04:04:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.197 with SMTP id da5ls863794lac.61.gmail; Tue, 11 Aug 2015 04:04:11 -0700 (PDT) X-Received: by 10.152.37.2 with SMTP id u2mr25727933laj.70.1439291051311; Tue, 11 Aug 2015 04:04:11 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id ra3si1081263lbb.160.2015.08.11.04.04.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Aug 2015 04:04:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lbbtg9 with SMTP id tg9so3945037lbb.1 for ; Tue, 11 Aug 2015 04:04:11 -0700 (PDT) X-Received: by 10.152.88.78 with SMTP id be14mr25434929lab.29.1439291050720; Tue, 11 Aug 2015 04:04:10 -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.7.198 with SMTP id l6csp2449177lba; Tue, 11 Aug 2015 04:04:09 -0700 (PDT) X-Received: by 10.66.101.71 with SMTP id fe7mr55391275pab.89.1439291039703; Tue, 11 Aug 2015 04:03:59 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3si2876335pdf.91.2015.08.11.04.03.58; Tue, 11 Aug 2015 04:03:59 -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 S964891AbbHKLDv (ORCPT + 28 others); Tue, 11 Aug 2015 07:03:51 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:33088 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964787AbbHKLDt (ORCPT ); Tue, 11 Aug 2015 07:03:49 -0400 Received: by wijp15 with SMTP id p15so171255186wij.0 for ; Tue, 11 Aug 2015 04:03:48 -0700 (PDT) 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 Cc: Andrew Lunn , wxt@rock-chips.com, linux-api@vger.kernel.org, Rob Herring , sboyd@codeaurora.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, khilman@kernel.org, s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, mporter@konsulko.com, pantelis.antoniou@konsulko.com, devicetree@vger.kernel.org, Mark Brown , maitysanchayan@gmail.com, p.zabel@pengutronix.de, Srinivas Kandagatla 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> 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.217.174 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 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)