Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1533618
| From | Kristian Evensen <kristian.evensen@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH net] cdc_ether: Fix handling connection notification |
| Date | 2016-11-30 23:00 +0100 |
| Message-ID | <sJl4Z-351-13@gated-at.bofh.it> (permalink) |
| References | <sJi77-1gR-1@gated-at.bofh.it> <sJl4Z-351-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Nov 30, 2016 at 10:51 PM, Bjørn Mork <bjorn@mork.no> wrote:
> Kristian Evensen <kristian.evensen@gmail.com> writes:
>
>> +void usbnet_cdc_zte_status(struct usbnet *dev, struct urb *urb)
>> +{
>> + struct usb_cdc_notification *event;
>> +
>> + if (urb->actual_length < sizeof(*event))
>> + return;
>> +
>> + event = urb->transfer_buffer;
>> +
>> + if (event->bNotificationType != USB_CDC_NOTIFY_NETWORK_CONNECTION) {
>> + usbnet_cdc_status(dev, urb);
>> + return;
>> + }
>> +
>> + netif_dbg(dev, timer, dev->net, "CDC: carrier %s\n",
>> + event->wValue ? "on" : "off");
>> +
>> + if (event->wValue &&
>> + !test_bit(__LINK_STATE_NOCARRIER, &dev->net->state))
>> + usbnet_link_change(dev, 0, 0);
>> +
>> + usbnet_link_change(dev, !!event->wValue, 0);
>> +}
>
> As Henning said: Use netif_carrier_ok instead of open coding it.
>
> But I also think you need to replace the first usbnet_link_change() with
> a plain netif_carrier_off(dev->net). Calling usbnet_link_change() twice
> here is only going to set off the "kevent XX may have been dropped"
> message since you call schedule_work() twice without giving the work
> queue a chance to be processed. No need to do that.
Thanks for the feedback and agree. Will submit a v2 tomorrow.
-Kristian
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH net] cdc_ether: Fix handling connection notification Kristian Evensen <kristian.evensen@gmail.com> - 2016-11-30 19:50 +0100
Re: [PATCH net] cdc_ether: Fix handling connection notification Henning Schild <henning.schild@siemens.com> - 2016-11-30 20:30 +0100
Re: [PATCH net] cdc_ether: Fix handling connection notification Bjørn Mork <bjorn@mork.no> - 2016-11-30 23:00 +0100
Re: [PATCH net] cdc_ether: Fix handling connection notification Kristian Evensen <kristian.evensen@gmail.com> - 2016-11-30 23:00 +0100
csiph-web