public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] media: i2c: et8ek8: use DEVICE_ATTR_RO() helper macro
@ 2021-06-03  7:15 Zhen Lei
  2021-06-23 21:17 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Zhen Lei @ 2021-06-03  7:15 UTC (permalink / raw)
  To: Pavel Machek, Sakari Ailus, Mauro Carvalho Chehab, linux-media; +Cc: Zhen Lei

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.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/media/i2c/et8ek8/et8ek8_driver.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/et8ek8/et8ek8_driver.c b/drivers/media/i2c/et8ek8/et8ek8_driver.c
index bb3eac5e005e4c2..fc3a3869a79d1d6 100644
--- a/drivers/media/i2c/et8ek8/et8ek8_driver.c
+++ b/drivers/media/i2c/et8ek8/et8ek8_driver.c
@@ -1234,8 +1234,7 @@ static int et8ek8_dev_init(struct v4l2_subdev *subdev)
  * sysfs attributes
  */
 static ssize_t
-et8ek8_priv_mem_read(struct device *dev, struct device_attribute *attr,
-		     char *buf)
+priv_mem_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct v4l2_subdev *subdev = dev_get_drvdata(dev);
 	struct et8ek8_sensor *sensor = to_et8ek8_sensor(subdev);
@@ -1248,7 +1247,7 @@ et8ek8_priv_mem_read(struct device *dev, struct device_attribute *attr,
 
 	return ET8EK8_PRIV_MEM_SIZE;
 }
-static DEVICE_ATTR(priv_mem, 0444, et8ek8_priv_mem_read, NULL);
+static DEVICE_ATTR_RO(priv_mem);
 
 /* --------------------------------------------------------------------------
  * V4L2 subdev core operations
-- 
2.26.0.106.g9fadedd



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

end of thread, other threads:[~2021-06-23 21:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-03  7:15 [PATCH 1/1] media: i2c: et8ek8: use DEVICE_ATTR_RO() helper macro Zhen Lei
2021-06-23 21:17 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox