aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/atm/usbatm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/atm/usbatm.c')
-rw-r--r--drivers/usb/atm/usbatm.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index ec63b0ee0743..b3f779f5933a 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -274,6 +274,9 @@ static void usbatm_complete(struct urb *urb)
274 (!(channel->usbatm->flags & UDSL_IGNORE_EILSEQ) || 274 (!(channel->usbatm->flags & UDSL_IGNORE_EILSEQ) ||
275 urb->status != -EILSEQ )) 275 urb->status != -EILSEQ ))
276 { 276 {
277 if (urb->status == -ESHUTDOWN)
278 return;
279
277 if (printk_ratelimit()) 280 if (printk_ratelimit())
278 atm_warn(channel->usbatm, "%s: urb 0x%p failed (%d)!\n", 281 atm_warn(channel->usbatm, "%s: urb 0x%p failed (%d)!\n",
279 __func__, urb, urb->status); 282 __func__, urb, urb->status);
@@ -343,7 +346,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char
343 UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end); 346 UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end);
344 } 347 }
345 348
346 memcpy(sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); 349 memcpy(skb_tail_pointer(sarb), source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD);
347 __skb_put(sarb, ATM_CELL_PAYLOAD); 350 __skb_put(sarb, ATM_CELL_PAYLOAD);
348 351
349 if (pti & 1) { 352 if (pti & 1) {
@@ -370,7 +373,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char
370 goto out; 373 goto out;
371 } 374 }
372 375
373 if (crc32_be(~0, sarb->tail - pdu_length, pdu_length) != 0xc704dd7b) { 376 if (crc32_be(~0, skb_tail_pointer(sarb) - pdu_length, pdu_length) != 0xc704dd7b) {
374 atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", 377 atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n",
375 __func__, vcc); 378 __func__, vcc);
376 atomic_inc(&vcc->stats->rx_err); 379 atomic_inc(&vcc->stats->rx_err);
@@ -396,7 +399,9 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char
396 goto out; /* atm_charge increments rx_drop */ 399 goto out; /* atm_charge increments rx_drop */
397 } 400 }
398 401
399 memcpy(skb->data, sarb->tail - pdu_length, length); 402 skb_copy_to_linear_data(skb,
403 skb_tail_pointer(sarb) - pdu_length,
404 length);
400 __skb_put(skb, length); 405 __skb_put(skb, length);
401 406
402 vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", 407 vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u",
@@ -484,7 +489,7 @@ static unsigned int usbatm_write_cells(struct usbatm_data *instance,
484 ptr[4] = 0xec; 489 ptr[4] = 0xec;
485 ptr += ATM_CELL_HEADER; 490 ptr += ATM_CELL_HEADER;
486 491
487 memcpy(ptr, skb->data, data_len); 492 skb_copy_from_linear_data(skb, ptr, data_len);
488 ptr += data_len; 493 ptr += data_len;
489 __skb_pull(skb, data_len); 494 __skb_pull(skb, data_len);
490 495
@@ -966,6 +971,14 @@ static int usbatm_atm_init(struct usbatm_data *instance)
966 /* temp init ATM device, set to 128kbit */ 971 /* temp init ATM device, set to 128kbit */
967 atm_dev->link_rate = 128 * 1000 / 424; 972 atm_dev->link_rate = 128 * 1000 / 424;
968 973
974 ret = sysfs_create_link(&atm_dev->class_dev.kobj,
975 &instance->usb_intf->dev.kobj, "device");
976 if (ret) {
977 atm_err(instance, "%s: sysfs_create_link failed: %d\n",
978 __func__, ret);
979 goto fail_sysfs;
980 }
981
969 if (instance->driver->atm_start && ((ret = instance->driver->atm_start(instance, atm_dev)) < 0)) { 982 if (instance->driver->atm_start && ((ret = instance->driver->atm_start(instance, atm_dev)) < 0)) {
970 atm_err(instance, "%s: atm_start failed: %d!\n", __func__, ret); 983 atm_err(instance, "%s: atm_start failed: %d!\n", __func__, ret);
971 goto fail; 984 goto fail;
@@ -984,6 +997,8 @@ static int usbatm_atm_init(struct usbatm_data *instance)
984 return 0; 997 return 0;
985 998
986 fail: 999 fail:
1000 sysfs_remove_link(&atm_dev->class_dev.kobj, "device");
1001 fail_sysfs:
987 instance->atm_dev = NULL; 1002 instance->atm_dev = NULL;
988 atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be called */ 1003 atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be called */
989 return ret; 1004 return ret;
@@ -1316,8 +1331,10 @@ void usbatm_usb_disconnect(struct usb_interface *intf)
1316 kfree(instance->cell_buf); 1331 kfree(instance->cell_buf);
1317 1332
1318 /* ATM finalize */ 1333 /* ATM finalize */
1319 if (instance->atm_dev) 1334 if (instance->atm_dev) {
1335 sysfs_remove_link(&instance->atm_dev->class_dev.kobj, "device");
1320 atm_dev_deregister(instance->atm_dev); 1336 atm_dev_deregister(instance->atm_dev);
1337 }
1321 1338
1322 usbatm_put_instance(instance); /* taken in usbatm_usb_probe */ 1339 usbatm_put_instance(instance); /* taken in usbatm_usb_probe */
1323} 1340}