Re: [PATCH] fix usb skeleton driver
From: BjÃrn Mork
Date: Thu Jun 07 2012 - 03:11:33 EST
Stefani Seibold <stefani@xxxxxxxxxxx> writes:
> Am Mittwoch, den 06.06.2012, 14:16 -0400 schrieb Alan Stern:
>
>> But that's wrong -- the accesses should go through the interface
>> pointer. After all, the driver is bound to the interface, not to the
>> device.
>>
>
> Not really true, in whole driver only the open() and close() use the
> interface pointer.
>
> In the open path the interface is already determinate by
> usb_find_interface(), so it was reasonable to do this also in the close
> path.
You are ignoring a few printk's you had to change:
@@ -460,9 +466,8 @@ static ssize_t skel_write(struct file *file, const char *user_buffer,
/* send the data out the bulk port */
retval = usb_submit_urb(urb, GFP_KERNEL);
- mutex_unlock(&dev->io_mutex);
if (retval) {
- dev_err(&dev->interface->dev,
+ dev_err(&dev->udev->dev,
"%s - failed submitting write urb, error %d\n",
__func__, retval);
goto error_unanchor;
IMHO this is really bad in an example driver. This is an interface
driver, and any messages from it should either reference the interface
or some related device the driver has registered.
"Simplifying" like this is not the way to go when writing a HOWTO.
BjÃrn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/