Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp509694pxj; Wed, 2 Jun 2021 04:59:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaXDRepmguX4Rj9F8q9INjXcFDsFDYJhV8OHdJh/iM1/cJ8XnzbugD5gmmdvHX/Mpibqpg X-Received: by 2002:a5d:9842:: with SMTP id p2mr25134013ios.132.1622635140870; Wed, 02 Jun 2021 04:59:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622635140; cv=none; d=google.com; s=arc-20160816; b=JZqtgoeV9T4YWCW6DOL/qymiu8Dt6LEaSQCt3Uf3e35PwcOuQuGaz7C1OjwqiwGqND QPYe6n4EngaoTHcGP4sz9RK6n/+m/n16QXS/kKeqjr+N0lC8Enr9COEaD4R9bfKhEdUW ubuKSbU90aXKVbbRMIjwyboJmDNVCknlRkulFOlnxtD6ColqM/t3etFxM/T48wn2Kh0D l9gWdI+/deuEuKs7Efa9QEDhZzA0scORYBUwBKWJ6IoP3s8tsjyCI7sz3N443u8XMMkN SbnJYi9vD/gOPydcCcuW6/iWBL/u5fRoDLtdg8ZGvGxXe5DruPIys/m5hIb94tkblQ74 SDug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=K6jaxICSBzsQ7qf/s9kJ3QfGbIE+rL0Pcy282lRb/YY=; b=UZc0M4EIgc2KwrSTGtv7rH26/PrDoxHz4DWTNGFTDFpfjsXHcLt2n+DtOGt/lPmx1D tUPJtVFnQciP8opQsu25UHwVov0gZaoQNyUlZy+fL2yYWTDfw/vt0WLQfBXx1AiKLpF7 +QpI/6Ev3PhiGLWxgFyTmpOKNj0fDdO+qfYAtK8gTh6uIZUxuatHrFN9XeGgAI+UXEUw ENVOZd9VyNSH9IgXHHgJDaxfGxZQIe5oc/LF8RTE3GoTavq5vKBvm4UxVoU2wxXy4X7m mMoqfoNBYSoSEEszJritxx+i/pWYhrVolLWYNfSi2o8OaqNGM4ziD2Vss616NP5nKGFe wx9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si23515500ile.22.2021.06.02.04.58.48; Wed, 02 Jun 2021 04:59:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229884AbhFBLqF (ORCPT + 99 others); Wed, 2 Jun 2021 07:46:05 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:2965 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229762AbhFBLpo (ORCPT ); Wed, 2 Jun 2021 07:45:44 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Fw6Y952hNz6933; Wed, 2 Jun 2021 19:41:01 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 19:43:57 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 19:43:57 +0800 From: Zhen Lei To: Lee Jones , patches , linux-arm-kernel , linux-kernel CC: Zhen Lei Subject: [PATCH 6/9] mfd: kempld-core: use DEVICE_ATTR_RO macro Date: Wed, 2 Jun 2021 19:43:36 +0800 Message-ID: <20210602114339.11223-7-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210602114339.11223-1-thunder.leizhen@huawei.com> References: <20210602114339.11223-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/mfd/kempld-core.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c index 9166075c1f321a4..bb26241c73bdb8f 100644 --- a/drivers/mfd/kempld-core.c +++ b/drivers/mfd/kempld-core.c @@ -344,16 +344,16 @@ static const char *kempld_get_type_string(struct kempld_device_data *pld) return version_type; } -static ssize_t kempld_version_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t pld_version_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct kempld_device_data *pld = dev_get_drvdata(dev); return scnprintf(buf, PAGE_SIZE, "%s\n", pld->info.version); } -static ssize_t kempld_specification_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t pld_specification_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct kempld_device_data *pld = dev_get_drvdata(dev); @@ -361,18 +361,17 @@ static ssize_t kempld_specification_show(struct device *dev, pld->info.spec_minor); } -static ssize_t kempld_type_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t pld_type_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct kempld_device_data *pld = dev_get_drvdata(dev); return scnprintf(buf, PAGE_SIZE, "%s\n", kempld_get_type_string(pld)); } -static DEVICE_ATTR(pld_version, S_IRUGO, kempld_version_show, NULL); -static DEVICE_ATTR(pld_specification, S_IRUGO, kempld_specification_show, - NULL); -static DEVICE_ATTR(pld_type, S_IRUGO, kempld_type_show, NULL); +static DEVICE_ATTR_RO(pld_version); +static DEVICE_ATTR_RO(pld_specification); +static DEVICE_ATTR_RO(pld_type); static struct attribute *pld_attributes[] = { &dev_attr_pld_version.attr, -- 2.26.0.106.g9fadedd