Re: [RFC] net: usbnet: add pre and post_reset support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sergei Shtylyov <sshtylyov@xxxxxxxxxx> wrote:

>Hello.
>
>On 10-10-2012 18:34, Bjørn Mork wrote:
>
>> Signed-off-by: Bjørn Mork <bjorn@xxxxxxx>
>> ---
>> What do you think about something like this? Does it have to
>> be more complicated?  Somewhat tested, and seems to do the
>> job for me.
>>
>>
>>   drivers/net/usb/usbnet.c   |   32 ++++++++++++++++++++++++++++++++
>>   include/linux/usb/usbnet.h |    2 ++
>>   2 files changed, 34 insertions(+)
>>
>> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
>> index fc9f578..2f60b2c 100644
>> --- a/drivers/net/usb/usbnet.c
>> +++ b/drivers/net/usb/usbnet.c
>> @@ -1592,6 +1592,38 @@ int usbnet_resume (struct usb_interface *intf)
>>   }
>>   EXPORT_SYMBOL_GPL(usbnet_resume);
>>   
>> +int usbnet_pre_reset (struct usb_interface *intf)
>> +{
>> +	struct usbnet		*dev = usb_get_intfdata(intf);
>> +
>> +	if (!dev->suspend_count++) {
>> +		netif_device_detach (dev->net);
>> +		usbnet_terminate_urbs(dev);
>> +		usb_kill_urb(dev->interrupt);
>> +	}
>> +	return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(usbnet_pre_reset);
>> +
>> +int usbnet_post_reset (struct usb_interface *intf)
>> +{
>> +	struct usbnet		*dev = usb_get_intfdata(intf);
>> +
>> +	if (!--dev->suspend_count) {
>> +		/* resume interrupt URBs */
>> +		if (dev->interrupt && test_bit(EVENT_DEV_OPEN, &dev->flags))
>> +			usb_submit_urb(dev->interrupt, GFP_NOIO);
>> +
>> +		netif_device_attach (dev->net);
>> +		if (test_bit(EVENT_DEV_OPEN, &dev->flags)) {
>> +			if (!(dev->txq.qlen >= TX_QLEN(dev)))
>> +				netif_tx_wake_all_queues(dev->net);
>> +			tasklet_schedule (&dev->bh);
>> +		}
>> +	}
>> +	return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(usbnet_post_reset);
>>   
>>  
>/*-------------------------------------------------------------------------*/
>>   
>
>    I suppose you didn't run it thru scripts/checkpatch.pl? It would 
>woran about spaces before (...
>
>WBR, Sergei
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-usb" in
>the body of a message to majordomo@xxxxxxxxxxxxxxx
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

Yes, I know. That was actually intentional, keeping the style consistent in this file. No, checkpatch will not like that, but you might want to do checkpatch -f usbnet.c then.


Bjørn
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux