From 4309193cab34f5f79808f03e09f8d39a5f2a7288 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 30 Oct 2008 03:51:46 +0000 Subject: V4L: struct device - replace bus_id with dev_name(), dev_set_name() From: Kay Sievers This patch is part of a larger patch series which will remove the "char bus_id[20]" name string from struct device. The device name is managed in the kobject anyway, and without any size limitation, and just needlessly copied into "struct device". To set and read the device name dev_name(dev) and dev_set_name(dev) must be used. If your code uses static kobjects, which it shouldn't do, "const char *init_name" can be used to statically provide the name the registered device should have. At registration time, the init_name field is cleared, to enforce the use of dev_name(dev) to access the device name at a later time. We need to get rid of all occurrences of bus_id in the entire tree to be able to enable the new interface. Please apply this patch, and possibly convert any remaining remaining occurrences of bus_id. We want to submit a patch to -next, which will remove bus_id from "struct device", to find the remaining pieces to convert, and finally switch over to the new api, which will remove the 20 bytes array and does no longer have a size limitation. Thanks, Kay Acked-by: Greg Kroah-Hartman Signed-Off-By: Kay Sievers Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/soc_camera.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'linux/drivers/media/video/soc_camera.c') diff --git a/linux/drivers/media/video/soc_camera.c b/linux/drivers/media/video/soc_camera.c index 66ebe5956..28cf5c94b 100644 --- a/linux/drivers/media/video/soc_camera.c +++ b/linux/drivers/media/video/soc_camera.c @@ -783,7 +783,7 @@ int soc_camera_host_register(struct soc_camera_host *ici) return -EINVAL; /* Number might be equal to the platform device ID */ - sprintf(ici->dev.bus_id, "camera_host%d", ici->nr); + dev_set_name(&ici->dev, "camera_host%d", ici->nr); mutex_lock(&list_lock); list_for_each_entry(ix, &hosts, list) { @@ -867,8 +867,7 @@ int soc_camera_device_register(struct soc_camera_device *icd) icd->devnum = num; icd->dev.bus = &soc_camera_bus_type; - snprintf(icd->dev.bus_id, sizeof(icd->dev.bus_id), - "%u-%u", icd->iface, icd->devnum); + dev_set_name(&icd->dev, "%u-%u", icd->iface, icd->devnum); icd->dev.release = dummy_release; -- cgit v1.2.3 From 17490135b2a7a46fc7fb67d64dbaeb1301ea169d Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 6 Nov 2008 23:02:07 +0100 Subject: v4l: fix dev_set_name compiler errors for kernels < 2.6.26 From: Hans Verkuil Priority: normal Signed-off-by: Hans Verkuil --- linux/drivers/media/video/soc_camera.c | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/drivers/media/video/soc_camera.c') diff --git a/linux/drivers/media/video/soc_camera.c b/linux/drivers/media/video/soc_camera.c index 28cf5c94b..7a46697c4 100644 --- a/linux/drivers/media/video/soc_camera.c +++ b/linux/drivers/media/video/soc_camera.c @@ -29,6 +29,7 @@ #include #include #include +#include "compat.h" static LIST_HEAD(hosts); static LIST_HEAD(devices); -- cgit v1.2.3