Skip to contentSkip to conversation

tlg2300: use correct device parent.

RFC PATCH In review Hans Verkuil 2 participants 3 messages Feb 7, 2013 – Feb 17, 2013 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 1/18 tlg2300: use correct device parent.

Set the correct parent for v4l2_device_register and don't set the name anymore (that's now deduced from the parent). Also remove an unnecessary forward reference and fix two weird looking log messages.

Changes since v1: don't set v4l2_dev.name anymore as per Huang's suggestion.
Huang: can you Ack this?

Regards,

Hans

---
 drivers/media/usb/tlg2300/pd-main.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/media/usb/tlg2300/pd-main.c +4 -9
index 7b1f6eb..247d6ac 100644
@@ -55,7 +55,6 @@ MODULE_PARM_DESC(debug_mode, "0 = disable, 1 = enable, 2 = verbose");
 
 #define TLG2300_FIRMWARE "tlg2300_firmware.bin"
 static const char *firmware_name = TLG2300_FIRMWARE;
-static struct usb_driver poseidon_driver;
 static LIST_HEAD(pd_device_list);
 
 /*
@@ -316,7 +315,7 @@ static int poseidon_suspend(struct usb_interface *intf, pm_message_t msg)
 		if (get_pm_count(pd) <= 0 && !in_hibernation(pd)) {
 			pd->msg.event = PM_EVENT_AUTO_SUSPEND;
 			pd->pm_resume = NULL; /*  a good guard */
-			printk(KERN_DEBUG "\n\t+ TLG2300 auto suspend +\n\n");
+			printk(KERN_DEBUG "TLG2300 auto suspend\n");
 		}
 		return 0;
 	}
@@ -331,7 +330,7 @@ static int poseidon_resume(struct usb_interface *intf)
 
 	if (!pd)
 		return 0;
-	printk(KERN_DEBUG "\n\t ++ TLG2300 resume ++\n\n");
+	printk(KERN_DEBUG "TLG2300 resume\n");
 
 	if (!is_working(pd)) {
 		if (PM_EVENT_AUTO_SUSPEND == pd->msg.event)
@@ -431,15 +430,11 @@ static int poseidon_probe(struct usb_interface *interface,
 	usb_set_intfdata(interface, pd);
 
 	if (new_one) {
-		struct device *dev = &interface->dev;
-
 		logpm(pd);
 		mutex_init(&pd->lock);
 
 		/* register v4l2 device */
-		snprintf(pd->v4l2_dev.name, sizeof(pd->v4l2_dev.name), "%s %s",
-			dev->driver->name, dev_name(dev));
-		ret = v4l2_device_register(NULL, &pd->v4l2_dev);
+		ret = v4l2_device_register(&interface->dev, &pd->v4l2_dev);
 
 		/* register devices in directory /dev */
 		ret = pd_video_init(pd);
@@ -530,7 +525,7 @@ module_init(poseidon_init);
 module_exit(poseidon_exit);
 
 MODULE_AUTHOR("Telegent Systems");
-MODULE_DESCRIPTION("For tlg2300-based USB device ");
+MODULE_DESCRIPTION("For tlg2300-based USB device");
 MODULE_LICENSE("GPL");
 MODULE_VERSION("0.0.2");
 MODULE_FIRMWARE(TLG2300_FIRMWARE);
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 6 lines · On Thu February 7 2013 13:36:25 Hans Verkuil wrote:

Set the correct parent for v4l2_device_register and don't set the name anymore (that's now deduced from the parent). Also remove an unnecessary forward reference and fix two weird looking log messages.

Changes since v1: don't set v4l2_dev.name anymore as per Huang's suggestion.
Huang: can you Ack this?

Huang Shijie, can you please Ack this patch and the
"[RFC PATCHv2 18/18] tlg2300: update MAINTAINERS file." patch I posted?

I'd like to do a post a pull request for this tomorrow and it would be nice if these two patches had your Acked-by as well.

Thanks!

Hans

Quoted 67 lines

Regards,

Hans

---
 drivers/media/usb/tlg2300/pd-main.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/media/usb/tlg2300/pd-main.c +4 -9
index 7b1f6eb..247d6ac 100644
@@ -55,7 +55,6 @@ MODULE_PARM_DESC(debug_mode, "0 = disable, 1 = enable, 2 = verbose");
 
 #define TLG2300_FIRMWARE "tlg2300_firmware.bin"
 static const char *firmware_name = TLG2300_FIRMWARE;
-static struct usb_driver poseidon_driver;
 static LIST_HEAD(pd_device_list);
 
 /*
@@ -316,7 +315,7 @@ static int poseidon_suspend(struct usb_interface *intf, pm_message_t msg)
 		if (get_pm_count(pd) <= 0 && !in_hibernation(pd)) {
 			pd->msg.event = PM_EVENT_AUTO_SUSPEND;
 			pd->pm_resume = NULL; /*  a good guard */
-			printk(KERN_DEBUG "\n\t+ TLG2300 auto suspend +\n\n");
+			printk(KERN_DEBUG "TLG2300 auto suspend\n");
 		}
 		return 0;
 	}
