* [PATCH 1/1] v4l: samsung, ov9650: Rely on V4L2-set sub-device names
@ 2018-09-15 22:51 Sakari Ailus
2018-09-17 11:31 ` kbuild test robot
0 siblings, 1 reply; 2+ messages in thread
From: Sakari Ailus @ 2018-09-15 22:51 UTC (permalink / raw)
To: linux-media
v4l2_i2c_subdev_init() sets the name of the sub-devices (as well as
entities) to what is fairly certainly known to be unique in the system,
even if there were more devices of the same kind.
These drivers (m5mols, noon010pc30, ov9650, s5c73m3, s5k4ecgx, s5k6aa) set
the name to the name of the driver or the module while omitting the
device's I²C address and bus, leaving the devices with a static name and
effectively limiting the number of such devices in a media device to 1.
Address this by using the name set by the V4L2 framework.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com> (ov9650)
---
since RFC v1:
- Use "-oif" instead of "-OIF" postfix for s5c73m3 OIF bit. (Suggested by
Sylwester.)
drivers/media/i2c/m5mols/m5mols_core.c | 1 -
drivers/media/i2c/noon010pc30.c | 1 -
drivers/media/i2c/ov9650.c | 1 -
drivers/media/i2c/s5c73m3/s5c73m3-core.c | 4 ++--
drivers/media/i2c/s5k4ecgx.c | 1 -
drivers/media/i2c/s5k6aa.c | 1 -
6 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c
index 155424a43d4c..320e79b63555 100644
--- a/drivers/media/i2c/m5mols/m5mols_core.c
+++ b/drivers/media/i2c/m5mols/m5mols_core.c
@@ -987,7 +987,6 @@ static int m5mols_probe(struct i2c_client *client,
sd = &info->sd;
v4l2_i2c_subdev_init(sd, client, &m5mols_ops);
- strscpy(sd->name, MODULE_NAME, sizeof(sd->name));
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
sd->internal_ops = &m5mols_subdev_internal_ops;
diff --git a/drivers/media/i2c/noon010pc30.c b/drivers/media/i2c/noon010pc30.c
index 4698e40fedd2..0629bc138fbc 100644
--- a/drivers/media/i2c/noon010pc30.c
+++ b/drivers/media/i2c/noon010pc30.c
@@ -720,7 +720,6 @@ static int noon010_probe(struct i2c_client *client,
mutex_init(&info->lock);
sd = &info->sd;
v4l2_i2c_subdev_init(sd, client, &noon010_ops);
- strscpy(sd->name, MODULE_NAME, sizeof(sd->name));
sd->internal_ops = &noon010_subdev_internal_ops;
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
index 3c9e6798d14b..9f1ed79d2a99 100644
--- a/drivers/media/i2c/ov9650.c
+++ b/drivers/media/i2c/ov9650.c
@@ -1539,7 +1539,6 @@ static int ov965x_probe(struct i2c_client *client,
sd = &ov965x->sd;
v4l2_i2c_subdev_init(sd, client, &ov965x_subdev_ops);
- strscpy(sd->name, DRIVER_NAME, sizeof(sd->name));
sd->internal_ops = &ov965x_sd_internal_ops;
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index 21ca5186f9ed..69967346f787 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -1683,7 +1683,7 @@ static int s5c73m3_probe(struct i2c_client *client,
v4l2_subdev_init(sd, &s5c73m3_subdev_ops);
sd->owner = client->dev.driver->owner;
v4l2_set_subdevdata(sd, state);
- strscpy(sd->name, "S5C73M3", sizeof(sd->name));
+ v4l2_i2c_subdev_set_name(sd, client, NULL, NULL);
sd->internal_ops = &s5c73m3_internal_ops;
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
@@ -1698,7 +1698,7 @@ static int s5c73m3_probe(struct i2c_client *client,
return ret;
v4l2_i2c_subdev_init(oif_sd, client, &oif_subdev_ops);
- strscpy(oif_sd->name, "S5C73M3-OIF", sizeof(oif_sd->name));
+ v4l2_i2c_subdev_set_name(sd, client, NULL, "-oif");
oif_sd->internal_ops = &oif_internal_ops;
oif_sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
diff --git a/drivers/media/i2c/s5k4ecgx.c b/drivers/media/i2c/s5k4ecgx.c
index 8c0dca6cb20c..8aaf5ad26826 100644
--- a/drivers/media/i2c/s5k4ecgx.c
+++ b/drivers/media/i2c/s5k4ecgx.c
@@ -954,7 +954,6 @@ static int s5k4ecgx_probe(struct i2c_client *client,
sd = &priv->sd;
/* Registering subdev */
v4l2_i2c_subdev_init(sd, client, &s5k4ecgx_ops);
- strscpy(sd->name, S5K4ECGX_DRIVER_NAME, sizeof(sd->name));
sd->internal_ops = &s5k4ecgx_subdev_internal_ops;
/* Support v4l2 sub-device user space API */
diff --git a/drivers/media/i2c/s5k6aa.c b/drivers/media/i2c/s5k6aa.c
index 52ca033f7069..9536316e2d80 100644
--- a/drivers/media/i2c/s5k6aa.c
+++ b/drivers/media/i2c/s5k6aa.c
@@ -1576,7 +1576,6 @@ static int s5k6aa_probe(struct i2c_client *client,
sd = &s5k6aa->sd;
v4l2_i2c_subdev_init(sd, client, &s5k6aa_subdev_ops);
- strscpy(sd->name, DRIVER_NAME, sizeof(sd->name));
sd->internal_ops = &s5k6aa_subdev_internal_ops;
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] v4l: samsung, ov9650: Rely on V4L2-set sub-device names
2018-09-15 22:51 [PATCH 1/1] v4l: samsung, ov9650: Rely on V4L2-set sub-device names Sakari Ailus
@ 2018-09-17 11:31 ` kbuild test robot
0 siblings, 0 replies; 2+ messages in thread
From: kbuild test robot @ 2018-09-17 11:31 UTC (permalink / raw)
To: Sakari Ailus; +Cc: kbuild-all, linux-media
[-- Attachment #1: Type: text/plain, Size: 5095 bytes --]
Hi Sakari,
I love your patch! Yet something to improve:
[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20180913]
[cannot apply to v4.19-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Sakari-Ailus/v4l-samsung-ov9650-Rely-on-V4L2-set-sub-device-names/20180916-232558
base: git://linuxtv.org/media_tree.git master
config: i386-randconfig-x0-09171846 (attached as .config)
compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers/media/i2c/s5c73m3/s5c73m3-core.c: In function 's5c73m3_probe':
>> drivers/media/i2c/s5c73m3/s5c73m3-core.c:1686:2: error: implicit declaration of function 'v4l2_i2c_subdev_set_name' [-Werror=implicit-function-declaration]
v4l2_i2c_subdev_set_name(sd, client, NULL, NULL);
^
cc1: some warnings being treated as errors
vim +/v4l2_i2c_subdev_set_name +1686 drivers/media/i2c/s5c73m3/s5c73m3-core.c
1660
1661 static int s5c73m3_probe(struct i2c_client *client,
1662 const struct i2c_device_id *id)
1663 {
1664 struct device *dev = &client->dev;
1665 struct v4l2_subdev *sd;
1666 struct v4l2_subdev *oif_sd;
1667 struct s5c73m3 *state;
1668 int ret, i;
1669
1670 state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL);
1671 if (!state)
1672 return -ENOMEM;
1673
1674 state->i2c_client = client;
1675 ret = s5c73m3_get_platform_data(state);
1676 if (ret < 0)
1677 return ret;
1678
1679 mutex_init(&state->lock);
1680 sd = &state->sensor_sd;
1681 oif_sd = &state->oif_sd;
1682
1683 v4l2_subdev_init(sd, &s5c73m3_subdev_ops);
1684 sd->owner = client->dev.driver->owner;
1685 v4l2_set_subdevdata(sd, state);
> 1686 v4l2_i2c_subdev_set_name(sd, client, NULL, NULL);
1687
1688 sd->internal_ops = &s5c73m3_internal_ops;
1689 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1690
1691 state->sensor_pads[S5C73M3_JPEG_PAD].flags = MEDIA_PAD_FL_SOURCE;
1692 state->sensor_pads[S5C73M3_ISP_PAD].flags = MEDIA_PAD_FL_SOURCE;
1693 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
1694
1695 ret = media_entity_pads_init(&sd->entity, S5C73M3_NUM_PADS,
1696 state->sensor_pads);
1697 if (ret < 0)
1698 return ret;
1699
1700 v4l2_i2c_subdev_init(oif_sd, client, &oif_subdev_ops);
1701 v4l2_i2c_subdev_set_name(sd, client, NULL, "-oif");
1702
1703 oif_sd->internal_ops = &oif_internal_ops;
1704 oif_sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1705
1706 state->oif_pads[OIF_ISP_PAD].flags = MEDIA_PAD_FL_SINK;
1707 state->oif_pads[OIF_JPEG_PAD].flags = MEDIA_PAD_FL_SINK;
1708 state->oif_pads[OIF_SOURCE_PAD].flags = MEDIA_PAD_FL_SOURCE;
1709 oif_sd->entity.function = MEDIA_ENT_F_PROC_VIDEO_SCALER;
1710
1711 ret = media_entity_pads_init(&oif_sd->entity, OIF_NUM_PADS,
1712 state->oif_pads);
1713 if (ret < 0)
1714 return ret;
1715
1716 ret = s5c73m3_configure_gpios(state);
1717 if (ret)
1718 goto out_err;
1719
1720 for (i = 0; i < S5C73M3_MAX_SUPPLIES; i++)
1721 state->supplies[i].supply = s5c73m3_supply_names[i];
1722
1723 ret = devm_regulator_bulk_get(dev, S5C73M3_MAX_SUPPLIES,
1724 state->supplies);
1725 if (ret) {
1726 dev_err(dev, "failed to get regulators\n");
1727 goto out_err;
1728 }
1729
1730 ret = s5c73m3_init_controls(state);
1731 if (ret)
1732 goto out_err;
1733
1734 state->sensor_pix_size[RES_ISP] = &s5c73m3_isp_resolutions[1];
1735 state->sensor_pix_size[RES_JPEG] = &s5c73m3_jpeg_resolutions[1];
1736 state->oif_pix_size[RES_ISP] = state->sensor_pix_size[RES_ISP];
1737 state->oif_pix_size[RES_JPEG] = state->sensor_pix_size[RES_JPEG];
1738
1739 state->mbus_code = S5C73M3_ISP_FMT;
1740
1741 state->fiv = &s5c73m3_intervals[S5C73M3_DEFAULT_FRAME_INTERVAL];
1742
1743 state->fw_file_version[0] = 'G';
1744 state->fw_file_version[1] = 'C';
1745
1746 ret = s5c73m3_register_spi_driver(state);
1747 if (ret < 0)
1748 goto out_err;
1749
1750 oif_sd->dev = dev;
1751
1752 ret = __s5c73m3_power_on(state);
1753 if (ret < 0)
1754 goto out_err1;
1755
1756 ret = s5c73m3_get_fw_version(state);
1757 __s5c73m3_power_off(state);
1758
1759 if (ret < 0) {
1760 dev_err(dev, "Device detection failed: %d\n", ret);
1761 goto out_err1;
1762 }
1763
1764 ret = v4l2_async_register_subdev(oif_sd);
1765 if (ret < 0)
1766 goto out_err1;
1767
1768 v4l2_info(sd, "%s: completed successfully\n", __func__);
1769 return 0;
1770
1771 out_err1:
1772 s5c73m3_unregister_spi_driver(state);
1773 out_err:
1774 media_entity_cleanup(&sd->entity);
1775 return ret;
1776 }
1777
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25739 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-17 16:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-15 22:51 [PATCH 1/1] v4l: samsung, ov9650: Rely on V4L2-set sub-device names Sakari Ailus
2018-09-17 11:31 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).