Skip to contentSkip to conversation

USB: change interface to usb_lock_device_for_reset()

DISCUSSION Mauro Carvalho Chehab 3 participants 3 messages Jan 9, 2009 8 messages not in the archive Media (V4L/DVB)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 15 lines · On Thu, 8 Jan 2009 21:56:15 -0800 (PST) Trent Piepho <[email protected]>…
Quoted 4 lines · Mike Isely
Quoted 2 lines

Yes... Anyway, this is the real patch. I've added a small comment about this change... I'll commit this tomorrow, if you don't have a better suggestion.

Looks good.

Or maybe like this?

diff -r f01b3897d141 linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c

linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +0 -0
@@ -3747,7 +3747,12 @@
 	int ret;
 	pvr2_trace(PVR2_TRACE_INIT,"Performing a device reset...");

linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c line 3757

Quoted 10 lines
linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +5 -1
 	ret = usb_lock_device_for_reset(hdw->usb_dev,NULL);
- 	if (ret == 1) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+	/* Due to the API changes, the ret value for success changed */
+	ret = ret != 1;
+#endif
+	if (ret == 0) {
 		ret = usb_reset_device(hdw->usb_dev);
 		usb_unlock_device(hdw->usb_dev);
 	} else {

Seems better! Could you please provide your SOB? I'll apply just the backport, then your patch.

Cheers,
Mauro

Acked-by
#9 lore raw
Quoted 22 lines · Mauro Carvalho Chehab
Quoted 19 lines · On Thu, 8 Jan 2009 21:56:15 -0800 (PST) Trent Piepho <[email protected]>…
Quoted 4 lines · Mike Isely
Quoted 2 lines

Yes... Anyway, this is the real patch. I've added a small comment about this change... I'll commit this tomorrow, if you don't have a better suggestion.

Looks good.

Or maybe like this?

diff -r f01b3897d141 linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c

linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +3 -1
@@ -3747,7 +3747,12 @@
 	int ret;
 	pvr2_trace(PVR2_TRACE_INIT,"Performing a device reset...");
 	ret = usb_lock_device_for_reset(hdw->usb_dev,NULL);
- 	if (ret == 1) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+	/* Due to the API changes, the ret value for success changed */
+	ret = ret != 1;
Quoted 8 lines

linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c line 3757

Quoted 6 lines
linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +2 -0
+#endif
+	if (ret == 0) {
 		ret = usb_reset_device(hdw->usb_dev);
 		usb_unlock_device(hdw->usb_dev);
 	} else {

Seems better! Could you please provide your SOB? I'll apply just the backport, then your patch.

Just for the record...

-Mike

Signature · 3 lines
Mike Isely
isely @ pobox (dot) com
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8
#10 lore raw
In reply to Mauro Carvalho Chehab
Quoted 21 lines · Mauro Carvalho Chehab
Quoted 19 lines · On Thu, 8 Jan 2009 21:56:15 -0800 (PST) Trent Piepho <[email protected]>…
Quoted 4 lines · Mike Isely
Quoted 2 lines

Yes... Anyway, this is the real patch. I've added a small comment about this change... I'll commit this tomorrow, if you don't have a better suggestion.

Looks good.

Or maybe like this?

diff -r f01b3897d141 linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c

linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +3 -1
@@ -3747,7 +3747,12 @@
 	int ret;
 	pvr2_trace(PVR2_TRACE_INIT,"Performing a device reset...");
 	ret = usb_lock_device_for_reset(hdw->usb_dev,NULL);
- 	if (ret == 1) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+	/* Due to the API changes, the ret value for success changed */
+	ret = ret != 1;
Quoted 8 lines

linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c line 3757

Quoted 6 lines
linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +2 -0
+#endif
+	if (ret == 0) {
 		ret = usb_reset_device(hdw->usb_dev);
 		usb_unlock_device(hdw->usb_dev);
 	} else {

Seems better! Could you please provide your SOB? I'll apply just the backport, then your patch.