diff options
Diffstat (limited to 'drivers/net/wimax/i2400m/usb-notif.c')
-rw-r--r-- | drivers/net/wimax/i2400m/usb-notif.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/drivers/net/wimax/i2400m/usb-notif.c b/drivers/net/wimax/i2400m/usb-notif.c index 6add27c3f35c..f88d1c6e35cb 100644 --- a/drivers/net/wimax/i2400m/usb-notif.c +++ b/drivers/net/wimax/i2400m/usb-notif.c | |||
@@ -51,6 +51,7 @@ | |||
51 | * | 51 | * |
52 | * i2400mu_usb_notification_cb() Called when a URB is ready | 52 | * i2400mu_usb_notification_cb() Called when a URB is ready |
53 | * i2400mu_notif_grok() | 53 | * i2400mu_notif_grok() |
54 | * i2400m_is_boot_barker() | ||
54 | * i2400m_dev_reset_handle() | 55 | * i2400m_dev_reset_handle() |
55 | * i2400mu_rx_kick() | 56 | * i2400mu_rx_kick() |
56 | */ | 57 | */ |
@@ -87,32 +88,21 @@ int i2400mu_notification_grok(struct i2400mu *i2400mu, const void *buf, | |||
87 | d_fnstart(4, dev, "(i2400m %p buf %p buf_len %zu)\n", | 88 | d_fnstart(4, dev, "(i2400m %p buf %p buf_len %zu)\n", |
88 | i2400mu, buf, buf_len); | 89 | i2400mu, buf, buf_len); |
89 | ret = -EIO; | 90 | ret = -EIO; |
90 | if (buf_len < sizeof(i2400m_NBOOT_BARKER)) | 91 | if (buf_len < sizeof(i2400m_ZERO_BARKER)) |
91 | /* Not a bug, just ignore */ | 92 | /* Not a bug, just ignore */ |
92 | goto error_bad_size; | 93 | goto error_bad_size; |
93 | if (!memcmp(i2400m_NBOOT_BARKER, buf, sizeof(i2400m_NBOOT_BARKER)) | 94 | ret = 0; |
94 | || !memcmp(i2400m_SBOOT_BARKER, buf, sizeof(i2400m_SBOOT_BARKER))) | 95 | if (!memcmp(i2400m_ZERO_BARKER, buf, sizeof(i2400m_ZERO_BARKER))) { |
95 | ret = i2400m_dev_reset_handle(i2400m); | ||
96 | else if (!memcmp(i2400m_ZERO_BARKER, buf, sizeof(i2400m_ZERO_BARKER))) { | ||
97 | i2400mu_rx_kick(i2400mu); | 96 | i2400mu_rx_kick(i2400mu); |
98 | ret = 0; | 97 | goto out; |
99 | } else { /* Unknown or unexpected data in the notif message */ | ||
100 | char prefix[64]; | ||
101 | ret = -EIO; | ||
102 | dev_err(dev, "HW BUG? Unknown/unexpected data in notification " | ||
103 | "message (%zu bytes)\n", buf_len); | ||
104 | snprintf(prefix, sizeof(prefix), "%s %s: ", | ||
105 | dev_driver_string(dev), dev_name(dev)); | ||
106 | if (buf_len > 64) { | ||
107 | print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, | ||
108 | 8, 4, buf, 64, 0); | ||
109 | printk(KERN_ERR "%s... (only first 64 bytes " | ||
110 | "dumped)\n", prefix); | ||
111 | } else | ||
112 | print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, | ||
113 | 8, 4, buf, buf_len, 0); | ||
114 | } | 98 | } |
99 | ret = i2400m_is_boot_barker(i2400m, buf, buf_len); | ||
100 | if (unlikely(ret >= 0)) | ||
101 | ret = i2400m_dev_reset_handle(i2400m, "device rebooted"); | ||
102 | else /* Unknown or unexpected data in the notif message */ | ||
103 | i2400m_unknown_barker(i2400m, buf, buf_len); | ||
115 | error_bad_size: | 104 | error_bad_size: |
105 | out: | ||
116 | d_fnend(4, dev, "(i2400m %p buf %p buf_len %zu) = %d\n", | 106 | d_fnend(4, dev, "(i2400m %p buf %p buf_len %zu) = %d\n", |
117 | i2400mu, buf, buf_len, ret); | 107 | i2400mu, buf, buf_len, ret); |
118 | return ret; | 108 | return ret; |
@@ -220,7 +210,8 @@ int i2400mu_notification_setup(struct i2400mu *i2400mu) | |||
220 | dev_err(dev, "notification: cannot allocate URB\n"); | 210 | dev_err(dev, "notification: cannot allocate URB\n"); |
221 | goto error_alloc_urb; | 211 | goto error_alloc_urb; |
222 | } | 212 | } |
223 | epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_NOTIFICATION); | 213 | epd = usb_get_epd(i2400mu->usb_iface, |
214 | i2400mu->endpoint_cfg.notification); | ||
224 | usb_pipe = usb_rcvintpipe(i2400mu->usb_dev, epd->bEndpointAddress); | 215 | usb_pipe = usb_rcvintpipe(i2400mu->usb_dev, epd->bEndpointAddress); |
225 | usb_fill_int_urb(i2400mu->notif_urb, i2400mu->usb_dev, usb_pipe, | 216 | usb_fill_int_urb(i2400mu->notif_urb, i2400mu->usb_dev, usb_pipe, |
226 | buf, I2400MU_MAX_NOTIFICATION_LEN, | 217 | buf, I2400MU_MAX_NOTIFICATION_LEN, |