ChangeSet 1.2181.4.69, 2005/03/24 15:30:41-08:00, [EMAIL PROTECTED]

        [PATCH] USB: usb rndis gadget sparse fixes [4/5]
        
        This is a bunch of "sparse" fixups for the RNDIS code, saying it's
        little-endian on the wire and swapping cpu_to_le32() calls with
        more-correct le32_to_cpu() ones.
        
        Signed-off-by: David Brownell <[EMAIL PROTECTED]>
        Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>



 rndis.c |  169 ++++++++++++++++++++++++++++++++--------------------------------
 rndis.h |  162 ++++++++++++++++++++++++++++++-------------------------------
 2 files changed, 167 insertions(+), 164 deletions(-)


diff -Nru a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
--- a/drivers/usb/gadget/rndis.c        2005-03-30 15:18:47 -08:00
+++ b/drivers/usb/gadget/rndis.c        2005-03-30 15:18:47 -08:00
@@ -74,7 +74,7 @@
 static rndis_params rndis_per_dev_params [RNDIS_MAX_CONFIGS];
 
 /* Driver Version */
-static const u32 rndis_driver_version = __constant_cpu_to_le32 (1);
+static const __le32 rndis_driver_version = __constant_cpu_to_le32 (1);
 
 /* Function Prototypes */
 static int rndis_init_response (int configNr, rndis_init_msg_type *buf);
@@ -92,7 +92,7 @@
 {
        int                     retval = -ENOTSUPP;
        u32                     length = 0;
-       u32                     *tmp;
+       __le32                  *tmp;
        int                     i, count;
        rndis_query_cmplt_type  *resp;
 
@@ -110,7 +110,7 @@
                DEBUG ("%s: OID_GEN_SUPPORTED_LIST\n", __FUNCTION__);
                length = sizeof (oid_supported_list);
                count  = length / sizeof (u32);
-               tmp = (u32 *) ((u8 *)resp + 24);
+               tmp = (__le32 *) ((u8 *)resp + 24);
                for (i = 0; i < count; i++)
                        tmp[i] = cpu_to_le32 (oid_supported_list[i]);
                retval = 0;
@@ -126,7 +126,7 @@
                 * reddite ergo quae sunt Caesaris Caesari
                 * et quae sunt Dei Deo!
                 */
-               *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+               *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                retval = 0;
                break;
                
@@ -134,7 +134,7 @@
        case OID_GEN_MEDIA_SUPPORTED:
                DEBUG("%s: OID_GEN_MEDIA_SUPPORTED\n", __FUNCTION__);
                length = 4;
-               *((u32 *) resp + 6) = cpu_to_le32 (
+               *((__le32 *) resp + 6) = cpu_to_le32 (
                                        rndis_per_dev_params [configNr].medium);
                retval = 0;
                break;
@@ -144,7 +144,7 @@
                DEBUG("%s: OID_GEN_MEDIA_IN_USE\n", __FUNCTION__);
                length = 4;
                /* one medium, one transport... (maybe you do it better) */
-               *((u32 *) resp + 6) = cpu_to_le32 (
+               *((__le32 *) resp + 6) = cpu_to_le32 (
                                        rndis_per_dev_params [configNr].medium);
                retval = 0;
                break;
@@ -154,11 +154,11 @@
                DEBUG("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].dev) {
                        length = 4;
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr].dev->mtu);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -169,9 +169,9 @@
                length = 4;
                if (rndis_per_dev_params [configNr].media_state
                        == NDIS_MEDIA_STATE_DISCONNECTED)
-                   *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                   *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                else
-                   *((u32 *) resp + 6) = cpu_to_le32 (
+                   *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr].speed);
                retval = 0;
                break;
@@ -181,7 +181,7 @@
                DEBUG("%s: OID_GEN_TRANSMIT_BLOCK_SIZE\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].dev) {
                        length = 4;
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr].dev->mtu);
                        retval = 0;
                }
