All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] mtd: mtdpart: use DEVICE_ATTR_RO() helper macro
@ 2021-06-03 12:30 Zhen Lei
  2021-06-11 19:00 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Zhen Lei @ 2021-06-03 12:30 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, linux-mtd
  Cc: Zhen Lei

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 <thunder.leizhen@huawei.com>
---
 drivers/mtd/mtdpart.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

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,
-- 
2.26.0.106.g9fadedd



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] mtd: mtdpart: use DEVICE_ATTR_RO() helper macro
  2021-06-03 12:30 [PATCH 1/1] mtd: mtdpart: use DEVICE_ATTR_RO() helper macro Zhen Lei
@ 2021-06-11 19:00 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2021-06-11 19:00 UTC (permalink / raw)
  To: Zhen Lei, Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	linux-mtd

On Thu, 2021-06-03 at 12:30:41 UTC, Zhen Lei wrote:
> 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 <thunder.leizhen@huawei.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-11 19:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 12:30 [PATCH 1/1] mtd: mtdpart: use DEVICE_ATTR_RO() helper macro Zhen Lei
2021-06-11 19:00 ` Miquel Raynal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.