diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-04-29 04:03:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:06:28 -0400 |
commit | a5abdeafedf722b0f3f357f4a23089a686b1b80d (patch) | |
tree | 06dc1712a552ddd190c4e1a323e9e069a4d5e059 /drivers/usb/atm/ueagle-atm.c | |
parent | 6b1e6f637469647f435f8f8ab00fbafa3c129712 (diff) |
usb: use get/put_unaligned_* helpers
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/atm/ueagle-atm.c')
-rw-r--r-- | drivers/usb/atm/ueagle-atm.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index 4220f22b6660..5f71ff3aee35 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
@@ -305,8 +305,6 @@ enum { | |||
305 | */ | 305 | */ |
306 | 306 | ||
307 | #define FW_GET_BYTE(p) *((__u8 *) (p)) | 307 | #define FW_GET_BYTE(p) *((__u8 *) (p)) |
308 | #define FW_GET_WORD(p) le16_to_cpu(get_unaligned((__le16 *) (p))) | ||
309 | #define FW_GET_LONG(p) le32_to_cpu(get_unaligned((__le32 *) (p))) | ||
310 | 308 | ||
311 | #define FW_DIR "ueagle-atm/" | 309 | #define FW_DIR "ueagle-atm/" |
312 | #define NB_MODEM 4 | 310 | #define NB_MODEM 4 |
@@ -621,7 +619,7 @@ static void uea_upload_pre_firmware(const struct firmware *fw_entry, void *conte | |||
621 | if (size < 4) | 619 | if (size < 4) |
622 | goto err_fw_corrupted; | 620 | goto err_fw_corrupted; |
623 | 621 | ||
624 | crc = FW_GET_LONG(pfw); | 622 | crc = get_unaligned_le32(pfw); |
625 | pfw += 4; | 623 | pfw += 4; |
626 | size -= 4; | 624 | size -= 4; |
627 | if (crc32_be(0, pfw, size) != crc) | 625 | if (crc32_be(0, pfw, size) != crc) |
@@ -640,7 +638,7 @@ static void uea_upload_pre_firmware(const struct firmware *fw_entry, void *conte | |||
640 | 638 | ||
641 | while (size > 3) { | 639 | while (size > 3) { |
642 | u8 len = FW_GET_BYTE(pfw); | 640 | u8 len = FW_GET_BYTE(pfw); |
643 | u16 add = FW_GET_WORD(pfw + 1); | 641 | u16 add = get_unaligned_le16(pfw + 1); |
644 | 642 | ||
645 | size -= len + 3; | 643 | size -= len + 3; |
646 | if (size < 0) | 644 | if (size < 0) |
@@ -738,7 +736,7 @@ static int check_dsp_e1(u8 *dsp, unsigned int len) | |||
738 | 736 | ||
739 | for (i = 0; i < pagecount; i++) { | 737 | for (i = 0; i < pagecount; i++) { |
740 | 738 | ||
741 | pageoffset = FW_GET_LONG(dsp + p); | 739 | pageoffset = get_unaligned_le32(dsp + p); |
742 | p += 4; | 740 | p += 4; |
743 | 741 | ||
744 | if (pageoffset == 0) | 742 | if (pageoffset == 0) |
@@ -759,7 +757,7 @@ static int check_dsp_e1(u8 *dsp, unsigned int len) | |||
759 | return 1; | 757 | return 1; |
760 | 758 | ||
761 | pp += 2; /* skip blockaddr */ | 759 | pp += 2; /* skip blockaddr */ |
762 | blocksize = FW_GET_WORD(dsp + pp); | 760 | blocksize = get_unaligned_le16(dsp + pp); |
763 | pp += 2; | 761 | pp += 2; |
764 | 762 | ||
765 | /* enough space for block data? */ | 763 | /* enough space for block data? */ |
@@ -928,7 +926,7 @@ static void uea_load_page_e1(struct work_struct *work) | |||
928 | goto bad1; | 926 | goto bad1; |
929 | 927 | ||
930 | p += 4 * pageno; | 928 | p += 4 * pageno; |
931 | pageoffset = FW_GET_LONG(p); | 929 | pageoffset = get_unaligned_le32(p); |
932 | 930 | ||
933 | if (pageoffset == 0) | 931 | if (pageoffset == 0) |
934 | goto bad1; | 932 | goto bad1; |
@@ -945,10 +943,10 @@ static void uea_load_page_e1(struct work_struct *work) | |||
945 | bi.wOvlOffset = cpu_to_le16(ovl | 0x8000); | 943 | bi.wOvlOffset = cpu_to_le16(ovl | 0x8000); |
946 | 944 | ||
947 | for (i = 0; i < blockcount; i++) { | 945 | for (i = 0; i < blockcount; i++) { |
948 | blockaddr = FW_GET_WORD(p); | 946 | blockaddr = get_unaligned_le16(p); |
949 | p += 2; | 947 | p += 2; |
950 | 948 | ||
951 | blocksize = FW_GET_WORD(p); | 949 | blocksize = get_unaligned_le16(p); |
952 | p += 2; | 950 | p += 2; |
953 | 951 | ||
954 | bi.wSize = cpu_to_le16(blocksize); | 952 | bi.wSize = cpu_to_le16(blocksize); |
@@ -1152,9 +1150,9 @@ static int uea_cmv_e1(struct uea_softc *sc, | |||
1152 | cmv.bDirection = E1_HOSTTOMODEM; | 1150 | cmv.bDirection = E1_HOSTTOMODEM; |
1153 | cmv.bFunction = function; | 1151 | cmv.bFunction = function; |
1154 | cmv.wIndex = cpu_to_le16(sc->cmv_dsc.e1.idx); | 1152 | cmv.wIndex = cpu_to_le16(sc->cmv_dsc.e1.idx); |
1155 | put_unaligned(cpu_to_le32(address), &cmv.dwSymbolicAddress); | 1153 | put_unaligned_le32(address, &cmv.dwSymbolicAddress); |
1156 | cmv.wOffsetAddress = cpu_to_le16(offset); | 1154 | cmv.wOffsetAddress = cpu_to_le16(offset); |
1157 | put_unaligned(cpu_to_le32(data >> 16 | data << 16), &cmv.dwData); | 1155 | put_unaligned_le32(data >> 16 | data << 16, &cmv.dwData); |
1158 | 1156 | ||
1159 | ret = uea_request(sc, UEA_E1_SET_BLOCK, UEA_MPTX_START, sizeof(cmv), &cmv); | 1157 | ret = uea_request(sc, UEA_E1_SET_BLOCK, UEA_MPTX_START, sizeof(cmv), &cmv); |
1160 | if (ret < 0) | 1158 | if (ret < 0) |
@@ -1646,7 +1644,7 @@ static int request_cmvs(struct uea_softc *sc, | |||
1646 | if (size < 5) | 1644 | if (size < 5) |
1647 | goto err_fw_corrupted; | 1645 | goto err_fw_corrupted; |
1648 | 1646 | ||
1649 | crc = FW_GET_LONG(data); | 1647 | crc = get_unaligned_le32(data); |
1650 | data += 4; | 1648 | data += 4; |
1651 | size -= 4; | 1649 | size -= 4; |
1652 | if (crc32_be(0, data, size) != crc) | 1650 | if (crc32_be(0, data, size) != crc) |
@@ -1696,9 +1694,9 @@ static int uea_send_cmvs_e1(struct uea_softc *sc) | |||
1696 | "please update your firmware\n"); | 1694 | "please update your firmware\n"); |
1697 | 1695 | ||
1698 | for (i = 0; i < len; i++) { | 1696 | for (i = 0; i < len; i++) { |
1699 | ret = uea_write_cmv_e1(sc, FW_GET_LONG(&cmvs_v1[i].address), | 1697 | ret = uea_write_cmv_e1(sc, get_unaligned_le32(&cmvs_v1[i].address), |
1700 | FW_GET_WORD(&cmvs_v1[i].offset), | 1698 | get_unaligned_le16(&cmvs_v1[i].offset), |
1701 | FW_GET_LONG(&cmvs_v1[i].data)); | 1699 | get_unaligned_le32(&cmvs_v1[i].data)); |
1702 | if (ret < 0) | 1700 | if (ret < 0) |
1703 | goto out; | 1701 | goto out; |
1704 | } | 1702 | } |
@@ -1706,9 +1704,9 @@ static int uea_send_cmvs_e1(struct uea_softc *sc) | |||
1706 | struct uea_cmvs_v2 *cmvs_v2 = cmvs_ptr; | 1704 | struct uea_cmvs_v2 *cmvs_v2 = cmvs_ptr; |
1707 | 1705 | ||
1708 | for (i = 0; i < len; i++) { | 1706 | for (i = 0; i < len; i++) { |
1709 | ret = uea_write_cmv_e1(sc, FW_GET_LONG(&cmvs_v2[i].address), | 1707 | ret = uea_write_cmv_e1(sc, get_unaligned_le32(&cmvs_v2[i].address), |
1710 | (u16) FW_GET_LONG(&cmvs_v2[i].offset), | 1708 | (u16) get_unaligned_le32(&cmvs_v2[i].offset), |
1711 | FW_GET_LONG(&cmvs_v2[i].data)); | 1709 | get_unaligned_le32(&cmvs_v2[i].data)); |
1712 | if (ret < 0) | 1710 | if (ret < 0) |
1713 | goto out; | 1711 | goto out; |
1714 | } | 1712 | } |
@@ -1759,10 +1757,10 @@ static int uea_send_cmvs_e4(struct uea_softc *sc) | |||
1759 | 1757 | ||
1760 | for (i = 0; i < len; i++) { | 1758 | for (i = 0; i < len; i++) { |
1761 | ret = uea_write_cmv_e4(sc, 1, | 1759 | ret = uea_write_cmv_e4(sc, 1, |
1762 | FW_GET_LONG(&cmvs_v2[i].group), | 1760 | get_unaligned_le32(&cmvs_v2[i].group), |
1763 | FW_GET_LONG(&cmvs_v2[i].address), | 1761 | get_unaligned_le32(&cmvs_v2[i].address), |
1764 | FW_GET_LONG(&cmvs_v2[i].offset), | 1762 | get_unaligned_le32(&cmvs_v2[i].offset), |
1765 | FW_GET_LONG(&cmvs_v2[i].data)); | 1763 | get_unaligned_le32(&cmvs_v2[i].data)); |
1766 | if (ret < 0) | 1764 | if (ret < 0) |
1767 | goto out; | 1765 | goto out; |
1768 | } | 1766 | } |
@@ -1964,7 +1962,7 @@ static void uea_dispatch_cmv_e1(struct uea_softc *sc, struct intr_pkt *intr) | |||
1964 | if (UEA_CHIP_VERSION(sc) == ADI930 | 1962 | if (UEA_CHIP_VERSION(sc) == ADI930 |
1965 | && cmv->bFunction == E1_MAKEFUNCTION(2, 2)) { | 1963 | && cmv->bFunction == E1_MAKEFUNCTION(2, 2)) { |
1966 | cmv->wIndex = cpu_to_le16(dsc->idx); | 1964 | cmv->wIndex = cpu_to_le16(dsc->idx); |
1967 | put_unaligned(cpu_to_le32(dsc->address), &cmv->dwSymbolicAddress); | 1965 | put_unaligned_le32(dsc->address, &cmv->dwSymbolicAddress); |
1968 | cmv->wOffsetAddress = cpu_to_le16(dsc->offset); | 1966 | cmv->wOffsetAddress = cpu_to_le16(dsc->offset); |
1969 | } else | 1967 | } else |
1970 | goto bad2; | 1968 | goto bad2; |
@@ -1978,11 +1976,11 @@ static void uea_dispatch_cmv_e1(struct uea_softc *sc, struct intr_pkt *intr) | |||
1978 | 1976 | ||
1979 | /* in case of MEMACCESS */ | 1977 | /* in case of MEMACCESS */ |
1980 | if (le16_to_cpu(cmv->wIndex) != dsc->idx || | 1978 | if (le16_to_cpu(cmv->wIndex) != dsc->idx || |
1981 | le32_to_cpu(get_unaligned(&cmv->dwSymbolicAddress)) != dsc->address || | 1979 | get_unaligned_le32(&cmv->dwSymbolicAddress) != dsc->address || |
1982 | le16_to_cpu(cmv->wOffsetAddress) != dsc->offset) | 1980 | le16_to_cpu(cmv->wOffsetAddress) != dsc->offset) |
1983 | goto bad2; | 1981 | goto bad2; |
1984 | 1982 | ||
1985 | sc->data = le32_to_cpu(get_unaligned(&cmv->dwData)); | 1983 | sc->data = get_unaligned_le32(&cmv->dwData); |
1986 | sc->data = sc->data << 16 | sc->data >> 16; | 1984 | sc->data = sc->data << 16 | sc->data >> 16; |
1987 | 1985 | ||
1988 | wake_up_cmv_ack(sc); | 1986 | wake_up_cmv_ack(sc); |