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

media: bttv: use DEVICE_ATTR_RO() helper macro

Use DEVICE_ATTR_RO() helper macro instead of DEVICE_ATTR(), which is
simpler and more readable.

Due to the name of the read function of the sysfs attribute is normalized,
there is a natural association.

Link: https://lore.kernel.org/linux-media/20210603071009.11438-1-thunder.leizhen@huawei.com

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Zhen Lei and committed by
Mauro Carvalho Chehab
9b4d7b5c e67219b0

+2 -2
+2 -2
drivers/media/pci/bt8xx/bttv-driver.c
··· 170 170 /* ----------------------------------------------------------------------- */ 171 171 /* sysfs */ 172 172 173 - static ssize_t show_card(struct device *cd, 173 + static ssize_t card_show(struct device *cd, 174 174 struct device_attribute *attr, char *buf) 175 175 { 176 176 struct video_device *vfd = to_video_device(cd); 177 177 struct bttv *btv = video_get_drvdata(vfd); 178 178 return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET); 179 179 } 180 - static DEVICE_ATTR(card, S_IRUGO, show_card, NULL); 180 + static DEVICE_ATTR_RO(card); 181 181 182 182 /* ----------------------------------------------------------------------- */ 183 183 /* dvb auto-load setup */