diff options
Diffstat (limited to 'drivers/usb/atm')
-rw-r--r-- | drivers/usb/atm/cxacru.c | 14 | ||||
-rw-r--r-- | drivers/usb/atm/ueagle-atm.c | 12 | ||||
-rw-r--r-- | drivers/usb/atm/usbatm.c | 27 | ||||
-rw-r--r-- | drivers/usb/atm/usbatm.h | 3 |
4 files changed, 30 insertions, 26 deletions
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index a51eeedc18d..5ea3093bc40 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c @@ -38,6 +38,7 @@ #include <linux/device.h> #include <linux/firmware.h> #include <linux/mutex.h> +#include <asm/unaligned.h> #include "usbatm.h" @@ -444,7 +445,7 @@ CXACRU_ALL_FILES(INIT); /* the following three functions are stolen from drivers/usb/core/message.c */ static void cxacru_blocking_completion(struct urb *urb) { - complete((struct completion *)urb->context); + complete(urb->context); } static void cxacru_timeout_kill(unsigned long data) @@ -573,7 +574,7 @@ static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_requ u32 *data, int size) { int ret, len; - u32 *buf; + __le32 *buf; int offb, offd; const int stride = CMD_PACKET_SIZE / (4 * 2) - 1; int buflen = ((size - 1) / stride + 1 + size * 2) * 4; @@ -837,7 +838,7 @@ static int cxacru_fw(struct usb_device *usb_dev, enum cxacru_fw_request fw, buf[offb++] = l; buf[offb++] = code1; buf[offb++] = code2; - *((u32 *) (buf + offb)) = cpu_to_le32(addr); + put_unaligned(cpu_to_le32(addr), (__le32 *)(buf + offb)); offb += 4; addr += l; if(l) @@ -874,8 +875,9 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, int off; struct usbatm_data *usbatm = instance->usbatm; struct usb_device *usb_dev = usbatm->usb_dev; - u16 signature[] = { usb_dev->descriptor.idVendor, usb_dev->descriptor.idProduct }; - u32 val; + __le16 signature[] = { usb_dev->descriptor.idVendor, + usb_dev->descriptor.idProduct }; + __le32 val; dbg("cxacru_upload_firmware"); @@ -955,7 +957,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, /* Load config data (le32), doing one packet at a time */ if (cf) for (off = 0; off < cf->size / 4; ) { - u32 buf[CMD_PACKET_SIZE / 4 - 1]; + __le32 buf[CMD_PACKET_SIZE / 4 - 1]; int i, len = min_t(int, cf->size / 4 - off, CMD_PACKET_SIZE / 4 / 2 - 1); buf[0] = cpu_to_le32(len); for (i = 0; i < len; i++, off++) { diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index c5ec1a55eee..4220f22b666 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c @@ -83,7 +83,7 @@ if (debug >= 1) \ dev_dbg(&(usb_dev)->dev, \ "[ueagle-atm dbg] %s: " format, \ - __FUNCTION__, ##args); \ + __func__, ##args); \ } while (0) #define uea_vdbg(usb_dev, format, args...) \ @@ -94,10 +94,10 @@ } while (0) #define uea_enters(usb_dev) \ - uea_vdbg(usb_dev, "entering %s\n", __FUNCTION__) + uea_vdbg(usb_dev, "entering %s\n", __func__) #define uea_leaves(usb_dev) \ - uea_vdbg(usb_dev, "leaving %s\n", __FUNCTION__) + uea_vdbg(usb_dev, "leaving %s\n", __func__) #define uea_err(usb_dev, format,args...) \ dev_err(&(usb_dev)->dev ,"[UEAGLE-ATM] " format , ##args) @@ -996,7 +996,7 @@ static void __uea_load_page_e4(struct uea_softc *sc, u8 pageno, int boot) blockoffset = sc->dsp_firm->data + le32_to_cpu(blockidx->PageOffset); bi.dwSize = cpu_to_be32(blocksize); - bi.dwAddress = swab32(blockidx->PageAddress); + bi.dwAddress = cpu_to_be32(le32_to_cpu(blockidx->PageAddress)); uea_dbg(INS_TO_USBDEV(sc), "sending block %u for DSP page %u size %u address %x\n", @@ -1040,7 +1040,7 @@ static void uea_load_page_e4(struct work_struct *work) return; p = (struct l1_code *) sc->dsp_firm->data; - if (pageno >= p->page_header[0].PageNumber) { + if (pageno >= le16_to_cpu(p->page_header[0].PageNumber)) { uea_err(INS_TO_USBDEV(sc), "invalid DSP page %u requested\n", pageno); return; } @@ -1065,7 +1065,7 @@ static void uea_load_page_e4(struct work_struct *work) bi.bPageNumber = 0xff; bi.wReserved = cpu_to_be16(UEA_RESERVED); bi.dwSize = cpu_to_be32(E4_PAGE_BYTES(p->page_header[0].PageSize)); - bi.dwAddress = swab32(p->page_header[0].PageAddress); + bi.dwAddress = cpu_to_be32(le32_to_cpu(p->page_header[0].PageAddress)); /* send block info through the IDMA pipe */ if (uea_idma_write(sc, &bi, E4_BLOCK_INFO_SIZE)) diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index e717f5b1cae..07228721caf 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c @@ -80,6 +80,7 @@ #include <linux/stat.h> #include <linux/timer.h> #include <linux/wait.h> +#include <linux/kthread.h> #ifdef VERBOSE_DEBUG static int usbatm_print_packet(const unsigned char *data, int len); @@ -1014,10 +1015,7 @@ static int usbatm_do_heavy_init(void *arg) struct usbatm_data *instance = arg; int ret; - daemonize(instance->driver->driver_name); allow_signal(SIGTERM); - instance->thread_pid = current->pid; - complete(&instance->thread_started); ret = instance->driver->heavy_init(instance, instance->usb_intf); @@ -1026,7 +1024,7 @@ static int usbatm_do_heavy_init(void *arg) ret = usbatm_atm_init(instance); mutex_lock(&instance->serialize); - instance->thread_pid = -1; + instance->thread = NULL; mutex_unlock(&instance->serialize); complete_and_exit(&instance->thread_exited, ret); @@ -1034,13 +1032,18 @@ static int usbatm_do_heavy_init(void *arg) static int usbatm_heavy_init(struct usbatm_data *instance) { - int ret = kernel_thread(usbatm_do_heavy_init, instance, CLONE_FS | CLONE_FILES); - - if (ret < 0) { - usb_err(instance, "%s: failed to create kernel_thread (%d)!\n", __func__, ret); - return ret; + struct task_struct *t; + + t = kthread_create(usbatm_do_heavy_init, instance, + instance->driver->driver_name); + if (IS_ERR(t)) { + usb_err(instance, "%s: failed to create kernel_thread (%ld)!\n", + __func__, PTR_ERR(t)); + return PTR_ERR(t); } + instance->thread = t; + wake_up_process(t); wait_for_completion(&instance->thread_started); return 0; @@ -1124,7 +1127,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, kref_init(&instance->refcount); /* dropped in usbatm_usb_disconnect */ mutex_init(&instance->serialize); - instance->thread_pid = -1; + instance->thread = NULL; init_completion(&instance->thread_started); init_completion(&instance->thread_exited); @@ -1287,8 +1290,8 @@ void usbatm_usb_disconnect(struct usb_interface *intf) mutex_lock(&instance->serialize); instance->disconnected = 1; - if (instance->thread_pid >= 0) - kill_proc(instance->thread_pid, SIGTERM, 1); + if (instance->thread != NULL) + send_sig(SIGTERM, instance->thread, 1); mutex_unlock(&instance->serialize); wait_for_completion(&instance->thread_exited); diff --git a/drivers/usb/atm/usbatm.h b/drivers/usb/atm/usbatm.h index ff8551e9337..e6887c6cf3c 100644 --- a/drivers/usb/atm/usbatm.h +++ b/drivers/usb/atm/usbatm.h @@ -24,7 +24,6 @@ #ifndef _USBATM_H_ #define _USBATM_H_ -#include <asm/semaphore.h> #include <linux/atm.h> #include <linux/atmdev.h> #include <linux/completion.h> @@ -176,7 +175,7 @@ struct usbatm_data { int disconnected; /* heavy init */ - int thread_pid; + struct task_struct *thread; struct completion thread_started; struct completion thread_exited; |