tree e61b3a7b99c1078faed0dc0594b1df8c09caa9b2
parent 3e1d393240880e3d7ae580c46f1ba265643fcd15
author Pavel Roskin <[EMAIL PROTECTED]> Sun, 31 Jul 2005 02:50:05 -0700
committer Jeff Garzik <[EMAIL PROTECTED]> Sun, 31 Jul 2005 02:17:23 -0400

[PATCH] hostap update

Warning fix for 64-bit platforms


The patch fixes following warning seen on 64-bit platforms (in my case -
x86_64, gcc-4.0):

In file included from /usr/local/src/hostap/driver/modules/hostap_cs.c:203:
/usr/local/src/hostap/driver/modules/hostap_hw.c: In function 
/usr/local/src/hostap/driver/modules/hostap_hw.c:1674: warning: cast from 
pointer to integer of different size
/usr/local/src/hostap/driver/modules/hostap_hw.c: In function ?prism2_transmit?:
/usr/local/src/hostap/driver/modules/hostap_hw.c:1758: warning: cast to pointer 
from integer of different size

prism2_transmit_cb uses a (void *) argument to get an integer.   A
simple fix would be to use double cast from pointer to long and then to
int (and vice versa when int is passed as a pointer).  But I prefer a
slightly longer patch.

I believe that whenever an argument can hold both a pointer and an
integer, it should be declared long.  long can hold both pointers and
integers (except win64, but we are not coding for Windows), it can be
cast to both of them and it's never assumed to be a valid pointer, which
could be useful for some automatic code checkers.

Signed-off-by: Pavel Roskin <[EMAIL PROTECTED]>
Signed-off-by: Jouni Malinen <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>

 drivers/net/wireless/hostap/hostap_hw.c   |   18 +++++++++---------
 drivers/net/wireless/hostap/hostap_wlan.h |    4 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/hostap/hostap_hw.c 
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -507,7 +507,7 @@ static int hfa384x_cmd(struct net_device
  * @cmd: Prism2 command code (HFA384X_CMD_CODE_*)
  * @param0: value for Param0 register
  * @callback: command completion callback function (%NULL = no callback)
- * @context: data pointer to be given to callback function
+ * @context: context data to be given to the callback function
  * Issue given command (possibly after waiting in command queue) and use
  * callback function to indicate command completion. This can be called both
@@ -517,9 +517,9 @@ static int hfa384x_cmd(struct net_device
 static int hfa384x_cmd_callback(struct net_device *dev, u16 cmd, u16 param0,
                                void (*callback)(struct net_device *dev,
-                                                void *context, u16 resp0,
+                                                long context, u16 resp0,
                                                 u16 status),
-                               void *context)
+                               long context)
        struct hostap_interface *iface;
        local_info_t *local;
@@ -1710,7 +1710,7 @@ static int prism2_get_txfid_idx(local_in
 /* Called only from hardware IRQ */
-static void prism2_transmit_cb(struct net_device *dev, void *context,
+static void prism2_transmit_cb(struct net_device *dev, long context,
                               u16 resp0, u16 res)
        struct hostap_interface *iface;
@@ -1805,7 +1805,7 @@ static int prism2_transmit(struct net_de
-               prism2_transmit_cb, (void *) idx);
+               prism2_transmit_cb, (long) idx);
        if (res) {
                struct net_device_stats *stats;
@@ -1951,7 +1951,7 @@ static int prism2_tx_80211(struct sk_buf
                /* Any RX packet seems to break something with TX bus
                 * mastering; enable command is enough to fix this.. */
                if (hfa384x_cmd_callback(dev, HFA384X_CMDCODE_ENABLE, 0,
-                                        prism2_tx_cb, (void *) buf_len)) {
+                                        prism2_tx_cb, (long) buf_len)) {
                        printk(KERN_DEBUG "%s: TX: enable port0 failed\n",
@@ -2697,7 +2697,7 @@ static void prism2_infdrop(struct net_de
         * get out of this state by inquiring CommTallies. */
        if (!last_inquire || time_after(jiffies, last_inquire + HZ)) {
                hfa384x_cmd_callback(dev, HFA384X_CMDCODE_INQUIRE,
-                                    HFA384X_INFO_COMMTALLIES, NULL, NULL);
+                                    HFA384X_INFO_COMMTALLIES, NULL, 0);
                last_inquire = jiffies;
@@ -3055,7 +3055,7 @@ static void hostap_passive_scan(unsigned
        if (hfa384x_cmd_callback(dev, HFA384X_CMDCODE_TEST |
                                 (HFA384X_TEST_CHANGE_CHANNEL << 8),
-                                channel, NULL, NULL))
+                                channel, NULL, 0))
                printk(KERN_ERR "%s: passive scan channel set %d "
                       "failed\n", dev->name, channel);
@@ -3088,7 +3088,7 @@ static void hostap_tick_timer(unsigned l
            !local->hw_downloading && local->hw_ready &&
            !local->hw_resetting && local->dev_enabled) {
                hfa384x_cmd_callback(local->dev, HFA384X_CMDCODE_INQUIRE,
-                                    HFA384X_INFO_COMMTALLIES, NULL, NULL);
+                                    HFA384X_INFO_COMMTALLIES, NULL, 0);
                last_inquire = jiffies;
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h 
--- a/drivers/net/wireless/hostap/hostap_wlan.h
+++ b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -545,9 +545,9 @@ struct hostap_cmd_queue {
        struct list_head list;
        wait_queue_head_t compl;
        volatile enum { CMD_SLEEP, CMD_CALLBACK, CMD_COMPLETED } type;
-       void (*callback)(struct net_device *dev, void *context, u16 resp0,
+       void (*callback)(struct net_device *dev, long context, u16 resp0,
                         u16 res);
-       void *context;
+       long context;
        u16 cmd, param0, param1;
        u16 resp0, res;
        volatile int issued, issuing;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to