Skip to contentSkip to conversation

media: mc-device.c: use DEVICE_ATTR_RO() helper macro

PATCH New Zhen Lei 1 participant 1 message Jun 3, 2021

Subsystems (2)
lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

PATCH 1/1 media: mc-device.c: 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.

---
 drivers/media/mc/mc-device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/mc/mc-device.c +2 -2
index 9e56d2ad6b94b5a..cf5e459b1d96269 100644
@@ -556,7 +556,7 @@ static const struct media_file_operations media_device_fops = {
  * sysfs
  */
 
-static ssize_t show_model(struct device *cd,
+static ssize_t model_show(struct device *cd,
 			  struct device_attribute *attr, char *buf)
 {
 	struct media_devnode *devnode = to_media_devnode(cd);
@@ -565,7 +565,7 @@ static ssize_t show_model(struct device *cd,
 	return sprintf(buf, "%.*s\n", (int)sizeof(mdev->model), mdev->model);
 }
 
-static DEVICE_ATTR(model, S_IRUGO, show_model, NULL);
+static DEVICE_ATTR_RO(model);
 
 /* -----------------------------------------------------------------------------
  * Registration/unregistration
Signature · 1 line
2.26.0.106.g9fadedd