diff options
Diffstat (limited to 'drivers/usb/atm/ueagle-atm.c')
-rw-r--r-- | drivers/usb/atm/ueagle-atm.c | 348 |
1 files changed, 208 insertions, 140 deletions
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index c5395246886d..e213d3fa4920 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c @@ -66,6 +66,7 @@ #include <linux/kthread.h> #include <linux/mutex.h> #include <linux/freezer.h> +#include <linux/slab.h> #include <asm/unaligned.h> @@ -93,19 +94,19 @@ } while (0) #define uea_enters(usb_dev) \ - uea_vdbg(usb_dev, "entering %s\n", __func__) + uea_vdbg(usb_dev, "entering %s\n" , __func__) #define uea_leaves(usb_dev) \ - uea_vdbg(usb_dev, "leaving %s\n", __func__) + uea_vdbg(usb_dev, "leaving %s\n" , __func__) -#define uea_err(usb_dev, format,args...) \ - dev_err(&(usb_dev)->dev ,"[UEAGLE-ATM] " format , ##args) +#define uea_err(usb_dev, format, args...) \ + dev_err(&(usb_dev)->dev , "[UEAGLE-ATM] " format , ##args) -#define uea_warn(usb_dev, format,args...) \ - dev_warn(&(usb_dev)->dev ,"[Ueagle-atm] " format, ##args) +#define uea_warn(usb_dev, format, args...) \ + dev_warn(&(usb_dev)->dev , "[Ueagle-atm] " format, ##args) -#define uea_info(usb_dev, format,args...) \ - dev_info(&(usb_dev)->dev ,"[ueagle-atm] " format, ##args) +#define uea_info(usb_dev, format, args...) \ + dev_info(&(usb_dev)->dev , "[ueagle-atm] " format, ##args) struct intr_pkt; @@ -288,7 +289,7 @@ enum { #define IS_ISDN(x) \ ((x)->annex & ANNEXB) -#define INS_TO_USBDEV(ins) ins->usb_dev +#define INS_TO_USBDEV(ins) (ins->usb_dev) #define GET_STATUS(data) \ ((data >> 8) & 0xf) @@ -303,7 +304,7 @@ enum { * The FW_GET_BYTE() macro is provided only for consistency. */ -#define FW_GET_BYTE(p) *((__u8 *) (p)) +#define FW_GET_BYTE(p) (*((__u8 *) (p))) #define FW_DIR "ueagle-atm/" #define UEA_FW_NAME_MAX 30 @@ -314,7 +315,7 @@ enum { #define ACK_TIMEOUT msecs_to_jiffies(3000) -#define UEA_INTR_IFACE_NO 0 +#define UEA_INTR_IFACE_NO 0 #define UEA_US_IFACE_NO 1 #define UEA_DS_IFACE_NO 2 @@ -325,9 +326,9 @@ enum { #define UEA_INTR_PIPE 0x04 #define UEA_ISO_DATA_PIPE 0x08 -#define UEA_E1_SET_BLOCK 0x0001 +#define UEA_E1_SET_BLOCK 0x0001 #define UEA_E4_SET_BLOCK 0x002c -#define UEA_SET_MODE 0x0003 +#define UEA_SET_MODE 0x0003 #define UEA_SET_2183_DATA 0x0004 #define UEA_SET_TIMEOUT 0x0011 @@ -365,7 +366,7 @@ struct l1_code { u8 string_header[E4_L1_STRING_HEADER]; u8 page_number_to_block_index[E4_MAX_PAGE_NUMBER]; struct block_index page_header[E4_NO_SWAPPAGE_HEADERS]; - u8 code [0]; + u8 code[0]; } __attribute__ ((packed)); /* structures describing a block within a DSP page */ @@ -427,7 +428,8 @@ struct block_info_e4 { #define E4_MODEMREADY 0x1 #define E1_MAKEFUNCTION(t, s) (((t) & 0xf) << 4 | ((s) & 0xf)) -#define E4_MAKEFUNCTION(t, st, s) (((t) & 0xf) << 8 | ((st) & 0xf) << 4 | ((s) & 0xf)) +#define E4_MAKEFUNCTION(t, st, s) (((t) & 0xf) << 8 | \ + ((st) & 0xf) << 4 | ((s) & 0xf)) #define E1_MAKESA(a, b, c, d) \ (((c) & 0xff) << 24 | \ @@ -472,7 +474,7 @@ struct cmv_e4 { __be16 wFunction; __be16 wOffset; __be16 wAddress; - __be32 dwData [6]; + __be32 dwData[6]; } __attribute__ ((packed)); /* structures representing swap information */ @@ -533,11 +535,13 @@ struct intr_pkt { static struct usb_driver uea_driver; static DEFINE_MUTEX(uea_mutex); -static const char *chip_name[] = {"ADI930", "Eagle I", "Eagle II", "Eagle III", "Eagle IV"}; +static const char *chip_name[] = {"ADI930", "Eagle I", "Eagle II", "Eagle III", + "Eagle IV"}; static int modem_index; static unsigned int debug; -static unsigned int altsetting[NB_MODEM] = {[0 ... (NB_MODEM - 1)] = FASTEST_ISO_INTF}; +static unsigned int altsetting[NB_MODEM] = { + [0 ... (NB_MODEM - 1)] = FASTEST_ISO_INTF}; static int sync_wait[NB_MODEM]; static char *cmv_file[NB_MODEM]; static int annex[NB_MODEM]; @@ -554,7 +558,7 @@ MODULE_PARM_DESC(cmv_file, "file name with configuration and management variables"); module_param_array(annex, uint, NULL, 0644); MODULE_PARM_DESC(annex, - "manually set annex a/b (0=auto, 1=annex a, 2=annex b)"); + "manually set annex a/b (0=auto, 1=annex a, 2=annex b)"); #define uea_wait(sc, cond, timeo) \ ({ \ @@ -601,7 +605,8 @@ static int uea_send_modem_cmd(struct usb_device *usb, return (ret == size) ? 0 : -EIO; } -static void uea_upload_pre_firmware(const struct firmware *fw_entry, void *context) +static void uea_upload_pre_firmware(const struct firmware *fw_entry, + void *context) { struct usb_device *usb = context; const u8 *pfw; @@ -706,7 +711,8 @@ static int uea_load_firmware(struct usb_device *usb, unsigned int ver) } ret = request_firmware_nowait(THIS_MODULE, 1, fw_name, &usb->dev, - GFP_KERNEL, usb, uea_upload_pre_firmware); + GFP_KERNEL, usb, + uea_upload_pre_firmware); if (ret) uea_err(usb, "firmware %s is not available\n", fw_name); else @@ -875,7 +881,7 @@ static int request_dsp(struct uea_softc *sc) if (ret < 0) { uea_err(INS_TO_USBDEV(sc), "requesting firmware %s failed with error %d\n", - dsp_name, ret); + dsp_name, ret); return ret; } @@ -993,14 +999,17 @@ static void __uea_load_page_e4(struct uea_softc *sc, u8 pageno, int boot) blockidx = &p->page_header[blockno]; blocksize = E4_PAGE_BYTES(blockidx->PageSize); - blockoffset = sc->dsp_firm->data + le32_to_cpu(blockidx->PageOffset); + blockoffset = sc->dsp_firm->data + le32_to_cpu( + blockidx->PageOffset); bi.dwSize = cpu_to_be32(blocksize); 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", - blockno, pageno, blocksize, le32_to_cpu(blockidx->PageAddress)); + "sending block %u for DSP page " + "%u size %u address %x\n", + blockno, pageno, blocksize, + le32_to_cpu(blockidx->PageAddress)); /* send block info through the IDMA pipe */ if (uea_idma_write(sc, &bi, E4_BLOCK_INFO_SIZE)) @@ -1041,7 +1050,8 @@ static void uea_load_page_e4(struct work_struct *work) p = (struct l1_code *) sc->dsp_firm->data; if (pageno >= le16_to_cpu(p->page_header[0].PageNumber)) { - uea_err(INS_TO_USBDEV(sc), "invalid DSP page %u requested\n", pageno); + uea_err(INS_TO_USBDEV(sc), "invalid DSP " + "page %u requested\n", pageno); return; } @@ -1058,7 +1068,7 @@ static void uea_load_page_e4(struct work_struct *work) __uea_load_page_e4(sc, i, 1); } - uea_dbg(INS_TO_USBDEV(sc),"sending start bi\n"); + uea_dbg(INS_TO_USBDEV(sc) , "sending start bi\n"); bi.wHdr = cpu_to_be16(UEA_BIHDR); bi.bBootPage = 0; @@ -1138,8 +1148,10 @@ static int uea_cmv_e1(struct uea_softc *sc, uea_enters(INS_TO_USBDEV(sc)); uea_vdbg(INS_TO_USBDEV(sc), "Function : %d-%d, Address : %c%c%c%c, " "offset : 0x%04x, data : 0x%08x\n", - E1_FUNCTION_TYPE(function), E1_FUNCTION_SUBTYPE(function), - E1_GETSA1(address), E1_GETSA2(address), E1_GETSA3(address), + E1_FUNCTION_TYPE(function), + E1_FUNCTION_SUBTYPE(function), + E1_GETSA1(address), E1_GETSA2(address), + E1_GETSA3(address), E1_GETSA4(address), offset, data); /* we send a request, but we expect a reply */ @@ -1156,7 +1168,8 @@ static int uea_cmv_e1(struct uea_softc *sc, cmv.wOffsetAddress = cpu_to_le16(offset); put_unaligned_le32(data >> 16 | data << 16, &cmv.dwData); - ret = uea_request(sc, UEA_E1_SET_BLOCK, UEA_MPTX_START, sizeof(cmv), &cmv); + ret = uea_request(sc, UEA_E1_SET_BLOCK, UEA_MPTX_START, + sizeof(cmv), &cmv); if (ret < 0) return ret; ret = wait_cmv_ack(sc); @@ -1190,7 +1203,8 @@ static int uea_cmv_e4(struct uea_softc *sc, cmv.wOffset = cpu_to_be16(offset); cmv.dwData[0] = cpu_to_be32(data); - ret = uea_request(sc, UEA_E4_SET_BLOCK, UEA_MPTX_START, sizeof(cmv), &cmv); + ret = uea_request(sc, UEA_E4_SET_BLOCK, UEA_MPTX_START, + sizeof(cmv), &cmv); if (ret < 0) return ret; ret = wait_cmv_ack(sc); @@ -1207,7 +1221,7 @@ static inline int uea_read_cmv_e1(struct uea_softc *sc, uea_err(INS_TO_USBDEV(sc), "reading cmv failed with error %d\n", ret); else - *data = sc->data; + *data = sc->data; return ret; } @@ -1215,13 +1229,14 @@ static inline int uea_read_cmv_e1(struct uea_softc *sc, static inline int uea_read_cmv_e4(struct uea_softc *sc, u8 size, u16 group, u16 address, u16 offset, u32 *data) { - int ret = uea_cmv_e4(sc, E4_MAKEFUNCTION(E4_MEMACCESS, E4_REQUESTREAD, size), + int ret = uea_cmv_e4(sc, E4_MAKEFUNCTION(E4_MEMACCESS, + E4_REQUESTREAD, size), group, address, offset, 0); if (ret < 0) uea_err(INS_TO_USBDEV(sc), "reading cmv failed with error %d\n", ret); else { - *data = sc->data; + *data = sc->data; /* size is in 16-bit word quantities */ if (size > 2) *(data + 1) = sc->data1; @@ -1244,7 +1259,8 @@ static inline int uea_write_cmv_e1(struct uea_softc *sc, static inline int uea_write_cmv_e4(struct uea_softc *sc, u8 size, u16 group, u16 address, u16 offset, u32 data) { - int ret = uea_cmv_e4(sc, E4_MAKEFUNCTION(E4_MEMACCESS, E4_REQUESTWRITE, size), + int ret = uea_cmv_e4(sc, E4_MAKEFUNCTION(E4_MEMACCESS, + E4_REQUESTWRITE, size), group, address, offset, data); if (ret < 0) uea_err(INS_TO_USBDEV(sc), @@ -1441,27 +1457,29 @@ static int uea_stat_e4(struct uea_softc *sc) return ret; switch (sc->stats.phy.state) { - case 0x0: /* not yet synchronized */ - case 0x1: - case 0x3: - case 0x4: - uea_dbg(INS_TO_USBDEV(sc), "modem not yet synchronized\n"); - return 0; - case 0x5: /* initialization */ - case 0x6: - case 0x9: - case 0xa: - uea_dbg(INS_TO_USBDEV(sc), "modem initializing\n"); - return 0; - case 0x2: /* fail ... */ - uea_info(INS_TO_USBDEV(sc), "modem synchronization failed" - " (may be try other cmv/dsp)\n"); - return -EAGAIN; - case 0x7: /* operational */ - break; - default: - uea_warn(INS_TO_USBDEV(sc), "unknown state: %x\n", sc->stats.phy.state); - return 0; + case 0x0: /* not yet synchronized */ + case 0x1: + case 0x3: + case 0x4: + uea_dbg(INS_TO_USBDEV(sc), "modem not yet " + "synchronized\n"); + return 0; + case 0x5: /* initialization */ + case 0x6: + case 0x9: + case 0xa: + uea_dbg(INS_TO_USBDEV(sc), "modem initializing\n"); + return 0; + case 0x2: /* fail ... */ + uea_info(INS_TO_USBDEV(sc), "modem synchronization " + "failed (may be try other cmv/dsp)\n"); + return -EAGAIN; + case 0x7: /* operational */ + break; + default: + uea_warn(INS_TO_USBDEV(sc), "unknown state: %x\n", + sc->stats.phy.state); + return 0; } if (data != 7) { @@ -1501,9 +1519,9 @@ static int uea_stat_e4(struct uea_softc *sc) if (sc->stats.phy.flags) { uea_dbg(INS_TO_USBDEV(sc), "Stat flag = 0x%x\n", sc->stats.phy.flags); - if (sc->stats.phy.flags & 1) //delineation LOSS + if (sc->stats.phy.flags & 1) /* delineation LOSS */ return -EAGAIN; - if (sc->stats.phy.flags & 0x4000) //Reset Flag + if (sc->stats.phy.flags & 0x4000) /* Reset Flag */ return -EAGAIN; return 0; } @@ -1617,7 +1635,8 @@ static int request_cmvs(struct uea_softc *sc, if (ret < 0) { /* if caller can handle old version, try to provide it */ if (*ver == 1) { - uea_warn(INS_TO_USBDEV(sc), "requesting firmware %s failed, " + uea_warn(INS_TO_USBDEV(sc), "requesting " + "firmware %s failed, " "try to get older cmvs\n", cmv_name); return request_cmvs_old(sc, cmvs, fw); } @@ -1631,8 +1650,8 @@ static int request_cmvs(struct uea_softc *sc, data = (u8 *) (*fw)->data; if (size < 4 || strncmp(data, "cmv2", 4) != 0) { if (*ver == 1) { - uea_warn(INS_TO_USBDEV(sc), "firmware %s is corrupted, " - "try to get older cmvs\n", cmv_name); + uea_warn(INS_TO_USBDEV(sc), "firmware %s is corrupted," + " try to get older cmvs\n", cmv_name); release_firmware(*fw); return request_cmvs_old(sc, cmvs, fw); } @@ -1669,7 +1688,7 @@ static int uea_send_cmvs_e1(struct uea_softc *sc) int i, ret, len; void *cmvs_ptr; const struct firmware *cmvs_fw; - int ver = 1; // we can handle v1 cmv firmware version; + int ver = 1; /* we can handle v1 cmv firmware version; */ /* Enter in R-IDLE (cmv) until instructed otherwise */ ret = uea_write_cmv_e1(sc, E1_SA_CNTL, 0, 1); @@ -1684,7 +1703,7 @@ static int uea_send_cmvs_e1(struct uea_softc *sc) sc->stats.phy.firmid); /* get options */ - ret = len = request_cmvs(sc, &cmvs_ptr, &cmvs_fw, &ver); + ret = len = request_cmvs(sc, &cmvs_ptr, &cmvs_fw, &ver); if (ret < 0) return ret; @@ -1696,9 +1715,10 @@ static int uea_send_cmvs_e1(struct uea_softc *sc) "please update your firmware\n"); for (i = 0; i < len; i++) { - ret = uea_write_cmv_e1(sc, get_unaligned_le32(&cmvs_v1[i].address), - get_unaligned_le16(&cmvs_v1[i].offset), - get_unaligned_le32(&cmvs_v1[i].data)); + ret = uea_write_cmv_e1(sc, + get_unaligned_le32(&cmvs_v1[i].address), + get_unaligned_le16(&cmvs_v1[i].offset), + get_unaligned_le32(&cmvs_v1[i].data)); if (ret < 0) goto out; } @@ -1706,9 +1726,10 @@ static int uea_send_cmvs_e1(struct uea_softc *sc) struct uea_cmvs_v2 *cmvs_v2 = cmvs_ptr; for (i = 0; i < len; i++) { - ret = uea_write_cmv_e1(sc, get_unaligned_le32(&cmvs_v2[i].address), - (u16) get_unaligned_le32(&cmvs_v2[i].offset), - get_unaligned_le32(&cmvs_v2[i].data)); + ret = uea_write_cmv_e1(sc, + get_unaligned_le32(&cmvs_v2[i].address), + (u16) get_unaligned_le32(&cmvs_v2[i].offset), + get_unaligned_le32(&cmvs_v2[i].data)); if (ret < 0) goto out; } @@ -1721,7 +1742,8 @@ static int uea_send_cmvs_e1(struct uea_softc *sc) /* Enter in R-ACT-REQ */ ret = uea_write_cmv_e1(sc, E1_SA_CNTL, 0, 2); uea_vdbg(INS_TO_USBDEV(sc), "Entering in R-ACT-REQ state\n"); - uea_info(INS_TO_USBDEV(sc), "modem started, waiting synchronization...\n"); + uea_info(INS_TO_USBDEV(sc), "modem started, waiting " + "synchronization...\n"); out: release_firmware(cmvs_fw); return ret; @@ -1732,7 +1754,7 @@ static int uea_send_cmvs_e4(struct uea_softc *sc) int i, ret, len; void *cmvs_ptr; const struct firmware *cmvs_fw; - int ver = 2; // we can only handle v2 cmv firmware version; + int ver = 2; /* we can only handle v2 cmv firmware version; */ /* Enter in R-IDLE (cmv) until instructed otherwise */ ret = uea_write_cmv_e4(sc, 1, E4_SA_CNTL, 0, 0, 1); @@ -1749,7 +1771,7 @@ static int uea_send_cmvs_e4(struct uea_softc *sc) /* get options */ - ret = len = request_cmvs(sc, &cmvs_ptr, &cmvs_fw, &ver); + ret = len = request_cmvs(sc, &cmvs_ptr, &cmvs_fw, &ver); if (ret < 0) return ret; @@ -1759,10 +1781,10 @@ static int uea_send_cmvs_e4(struct uea_softc *sc) for (i = 0; i < len; i++) { ret = uea_write_cmv_e4(sc, 1, - get_unaligned_le32(&cmvs_v2[i].group), - get_unaligned_le32(&cmvs_v2[i].address), - get_unaligned_le32(&cmvs_v2[i].offset), - get_unaligned_le32(&cmvs_v2[i].data)); + get_unaligned_le32(&cmvs_v2[i].group), + get_unaligned_le32(&cmvs_v2[i].address), + get_unaligned_le32(&cmvs_v2[i].offset), + get_unaligned_le32(&cmvs_v2[i].data)); if (ret < 0) goto out; } @@ -1775,7 +1797,8 @@ static int uea_send_cmvs_e4(struct uea_softc *sc) /* Enter in R-ACT-REQ */ ret = uea_write_cmv_e4(sc, 1, E4_SA_CNTL, 0, 0, 2); uea_vdbg(INS_TO_USBDEV(sc), "Entering in R-ACT-REQ state\n"); - uea_info(INS_TO_USBDEV(sc), "modem started, waiting synchronization...\n"); + uea_info(INS_TO_USBDEV(sc), "modem started, waiting " + "synchronization...\n"); out: release_firmware(cmvs_fw); return ret; @@ -1811,7 +1834,7 @@ static int uea_start_reset(struct uea_softc *sc) uea_request(sc, UEA_SET_MODE, UEA_LOOPBACK_ON, 0, NULL); uea_request(sc, UEA_SET_MODE, UEA_BOOT_IDMA, 0, NULL); - /* enter reset mode */ + /* enter reset mode */ uea_request(sc, UEA_SET_MODE, UEA_START_RESET, 0, NULL); /* original driver use 200ms, but windows driver use 100ms */ @@ -1823,7 +1846,7 @@ static int uea_start_reset(struct uea_softc *sc) uea_request(sc, UEA_SET_MODE, UEA_END_RESET, 0, NULL); if (UEA_CHIP_VERSION(sc) != EAGLE_IV) { - /* clear tx and rx mailboxes */ + /* clear tx and rx mailboxes */ uea_request(sc, UEA_SET_2183_DATA, UEA_MPTX_MAILBOX, 2, &zero); uea_request(sc, UEA_SET_2183_DATA, UEA_MPRX_MAILBOX, 2, &zero); uea_request(sc, UEA_SET_2183_DATA, UEA_SWAP_MAILBOX, 2, &zero); @@ -1834,9 +1857,11 @@ static int uea_start_reset(struct uea_softc *sc) return ret; if (UEA_CHIP_VERSION(sc) == EAGLE_IV) - sc->cmv_dsc.e4.function = E4_MAKEFUNCTION(E4_ADSLDIRECTIVE, E4_MODEMREADY, 1); + sc->cmv_dsc.e4.function = E4_MAKEFUNCTION(E4_ADSLDIRECTIVE, + E4_MODEMREADY, 1); else - sc->cmv_dsc.e1.function = E1_MAKEFUNCTION(E1_ADSLDIRECTIVE, E1_MODEMREADY); + sc->cmv_dsc.e1.function = E1_MAKEFUNCTION(E1_ADSLDIRECTIVE, + E1_MODEMREADY); /* demask interrupt */ sc->booting = 0; @@ -1936,7 +1961,8 @@ static int load_XILINX_firmware(struct uea_softc *sc) value = 0; ret = uea_send_modem_cmd(sc->usb_dev, 0xe, 1, &value); if (ret < 0) - uea_err(sc->usb_dev, "elsa de-assert failed with error %d\n", ret); + uea_err(sc->usb_dev, "elsa de-assert failed with error" + " %d\n", ret); err1: release_firmware(fw_entry); @@ -1965,13 +1991,15 @@ static void uea_dispatch_cmv_e1(struct uea_softc *sc, struct intr_pkt *intr) if (UEA_CHIP_VERSION(sc) == ADI930 && cmv->bFunction == E1_MAKEFUNCTION(2, 2)) { cmv->wIndex = cpu_to_le16(dsc->idx); - put_unaligned_le32(dsc->address, &cmv->dwSymbolicAddress); + put_unaligned_le32(dsc->address, + &cmv->dwSymbolicAddress); cmv->wOffsetAddress = cpu_to_le16(dsc->offset); } else goto bad2; } - if (cmv->bFunction == E1_MAKEFUNCTION(E1_ADSLDIRECTIVE, E1_MODEMREADY)) { + if (cmv->bFunction == E1_MAKEFUNCTION(E1_ADSLDIRECTIVE, + E1_MODEMREADY)) { wake_up_cmv_ack(sc); uea_leaves(INS_TO_USBDEV(sc)); return; @@ -2020,7 +2048,8 @@ static void uea_dispatch_cmv_e4(struct uea_softc *sc, struct intr_pkt *intr) if (be16_to_cpu(cmv->wFunction) != dsc->function) goto bad2; - if (be16_to_cpu(cmv->wFunction) == E4_MAKEFUNCTION(E4_ADSLDIRECTIVE, E4_MODEMREADY, 1)) { + if (be16_to_cpu(cmv->wFunction) == E4_MAKEFUNCTION(E4_ADSLDIRECTIVE, + E4_MODEMREADY, 1)) { wake_up_cmv_ack(sc); uea_leaves(INS_TO_USBDEV(sc)); return; @@ -2047,14 +2076,16 @@ bad2: return; } -static void uea_schedule_load_page_e1(struct uea_softc *sc, struct intr_pkt *intr) +static void uea_schedule_load_page_e1(struct uea_softc *sc, + struct intr_pkt *intr) { sc->pageno = intr->e1_bSwapPageNo; sc->ovl = intr->e1_bOvl >> 4 | intr->e1_bOvl << 4; queue_work(sc->work_q, &sc->task); } -static void uea_schedule_load_page_e4(struct uea_softc *sc, struct intr_pkt *intr) +static void uea_schedule_load_page_e4(struct uea_softc *sc, + struct intr_pkt *intr) { sc->pageno = intr->e4_bSwapPageNo; queue_work(sc->work_q, &sc->task); @@ -2262,8 +2293,8 @@ out: static DEVICE_ATTR(stat_status, S_IWUGO | S_IRUGO, read_status, reboot); -static ssize_t read_human_status(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t read_human_status(struct device *dev, + struct device_attribute *attr, char *buf) { int ret = -ENODEV; int modem_state; @@ -2288,7 +2319,7 @@ static ssize_t read_human_status(struct device *dev, struct device_attribute *at case 0xa: modem_state = 1; break; - case 0x7: /* operational */ + case 0x7: /* operational */ modem_state = 2; break; case 0x2: /* fail ... */ @@ -2323,7 +2354,8 @@ out: return ret; } -static DEVICE_ATTR(stat_human_status, S_IWUGO | S_IRUGO, read_human_status, NULL); +static DEVICE_ATTR(stat_human_status, S_IWUGO | S_IRUGO, + read_human_status, NULL); static ssize_t read_delin(struct device *dev, struct device_attribute *attr, char *buf) @@ -2357,25 +2389,25 @@ out: static DEVICE_ATTR(stat_delin, S_IWUGO | S_IRUGO, read_delin, NULL); -#define UEA_ATTR(name, reset) \ +#define UEA_ATTR(name, reset) \ \ -static ssize_t read_##name(struct device *dev, \ +static ssize_t read_##name(struct device *dev, \ struct device_attribute *attr, char *buf) \ -{ \ - int ret = -ENODEV; \ - struct uea_softc *sc; \ - \ - mutex_lock(&uea_mutex); \ +{ \ + int ret = -ENODEV; \ + struct uea_softc *sc; \ + \ + mutex_lock(&uea_mutex); \ sc = dev_to_uea(dev); \ - if (!sc) \ - goto out; \ + if (!sc) \ + goto out; \ ret = snprintf(buf, 10, "%08x\n", sc->stats.phy.name); \ if (reset) \ sc->stats.phy.name = 0; \ -out: \ - mutex_unlock(&uea_mutex); \ - return ret; \ -} \ +out: \ + mutex_unlock(&uea_mutex); \ + return ret; \ +} \ \ static DEVICE_ATTR(stat_##name, S_IRUGO, read_##name, NULL) @@ -2526,12 +2558,14 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, else if (sc->driver_info & AUTO_ANNEX_B) sc->annex = ANNEXB; else - sc->annex = (le16_to_cpu(sc->usb_dev->descriptor.bcdDevice) & 0x80)?ANNEXB:ANNEXA; + sc->annex = (le16_to_cpu + (sc->usb_dev->descriptor.bcdDevice) & 0x80) ? ANNEXB : ANNEXA; alt = altsetting[sc->modem_index]; /* ADI930 don't support iso */ if (UEA_CHIP_VERSION(id) != ADI930 && alt > 0) { - if (alt <= 8 && usb_set_interface(usb, UEA_DS_IFACE_NO, alt) == 0) { + if (alt <= 8 && + usb_set_interface(usb, UEA_DS_IFACE_NO, alt) == 0) { uea_dbg(usb, "set alternate %u for 2 interface\n", alt); uea_info(usb, "using iso mode\n"); usbatm->flags |= UDSL_USE_ISOC | UDSL_IGNORE_EILSEQ; @@ -2620,40 +2654,74 @@ static void uea_disconnect(struct usb_interface *intf) * List of supported VID/PID */ static const struct usb_device_id uea_ids[] = { - {USB_DEVICE(ANALOG_VID, ADI930_PID_PREFIRM), .driver_info = ADI930 | PREFIRM}, - {USB_DEVICE(ANALOG_VID, ADI930_PID_PSTFIRM), .driver_info = ADI930 | PSTFIRM}, - {USB_DEVICE(ANALOG_VID, EAGLE_I_PID_PREFIRM), .driver_info = EAGLE_I | PREFIRM}, - {USB_DEVICE(ANALOG_VID, EAGLE_I_PID_PSTFIRM), .driver_info = EAGLE_I | PSTFIRM}, - {USB_DEVICE(ANALOG_VID, EAGLE_II_PID_PREFIRM), .driver_info = EAGLE_II | PREFIRM}, - {USB_DEVICE(ANALOG_VID, EAGLE_II_PID_PSTFIRM), .driver_info = EAGLE_II | PSTFIRM}, - {USB_DEVICE(ANALOG_VID, EAGLE_IIC_PID_PREFIRM), .driver_info = EAGLE_II | PREFIRM}, - {USB_DEVICE(ANALOG_VID, EAGLE_IIC_PID_PSTFIRM), .driver_info = EAGLE_II | PSTFIRM}, - {USB_DEVICE(ANALOG_VID, EAGLE_III_PID_PREFIRM), .driver_info = EAGLE_III | PREFIRM}, - {USB_DEVICE(ANALOG_VID, EAGLE_III_PID_PSTFIRM), .driver_info = EAGLE_III | PSTFIRM}, - {USB_DEVICE(ANALOG_VID, EAGLE_IV_PID_PREFIRM), .driver_info = EAGLE_IV | PREFIRM}, - {USB_DEVICE(ANALOG_VID, EAGLE_IV_PID_PSTFIRM), .driver_info = EAGLE_IV | PSTFIRM}, - {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_I_A_PID_PREFIRM), .driver_info = EAGLE_I | PREFIRM}, - {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_I_A_PID_PSTFIRM), .driver_info = EAGLE_I | PSTFIRM | AUTO_ANNEX_A}, - {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_I_B_PID_PREFIRM), .driver_info = EAGLE_I | PREFIRM}, - {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_I_B_PID_PSTFIRM), .driver_info = EAGLE_I | PSTFIRM | AUTO_ANNEX_B}, - {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_II_A_PID_PREFIRM), .driver_info = EAGLE_II | PREFIRM}, - {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_II_A_PID_PSTFIRM), .driver_info = EAGLE_II | PSTFIRM | AUTO_ANNEX_A}, - {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_II_B_PID_PREFIRM), .driver_info = EAGLE_II | PREFIRM}, - {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_II_B_PID_PSTFIRM), .driver_info = EAGLE_II | PSTFIRM | AUTO_ANNEX_B}, - {USB_DEVICE(ELSA_VID, ELSA_PID_PREFIRM), .driver_info = ADI930 | PREFIRM}, - {USB_DEVICE(ELSA_VID, ELSA_PID_PSTFIRM), .driver_info = ADI930 | PSTFIRM}, - {USB_DEVICE(ELSA_VID, ELSA_PID_A_PREFIRM), .driver_info = ADI930 | PREFIRM}, - {USB_DEVICE(ELSA_VID, ELSA_PID_A_PSTFIRM), .driver_info = ADI930 | PSTFIRM | AUTO_ANNEX_A}, - {USB_DEVICE(ELSA_VID, ELSA_PID_B_PREFIRM), .driver_info = ADI930 | PREFIRM}, - {USB_DEVICE(ELSA_VID, ELSA_PID_B_PSTFIRM), .driver_info = ADI930 | PSTFIRM | AUTO_ANNEX_B}, - {USB_DEVICE(USR_VID, MILLER_A_PID_PREFIRM), .driver_info = EAGLE_I | PREFIRM}, - {USB_DEVICE(USR_VID, MILLER_A_PID_PSTFIRM), .driver_info = EAGLE_I | PSTFIRM | AUTO_ANNEX_A}, - {USB_DEVICE(USR_VID, MILLER_B_PID_PREFIRM), .driver_info = EAGLE_I | PREFIRM}, - {USB_DEVICE(USR_VID, MILLER_B_PID_PSTFIRM), .driver_info = EAGLE_I | PSTFIRM | AUTO_ANNEX_B}, - {USB_DEVICE(USR_VID, HEINEKEN_A_PID_PREFIRM),.driver_info = EAGLE_I | PREFIRM}, - {USB_DEVICE(USR_VID, HEINEKEN_A_PID_PSTFIRM),.driver_info = EAGLE_I | PSTFIRM | AUTO_ANNEX_A}, - {USB_DEVICE(USR_VID, HEINEKEN_B_PID_PREFIRM),.driver_info = EAGLE_I | PREFIRM}, - {USB_DEVICE(USR_VID, HEINEKEN_B_PID_PSTFIRM),.driver_info = EAGLE_I | PSTFIRM | AUTO_ANNEX_B}, + {USB_DEVICE(ANALOG_VID, ADI930_PID_PREFIRM), + .driver_info = ADI930 | PREFIRM}, + {USB_DEVICE(ANALOG_VID, ADI930_PID_PSTFIRM), + .driver_info = ADI930 | PSTFIRM}, + {USB_DEVICE(ANALOG_VID, EAGLE_I_PID_PREFIRM), + .driver_info = EAGLE_I | PREFIRM}, + {USB_DEVICE(ANALOG_VID, EAGLE_I_PID_PSTFIRM), + .driver_info = EAGLE_I | PSTFIRM}, + {USB_DEVICE(ANALOG_VID, EAGLE_II_PID_PREFIRM), + .driver_info = EAGLE_II | PREFIRM}, + {USB_DEVICE(ANALOG_VID, EAGLE_II_PID_PSTFIRM), + .driver_info = EAGLE_II | PSTFIRM}, + {USB_DEVICE(ANALOG_VID, EAGLE_IIC_PID_PREFIRM), + .driver_info = EAGLE_II | PREFIRM}, + {USB_DEVICE(ANALOG_VID, EAGLE_IIC_PID_PSTFIRM), + .driver_info = EAGLE_II | PSTFIRM}, + {USB_DEVICE(ANALOG_VID, EAGLE_III_PID_PREFIRM), + .driver_info = EAGLE_III | PREFIRM}, + {USB_DEVICE(ANALOG_VID, EAGLE_III_PID_PSTFIRM), + .driver_info = EAGLE_III | PSTFIRM}, + {USB_DEVICE(ANALOG_VID, EAGLE_IV_PID_PREFIRM), + .driver_info = EAGLE_IV | PREFIRM}, + {USB_DEVICE(ANALOG_VID, EAGLE_IV_PID_PSTFIRM), + .driver_info = EAGLE_IV | PSTFIRM}, + {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_I_A_PID_PREFIRM), + .driver_info = EAGLE_I | PREFIRM}, + {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_I_A_PID_PSTFIRM), + .driver_info = EAGLE_I | PSTFIRM | AUTO_ANNEX_A}, + {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_I_B_PID_PREFIRM), + .driver_info = EAGLE_I | PREFIRM}, + {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_I_B_PID_PSTFIRM), + .driver_info = EAGLE_I | PSTFIRM | AUTO_ANNEX_B}, + {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_II_A_PID_PREFIRM), + .driver_info = EAGLE_II | PREFIRM}, + {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_II_A_PID_PSTFIRM), + .driver_info = EAGLE_II | PSTFIRM | AUTO_ANNEX_A}, + {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_II_B_PID_PREFIRM), + .driver_info = EAGLE_II | PREFIRM}, + {USB_DEVICE(DEVOLO_VID, DEVOLO_EAGLE_II_B_PID_PSTFIRM), + .driver_info = EAGLE_II | PSTFIRM | AUTO_ANNEX_B}, + {USB_DEVICE(ELSA_VID, ELSA_PID_PREFIRM), + .driver_info = ADI930 | PREFIRM}, + {USB_DEVICE(ELSA_VID, ELSA_PID_PSTFIRM), + .driver_info = ADI930 | PSTFIRM}, + {USB_DEVICE(ELSA_VID, ELSA_PID_A_PREFIRM), + .driver_info = ADI930 | PREFIRM}, + {USB_DEVICE(ELSA_VID, ELSA_PID_A_PSTFIRM), + .driver_info = ADI930 | PSTFIRM | AUTO_ANNEX_A}, + {USB_DEVICE(ELSA_VID, ELSA_PID_B_PREFIRM), + .driver_info = ADI930 | PREFIRM}, + {USB_DEVICE(ELSA_VID, ELSA_PID_B_PSTFIRM), + .driver_info = ADI930 | PSTFIRM | AUTO_ANNEX_B}, + {USB_DEVICE(USR_VID, MILLER_A_PID_PREFIRM), + .driver_info = EAGLE_I | PREFIRM}, + {USB_DEVICE(USR_VID, MILLER_A_PID_PSTFIRM), + .driver_info = EAGLE_I | PSTFIRM | AUTO_ANNEX_A}, + {USB_DEVICE(USR_VID, MILLER_B_PID_PREFIRM), + .driver_info = EAGLE_I | PREFIRM}, + {USB_DEVICE(USR_VID, MILLER_B_PID_PSTFIRM), + .driver_info = EAGLE_I | PSTFIRM | AUTO_ANNEX_B}, + {USB_DEVICE(USR_VID, HEINEKEN_A_PID_PREFIRM), + .driver_info = EAGLE_I | PREFIRM}, + {USB_DEVICE(USR_VID, HEINEKEN_A_PID_PSTFIRM), + .driver_info = EAGLE_I | PSTFIRM | AUTO_ANNEX_A}, + {USB_DEVICE(USR_VID, HEINEKEN_B_PID_PREFIRM), + .driver_info = EAGLE_I | PREFIRM}, + {USB_DEVICE(USR_VID, HEINEKEN_B_PID_PSTFIRM), + .driver_info = EAGLE_I | PSTFIRM | AUTO_ANNEX_B}, {} }; |