@@ -192,7 +192,7 @@
                DEBUG("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].dev) {
                        length = 4;
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr].dev->mtu);
                        retval = 0;
                }
@@ -202,7 +202,7 @@
        case OID_GEN_VENDOR_ID:
                DEBUG("%s: OID_GEN_VENDOR_ID\n", __FUNCTION__);
                length = 4;
-               *((u32 *) resp + 6) = cpu_to_le32 (
+               *((__le32 *) resp + 6) = cpu_to_le32 (
                        rndis_per_dev_params [configNr].vendorID);
                retval = 0;
                break;
@@ -220,7 +220,7 @@
                DEBUG("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __FUNCTION__);
                length = 4;
                /* Created as LE */
-               *((u32 *) resp + 6) = rndis_driver_version;
+               *((__le32 *) resp + 6) = rndis_driver_version;
                retval = 0;
                break;
 
@@ -228,7 +228,7 @@
        case OID_GEN_CURRENT_PACKET_FILTER:
                DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __FUNCTION__);
                length = 4;
-               *((u32 *) resp + 6) = cpu_to_le32 (
+               *((__le32 *) resp + 6) = cpu_to_le32 (
                                        rndis_per_dev_params[configNr].filter);
                retval = 0;
                break;
@@ -237,7 +237,7 @@
        case OID_GEN_MAXIMUM_TOTAL_SIZE:
                DEBUG("%s: OID_GEN_MAXIMUM_TOTAL_SIZE\n", __FUNCTION__);
                length = 4;
-               *((u32 *) resp + 6) = __constant_cpu_to_le32(
+               *((__le32 *) resp + 6) = __constant_cpu_to_le32(
                                        RNDIS_MAX_TOTAL_SIZE);
                retval = 0;
                break;
@@ -246,7 +246,7 @@
        case OID_GEN_MEDIA_CONNECT_STATUS:
                DEBUG("%s: OID_GEN_MEDIA_CONNECT_STATUS\n", __FUNCTION__);
                length = 4;
-               *((u32 *) resp + 6) = cpu_to_le32 (
+               *((__le32 *) resp + 6) = cpu_to_le32 (
                                        rndis_per_dev_params [configNr]
                                                .media_state);
                retval = 0;
@@ -255,7 +255,7 @@
        case OID_GEN_PHYSICAL_MEDIUM:
                DEBUG("%s: OID_GEN_PHYSICAL_MEDIUM\n", __FUNCTION__);
                length = 4;
-               *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+               *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                retval = 0;
                break;
 
@@ -266,7 +266,7 @@
        case OID_GEN_MAC_OPTIONS:               /* from WinME */
                DEBUG("%s: OID_GEN_MAC_OPTIONS\n", __FUNCTION__);
                length = 4;
-               *((u32 *) resp + 6) = __constant_cpu_to_le32(
+               *((__le32 *) resp + 6) = __constant_cpu_to_le32(
                          NDIS_MAC_OPTION_RECEIVE_SERIALIZED
                        | NDIS_MAC_OPTION_FULL_DUPLEX);
                retval = 0;
@@ -279,13 +279,13 @@
                DEBUG("%s: OID_GEN_XMIT_OK\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
                        length = 4;
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                            rndis_per_dev_params [configNr].stats->tx_packets - 
                            rndis_per_dev_params [configNr].stats->tx_errors -
                            rndis_per_dev_params [configNr].stats->tx_dropped);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -295,13 +295,13 @@
                DEBUG("%s: OID_GEN_RCV_OK\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
                        length = 4;
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                            rndis_per_dev_params [configNr].stats->rx_packets - 
                            rndis_per_dev_params [configNr].stats->rx_errors -
                            rndis_per_dev_params [configNr].stats->rx_dropped);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -311,12 +311,12 @@
                DEBUG("%s: OID_GEN_XMIT_ERROR\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
                        length = 4;
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->tx_errors);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -325,12 +325,12 @@
        case OID_GEN_RCV_ERROR:
                DEBUG("%s: OID_GEN_RCV_ERROR\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->rx_errors);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -339,12 +339,12 @@
        case OID_GEN_RCV_NO_BUFFER:
                DEBUG("%s: OID_GEN_RCV_NO_BUFFER\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->rx_dropped);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -359,7 +359,7 @@
                 */
                if (rndis_per_dev_params [configNr].stats) {
                        length = 4;
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                (rndis_per_dev_params [configNr]
                                        .stats->tx_packets - 
                                 rndis_per_dev_params [configNr]
@@ -369,7 +369,7 @@
                                * 123);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -379,7 +379,7 @@
                /* dito */
                if (rndis_per_dev_params [configNr].stats) {
                        length = 4;
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                (rndis_per_dev_params [configNr]
                                        .stats->tx_packets - 
                                 rndis_per_dev_params [configNr]
@@ -389,7 +389,7 @@
                                / 123);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -397,12 +397,12 @@
        case OID_GEN_MULTICAST_BYTES_XMIT:
                DEBUG("%s: OID_GEN_MULTICAST_BYTES_XMIT\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->multicast*1234);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -410,12 +410,12 @@
        case OID_GEN_MULTICAST_FRAMES_XMIT:
                DEBUG("%s: OID_GEN_MULTICAST_FRAMES_XMIT\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->multicast);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -423,12 +423,12 @@
        case OID_GEN_BROADCAST_BYTES_XMIT:
                DEBUG("%s: OID_GEN_BROADCAST_BYTES_XMIT\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->tx_packets/42*255);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -436,37 +436,37 @@
        case OID_GEN_BROADCAST_FRAMES_XMIT:
                DEBUG("%s: OID_GEN_BROADCAST_FRAMES_XMIT\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->tx_packets/42);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
                
        case OID_GEN_DIRECTED_BYTES_RCV:
                DEBUG("%s: OID_GEN_DIRECTED_BYTES_RCV\n", __FUNCTION__);
-               *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+               *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                retval = 0;
                break;
                
        case OID_GEN_DIRECTED_FRAMES_RCV:
                DEBUG("%s: OID_GEN_DIRECTED_FRAMES_RCV\n", __FUNCTION__);
-               *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+               *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                retval = 0;
                break;
                
        case OID_GEN_MULTICAST_BYTES_RCV:
                DEBUG("%s: OID_GEN_MULTICAST_BYTES_RCV\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->multicast * 1111);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -474,12 +474,12 @@
        case OID_GEN_MULTICAST_FRAMES_RCV:
                DEBUG("%s: OID_GEN_MULTICAST_FRAMES_RCV\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->multicast);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -487,12 +487,12 @@
        case OID_GEN_BROADCAST_BYTES_RCV:
                DEBUG("%s: OID_GEN_BROADCAST_BYTES_RCV\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->rx_packets/42*255);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -500,12 +500,12 @@
        case OID_GEN_BROADCAST_FRAMES_RCV:
                DEBUG("%s: OID_GEN_BROADCAST_FRAMES_RCV\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->rx_packets/42);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -513,19 +513,19 @@
        case OID_GEN_RCV_CRC_ERROR:
                DEBUG("%s: OID_GEN_RCV_CRC_ERROR\n", __FUNCTION__);
                if (rndis_per_dev_params [configNr].stats) {
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->rx_crc_errors);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
                
        case OID_GEN_TRANSMIT_QUEUE_LENGTH:
                DEBUG("%s: OID_GEN_TRANSMIT_QUEUE_LENGTH\n", __FUNCTION__);
-               *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+               *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                retval = 0;
                break;
 #endif /* RNDIS_OPTIONAL_STATS */
@@ -542,7 +542,7 @@
                                length);
                        retval = 0;
                } else {
-                       *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+                       *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                        retval = 0;
                }
                break;
@@ -564,7 +564,7 @@
                DEBUG("%s: OID_802_3_MULTICAST_LIST\n", __FUNCTION__);
                length = 4;
                /* Multicast base address only */
-               *((u32 *) resp + 6) = __constant_cpu_to_le32 (0xE0000000);
+               *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0xE0000000);
                retval = 0;
                break;
                
@@ -573,7 +573,7 @@
                DEBUG("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __FUNCTION__);
                 length = 4;
                /* Multicast base address only */
-               *((u32 *) resp + 6) = __constant_cpu_to_le32 (1);
+               *((__le32 *) resp + 6) = __constant_cpu_to_le32 (1);
                retval = 0;
                break;
                
@@ -589,7 +589,7 @@
                if (rndis_per_dev_params [configNr].stats)
                {
                        length = 4;
-                       *((u32 *) resp + 6) = cpu_to_le32 (
+                       *((__le32 *) resp + 6) = cpu_to_le32 (
                                rndis_per_dev_params [configNr]
                                        .stats->rx_frame_errors);
                        retval = 0;
@@ -600,7 +600,7 @@
        case OID_802_3_XMIT_ONE_COLLISION:
                DEBUG("%s: OID_802_3_XMIT_ONE_COLLISION\n", __FUNCTION__);
                length = 4;
-               *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+               *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                retval = 0;
                break;
                
@@ -608,7 +608,7 @@
        case OID_802_3_XMIT_MORE_COLLISIONS:
                DEBUG("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __FUNCTION__);
                length = 4;
-               *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
+               *((__le32 *) resp + 6) = __constant_cpu_to_le32 (0);
                retval = 0;
                break;
                
@@ -734,7 +734,7 @@
                 *      PROMISCUOUS, DIRECTED,
                 *      MULTICAST, ALL_MULTICAST, BROADCAST
                 */
-               params->filter = cpu_to_le32p((u32 *)buf);
+               params->filter = le32_to_cpup((__le32 *)buf);
                DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n",
                        __FUNCTION__, params->filter);
 
@@ -866,7 +866,7 @@
        resp->MessageLength = __constant_cpu_to_le32 (24);
        resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
        
-       if (gen_ndis_query_resp (configNr, cpu_to_le32 (buf->OID), r)) {
+       if (gen_ndis_query_resp (configNr, le32_to_cpu (buf->OID), r)) {
                /* OID not supported */
                resp->Status = __constant_cpu_to_le32 (
                                RNDIS_STATUS_NOT_SUPPORTED);
@@ -893,8 +893,8 @@
        resp = (rndis_set_cmplt_type *) r->buf;
        if (!resp) return -ENOMEM;
 
-       BufLength = cpu_to_le32 (buf->InformationBufferLength);
-       BufOffset = cpu_to_le32 (buf->InformationBufferOffset);
+       BufLength = le32_to_cpu (buf->InformationBufferLength);
+       BufOffset = le32_to_cpu (buf->InformationBufferOffset);
 
 #ifdef VERBOSE
        DEBUG("%s: Length: %d\n", __FUNCTION__, BufLength);
@@ -911,7 +911,7 @@
        resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_SET_CMPLT);
        resp->MessageLength = __constant_cpu_to_le32 (16);
        resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
-       if (gen_ndis_set_resp (configNr, cpu_to_le32 (buf->OID), 
+       if (gen_ndis_set_resp (configNr, le32_to_cpu (buf->OID), 
                               ((u8 *) buf) + 8 + BufOffset, BufLength, r))
            resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_NOT_SUPPORTED);
        else resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS);
@@ -1030,15 +1030,16 @@
  */
 int rndis_msg_parser (u8 configNr, u8 *buf)
 {
-       u32 MsgType, MsgLength, *tmp;
+       u32 MsgType, MsgLength;
+       __le32 *tmp;
        struct rndis_params             *params;
        
        if (!buf)
                return -ENOMEM;
        
-       tmp = (u32 *) buf; 
-       MsgType   = cpu_to_le32p(tmp++);
-       MsgLength = cpu_to_le32p(tmp++);
+       tmp = (__le32 *) buf; 
+       MsgType   = le32_to_cpup(tmp++);
+       MsgLength = le32_to_cpup(tmp++);
        
        if (configNr >= RNDIS_MAX_CONFIGS)
                return -ENOTSUPP;
@@ -1187,15 +1188,16 @@
 
 void rndis_add_hdr (struct sk_buff *skb)
 {
-       if (!skb) return;
-       skb_push (skb, sizeof (struct rndis_packet_msg_type));
-       memset (skb->data, 0, sizeof (struct rndis_packet_msg_type));
-       *((u32 *) skb->data) = __constant_cpu_to_le32 (1);
-       *((u32 *) skb->data + 1) = cpu_to_le32(skb->len);
-       *((u32 *) skb->data + 2) = __constant_cpu_to_le32 (36);
-       *((u32 *) skb->data + 3) = cpu_to_le32(skb->len - 44);
-       
-       return;
+       struct rndis_packet_msg_type    *header;
+
+       if (!skb)
+               return;
+       header = (void *) skb_push (skb, sizeof *header);
+       memset (header, 0, sizeof *header);
+       header->MessageType = __constant_cpu_to_le32 (1);
+       header->MessageLength = cpu_to_le32(skb->len);
+       header->DataOffset = __constant_cpu_to_le32 (36);
+       header->OOBDataOffset = cpu_to_le32(skb->len - 44);
 }
 
 void rndis_free_response (int configNr, u8 *buf)
@@ -1253,15 +1255,16 @@
 
 int rndis_rm_hdr (u8 *buf, u32 *length)
 {
-       u32 i, messageLen, dataOffset, *tmp;
+       u32 i, messageLen, dataOffset;
+       __le32 *tmp;
        
-       tmp = (u32 *) buf; 
+       tmp = (__le32 *) buf; 
 
        if (!buf || !length) return -1;
-       if (cpu_to_le32p(tmp++) != 1) return -1;
+       if (le32_to_cpup(tmp++) != 1) return -1;
        
-       messageLen = cpu_to_le32p(tmp++);
-       dataOffset = cpu_to_le32p(tmp++) + 8;
+       messageLen = le32_to_cpup(tmp++);
+       dataOffset = le32_to_cpup(tmp++) + 8;
 
        if (messageLen < dataOffset || messageLen > *length) return -1;
        
diff -Nru a/drivers/usb/gadget/rndis.h b/drivers/usb/gadget/rndis.h
--- a/drivers/usb/gadget/rndis.h        2005-03-30 15:18:47 -08:00
+++ b/drivers/usb/gadget/rndis.h        2005-03-30 15:18:47 -08:00
@@ -154,139 +154,139 @@
 
 typedef struct rndis_init_msg_type 
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     RequestID;
-       u32     MajorVersion;
-       u32     MinorVersion;
-       u32     MaxTransferSize;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  RequestID;
+       __le32  MajorVersion;
+       __le32  MinorVersion;
+       __le32  MaxTransferSize;
 } rndis_init_msg_type;
 
 typedef struct rndis_init_cmplt_type
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     RequestID;
-       u32     Status;
-       u32     MajorVersion;
-       u32     MinorVersion;
-       u32     DeviceFlags;
-       u32     Medium;
-       u32     MaxPacketsPerTransfer;
-       u32     MaxTransferSize;
-       u32     PacketAlignmentFactor;
-       u32     AFListOffset;
-       u32     AFListSize;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  RequestID;
+       __le32  Status;
+       __le32  MajorVersion;
+       __le32  MinorVersion;
+       __le32  DeviceFlags;
+       __le32  Medium;
+       __le32  MaxPacketsPerTransfer;
+       __le32  MaxTransferSize;
+       __le32  PacketAlignmentFactor;
+       __le32  AFListOffset;
+       __le32  AFListSize;
 } rndis_init_cmplt_type;
 
 typedef struct rndis_halt_msg_type
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     RequestID;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  RequestID;
 } rndis_halt_msg_type;
 
 typedef struct rndis_query_msg_type
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     RequestID;
-       u32     OID;
-       u32     InformationBufferLength;
-       u32     InformationBufferOffset;
-       u32     DeviceVcHandle;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  RequestID;
+       __le32  OID;
+       __le32  InformationBufferLength;
+       __le32  InformationBufferOffset;
+       __le32  DeviceVcHandle;
 } rndis_query_msg_type;
 
 typedef struct rndis_query_cmplt_type
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     RequestID;
-       u32     Status;
-       u32     InformationBufferLength;
-       u32     InformationBufferOffset;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  RequestID;
+       __le32  Status;
+       __le32  InformationBufferLength;
+       __le32  InformationBufferOffset;
 } rndis_query_cmplt_type;
 
 typedef struct rndis_set_msg_type
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     RequestID;
-       u32     OID;
-       u32     InformationBufferLength;
-       u32     InformationBufferOffset;
-       u32     DeviceVcHandle;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  RequestID;
+       __le32  OID;
+       __le32  InformationBufferLength;
+       __le32  InformationBufferOffset;
+       __le32  DeviceVcHandle;
 } rndis_set_msg_type;
 
 typedef struct rndis_set_cmplt_type
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     RequestID;
-       u32     Status;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  RequestID;
+       __le32  Status;
 } rndis_set_cmplt_type;
 
 typedef struct rndis_reset_msg_type
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     Reserved;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  Reserved;
 } rndis_reset_msg_type;
 
 typedef struct rndis_reset_cmplt_type
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     Status;
-       u32     AddressingReset;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  Status;
+       __le32  AddressingReset;
 } rndis_reset_cmplt_type;
 
 typedef struct rndis_indicate_status_msg_type
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     Status;
-       u32     StatusBufferLength;
-       u32     StatusBufferOffset;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  Status;
+       __le32  StatusBufferLength;
+       __le32  StatusBufferOffset;
 } rndis_indicate_status_msg_type;
 
 typedef struct rndis_keepalive_msg_type
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     RequestID;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  RequestID;
 } rndis_keepalive_msg_type;
 
 typedef struct rndis_keepalive_cmplt_type
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     RequestID;
-       u32     Status;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  RequestID;
+       __le32  Status;
 } rndis_keepalive_cmplt_type;
 
 struct rndis_packet_msg_type
 {
-       u32     MessageType;
-       u32     MessageLength;
-       u32     DataOffset;
-       u32     DataLength;
-       u32     OOBDataOffset;
-       u32     OOBDataLength;
-       u32     NumOOBDataElements;
-       u32     PerPacketInfoOffset;
-       u32     PerPacketInfoLength;
-       u32     VcHandle;
-       u32     Reserved;
+       __le32  MessageType;
+       __le32  MessageLength;
+       __le32  DataOffset;
+       __le32  DataLength;
+       __le32  OOBDataOffset;
+       __le32  OOBDataLength;
+       __le32  NumOOBDataElements;
+       __le32  PerPacketInfoOffset;
+       __le32  PerPacketInfoLength;
+       __le32  VcHandle;
+       __le32  Reserved;
 };
 
 struct rndis_config_parameter
 {
-       u32     ParameterNameOffset;
-       u32     ParameterNameLength;
-       u32     ParameterType;
-       u32     ParameterValueOffset;
-       u32     ParameterValueLength;
+       __le32  ParameterNameOffset;
+       __le32  ParameterNameLength;
+       __le32  ParameterType;
+       __le32  ParameterValueOffset;
+       __le32  ParameterValueLength;
 };
 
 /* implementation specific */
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to