Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3443074imm; Fri, 25 May 2018 05:56:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqS1gkYBGqhJiBGY9nzKfVKWoBUMt2JlkUtAzipu9KFpfutBcIWpoLUvBfw8wJaRb4F8hKz X-Received: by 2002:a17:902:4483:: with SMTP id l3-v6mr2552932pld.282.1527252980775; Fri, 25 May 2018 05:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527252980; cv=none; d=google.com; s=arc-20160816; b=nYpipljQxSVX2oNsx/zNnvc4q1nBWPaBNiqDqfOmitnsflwTj9/Gve3pQ5/4J+Yycj +W8QSuz/abkvmxW44JuFlh/NV5ZIEs1hh8+eiUuads3Y8f1SJXrDz+hVprobSNT5x1fp g7MKtzGpYv3U43orXw9EvemuGa4wJjIloVW979HwcvuWbzK2yYOJzQVmmn58t3+xMijF 5Fqw/64SbrqME9WxFaIaC/TJNf/+iKk2ep0ooGNHxplXMhO3PPz9/8/mx9AvyzxNJQto DhTuf91tDLHfylztaiQTofWV2Sg7aUiM7fNiEtoQiBgWJoqnnUmVz94AvoBfuliTGK8n hS0A== 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:arc-authentication-results; bh=1q8Hn1WTig6HakVFAtPbv1hUzv+jRJepqOm6D1HQnIw=; b=RsT3akDCWxA1XDwC3ITnBk4tg8DggN0sEDmDZ/V9lp51+pDPUgueGP6ucPGhRBrMb5 mnqg236v9xNAj5oYQ3bbxvA8oY5HFP1zNOb62ioMRDo1wBTFogfGT+aYumjLlVuXIGAF Emvlxsave6YKmDlFxlAOdNTXfapnvcf3/QSc4qo4H/N0BhnnqtfunBAx7istXmEdnB9f cCStdur9cdlw1pH7tJ4yR0r2rqbj0CpmEVMPmEUxN5kdObKkkKkF2qfrKjppIAuCI1ky L9pNbXnhF2LXk89eO2aUYyT7vDTh/QrsgaBnPaYm+zZ6WMxivCcfwZQM83pnBcbwXPgQ FC+A== ARC-Authentication-Results: i=1; mx.google.com; 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 t80-v6si1415135pfe.59.2018.05.25.05.56.06; Fri, 25 May 2018 05:56:20 -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; 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 S935926AbeEYMy3 (ORCPT + 99 others); Fri, 25 May 2018 08:54:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:40260 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753104AbeEYMxi (ORCPT ); Fri, 25 May 2018 08:53:38 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E673BAEC1; Fri, 25 May 2018 12:53:36 +0000 (UTC) From: Johannes Thumshirn To: Christoph Hellwig , Keith Busch , Sagi Grimberg Cc: Hannes Reinecke , Mike Snitzer , Laurence Oberman , Ewan Milne , James Smart , Linux Kernel Mailinglist , Linux NVMe Mailinglist , "Martin K . Petersen" , Martin George , John Meneghini Subject: [PATCH 2/3] nvme multipath: added SUBSYS_ATTR_RW Date: Fri, 25 May 2018 14:53:21 +0200 Message-Id: <20180525125322.15398-3-jthumshirn@suse.de> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180525125322.15398-1-jthumshirn@suse.de> References: <20180525125322.15398-1-jthumshirn@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Snitzer Prep for adding dev_attr in addition to subsys_attr for 'mpath_personality'. Signed-off-by: Mike Snitzer --- drivers/nvme/host/core.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 3a1c70bd9008..7105980dde3f 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2082,13 +2082,15 @@ static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsysnqn) return NULL; } -#define SUBSYS_ATTR_RW(_name) \ - struct device_attribute subsys_attr_##_name = \ - __ATTR_RW(_name) +#define SUBSYS_ATTR(_name, _mode, _show, _store) \ + struct device_attribute subsys_attr_##_name = \ + __ATTR(_name, _mode, _show, _store) -#define SUBSYS_ATTR_RO(_name, _mode, _show) \ - struct device_attribute subsys_attr_##_name = \ - __ATTR(_name, _mode, _show, NULL) +#define SUBSYS_ATTR_RO(_name, _show) \ + SUBSYS_ATTR(_name, 0444, _show, NULL) + +#define SUBSYS_ATTR_RW(_name, _show, _store) \ + SUBSYS_ATTR(_name, 0644, _show, _store) static ssize_t nvme_subsys_show_nqn(struct device *dev, struct device_attribute *attr, @@ -2099,7 +2101,7 @@ static ssize_t nvme_subsys_show_nqn(struct device *dev, return snprintf(buf, PAGE_SIZE, "%s\n", subsys->subnqn); } -static SUBSYS_ATTR_RO(subsysnqn, S_IRUGO, nvme_subsys_show_nqn); +static SUBSYS_ATTR_RO(subsysnqn, nvme_subsys_show_nqn); #define nvme_subsys_show_str_function(field) \ static ssize_t subsys_##field##_show(struct device *dev, \ @@ -2110,17 +2112,16 @@ static ssize_t subsys_##field##_show(struct device *dev, \ return sprintf(buf, "%.*s\n", \ (int)sizeof(subsys->field), subsys->field); \ } \ -static SUBSYS_ATTR_RO(field, S_IRUGO, subsys_##field##_show); +static SUBSYS_ATTR_RO(field, subsys_##field##_show); nvme_subsys_show_str_function(model); nvme_subsys_show_str_function(serial); nvme_subsys_show_str_function(firmware_rev); - #ifdef CONFIG_NVME_MULTIPATH -static ssize_t mpath_personality_show(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t nvme_subsys_show_mpath_personality(struct device *dev, + struct device_attribute *attr, + char *buf) { struct nvme_subsystem *subsys = container_of(dev, struct nvme_subsystem, dev); @@ -2134,9 +2135,9 @@ static ssize_t mpath_personality_show(struct device *dev, return ret; } -static ssize_t mpath_personality_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t nvme_subsys_store_mpath_personality(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { struct nvme_subsystem *subsys = container_of(dev, struct nvme_subsystem, dev); @@ -2161,7 +2162,8 @@ static ssize_t mpath_personality_store(struct device *dev, out: return ret ? ret : count; } -static SUBSYS_ATTR_RW(mpath_personality); +static SUBSYS_ATTR_RW(mpath_personality, nvme_subsys_show_mpath_personality, + nvme_subsys_store_mpath_personality); #endif static struct attribute *nvme_subsys_attrs[] = { -- 2.16.3