aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-10-29 23:51:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:26 -0500
commitaf128a102c4aee994b4ff6e422b3cfab17127578 (patch)
treed56dbca4fcc265411f6f43b175d266fb2f9fea45 /drivers
parent9b2fb337a1423be53c671c4937fd4651cb30618e (diff)
V4L/DVB (9521): V4L: struct device - replace bus_id with dev_name(), dev_set_name()
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 Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/bt8xx/bttv-gpio.c7
-rw-r--r--drivers/media/video/bt8xx/bttv.h2
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c4
-rw-r--r--drivers/media/video/et61x251/et61x251_core.c2
-rw-r--r--drivers/media/video/ir-kbd-i2c.c6
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-sysfs.c4
-rw-r--r--drivers/media/video/sh_mobile_ceu_camera.c6
-rw-r--r--drivers/media/video/sn9c102/sn9c102_core.c2
-rw-r--r--drivers/media/video/soc_camera.c5
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c2
-rw-r--r--drivers/media/video/v4l2-dev.c2
-rw-r--r--drivers/media/video/zc0301/zc0301_core.c2
13 files changed, 22 insertions, 24 deletions
diff --git a/drivers/media/video/bt8xx/bttv-gpio.c b/drivers/media/video/bt8xx/bttv-gpio.c
index dce6dae5740e..74c325e594a2 100644
--- a/drivers/media/video/bt8xx/bttv-gpio.c
+++ b/drivers/media/video/bt8xx/bttv-gpio.c
@@ -42,7 +42,7 @@ static int bttv_sub_bus_match(struct device *dev, struct device_driver *drv)
42 struct bttv_sub_driver *sub = to_bttv_sub_drv(drv); 42 struct bttv_sub_driver *sub = to_bttv_sub_drv(drv);
43 int len = strlen(sub->wanted); 43 int len = strlen(sub->wanted);
44 44
45 if (0 == strncmp(dev->bus_id, sub->wanted, len)) 45 if (0 == strncmp(dev_name(dev), sub->wanted, len))
46 return 1; 46 return 1;
47 return 0; 47 return 0;
48} 48}
@@ -91,15 +91,14 @@ int bttv_sub_add_device(struct bttv_core *core, char *name)
91 sub->dev.parent = &core->pci->dev; 91 sub->dev.parent = &core->pci->dev;
92 sub->dev.bus = &bttv_sub_bus_type; 92 sub->dev.bus = &bttv_sub_bus_type;
93 sub->dev.release = release_sub_device; 93 sub->dev.release = release_sub_device;
94 snprintf(sub->dev.bus_id,sizeof(sub->dev.bus_id),"%s%d", 94 dev_set_name(&sub->dev, "%s%d", name, core->nr);
95 name, core->nr);
96 95
97 err = device_register(&sub->dev); 96 err = device_register(&sub->dev);
98 if (0 != err) { 97 if (0 != err) {
99 kfree(sub); 98 kfree(sub);
100 return err; 99 return err;
101 } 100 }
102 printk("bttv%d: add subdevice \"%s\"\n", core->nr, sub->dev.bus_id); 101 printk("bttv%d: add subdevice \"%s\"\n", core->nr, dev_name(&sub->dev));
103 list_add_tail(&sub->list,&core->subs); 102 list_add_tail(&sub->list,&core->subs);
104 return 0; 103 return 0;
105} 104}
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h
index 46cb90e0985b..bc2c88499ab9 100644
--- a/drivers/media/video/bt8xx/bttv.h
+++ b/drivers/media/video/bt8xx/bttv.h
@@ -308,7 +308,7 @@ struct bttv_sub_device {
308 308
309struct bttv_sub_driver { 309struct bttv_sub_driver {
310 struct device_driver drv; 310 struct device_driver drv;
311 char wanted[BUS_ID_SIZE]; 311 char wanted[20];
312 int (*probe)(struct bttv_sub_device *sub); 312 int (*probe)(struct bttv_sub_device *sub);
313 void (*remove)(struct bttv_sub_device *sub); 313 void (*remove)(struct bttv_sub_device *sub);
314}; 314};
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 4ea1f1e04897..415dff830f88 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1271,7 +1271,7 @@ static int vidioc_querycap(struct file *file, void *priv,
1271 1271
1272 strlcpy(cap->driver, "em28xx", sizeof(cap->driver)); 1272 strlcpy(cap->driver, "em28xx", sizeof(cap->driver));
1273 strlcpy(cap->card, em28xx_boards[dev->model].name, sizeof(cap->card)); 1273 strlcpy(cap->card, em28xx_boards[dev->model].name, sizeof(cap->card));
1274 strlcpy(cap->bus_info, dev->udev->dev.bus_id, sizeof(cap->bus_info)); 1274 strlcpy(cap->bus_info, dev_name(&dev->udev->dev), sizeof(cap->bus_info));
1275 1275
1276 cap->version = EM28XX_VERSION_CODE; 1276 cap->version = EM28XX_VERSION_CODE;
1277 1277
@@ -1424,7 +1424,7 @@ static int radio_querycap(struct file *file, void *priv,
1424 1424
1425 strlcpy(cap->driver, "em28xx", sizeof(cap->driver)); 1425 strlcpy(cap->driver, "em28xx", sizeof(cap->driver));
1426 strlcpy(cap->card, em28xx_boards[dev->model].name, sizeof(cap->card)); 1426 strlcpy(cap->card, em28xx_boards[dev->model].name, sizeof(cap->card));
1427 strlcpy(cap->bus_info, dev->udev->dev.bus_id, sizeof(cap->bus_info)); 1427 strlcpy(cap->bus_info, dev_name(&dev->udev->dev), sizeof(cap->bus_info));
1428 1428
1429 cap->version = EM28XX_VERSION_CODE; 1429 cap->version = EM28XX_VERSION_CODE;
1430 cap->capabilities = V4L2_CAP_TUNER; 1430 cap->capabilities = V4L2_CAP_TUNER;
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c
index 9d0ef96c23ff..83c07112c59d 100644
--- a/drivers/media/video/et61x251/et61x251_core.c
+++ b/drivers/media/video/et61x251/et61x251_core.c
@@ -1581,7 +1581,7 @@ et61x251_vidioc_querycap(struct et61x251_device* cam, void __user * arg)
1581 1581
1582 strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); 1582 strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card));
1583 if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) 1583 if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0)
1584 strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, 1584 strlcpy(cap.bus_info, dev_name(&cam->usbdev->dev),
1585 sizeof(cap.bus_info)); 1585 sizeof(cap.bus_info));
1586 1586
1587 if (copy_to_user(arg, &cap, sizeof(cap))) 1587 if (copy_to_user(arg, &cap, sizeof(cap)))
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index efe849981ab7..d4658c56eddc 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -385,10 +385,10 @@ static int ir_attach(struct i2c_adapter *adap, int addr,
385 goto err_out_detach; 385 goto err_out_detach;
386 } 386 }
387 387
388 /* Phys addr can only be set after attaching (for ir->c.dev.bus_id) */ 388 /* Phys addr can only be set after attaching (for ir->c.dev) */
389 snprintf(ir->phys, sizeof(ir->phys), "%s/%s/ir0", 389 snprintf(ir->phys, sizeof(ir->phys), "%s/%s/ir0",
390 ir->c.adapter->dev.bus_id, 390 dev_name(&ir->c.adapter->dev),
391 ir->c.dev.bus_id); 391 dev_name(&ir->c.dev));
392 392
393 /* init + register input device */ 393 /* init + register input device */
394 ir_input_init(input_dev, &ir->ir, ir_type, ir->ir_codes); 394 ir_input_init(input_dev, &ir->ir, ir_type, ir->ir_codes);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 5b81ba469641..4358079f1966 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -2395,7 +2395,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
2395 2395
2396 scnprintf(hdw->bus_info,sizeof(hdw->bus_info), 2396 scnprintf(hdw->bus_info,sizeof(hdw->bus_info),
2397 "usb %s address %d", 2397 "usb %s address %d",
2398 hdw->usb_dev->dev.bus_id, 2398 dev_name(&hdw->usb_dev->dev),
2399 hdw->usb_dev->devnum); 2399 hdw->usb_dev->devnum);
2400 2400
2401 ifnum = hdw->usb_intf->cur_altsetting->desc.bInterfaceNumber; 2401 ifnum = hdw->usb_intf->cur_altsetting->desc.bInterfaceNumber;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index 733680f21317..e641cd971453 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -628,10 +628,10 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
628 628
629 class_dev->class = &class_ptr->class; 629 class_dev->class = &class_ptr->class;
630 if (pvr2_hdw_get_sn(sfp->channel.hdw)) { 630 if (pvr2_hdw_get_sn(sfp->channel.hdw)) {
631 snprintf(class_dev->bus_id, BUS_ID_SIZE, "sn-%lu", 631 dev_set_name(class_dev, "sn-%lu",
632 pvr2_hdw_get_sn(sfp->channel.hdw)); 632 pvr2_hdw_get_sn(sfp->channel.hdw));
633 } else if (pvr2_hdw_get_unit_number(sfp->channel.hdw) >= 0) { 633 } else if (pvr2_hdw_get_unit_number(sfp->channel.hdw) >= 0) {
634 snprintf(class_dev->bus_id, BUS_ID_SIZE, "unit-%c", 634 dev_set_name(class_dev, "unit-%c",
635 pvr2_hdw_get_unit_number(sfp->channel.hdw) + 'a'); 635 pvr2_hdw_get_unit_number(sfp->channel.hdw) + 'a');
636 } else { 636 } else {
637 kfree(class_dev); 637 kfree(class_dev);
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 536b1a9b310c..63bc0a6e68b0 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -616,7 +616,7 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev)
616 616
617 /* request irq */ 617 /* request irq */
618 err = request_irq(pcdev->irq, sh_mobile_ceu_irq, IRQF_DISABLED, 618 err = request_irq(pcdev->irq, sh_mobile_ceu_irq, IRQF_DISABLED,
619 pdev->dev.bus_id, pcdev); 619 dev_name(&pdev->dev), pcdev);
620 if (err) { 620 if (err) {
621 dev_err(&pdev->dev, "Unable to register CEU interrupt.\n"); 621 dev_err(&pdev->dev, "Unable to register CEU interrupt.\n");
622 goto exit_release_mem; 622 goto exit_release_mem;
@@ -633,8 +633,8 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev)
633 pcdev->ici.priv = pcdev; 633 pcdev->ici.priv = pcdev;
634 pcdev->ici.dev.parent = &pdev->dev; 634 pcdev->ici.dev.parent = &pdev->dev;
635 pcdev->ici.nr = pdev->id; 635 pcdev->ici.nr = pdev->id;
636 pcdev->ici.drv_name = pdev->dev.bus_id, 636 pcdev->ici.drv_name = dev_name(&pdev->dev);
637 pcdev->ici.ops = &sh_mobile_ceu_host_ops, 637 pcdev->ici.ops = &sh_mobile_ceu_host_ops;
638 638
639 err = soc_camera_host_register(&pcdev->ici); 639 err = soc_camera_host_register(&pcdev->ici);
640 if (err) 640 if (err)
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c
index fcd2b62f92c4..01a8efb8deb1 100644
--- a/drivers/media/video/sn9c102/sn9c102_core.c
+++ b/drivers/media/video/sn9c102/sn9c102_core.c
@@ -2162,7 +2162,7 @@ sn9c102_vidioc_querycap(struct sn9c102_device* cam, void __user * arg)
2162 2162
2163 strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); 2163 strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card));
2164 if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) 2164 if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0)
2165 strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, 2165 strlcpy(cap.bus_info, dev_name(&cam->usbdev->dev),
2166 sizeof(cap.bus_info)); 2166 sizeof(cap.bus_info));
2167 2167
2168 if (copy_to_user(arg, &cap, sizeof(cap))) 2168 if (copy_to_user(arg, &cap, sizeof(cap)))
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index 66ebe5956a87..28cf5c94bd61 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -783,7 +783,7 @@ int soc_camera_host_register(struct soc_camera_host *ici)
783 return -EINVAL; 783 return -EINVAL;
784 784
785 /* Number might be equal to the platform device ID */ 785 /* Number might be equal to the platform device ID */
786 sprintf(ici->dev.bus_id, "camera_host%d", ici->nr); 786 dev_set_name(&ici->dev, "camera_host%d", ici->nr);
787 787
788 mutex_lock(&list_lock); 788 mutex_lock(&list_lock);
789 list_for_each_entry(ix, &hosts, list) { 789 list_for_each_entry(ix, &hosts, list) {
@@ -867,8 +867,7 @@ int soc_camera_device_register(struct soc_camera_device *icd)
867 867
868 icd->devnum = num; 868 icd->devnum = num;
869 icd->dev.bus = &soc_camera_bus_type; 869 icd->dev.bus = &soc_camera_bus_type;
870 snprintf(icd->dev.bus_id, sizeof(icd->dev.bus_id), 870 dev_set_name(&icd->dev, "%u-%u", icd->iface, icd->devnum);
871 "%u-%u", icd->iface, icd->devnum);
872 871
873 icd->dev.release = dummy_release; 872 icd->dev.release = dummy_release;
874 873
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index 062819cabec4..48c8c4399eb8 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -523,7 +523,7 @@ static int vidioc_querycap (struct file *file, void *priv,
523 strlcpy(vc->card, 523 strlcpy(vc->card,
524 usbvision_device_data[usbvision->DevModel].ModelString, 524 usbvision_device_data[usbvision->DevModel].ModelString,
525 sizeof(vc->card)); 525 sizeof(vc->card));
526 strlcpy(vc->bus_info, usbvision->dev->dev.bus_id, 526 strlcpy(vc->bus_info, dev_name(&usbvision->dev->dev),
527 sizeof(vc->bus_info)); 527 sizeof(vc->bus_info));
528 vc->version = USBVISION_DRIVER_VERSION; 528 vc->version = USBVISION_DRIVER_VERSION;
529 vc->capabilities = V4L2_CAP_VIDEO_CAPTURE | 529 vc->capabilities = V4L2_CAP_VIDEO_CAPTURE |
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index ead6d18e51ad..682f48aadcac 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -339,7 +339,7 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
339 vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); 339 vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
340 if (vfd->parent) 340 if (vfd->parent)
341 vfd->dev.parent = vfd->parent; 341 vfd->dev.parent = vfd->parent;
342 sprintf(vfd->dev.bus_id, "%s%d", name_base, nr); 342 dev_set_name(&vfd->dev, "%s%d", name_base, nr);
343 ret = device_register(&vfd->dev); 343 ret = device_register(&vfd->dev);
344 if (ret < 0) { 344 if (ret < 0) {
345 printk(KERN_ERR "%s: device_register failed\n", __func__); 345 printk(KERN_ERR "%s: device_register failed\n", __func__);
diff --git a/drivers/media/video/zc0301/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c
index 9fc581707638..9d00e6056491 100644
--- a/drivers/media/video/zc0301/zc0301_core.c
+++ b/drivers/media/video/zc0301/zc0301_core.c
@@ -1020,7 +1020,7 @@ zc0301_vidioc_querycap(struct zc0301_device* cam, void __user * arg)
1020 1020
1021 strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); 1021 strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card));
1022 if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) 1022 if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0)
1023 strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, 1023 strlcpy(cap.bus_info, dev_name(&cam->usbdev->dev),
1024 sizeof(cap.bus_info)); 1024 sizeof(cap.bus_info));
1025 1025
1026 if (copy_to_user(arg, &cap, sizeof(cap))) 1026 if (copy_to_user(arg, &cap, sizeof(cap)))