mwifiex: fix powerpc64-linux- compilation warnings
authorBing Zhao <bzhao@marvell.com>
Tue, 7 Aug 2012 23:08:08 +0000 (16:08 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 10 Aug 2012 19:26:59 +0000 (15:26 -0400)
These warnings can be detected by using powerpc64-linux toolchain
(gcc-4.6.3-nolibc).

  CC [M]  drivers/net/wireless/mwifiex/sta_event.o
drivers/net/wireless/mwifiex/sta_event.c: In function 'mwifiex_process_sta_event':
drivers/net/wireless/mwifiex/sta_event.c:388:4: warning: comparison of distinct pointer types lacks a cast [enabled by default]
  CC [M]  drivers/net/wireless/mwifiex/uap_event.o
drivers/net/wireless/mwifiex/uap_event.c: In function 'mwifiex_process_uap_event':
drivers/net/wireless/mwifiex/uap_event.c:258:11: warning: comparison of distinct pointer types lacks a cast [enabled by default]

Use min_t() instead of min() to fix the warnings.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/sta_event.c
drivers/net/wireless/mwifiex/uap_event.c

index 2aad148db5c3c85a92438bb2157ea701a6d5ed1c..4758d3064887b6e0620a560b8b340ceb8c2a0be3 100644 (file)
@@ -186,6 +186,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
        struct mwifiex_adapter *adapter = priv->adapter;
        int ret = 0;
        u32 eventcause = adapter->event_cause;
+       u16 ctrl;
 
        switch (eventcause) {
        case EVENT_DUMMY_HOST_WAKEUP_SIGNAL:
@@ -382,11 +383,11 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
                                              adapter->event_body);
                break;
        case EVENT_AMSDU_AGGR_CTRL:
-               dev_dbg(adapter->dev, "event:  AMSDU_AGGR_CTRL %d\n",
-                       *(u16 *) adapter->event_body);
+               ctrl = le16_to_cpu(*(__le16 *)adapter->event_body);
+               dev_dbg(adapter->dev, "event: AMSDU_AGGR_CTRL %d\n", ctrl);
+
                adapter->tx_buf_size =
-                       min(adapter->curr_tx_buf_size,
-                           le16_to_cpu(*(__le16 *) adapter->event_body));
+                               min_t(u16, adapter->curr_tx_buf_size, ctrl);
                dev_dbg(adapter->dev, "event: tx_buf_size %d\n",
                        adapter->tx_buf_size);
                break;
index 14d4f04201b9dbe642e7788b59dfadd674965665..1703abf73dace15d4240fd6028fb16cfbbd2f023 100644 (file)
@@ -170,6 +170,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
        struct mwifiex_sta_node *node;
        u8 *deauth_mac;
        struct host_cmd_ds_11n_batimeout *ba_timeout;
+       u16 ctrl;
 
        switch (eventcause) {
        case EVENT_UAP_STA_ASSOC:
@@ -250,14 +251,12 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
                dev_dbg(adapter->dev, "AP EVENT: event id: %#x\n", eventcause);
                break;
        case EVENT_AMSDU_AGGR_CTRL:
-               dev_dbg(adapter->dev, "event:  AMSDU_AGGR_CTRL %d\n",
-                       *(u16 *)adapter->event_body);
+               ctrl = le16_to_cpu(*(__le16 *)adapter->event_body);
+               dev_dbg(adapter->dev, "event: AMSDU_AGGR_CTRL %d\n", ctrl);
 
                if (priv->media_connected) {
                        adapter->tx_buf_size =
-                              min(adapter->curr_tx_buf_size,
-                                  le16_to_cpu(*(__le16 *)adapter->event_body));
-
+                               min_t(u16, adapter->curr_tx_buf_size, ctrl);
                        dev_dbg(adapter->dev, "event: tx_buf_size %d\n",
                                adapter->tx_buf_size);
                }