* hso: remove usb_driver_claim_interface()
@ 2008-09-10 9:06 Paulius Zaleckas
2008-09-10 10:44 ` Denis Joseph Barrow
0 siblings, 1 reply; 7+ messages in thread
From: Paulius Zaleckas @ 2008-09-10 9:06 UTC (permalink / raw)
To: linux-usb, netdev; +Cc: D.Barow
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: hso-no-claim-interface.patch --]
[-- Type: text/x-patch, Size: 587 bytes --]
No need to reclaim the same USB interface beeing probed.
Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Cc: Denis Joseph Barrow <D.Barow@option.com>
Index: linux-2.6/drivers/net/usb/hso.c
===================================================================
--- linux-2.6.orig/drivers/net/usb/hso.c
+++ linux-2.6/drivers/net/usb/hso.c
@@ -2487,8 +2487,6 @@ static int hso_probe(struct usb_interfac
goto exit;
}
- usb_driver_claim_interface(&hso_driver, interface, hso_dev);
-
/* save our data pointer in this device */
usb_set_intfdata(interface, hso_dev);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: hso: remove usb_driver_claim_interface()
2008-09-10 9:06 hso: remove usb_driver_claim_interface() Paulius Zaleckas
@ 2008-09-10 10:44 ` Denis Joseph Barrow
[not found] ` <48C7A4F5.2070607-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
2008-09-10 13:55 ` Alan Stern
0 siblings, 2 replies; 7+ messages in thread
From: Denis Joseph Barrow @ 2008-09-10 10:44 UTC (permalink / raw)
To: Paulius Zaleckas; +Cc: linux-usb, netdev, Greg Kroah-Hartman
Hi Paulius,
I'm not in a position yet to know if this patch is good, yet at least.
hso_probe gets called once for each serial ttyHSx device
usually four per usb stick modem & once for the hsox network device
per modem.
>From the comment on usb_driver_claim_interface
* This is used by usb device drivers that need to claim more than one
* interface on a device when probing (audio and acm are current examples).
I'm not used to USB terminology
>From my understanding of the code
we are claiming more than one interface on the usb modem multiple ttyHSx devices
& one network device. However we get probed once for each interface
We are also calling usb_driver_release_interface from hso_disconnect.
This looks a little asymmetrical to me.
Greg is this patch good? I've no problem with it if it gets your guys blessing.
Index: linux-2.6/drivers/net/usb/hso.c
===================================================================
--- linux-2.6.orig/drivers/net/usb/hso.c
+++ linux-2.6/drivers/net/usb/hso.c
@@ -2487,8 +2487,6 @@ static int hso_probe(struct usb_interfac
goto exit;
}
- usb_driver_claim_interface(&hso_driver, interface, hso_dev);
-
/* save our data pointer in this device */
usb_set_intfdata(interface, hso_dev);
Paulius Zaleckas wrote:
--
best regards,
D.J. Barrow
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: hso: remove usb_driver_claim_interface()
[not found] ` <48C7A4F5.2070607-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
@ 2008-09-10 11:26 ` Paulius Zaleckas
2008-09-10 11:34 ` Denis Joseph Barrow
0 siblings, 1 reply; 7+ messages in thread
From: Paulius Zaleckas @ 2008-09-10 11:26 UTC (permalink / raw)
To: Denis Joseph Barrow
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev, Greg Kroah-Hartman
Denis Joseph Barrow wrote:
> Hi Paulius,
> I'm not in a position yet to know if this patch is good, yet at least.
> hso_probe gets called once for each serial ttyHSx device
> usually four per usb stick modem & once for the hsox network device
> per modem.
>
> From the comment on usb_driver_claim_interface
> * This is used by usb device drivers that need to claim more than one
> * interface on a device when probing (audio and acm are current examples).
>
> I'm not used to USB terminology
> From my understanding of the code
> we are claiming more than one interface on the usb modem multiple ttyHSx devices
> & one network device. However we get probed once for each interface
usb_driver_claim_interface() is needed only when you want to claim
additional interface.
> We are also calling usb_driver_release_interface from hso_disconnect.
> This looks a little asymmetrical to me.
Nice catch. usb_driver_release_interface() is not needed there too.
This is some code from usb_driver_release_interface():
/* don't release from within disconnect() */
if (iface->condition != USB_INTERFACE_BOUND)
return;
So since hso_disconnect is usb disconnect(), function call to
usb_driver_release_interface() just returns without any action.
I will prepare patch for this one too.
Greg: Maybe we should put warning in this check to catch other
driver from misusing this function?
> Greg is this patch good? I've no problem with it if it gets your guys blessing.
>
>
> Index: linux-2.6/drivers/net/usb/hso.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/usb/hso.c
> +++ linux-2.6/drivers/net/usb/hso.c
> @@ -2487,8 +2487,6 @@ static int hso_probe(struct usb_interfac
> goto exit;
> }
>
> - usb_driver_claim_interface(&hso_driver, interface, hso_dev);
> -
> /* save our data pointer in this device */
> usb_set_intfdata(interface, hso_dev);
>
>
>
>
> Paulius Zaleckas wrote:
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: hso: remove usb_driver_claim_interface()
2008-09-10 11:26 ` Paulius Zaleckas
@ 2008-09-10 11:34 ` Denis Joseph Barrow
2008-09-10 11:44 ` Paulius Zaleckas
0 siblings, 1 reply; 7+ messages in thread
From: Denis Joseph Barrow @ 2008-09-10 11:34 UTC (permalink / raw)
To: Paulius Zaleckas; +Cc: linux-usb, netdev, Greg Kroah-Hartman
Paulius Zaleckas wrote:
Have you a hso device to test this on.
If you have & it works it gets my blessing.
> Denis Joseph Barrow wrote:
>> Hi Paulius,
>> I'm not in a position yet to know if this patch is good, yet at least.
>> hso_probe gets called once for each serial ttyHSx device
>> usually four per usb stick modem & once for the hsox network device
>> per modem.
>>
>> From the comment on usb_driver_claim_interface
>> * This is used by usb device drivers that need to claim more than one
>> * interface on a device when probing (audio and acm are current
>> examples).
>>
>> I'm not used to USB terminology
>> From my understanding of the code
>> we are claiming more than one interface on the usb modem multiple
>> ttyHSx devices
>> & one network device. However we get probed once for each interface
>
> usb_driver_claim_interface() is needed only when you want to claim
> additional interface.
>
>> We are also calling usb_driver_release_interface from hso_disconnect.
>> This looks a little asymmetrical to me.
>
> Nice catch. usb_driver_release_interface() is not needed there too.
> This is some code from usb_driver_release_interface():
>
> /* don't release from within disconnect() */
> if (iface->condition != USB_INTERFACE_BOUND)
> return;
>
> So since hso_disconnect is usb disconnect(), function call to
> usb_driver_release_interface() just returns without any action.
> I will prepare patch for this one too.
>
> Greg: Maybe we should put warning in this check to catch other
> driver from misusing this function?
>
>> Greg is this patch good? I've no problem with it if it gets your guys
>> blessing.
>>
>>
>> Index: linux-2.6/drivers/net/usb/hso.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/net/usb/hso.c
>> +++ linux-2.6/drivers/net/usb/hso.c
>> @@ -2487,8 +2487,6 @@ static int hso_probe(struct usb_interfac
>> goto exit;
>> }
>>
>> - usb_driver_claim_interface(&hso_driver, interface, hso_dev);
>> -
>> /* save our data pointer in this device */
>> usb_set_intfdata(interface, hso_dev);
>>
>>
>>
>>
>> Paulius Zaleckas wrote:
>>
--
best regards,
D.J. Barrow
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: hso: remove usb_driver_claim_interface()
2008-09-10 11:34 ` Denis Joseph Barrow
@ 2008-09-10 11:44 ` Paulius Zaleckas
2008-09-10 11:56 ` Denis Joseph Barrow
0 siblings, 1 reply; 7+ messages in thread
From: Paulius Zaleckas @ 2008-09-10 11:44 UTC (permalink / raw)
To: Denis Joseph Barrow; +Cc: linux-usb, netdev, Greg Kroah-Hartman
Denis Joseph Barrow wrote:
> Paulius Zaleckas wrote:
> Have you a hso device to test this on.
> If you have & it works it gets my blessing.
Yes, I have couple different hso devices.
This "usb_driver_claim_interface" patch was tested long ago,
but somehow I didn't post to the mailing-lists :)
I'll make patch for usb_driver_release_interface and
retest both patches.
>> Denis Joseph Barrow wrote:
>>> Hi Paulius,
>>> I'm not in a position yet to know if this patch is good, yet at least.
>>> hso_probe gets called once for each serial ttyHSx device
>>> usually four per usb stick modem & once for the hsox network device
>>> per modem.
>>>
>>> From the comment on usb_driver_claim_interface
>>> * This is used by usb device drivers that need to claim more than one
>>> * interface on a device when probing (audio and acm are current
>>> examples).
>>>
>>> I'm not used to USB terminology
>>> From my understanding of the code
>>> we are claiming more than one interface on the usb modem multiple
>>> ttyHSx devices
>>> & one network device. However we get probed once for each interface
>> usb_driver_claim_interface() is needed only when you want to claim
>> additional interface.
>>
>>> We are also calling usb_driver_release_interface from hso_disconnect.
>>> This looks a little asymmetrical to me.
>> Nice catch. usb_driver_release_interface() is not needed there too.
>> This is some code from usb_driver_release_interface():
>>
>> /* don't release from within disconnect() */
>> if (iface->condition != USB_INTERFACE_BOUND)
>> return;
>>
>> So since hso_disconnect is usb disconnect(), function call to
>> usb_driver_release_interface() just returns without any action.
>> I will prepare patch for this one too.
>>
>> Greg: Maybe we should put warning in this check to catch other
>> driver from misusing this function?
>>
>>> Greg is this patch good? I've no problem with it if it gets your guys
>>> blessing.
>>>
>>>
>>> Index: linux-2.6/drivers/net/usb/hso.c
>>> ===================================================================
>>> --- linux-2.6.orig/drivers/net/usb/hso.c
>>> +++ linux-2.6/drivers/net/usb/hso.c
>>> @@ -2487,8 +2487,6 @@ static int hso_probe(struct usb_interfac
>>> goto exit;
>>> }
>>>
>>> - usb_driver_claim_interface(&hso_driver, interface, hso_dev);
>>> -
>>> /* save our data pointer in this device */
>>> usb_set_intfdata(interface, hso_dev);
>>>
>>>
>>>
>>>
>>> Paulius Zaleckas wrote:
>>>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: hso: remove usb_driver_claim_interface()
2008-09-10 11:44 ` Paulius Zaleckas
@ 2008-09-10 11:56 ` Denis Joseph Barrow
0 siblings, 0 replies; 7+ messages in thread
From: Denis Joseph Barrow @ 2008-09-10 11:56 UTC (permalink / raw)
To: Paulius Zaleckas, Greg Kroah-Hartman; +Cc: linux-usb, netdev
Hi Paulius,
The patch worked for me,
If it gets Gregs blessing it's in.
Paulius Zaleckas wrote:
> Denis Joseph Barrow wrote:
>> Paulius Zaleckas wrote:
>> Have you a hso device to test this on.
>> If you have & it works it gets my blessing.
>
> Yes, I have couple different hso devices.
> This "usb_driver_claim_interface" patch was tested long ago,
> but somehow I didn't post to the mailing-lists :)
>
> I'll make patch for usb_driver_release_interface and
> retest both patches.
>
>>> Denis Joseph Barrow wrote:
>>>> Hi Paulius,
>>>> I'm not in a position yet to know if this patch is good, yet at least.
>>>> hso_probe gets called once for each serial ttyHSx device
>>>> usually four per usb stick modem & once for the hsox network device
>>>> per modem.
>>>>
>>>> From the comment on usb_driver_claim_interface
>>>> * This is used by usb device drivers that need to claim more than one
>>>> * interface on a device when probing (audio and acm are current
>>>> examples).
>>>>
>>>> I'm not used to USB terminology
>>>> From my understanding of the code
>>>> we are claiming more than one interface on the usb modem multiple
>>>> ttyHSx devices
>>>> & one network device. However we get probed once for each interface
>>> usb_driver_claim_interface() is needed only when you want to claim
>>> additional interface.
>>>
>>>> We are also calling usb_driver_release_interface from hso_disconnect.
>>>> This looks a little asymmetrical to me.
>>> Nice catch. usb_driver_release_interface() is not needed there too.
>>> This is some code from usb_driver_release_interface():
>>>
>>> /* don't release from within disconnect() */
>>> if (iface->condition != USB_INTERFACE_BOUND)
>>> return;
>>>
>>> So since hso_disconnect is usb disconnect(), function call to
>>> usb_driver_release_interface() just returns without any action.
>>> I will prepare patch for this one too.
>>>
>>> Greg: Maybe we should put warning in this check to catch other
>>> driver from misusing this function?
>>>
>>>> Greg is this patch good? I've no problem with it if it gets your guys
>>>> blessing.
>>>>
>>>>
>>>> Index: linux-2.6/drivers/net/usb/hso.c
>>>> ===================================================================
>>>> --- linux-2.6.orig/drivers/net/usb/hso.c
>>>> +++ linux-2.6/drivers/net/usb/hso.c
>>>> @@ -2487,8 +2487,6 @@ static int hso_probe(struct usb_interfac
>>>> goto exit;
>>>> }
>>>>
>>>> - usb_driver_claim_interface(&hso_driver, interface, hso_dev);
>>>> -
>>>> /* save our data pointer in this device */
>>>> usb_set_intfdata(interface, hso_dev);
>>>>
>>>>
>>>>
>>>>
>>>> Paulius Zaleckas wrote:
>>>>
>>
>>
--
best regards,
D.J. Barrow
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: hso: remove usb_driver_claim_interface()
2008-09-10 10:44 ` Denis Joseph Barrow
[not found] ` <48C7A4F5.2070607-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
@ 2008-09-10 13:55 ` Alan Stern
1 sibling, 0 replies; 7+ messages in thread
From: Alan Stern @ 2008-09-10 13:55 UTC (permalink / raw)
To: Denis Joseph Barrow
Cc: Paulius Zaleckas, linux-usb, netdev, Greg Kroah-Hartman
On Wed, 10 Sep 2008, Denis Joseph Barrow wrote:
> Hi Paulius,
> I'm not in a position yet to know if this patch is good, yet at least.
> hso_probe gets called once for each serial ttyHSx device
> usually four per usb stick modem & once for the hsox network device
> per modem.
>
> From the comment on usb_driver_claim_interface
> * This is used by usb device drivers that need to claim more than one
> * interface on a device when probing (audio and acm are current examples).
>
> I'm not used to USB terminology
> From my understanding of the code
> we are claiming more than one interface on the usb modem multiple ttyHSx devices
> & one network device. However we get probed once for each interface
The idea behind usb_driver_claim_interface() is that it allows a driver
to bind to an arbitrary interface, generally because the driver needs
control of multiple interfaces in order to manage the device. For
example, an audio device might include both a control interface and a
data interface -- the driver would claim the data interface when it is
probed for the control interface, since both are needed to run the
device.
But if the interfaces are independent and the driver is going to be
probed for both of them anyway then there is no need to claim either
one. Just let the usual probing mechanism do its job.
And there is never any need to claim the interface for which the driver
is being probed, since the driver is already getting bound to that
interface.
Alan Stern
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-09-10 13:55 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-10 9:06 hso: remove usb_driver_claim_interface() Paulius Zaleckas
2008-09-10 10:44 ` Denis Joseph Barrow
[not found] ` <48C7A4F5.2070607-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
2008-09-10 11:26 ` Paulius Zaleckas
2008-09-10 11:34 ` Denis Joseph Barrow
2008-09-10 11:44 ` Paulius Zaleckas
2008-09-10 11:56 ` Denis Joseph Barrow
2008-09-10 13:55 ` Alan Stern
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).