From patchwork Thu Jun 3 12:30:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 453252 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp230021jao; Thu, 3 Jun 2021 05:31:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhR6d4l9hJbcBMMQSwXCO4nxFyUgogBS5k0AVW7cr3poYcynwHZMnmakALOoTNBcowtxWB X-Received: by 2002:a17:906:af85:: with SMTP id mj5mr6313521ejb.352.1622723484383; Thu, 03 Jun 2021 05:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622723484; cv=none; d=google.com; s=arc-20160816; b=fobHlZB2dcR6Hp3Ewn80rffeNpkEsy4WZ+e0/y8N+hJCE4mqiJFGxj+7tezhtBICyC Tva0MupqZnaBcuiJfQPwv1urZ6qHqlmcG07SlWkgsDbG3l9P8onfuPD/7tCWi5YyS7Cw 70OHT5nit9fQyyQHaEwl9dp6Wvt5/JtsV6icv90Dgt0TL2g95Oph3apY7kyDiHbEuKcS A6293jh72IV191UrV3eO2plN+0XiGH7HJwtj661Fpz+mdf2w94NC4kHvrjUKCN321vka UXeQCBrBs2Cw8OVGXVhl8gMwk/aHBznxr/fZy0SmgI1P13gdGPIASVDP5aSoyB8P0S2Z v5HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=RUNO6CFSsQHS8QKn5rQ3C6epuxptfg/Ko/hVWh3YO1Y=; b=sk3v5l6DFC2Pv79shp9OJbuIda03sd3o2cCmKjyRXi/DB8+bqkG+XDtMUaLHCIyaxK hnZi63jt6RUUOLCF1dXsqFLhN3+iOpQRyS0bOMNwymOSVzynmoKjQE8YKISb/I+7Rni0 oc2OHiebFUbWEsmeYWA+/wZfdTIoU/aJcM15XwBR3FP6FSmPCxXUsEgRUtzYH0HaNQt+ H7foYFgl4vLCCyEd5lxw2iQiLDPklpfoIeqOeuksN+Bp+Ftu91fZJgSjwTIt5uzObR8S 2j9dqvvTNcmBhqr5U9207TnAe+kp01p4Z6FJrjmn3YetbUlfBLneUYIXtf7l6k2moaUK 6MTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=gxp4Y9LF; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id e16si2136540ejj.154.2021.06.03.05.31.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 05:31:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=gxp4Y9LF; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=RUNO6CFSsQHS8QKn5rQ3C6epuxptfg/Ko/hVWh3YO1Y=; b=gxp4Y9LF9PcqcG cvpoA9F3nemyWIrl4OxcVJkeoKpm2+DdFUeZGfuZ1aCmN/zrW06h90sVatQ7yY/K1ELAfE8nXo35o 1CH/H6G6QnGv8p2WPpkV1SEKRAEqkXF882UcVWAKvq0BnD1dMhmxAf+p1EAWdaUjm5UHBTeEwtdIy b4YTZfJSnGJjKEL2JdJ7U/g5ObHHhYPdyxZQFHzOBiib+0b5/gBciNku236Wum0Nm9jJFNSJSmRU9 a5DOfkIHse3imd6Km9jjm5cZBumSFcoVRfAcz0nIqRQ9kcZI3xo++sK9du4P3sEiLdwn/vSw0Ces2 39KNdIZ2iftla52/asUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lomV5-008dLI-CC; Thu, 03 Jun 2021 12:31:03 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lomUt-008dEy-7z for linux-mtd@lists.infradead.org; Thu, 03 Jun 2021 12:30:53 +0000 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FwlVf21Q6zWrKB; Thu, 3 Jun 2021 20:26:02 +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; Thu, 3 Jun 2021 20:30:46 +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; Thu, 3 Jun 2021 20:30:46 +0800 From: Zhen Lei To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-mtd CC: Zhen Lei Subject: [PATCH 1/1] mtd: mtdpart: use DEVICE_ATTR_RO() helper macro Date: Thu, 3 Jun 2021 20:30:41 +0800 Message-ID: <20210603123041.12036-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210603_053051_591335_8693DFC9 X-CRM114-Status: UNSURE ( 9.31 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Use DEVICE_ATTR_RO() helper macro instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/mtd/mtdpart.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) Content analysis details: (-2.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.187 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Use DEVICE_ATTR_RO() helper macro instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/mtd/mtdpart.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.26.0.106.g9fadedd ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 66a67c6e3cbc049..04af12b66110c60 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -212,15 +212,14 @@ static struct mtd_info *allocate_partition(struct mtd_info *parent, return child; } -static ssize_t mtd_partition_offset_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t offset_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct mtd_info *mtd = dev_get_drvdata(dev); return sysfs_emit(buf, "%lld\n", mtd->part.offset); } - -static DEVICE_ATTR(offset, S_IRUGO, mtd_partition_offset_show, NULL); +static DEVICE_ATTR_RO(offset); /* mtd partition offset */ static const struct attribute *mtd_partition_attrs[] = { &dev_attr_offset.attr,