@@ -331,7 +330,7 @@ static int poseidon_resume(struct usb_interface *intf)
 
 	if (!pd)
 		return 0;
-	printk(KERN_DEBUG "\n\t ++ TLG2300 resume ++\n\n");
+	printk(KERN_DEBUG "TLG2300 resume\n");
 
 	if (!is_working(pd)) {
 		if (PM_EVENT_AUTO_SUSPEND == pd->msg.event)
@@ -431,15 +430,11 @@ static int poseidon_probe(struct usb_interface *interface,
 	usb_set_intfdata(interface, pd);
 
 	if (new_one) {
-		struct device *dev = &interface->dev;
-
 		logpm(pd);
 		mutex_init(&pd->lock);
 
 		/* register v4l2 device */
-		snprintf(pd->v4l2_dev.name, sizeof(pd->v4l2_dev.name), "%s %s",
-			dev->driver->name, dev_name(dev));
-		ret = v4l2_device_register(NULL, &pd->v4l2_dev);
+		ret = v4l2_device_register(&interface->dev, &pd->v4l2_dev);
 
 		/* register devices in directory /dev */
 		ret = pd_video_init(pd);
@@ -530,7 +525,7 @@ module_init(poseidon_init);
 module_exit(poseidon_exit);
 
 MODULE_AUTHOR("Telegent Systems");
-MODULE_DESCRIPTION("For tlg2300-based USB device ");
+MODULE_DESCRIPTION("For tlg2300-based USB device");
 MODULE_LICENSE("GPL");
 MODULE_VERSION("0.0.2");
 MODULE_FIRMWARE(TLG2300_FIRMWARE);
Acked-by on v2 1/18
#2 lore raw
In reply to Hans Verkuil
Quoted 73 lines · Hans Verkuil

Set the correct parent for v4l2_device_register and don't set the name anymore (that's now deduced from the parent). Also remove an unnecessary forward reference and fix two weird looking log messages.

Changes since v1: don't set v4l2_dev.name anymore as per Huang's suggestion.
Huang: can you Ack this?

Regards,

Hans

---
 drivers/media/usb/tlg2300/pd-main.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/media/usb/tlg2300/pd-main.c +4 -10
index 7b1f6eb..247d6ac 100644
@@ -55,7 +55,6 @@ MODULE_PARM_DESC(debug_mode, "0 = disable, 1 = enable, 2 = verbose");
 
 #define TLG2300_FIRMWARE "tlg2300_firmware.bin"
 static const char *firmware_name = TLG2300_FIRMWARE;
-static struct usb_driver poseidon_driver;
 static LIST_HEAD(pd_device_list);
 
 /*
@@ -316,7 +315,7 @@ static int poseidon_suspend(struct usb_interface *intf, pm_message_t msg)
                if (get_pm_count(pd) <= 0 && !in_hibernation(pd)) {
                        pd->msg.event = PM_EVENT_AUTO_SUSPEND;
                        pd->pm_resume = NULL; /*  a good guard */
-                       printk(KERN_DEBUG "\n\t+ TLG2300 auto suspend +\n\n");
+                       printk(KERN_DEBUG "TLG2300 auto suspend\n");
                }
                return 0;
        }
@@ -331,7 +330,7 @@ static int poseidon_resume(struct usb_interface *intf)
 
        if (!pd)
                return 0;
-       printk(KERN_DEBUG "\n\t ++ TLG2300 resume ++\n\n");
+       printk(KERN_DEBUG "TLG2300 resume\n");
 
        if (!is_working(pd)) {
                if (PM_EVENT_AUTO_SUSPEND == pd->msg.event)
@@ -431,15 +430,11 @@ static int poseidon_probe(struct usb_interface *interface,
        usb_set_intfdata(interface, pd);
 
        if (new_one) {
-               struct device *dev = &interface->dev;
-
                logpm(pd);
                mutex_init(&pd->lock);
 
                /* register v4l2 device */
-               snprintf(pd->v4l2_dev.name, sizeof(pd->v4l2_dev.name), "%s %s",
-                       dev->driver->name, dev_name(dev));
-               ret = v4l2_device_register(NULL, &pd->v4l2_dev);
+               ret = v4l2_device_register(&interface->dev, &pd->v4l2_dev);
 
                /* register devices in directory /dev */
                ret = pd_video_init(pd);
@@ -530,7 +525,7 @@ module_init(poseidon_init);
 module_exit(poseidon_exit);
 
 MODULE_AUTHOR("Telegent Systems");
-MODULE_DESCRIPTION("For tlg2300-based USB device ");
+MODULE_DESCRIPTION("For tlg2300-based USB device");
 MODULE_LICENSE("GPL");
 MODULE_VERSION("0.0.2");
 MODULE_FIRMWARE(TLG2300_FIRMWARE);
--
Quoted 2 lines

1.7.10.4

sorry for the later reply. I was on vacation.