Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1403935img; Tue, 26 Feb 2019 21:35:33 -0800 (PST) X-Google-Smtp-Source: AHgI3IZNAOTPnwvoJN5dFMcU5BctZ7elXLi/2mN9xyykA7y43KgtenE9b2nPkV7CYspxncdpwtcJ X-Received: by 2002:a17:902:9a95:: with SMTP id w21mr349059plp.118.1551245733270; Tue, 26 Feb 2019 21:35:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551245733; cv=none; d=google.com; s=arc-20160816; b=wIGTJC6+C+2uDdnbMPE2fPW60+i8qdDMbygFkaVndiFWY+lZ1cO5bz4H5RsNJsy7PM uUom4Xvh8F2Ps6gopGASnLnVRCuyEgRHoOcUJkdFR6vL72mIt5QUcXbhgzqDNzWWJ/Gg 0BmjUX8FBSYHPS6ZwDS8C69FXso+lq1619/hLTsQ7DlP4gePx90W79tTcqeRBdkhB2tV Ot3VdXBb+F/DpjkYFbSAwvgN+O5sSfbCz2Yudgm723+Wbg3ym3FvDJS7xgveMlurZy2V v5e8junKtKmUII+G31xWECnlbUsF2eRTIIysMxBLs/1TMkFUCZm4a0RbcgLBpe+yZuLO VoUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=1TwBn8yWZnaqFDh+9IwBVbo1nnDzlOorD/g15LifO70=; b=NP0M+8HrTzSZXfbEe5Qnh5gUeas8Aa5IIHmzBEPefwE0CBxk2SFmgbVBD9xfPkU4fI AQ78xaA2ouje+AhKrYkUuuECH1L0WfxfHYoCNjVv48Y1YUVA+CUpRMDx4nNxre2rUiBD zmF2oT6lZJ8+UdTUktZDZZL0aixqZpdkm9nLrt1UVL7NZES+AE1Drg7BJnW8ukRZwx4G P8p6SYnIHVdW3TruAI87urqn8xzoVQaswZ9d/vmVhVmLMDypqsXEy/9d6e+EevGCWWGm jGzrCk8vlr8B6uiNT0HyYGgVAjq/rYeAdPGvWHNWB3PY113fSuuuErrX3N9FuN+quXY5 0Jcw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n6si3401017pla.169.2019.02.26.21.34.40; Tue, 26 Feb 2019 21:35:33 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726704AbfB0Fds (ORCPT + 99 others); Wed, 27 Feb 2019 00:33:48 -0500 Received: from mga18.intel.com ([134.134.136.126]:35513 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725903AbfB0Fds (ORCPT ); Wed, 27 Feb 2019 00:33:48 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2019 21:33:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,418,1544515200"; d="scan'208";a="146888280" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 26 Feb 2019 21:33:46 -0800 Date: Wed, 27 Feb 2019 13:33:19 +0800 From: Wei Yang To: "Michael S. Tsirkin" Cc: Wei Yang , qemu-devel@nongnu.org, linux-kernel@vger.kernel.org, somlo@cmu.edu Subject: Re: [PATCH] fw_cfg: use __ATTR_RO_MODE to define rev sysfs Message-ID: <20190227053319.GB5449@richard> Reply-To: Wei Yang References: <20190226073159.13434-1-richardw.yang@linux.intel.com> <20190226110934-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190226110934-mutt-send-email-mst@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 26, 2019 at 11:10:06AM -0500, Michael S. Tsirkin wrote: >On Tue, Feb 26, 2019 at 03:31:59PM +0800, Wei Yang wrote: >> Leverage __ATTR_RO_MODE to define rev sysfs instead of using open code >> to define the attribute. >> >> Signed-off-by: Wei Yang >> --- >> drivers/firmware/qemu_fw_cfg.c | 13 ++++--------- >> 1 file changed, 4 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c >> index 039e0f91dba8..a1293cbd7adb 100644 >> --- a/drivers/firmware/qemu_fw_cfg.c >> +++ b/drivers/firmware/qemu_fw_cfg.c >> @@ -296,18 +296,13 @@ static int fw_cfg_do_platform_probe(struct platform_device *pdev) >> return 0; >> } >> >> -static ssize_t fw_cfg_showrev(struct kobject *k, struct attribute *a, char *buf) >> +static ssize_t fw_cfg_rev_show(struct kobject *k, struct kobj_attribute *a, >> + char *buf) >> { >> return sprintf(buf, "%u\n", fw_cfg_rev); >> } >> - >> -static const struct { >> - struct attribute attr; >> - ssize_t (*show)(struct kobject *k, struct attribute *a, char *buf); >> -} fw_cfg_rev_attr = { >> - .attr = { .name = "rev", .mode = S_IRUSR }, >> - .show = fw_cfg_showrev, >> -}; >> +static const struct kobj_attribute fw_cfg_rev_attr = >> + __ATTR_RO_MODE(fw_cfg_rev, 0400); >> >> /* fw_cfg_sysfs_entry type */ >> struct fw_cfg_sysfs_entry { > > >Looks like this will change the name from "rev" to "fw_cfg_rev". >That's a userspace visible change which we should not do lightly. You are right, I should keep the interface untouched. To keep it user un-visible, we could change like below: - __ATTR_RO(fw_cfg_rev); + __ATTR_RO(rev); Is this better for you? >> -- >> 2.19.1 -- Wei Yang Help you, Help me