linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] usb: add 'usb_get_intf()' call into the probe methods of drivers for usb interfaces.
@ 2012-11-19  3:01 harvey yang
  2012-11-20 16:09 ` Alan Stern
  0 siblings, 1 reply; 3+ messages in thread
From: harvey yang @ 2012-11-19  3:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-usb; +Cc: linux-kernel

Hi, all
I checked many usb drivers in the mainline kernel which do not record
this reference in their probe methods. But according to the documents
about this function, we shoud record this reference in our probe
methods, just as the call to 'usb_get_dev()' to reference a usb
device. Are these usb drivers right or we need to fix them?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] usb: add 'usb_get_intf()' call into the probe methods of drivers for usb interfaces.
  2012-11-19  3:01 [RFC] usb: add 'usb_get_intf()' call into the probe methods of drivers for usb interfaces harvey yang
@ 2012-11-20 16:09 ` Alan Stern
  2012-11-21  1:51   ` harvey yang
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Stern @ 2012-11-20 16:09 UTC (permalink / raw)
  To: harvey yang; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On Mon, 19 Nov 2012, harvey yang wrote:

> Hi, all
> I checked many usb drivers in the mainline kernel which do not record
> this reference in their probe methods. But according to the documents
> about this function, we shoud record this reference in our probe
> methods, just as the call to 'usb_get_dev()' to reference a usb
> device. Are these usb drivers right or we need to fix them?

The drivers are right; they do not need to be fixed.  The reason is
because the drivers will be unbound automatically when the device or
interface is unregistered.

The only reason for a driver to take a reference would be if it wanted 
to continue using the device after it was unbound.  But drivers aren't 
supposed to do that.

Alan Stern


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] usb: add 'usb_get_intf()' call into the probe methods of drivers for usb interfaces.
  2012-11-20 16:09 ` Alan Stern
@ 2012-11-21  1:51   ` harvey yang
  0 siblings, 0 replies; 3+ messages in thread
From: harvey yang @ 2012-11-21  1:51 UTC (permalink / raw)
  To: Alan Stern; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

Thanks for your comments :)

Harvey


On Wed, Nov 21, 2012 at 12:09 AM, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Mon, 19 Nov 2012, harvey yang wrote:
>
>> Hi, all
>> I checked many usb drivers in the mainline kernel which do not record
>> this reference in their probe methods. But according to the documents
>> about this function, we shoud record this reference in our probe
>> methods, just as the call to 'usb_get_dev()' to reference a usb
>> device. Are these usb drivers right or we need to fix them?
>
> The drivers are right; they do not need to be fixed.  The reason is
> because the drivers will be unbound automatically when the device or
> interface is unregistered.
>
> The only reason for a driver to take a reference would be if it wanted
> to continue using the device after it was unbound.  But drivers aren't
> supposed to do that.
>
> Alan Stern
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-21  1:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-19  3:01 [RFC] usb: add 'usb_get_intf()' call into the probe methods of drivers for usb interfaces harvey yang
2012-11-20 16:09 ` Alan Stern
2012-11-21  1:51   ` harvey yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).