Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: rawnand: r852: use DEVICE_ATTR_RO() helper macro

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>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210603123339.12089-1-thunder.leizhen@huawei.com

authored by

Zhen Lei and committed by
Miquel Raynal
21db4f47 f145b9dc

+3 -4
+3 -4
drivers/mtd/nand/raw/r852.c
··· 583 583 r852_write_reg(dev, R852_CARD_IRQ_ENABLE, card_detect_reg); 584 584 } 585 585 586 - static ssize_t r852_media_type_show(struct device *sys_dev, 587 - struct device_attribute *attr, char *buf) 586 + static ssize_t media_type_show(struct device *sys_dev, 587 + struct device_attribute *attr, char *buf) 588 588 { 589 589 struct mtd_info *mtd = container_of(sys_dev, struct mtd_info, dev); 590 590 struct r852_device *dev = r852_get_dev(mtd); ··· 593 593 strcpy(buf, data); 594 594 return strlen(data); 595 595 } 596 - 597 - static DEVICE_ATTR(media_type, S_IRUGO, r852_media_type_show, NULL); 596 + static DEVICE_ATTR_RO(media_type); 598 597 599 598 600 599 /* Detect properties of card in slot */