Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp64176img; Wed, 27 Feb 2019 16:50:26 -0800 (PST) X-Google-Smtp-Source: AHgI3IbcXgsjuNfd3WCsghZycpIupL8O1Vwhuns5yOERdEVXOtty4KFJ94FF4r2DUbdrNHrk8wLc X-Received: by 2002:a63:e40b:: with SMTP id a11mr5735991pgi.259.1551315026698; Wed, 27 Feb 2019 16:50:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551315026; cv=none; d=google.com; s=arc-20160816; b=WRRkVqDLq+BOtZLRrdvBeXtMII0qr09iBsnYq/9dulpJ7UkFGH6uUF2OVxj57z8705 fHNDTvq8J9sii7pwpE9TZBGkhVfsqPLECgIIe6r0rNQ5EXH+xjBQdz8RXFiI2mvHVg3W tWqC1Kbz/FwdDt+qu/Ux4IffQ7zHoYI7vab8r3fh+JFaLmGJ4FC29ZyE37vpv07Jtl2p mxGid8pOMYVT7VPgVrt5HYBhBi8grLnQd6Yk35j8mTsz0B0XxB2ERJv6sJ1ezP7rT4WM Tom92zYoopkzXoRiZ1RPF5jccOwEKBgORfV1fVuRdDIK63a9Y9u/cveVrrqz6L0WK5H3 m4xw== 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=eiKpcBAXm+FQI/TRUF4hGwgyFGYbqUpqp8HS6jnVKU4=; b=ZJNhe6bzsTyrtMQ6x08l3Bj0L6MdsDdDBXxfL+l0ztBFUjriUXiu2q9G6+lViFaxgP EUutqnUyOUbwaYgQ/lG8sZGcfOZD+yO1aiuwIFnHg5dPYG16wnzcpY03nOQWV1W8XIhS 3u6Zju8p4ZckwfJ6eEbizFxI8Iwoijar6j9SuMvkRz+1UFGbYpYpCrQu1/lI6ch+FIwk 7YzpBKS+zwKMRp5kqsIT3rQf2HdVXdkIddCLsnBAUBZVpscrxbEr1V4SgcsEdi4C1Da1 aaKBENsUApQSv8WDRX4fzXvjp2RNLPi7VfauiDd7KzzAdUuR9mWsgqA5mkzZ9/M0cAHo dOXQ== 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 w5si12461575pgr.93.2019.02.27.16.50.10; Wed, 27 Feb 2019 16:50:26 -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 S1730398AbfB1Atj (ORCPT + 99 others); Wed, 27 Feb 2019 19:49:39 -0500 Received: from mga11.intel.com ([192.55.52.93]:57504 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730234AbfB1Ati (ORCPT ); Wed, 27 Feb 2019 19:49:38 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Feb 2019 16:49:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,421,1544515200"; d="scan'208";a="147907478" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga004.fm.intel.com with ESMTP; 27 Feb 2019 16:49:37 -0800 Date: Thu, 28 Feb 2019 08:49:11 +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: <20190228004911.GB5009@richard> Reply-To: Wei Yang References: <20190226073159.13434-1-richardw.yang@linux.intel.com> <20190226110934-mutt-send-email-mst@kernel.org> <20190227053319.GB5449@richard> <20190227084843-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190227084843-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 Wed, Feb 27, 2019 at 08:51:11AM -0500, Michael S. Tsirkin wrote: >On Wed, Feb 27, 2019 at 01:33:19PM +0800, Wei Yang wrote: >> 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? > > >Also why use 0400 and not S_IRUSR? > In case this is the proper way to use 0400 and after keeping the name un-changed, would you mind I sending v2 for this? >> >> -- >> >> 2.19.1 >> >> -- >> Wei Yang >> Help you, Help me -- Wei Yang Help you, Help me