Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp292823img; Mon, 25 Feb 2019 23:33:16 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia8aWJ56RXVAMye5Cm0VOPC0yokyBFVbVz43coTadkbsD5y8faPG+wVzdwVPgrlCiCteU54 X-Received: by 2002:a62:f517:: with SMTP id n23mr24719894pfh.209.1551166396437; Mon, 25 Feb 2019 23:33:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551166396; cv=none; d=google.com; s=arc-20160816; b=clHfBTw8TsLnYWJMe/zho5/d7P/Uqk2KKvfwUT6eHydG/ocUO30ugET52nRdgr9Iyn VGY2WAs921sAwtW6UO1kKUNI8FMYSmyOpWK6eM34csjANbzA9KidJMXsstadKWO77hOx lU+EgXRK5tAEKRDP3FxsUPQsbMdqLRhD3s8tU1HtuyfgyZ8f2YzOepnzBEcSVUvY6nwC xBB5cfrO62MYpsx3PpWk+pWoFvxARfYkBkLCKhc2gODYByEtKsj3T/2deFpM068nlMuE ye6ZbpPDlKNLEV1Wel0K4Pek5BvJiUU6JTocEIT+el5qPbcO0KENRd/ETRWC6llwm7i7 RrcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Ls7pwn78dJLiL7qcETwlO3KMVhAa9VTbR5JTY+lT9EQ=; b=GVVNjiCYRJMLwjX9gOsEbZYxuWnTyxeEy2AUtAJ7btDAhjfi3IArBWHI521tT7GA2I WdXhfA9gNQqe8Xx54emcCVgzxzn8IPAUFx6th2Tbh1FNRGHHop6tDMt6lRykT5Tu43gp pkMzP3Vb2QxcUrlyJpyhuJT29biZ6VcJBqt945g9nl7ucQ/1iRvihUv9jBa+0gIvbdEX h+kw21Nj/0PBdAaDKydUyXENu8K/E4woUhO9XVWa2K7w2HprITk2wk3JTb2WbnUgsmBr dOrEsScyWCAPGU1BqR64E4xNNxCCC34ZT4lzxNwL5PIPa6Qrp926apV75Qb43BuXjjoy 2ijw== 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 f10si12989093pfh.8.2019.02.25.23.33.01; Mon, 25 Feb 2019 23:33:16 -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 S1726906AbfBZHc3 (ORCPT + 99 others); Tue, 26 Feb 2019 02:32:29 -0500 Received: from mga06.intel.com ([134.134.136.31]:29683 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfBZHc3 (ORCPT ); Tue, 26 Feb 2019 02:32:29 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Feb 2019 23:32:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,414,1544515200"; d="scan'208";a="127300126" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga008.fm.intel.com with ESMTP; 25 Feb 2019 23:32:27 -0800 From: Wei Yang To: qemu-devel@nongnu.org, linux-kernel@vger.kernel.org Cc: somlo@cmu.edu, mst@redhat.com, Wei Yang Subject: [PATCH] fw_cfg: use __ATTR_RO_MODE to define rev sysfs Date: Tue, 26 Feb 2019 15:31:59 +0800 Message-Id: <20190226073159.13434-1-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 { -- 2.19.1