diff options
Diffstat (limited to 'drivers/usb/atm/ueagle-atm.c')
-rw-r--r-- | drivers/usb/atm/ueagle-atm.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index f6b9f7e1f716..dae4ef1e8fe5 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
@@ -64,6 +64,8 @@ | |||
64 | #include <linux/kthread.h> | 64 | #include <linux/kthread.h> |
65 | #include <linux/version.h> | 65 | #include <linux/version.h> |
66 | #include <linux/mutex.h> | 66 | #include <linux/mutex.h> |
67 | #include <linux/freezer.h> | ||
68 | |||
67 | #include <asm/unaligned.h> | 69 | #include <asm/unaligned.h> |
68 | 70 | ||
69 | #include "usbatm.h" | 71 | #include "usbatm.h" |
@@ -401,9 +403,8 @@ static int uea_send_modem_cmd(struct usb_device *usb, | |||
401 | int ret = -ENOMEM; | 403 | int ret = -ENOMEM; |
402 | u8 *xfer_buff; | 404 | u8 *xfer_buff; |
403 | 405 | ||
404 | xfer_buff = kmalloc(size, GFP_KERNEL); | 406 | xfer_buff = kmemdup(buff, size, GFP_KERNEL); |
405 | if (xfer_buff) { | 407 | if (xfer_buff) { |
406 | memcpy(xfer_buff, buff, size); | ||
407 | ret = usb_control_msg(usb, | 408 | ret = usb_control_msg(usb, |
408 | usb_sndctrlpipe(usb, 0), | 409 | usb_sndctrlpipe(usb, 0), |
409 | LOAD_INTERNAL, | 410 | LOAD_INTERNAL, |
@@ -595,14 +596,12 @@ static int uea_idma_write(struct uea_softc *sc, void *data, u32 size) | |||
595 | u8 *xfer_buff; | 596 | u8 *xfer_buff; |
596 | int bytes_read; | 597 | int bytes_read; |
597 | 598 | ||
598 | xfer_buff = kmalloc(size, GFP_KERNEL); | 599 | xfer_buff = kmemdup(data, size, GFP_KERNEL); |
599 | if (!xfer_buff) { | 600 | if (!xfer_buff) { |
600 | uea_err(INS_TO_USBDEV(sc), "can't allocate xfer_buff\n"); | 601 | uea_err(INS_TO_USBDEV(sc), "can't allocate xfer_buff\n"); |
601 | return ret; | 602 | return ret; |
602 | } | 603 | } |
603 | 604 | ||
604 | memcpy(xfer_buff, data, size); | ||
605 | |||
606 | ret = usb_bulk_msg(sc->usb_dev, | 605 | ret = usb_bulk_msg(sc->usb_dev, |
607 | usb_sndbulkpipe(sc->usb_dev, UEA_IDMA_PIPE), | 606 | usb_sndbulkpipe(sc->usb_dev, UEA_IDMA_PIPE), |
608 | xfer_buff, size, &bytes_read, BULK_TIMEOUT); | 607 | xfer_buff, size, &bytes_read, BULK_TIMEOUT); |
@@ -658,9 +657,9 @@ static int request_dsp(struct uea_softc *sc) | |||
658 | /* | 657 | /* |
659 | * The uea_load_page() function must be called within a process context | 658 | * The uea_load_page() function must be called within a process context |
660 | */ | 659 | */ |
661 | static void uea_load_page(void *xsc) | 660 | static void uea_load_page(struct work_struct *work) |
662 | { | 661 | { |
663 | struct uea_softc *sc = xsc; | 662 | struct uea_softc *sc = container_of(work, struct uea_softc, task); |
664 | u16 pageno = sc->pageno; | 663 | u16 pageno = sc->pageno; |
665 | u16 ovl = sc->ovl; | 664 | u16 ovl = sc->ovl; |
666 | struct block_info bi; | 665 | struct block_info bi; |
@@ -765,12 +764,11 @@ static int uea_request(struct uea_softc *sc, | |||
765 | u8 *xfer_buff; | 764 | u8 *xfer_buff; |
766 | int ret = -ENOMEM; | 765 | int ret = -ENOMEM; |
767 | 766 | ||
768 | xfer_buff = kmalloc(size, GFP_KERNEL); | 767 | xfer_buff = kmemdup(data, size, GFP_KERNEL); |
769 | if (!xfer_buff) { | 768 | if (!xfer_buff) { |
770 | uea_err(INS_TO_USBDEV(sc), "can't allocate xfer_buff\n"); | 769 | uea_err(INS_TO_USBDEV(sc), "can't allocate xfer_buff\n"); |
771 | return ret; | 770 | return ret; |
772 | } | 771 | } |
773 | memcpy(xfer_buff, data, size); | ||
774 | 772 | ||
775 | ret = usb_control_msg(sc->usb_dev, usb_sndctrlpipe(sc->usb_dev, 0), | 773 | ret = usb_control_msg(sc->usb_dev, usb_sndctrlpipe(sc->usb_dev, 0), |
776 | UCDC_SEND_ENCAPSULATED_COMMAND, | 774 | UCDC_SEND_ENCAPSULATED_COMMAND, |
@@ -1352,7 +1350,7 @@ static int uea_boot(struct uea_softc *sc) | |||
1352 | 1350 | ||
1353 | uea_enters(INS_TO_USBDEV(sc)); | 1351 | uea_enters(INS_TO_USBDEV(sc)); |
1354 | 1352 | ||
1355 | INIT_WORK(&sc->task, uea_load_page, sc); | 1353 | INIT_WORK(&sc->task, uea_load_page); |
1356 | init_waitqueue_head(&sc->sync_q); | 1354 | init_waitqueue_head(&sc->sync_q); |
1357 | init_waitqueue_head(&sc->cmv_ack_wait); | 1355 | init_waitqueue_head(&sc->cmv_ack_wait); |
1358 | 1356 | ||