Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp920337img; Tue, 26 Feb 2019 10:50:50 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ4hQCzAKkgt3urIcJndly05Bii+DRiHSNjF0dkyH93dYCKtrGjncHDNJcJaTqvV8/LHVcA X-Received: by 2002:a17:902:bd96:: with SMTP id q22mr27706526pls.7.1551207050819; Tue, 26 Feb 2019 10:50:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551207050; cv=none; d=google.com; s=arc-20160816; b=FxVrAP36A7l7qm3SBPmO6SBGi7OLQTiaPyPIbk9L0GtkeZ+EWMpKG/TC4tZ7JPzD2I 5eY8dvVbf+lYmjRwarDaKzeutMjxZMMuBoFwdpzHFj3e0RDiIOHM3VHMsqSDtahV6V9N dzf/HXZjAIZqaDO5dKL4K/2V9HhJzC6yOu9SKPCGZJH93fMzIXrzDsEHWQQsUym4+IWx nzMVmXDfjRg/uvylXdMPFWbBJBp93JpQ+FCzw1z2S5JlNu6iXCeZsyDFJRtaKmSvOkOp B1FMOE67CjkEjS5RDpHf4a2OSLo2JOlxnKnohWqm928We5QlSvyf7rMR2Y91w6/fsW3W qzdA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=a8sLJQQ+GhNvebCn2znJiw1HXJG+0r7fno7t8mzGjbI=; b=MLNtW6zqFcka5wk6mt4bvEpoalLi/ad2uzTx/YvRHO6Wfhtj8S3nBVkkAb+nf62LJa GMnmRZQDxvX/1UnQDadVVexVBhA3+HryY/QgCm/4bpurIQYCcrweFAQaWZAIrmfvn7pV Rhxy+yfYdE9Ww/YCwGquE6YT4UHGPhbls2OrOgzbP0SmCYiOfBu7EDC9vEi9+HUoY7+u I1te972nVtuWxI26n0i2XPKTwPpcnVXaD4i3kzfdpgAS1LsXO5P/TROa8/HembyDWEW/ dYXz0CfDWAO00dIS///pWUWyiU6N1SwcGdgTe4vZzVWkn6wcmIIAKjWFY6hWWIyfFb7t 3I8A== 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 x14si12854466pgq.185.2019.02.26.10.50.35; Tue, 26 Feb 2019 10:50:50 -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 S1728632AbfBZSuK (ORCPT + 99 others); Tue, 26 Feb 2019 13:50:10 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:35917 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727580AbfBZSuK (ORCPT ); Tue, 26 Feb 2019 13:50:10 -0500 Received: by mail-qt1-f195.google.com with SMTP id p25so16175739qtb.3 for ; Tue, 26 Feb 2019 10:50: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:content-transfer-encoding :in-reply-to; bh=a8sLJQQ+GhNvebCn2znJiw1HXJG+0r7fno7t8mzGjbI=; b=axTFe0jb66JIkEeHViDBLvkJbplkBClFeOIozp5FEbP7CLJnNKlkI2FrMNHb8Ysa9W Yo0/KiM0FNb8qS37z0ArXP4ADI+f+6kG2qoNHix03LkJGJOszn54t2YiQ6VmOHthe3gB oiYiI0ltF/aI9JthrU+ip1uNLAVwoobuH6ShWzEu2HjIPoRLn/mCSaReRbDvqt9WhBiG qLt5MHmjRHhpAkoe/RcxguKUqp0WkjoY2JXyM6zTh1BopIV3ZcTnjcYOaLryTxYLAI8A hWn8XLG6mk4g6a3lDHJ28cXCVTksj6dglEY7DzljZD/mucFYjlZtUmizB2Gh3o7BXOLN G+4Q== X-Gm-Message-State: AHQUAuaPZE1hPIzdBMQYHQrzR1HTXxuumwKJat1JMsh7k+vkNKGbbOKN 47XHMJj4x62NwRwrTM9ePVdCFQ== X-Received: by 2002:a0c:b90d:: with SMTP id u13mr18701977qvf.66.1551207009204; Tue, 26 Feb 2019 10:50:09 -0800 (PST) Received: from redhat.com ([66.187.232.66]) by smtp.gmail.com with ESMTPSA id j11sm9517049qtk.26.2019.02.26.10.50.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 10:50:08 -0800 (PST) Date: Tue, 26 Feb 2019 13:50:05 -0500 From: "Michael S. Tsirkin" To: Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= Cc: Wei Yang , somlo@cmu.edu, qemu-devel@nongnu.org, linux-kernel@vger.kernel.org Subject: Re: [Qemu-devel] [PATCH] fw_cfg: use __ATTR_RO_MODE to define rev sysfs Message-ID: <20190226134948-mutt-send-email-mst@kernel.org> References: <20190226073159.13434-1-richardw.yang@linux.intel.com> <20190226110934-mutt-send-email-mst@kernel.org> <683d6fc9-bfdc-b2e5-e1b7-cd2d2711268e@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <683d6fc9-bfdc-b2e5-e1b7-cd2d2711268e@redhat.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 07:47:35PM +0100, Philippe Mathieu-Daud? wrote: > On 2/26/19 5:10 PM, 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. > > We could name the function rev_show but this stay fragile, we'd also > need a comment "don't rename this". It's a given that one must not rename attributes. > >> -- > >> 2.19.1 > >