summary refs log tree commit diff
path: root/include/media
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2018-08-29 05:52:46 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-17 15:17:22 -0400
commit0658293012af1e69d8bb8a25e71781470f9b2ac6 (patch)
tree69196e8b283dd4fbcb8ffc6df5f4bf4c4d6ba47e /include/media
parente6002df8f37fdeb1b00c65892e45dffbec8d39ed (diff)
downloadlinux-0658293012af1e69d8bb8a25e71781470f9b2ac6.tar.gz
media: v4l: subdev: Add a function to set an I²C sub-device's name
v4l2_i2c_subdev_set_name() can be used to assign a name to a sub-device.
This way uniform names can be formed easily without having to resort to
things such as snprintf in drivers.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/v4l2-common.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index cdc87ec61e54..bd880a909ecf 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -155,6 +155,18 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
 		const unsigned short *probe_addrs);
 
 /**
+ * v4l2_i2c_subdev_set_name - Set name for an I²C sub-device
+ *
+ * @sd: pointer to &struct v4l2_subdev
+ * @client: pointer to struct i2c_client
+ * @devname: the name of the device; if NULL, the I²C device's name will be used
+ * @postfix: sub-device specific string to put right after the I²C device name;
+ *	     may be NULL
+ */
+void v4l2_i2c_subdev_set_name(struct v4l2_subdev *sd, struct i2c_client *client,
+			      const char *devname, const char *postfix);
+
+/**
  * v4l2_i2c_subdev_init - Initializes a &struct v4l2_subdev with data from
  *	an i2c_client struct.
  *