Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp761095img; Tue, 26 Feb 2019 08:11:07 -0800 (PST) X-Google-Smtp-Source: AHgI3Iau2uMwrQlANjBhoM4Diocfq+gnLmlhijCgMbdn6FoTSQVIzmHc9Sle0GqPT99v4GgI0Xw3 X-Received: by 2002:a62:4e8a:: with SMTP id c132mr12375506pfb.24.1551197466951; Tue, 26 Feb 2019 08:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551197466; cv=none; d=google.com; s=arc-20160816; b=d07JS1zy/oOgr56wAzIOdiGmuWmn06PzHTcx2vL7g2eZd8NzZ1afYeNryHEhSTuSAa Ga8aupKet+oVny3TwUhqST/QPlYh7/NltmH9ACEodTEZ3uDmaP+5wFOCuKXg8Rw/B+bV uuL3tbDdhDucueCWsaZtDXMpQOSVeT3IZzyDKLNhyM2cf+g/D5o9iXrJ2EeaXOSBqQq+ qVtvVrqq2xPlAY2pxbQpov3kij4k700TpjZfp852fuo2RiXlmbPV9iBL8h2d062aaw83 2RSUEmJrAN9ZDcwFGXoNFzcZANMlUnI41L7tEUfQbITQGh9xmuXRSQBnosePbXEl0kS9 ZXng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=QtUY5Tv1lyEiK8OfP83p1zoJMwRohlkPbiHE/lluIWc=; b=NsexGbrsyFxSl1fAxYgqtKUAIEJ29MfkD27Ug/eF6/ji2YWlt0lx+6TYXGFg0JhVnF 8YrYOT4CowMOG4W01XoPAQpwqTRQ7UtL+pR464epCLMqEEc6DKoYCVkZgSvqxn8Phls7 mS8obs8EPr9icosb27kIfFWE9RaFzlNnpa2LfAh+cgfPtzgCcNpsnBvCJE1r/8SqdDBS wbyXVtQby7PrsmDWyFomhgyTV1f5N8QxpR4oldzTC4qnRVNAEY2xgwEqbc29WGlwbc0P gBKP8F9ru+hfrvYOrTxevE5I9uAyPc+25B8SViN5YAjMxV8aFUbdoVsJq2WB2rareyWC 4zqg== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24si8396755pgw.581.2019.02.26.08.10.50; Tue, 26 Feb 2019 08:11:06 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727549AbfBZQKK (ORCPT + 99 others); Tue, 26 Feb 2019 11:10:10 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:41120 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726507AbfBZQKK (ORCPT ); Tue, 26 Feb 2019 11:10:10 -0500 Received: by mail-qt1-f196.google.com with SMTP id v10so15465154qtp.8 for ; Tue, 26 Feb 2019 08:10:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=QtUY5Tv1lyEiK8OfP83p1zoJMwRohlkPbiHE/lluIWc=; b=K2l6YoQSD/9WWlh0rK2fHlb9yydK2pIgMt2D0HbRuOJJ8NaGKCx7DsroFUtaJIhUuJ TwAwHqeGAL5DB9wslTSwDVOQR+jKvEVrV5Ghy9dvPvCMak4qjtmrqgr5Ya0C2zPuCw8u Mc+MWsdBrAJ9qfTfh2775FELz56YS88VttzzZ7qpuMp/xM1j+jW7IRVMweU+7qcGDSCD /4sHAJoYnzXcNAwLV0fuhr+Cde+9a0EOmphFlyvlngVn+lekRrzxNw1y+HkSSBqnKDIL rI7bkCX2yatukEvR2fNKJC7uV7NFZj7kPV8GGtvoA1/2DTbab0vylz9FqHkDBfGGVUbq fNcA== X-Gm-Message-State: AHQUAuZYaBkoiphl8uiq6yCtYi6nsR9lKrGu3p+Ncurmo5u/PBQJdEAT 3AY0gfRbSLltvQnUoVwE8FoGUg== X-Received: by 2002:ac8:969:: with SMTP id z38mr18988900qth.49.1551197409510; Tue, 26 Feb 2019 08:10:09 -0800 (PST) Received: from redhat.com (pool-173-76-246-42.bstnma.fios.verizon.net. [173.76.246.42]) by smtp.gmail.com with ESMTPSA id v131sm7511283qka.95.2019.02.26.08.10.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 08:10:08 -0800 (PST) Date: Tue, 26 Feb 2019 11:10:06 -0500 From: "Michael S. Tsirkin" To: Wei Yang Cc: 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: <20190226110934-mutt-send-email-mst@kernel.org> References: <20190226073159.13434-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190226073159.13434-1-richardw.yang@linux.intel.com> 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 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. > -- > 2.19.1