Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1315898img; Tue, 26 Feb 2019 19:12:18 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib9luyis5/kbNPyD9OIqvl4OF7EzSdlDbkwzn5YkJMmL2Z6LWTVa0dL1p/8JsrhOEMVJfw1 X-Received: by 2002:a17:902:b591:: with SMTP id a17mr2849595pls.228.1551237138609; Tue, 26 Feb 2019 19:12:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551237138; cv=none; d=google.com; s=arc-20160816; b=SZXCq4OLJSPBmSGTKcL89zOXrF5dLImQI61qg2nJFB5SJVL28nuwuHhq0RXaidhQAA 16es2deGrbiURPiRBB6wQrB0TZJ3g3t00QsB17F/X9Tzm1YprRMmym56zh4KDz9L4B50 o1khKIPTp2cNufE9u8MMWiHZIjZ0CL8yyT+kuizOSV+tF3OGJYR5d8lg/g1xmvk01Zmm 98t10DC3/2f3J6gV9VTatwGm++NEE0unWrQbN5H75bOEQdimE5zV/Of05t3w/wzEpXyQ 7oyfN1iMy0W063u0dH8C7TLNACnnqI76v6XVqR4TYNSNJCjHX2ViDyd+ilYIQHbO2UnZ fh2A== 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-transfer-encoding:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date; bh=dQT0Z/Hboqg8ydgK6IPT8OOjktpVMZqjeaLgBpltQiE=; b=pIWQkneT1X9/g9LcY+/Kp9JWts+0vY8vlEDnItfLozGJ21TFwDimh8afHgG6+06ZY9 yW2AMIgAScWTteIq5QDQ4f7ind7bckauvn4SHUYxNAaO8sB+/Yj2C4I7ymnS+Rcw9OsN Df/RVre980GiXqXFcRMQ7SWcw/dgHgX9ScniIChNfIBuT4piWeW9tH1CEGqmQHHF/Rnb uJEp1D1LhvhC1r6eHS13M1TsYntkQIMMNWU5/2S8ocvusGEBp1F9PR/yIUAOu8kPcysx ktxRAkIAgeqUuFGet/75seffO911S1u6aHNJHxXiU3xCDX3GCGPFChCDPaIZ+TIWYYap pH+Q== 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 a6si13938262pgc.137.2019.02.26.19.12.02; Tue, 26 Feb 2019 19:12:18 -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 S1729329AbfB0DHp (ORCPT + 99 others); Tue, 26 Feb 2019 22:07:45 -0500 Received: from mga18.intel.com ([134.134.136.126]:26677 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728942AbfB0DHo (ORCPT ); Tue, 26 Feb 2019 22:07:44 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2019 19:07:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,417,1544515200"; d="scan'208";a="125496589" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga007.fm.intel.com with ESMTP; 26 Feb 2019 19:07:42 -0800 Date: Wed, 27 Feb 2019 11:07:16 +0800 From: Wei Yang To: Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= Cc: Wei Yang , qemu-devel@nongnu.org, linux-kernel@vger.kernel.org, somlo@cmu.edu, mst@redhat.com Subject: Re: [Qemu-devel] [PATCH] fw_cfg: use __ATTR_RO_MODE to define rev sysfs Message-ID: <20190227030715.GA5449@richard> Reply-To: Wei Yang References: <20190226073159.13434-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 07:45:46PM +0100, Philippe Mathieu-Daud? wrote: >Hi Wei, > >On 2/26/19 8:31 AM, 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); > >Why not keep S_IRUSR? > Because scripts/checkpatch.pl suggest not use S_IRUSR :-) I am not sure about the particular reason. >> >> /* fw_cfg_sysfs_entry type */ >> struct fw_cfg_sysfs_entry { >> -- Wei Yang Help you, Help me