]> git.karo-electronics.de Git - linux-beck.git/commitdiff
net: Replace min macro with min_t
authorSilvan Jegen <s.jegen@gmail.com>
Tue, 25 Feb 2014 17:12:52 +0000 (18:12 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 3 Mar 2014 20:35:54 +0000 (15:35 -0500)
Instead of an explicit cast, use the min_t macro.

Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
17 files changed:
drivers/net/wireless/b43/main.c
drivers/net/wireless/b43/sysfs.c
drivers/net/wireless/b43/xmit.c
drivers/net/wireless/b43legacy/main.c
drivers/net/wireless/b43legacy/sysfs.c
drivers/net/wireless/b43legacy/xmit.c
drivers/net/wireless/cw1200/fwio.c
drivers/net/wireless/ipw2x00/ipw2100.c
drivers/net/wireless/ipw2x00/ipw2200.c
drivers/net/wireless/libertas/if_sdio.c
drivers/net/wireless/mwifiex/debugfs.c
drivers/net/wireless/p54/p54usb.c
drivers/net/wireless/prism54/isl_ioctl.c
drivers/net/wireless/rt2x00/rt2x00debug.c
drivers/net/wireless/ti/wlcore/main.c
drivers/net/wireless/ti/wlcore/spi.c
drivers/net/wireless/ti/wlcore/sysfs.c

index c75237eb55a16b7e17de051ff7f51f1ca62c4fe1..69fc3d65531a7eeb88c4901f804ab197dbbb939e 100644 (file)
@@ -1549,7 +1549,7 @@ static void b43_write_beacon_template(struct b43_wldev *dev,
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(dev->wl->current_beacon);
 
        bcn = (const struct ieee80211_mgmt *)(dev->wl->current_beacon->data);
-       len = min((size_t) dev->wl->current_beacon->len,
+       len = min_t(size_t, dev->wl->current_beacon->len,
                  0x200 - sizeof(struct b43_plcp_hdr6));
        rate = ieee80211_get_tx_rate(dev->wl->hw, info)->hw_value;
 
index 8e8431d4eb0c0d9c4ee86463e5823a91cca952dc..3190493bd07f4ce272ba90fbe61aa0a32f9d0535 100644 (file)
@@ -40,7 +40,7 @@ static int get_integer(const char *buf, size_t count)
 
        if (count == 0)
                goto out;
-       count = min(count, (size_t) 10);
+       count = min_t(size_t, count, 10);
        memcpy(tmp, buf, count);
        ret = simple_strtol(tmp, NULL, 10);
       out:
index 218a0f37af46627570ba4e1e1a8e359edb470ddb..31adb8cf0291fb0bbebf1a6896c8f4ff4d7288b9 100644 (file)
@@ -337,7 +337,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
                        /* iv16 */
                        memcpy(txhdr->iv + 10, ((u8 *) wlhdr) + wlhdr_len, 3);
                } else {
-                       iv_len = min((size_t) info->control.hw_key->iv_len,
+                       iv_len = min_t(size_t, info->control.hw_key->iv_len,
                                     ARRAY_SIZE(txhdr->iv));
                        memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len);
                }
index 349c77605231a660dbf398b3a93a13978715de3d..1aec2146a2bfb5ecfe3fe6d8452236799058d9c8 100644 (file)
@@ -978,7 +978,7 @@ static void b43legacy_write_beacon_template(struct b43legacy_wldev *dev,
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(dev->wl->current_beacon);
 
        bcn = (const struct ieee80211_mgmt *)(dev->wl->current_beacon->data);
-       len = min((size_t)dev->wl->current_beacon->len,
+       len = min_t(size_t, dev->wl->current_beacon->len,
                  0x200 - sizeof(struct b43legacy_plcp_hdr6));
        rate = ieee80211_get_tx_rate(dev->wl->hw, info)->hw_value;
 
@@ -1155,7 +1155,7 @@ static void b43legacy_write_probe_resp_template(struct b43legacy_wldev *dev,
        b43legacy_write_probe_resp_plcp(dev, 0x350, size,
                                        &b43legacy_b_ratetable[3]);
 
-       size = min((size_t)size,
+       size = min_t(size_t, size,
                   0x200 - sizeof(struct b43legacy_plcp_hdr6));
        b43legacy_write_template_common(dev, probe_resp_data,
                                        size, ram_offset,
index 57f8b089767ca0f7d9700e16fee71bbe76998855..2a1da15c913b0704eb5aa04d179e6eef70e0cfa6 100644 (file)
@@ -42,7 +42,7 @@ static int get_integer(const char *buf, size_t count)
 
        if (count == 0)
                goto out;
-       count = min(count, (size_t)10);
+       count = min_t(size_t, count, 10);
        memcpy(tmp, buf, count);
        ret = simple_strtol(tmp, NULL, 10);
 out:
index 86588c9ff0f2b6cddee0b3a7da5455fd05b29a9b..34bf3f0b729f79c901ba5351bd47043591118563 100644 (file)
@@ -254,7 +254,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
                                   B43legacy_TX4_MAC_KEYALG_SHIFT) &
                                   B43legacy_TX4_MAC_KEYALG;
                        wlhdr_len = ieee80211_hdrlen(wlhdr->frame_control);
-                       iv_len = min((size_t)info->control.hw_key->iv_len,
+                       iv_len = min_t(size_t, info->control.hw_key->iv_len,
                                     ARRAY_SIZE(txhdr->iv));
                        memcpy(txhdr->iv, ((u8 *)wlhdr) + wlhdr_len, iv_len);
                } else {
index 5a9ffd3a6a6caa0d1c98a27cc238de4e8e5047cb..e23d67e0bfe66806f1498e81fbcb82c4b3675a40 100644 (file)
@@ -202,8 +202,8 @@ static int cw1200_load_firmware_cw1200(struct cw1200_common *priv)
                }
 
                /* calculate the block size */
-               tx_size = block_size = min((size_t)(firmware->size - put),
-                       (size_t)DOWNLOAD_BLOCK_SIZE);
+               tx_size = block_size = min_t(size_t, firmware->size - put,
+                                       DOWNLOAD_BLOCK_SIZE);
 
                memcpy(buf, &firmware->data[put], block_size);
                if (block_size < DOWNLOAD_BLOCK_SIZE) {
index 3aba49259ef1886d09157559977cb7f72ac1d944..dfc6dfc56d52fa8029beb5e25826c61908b02286 100644 (file)
@@ -7065,7 +7065,7 @@ static int ipw2100_wx_set_nick(struct net_device *dev,
        if (wrqu->data.length > IW_ESSID_MAX_SIZE)
                return -E2BIG;
 
-       wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick));
+       wrqu->data.length = min_t(size_t, wrqu->data.length, sizeof(priv->nick));
        memset(priv->nick, 0, sizeof(priv->nick));
        memcpy(priv->nick, extra, wrqu->data.length);
 
index 139326065bd923aad89a867774168480f7a83d0c..c5aa404069f3b14d4c9bba36987faeed088cba58 100644 (file)
@@ -9169,7 +9169,7 @@ static int ipw_wx_set_nick(struct net_device *dev,
        if (wrqu->data.length > IW_ESSID_MAX_SIZE)
                return -E2BIG;
        mutex_lock(&priv->mutex);
-       wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick));
+       wrqu->data.length = min_t(size_t, wrqu->data.length, sizeof(priv->nick));
        memset(priv->nick, 0, sizeof(priv->nick));
        memcpy(priv->nick, extra, wrqu->data.length);
        IPW_DEBUG_TRACE("<<\n");
index 58c6ee5de98f9256b2e3db4735adbfe1fed299bd..33ceda296c9c61ece7d14a8484cd551b50026dfa 100644 (file)
@@ -498,7 +498,7 @@ static int if_sdio_prog_helper(struct if_sdio_card *card,
                 */
                mdelay(2);
 
-               chunk_size = min(size, (size_t)60);
+               chunk_size = min_t(size_t, size, 60);
 
                *((__le32*)chunk_buffer) = cpu_to_le32(chunk_size);
                memcpy(chunk_buffer + 4, firmware, chunk_size);
@@ -639,7 +639,7 @@ static int if_sdio_prog_real(struct if_sdio_card *card,
                        req_size = size;
 
                while (req_size) {
-                       chunk_size = min(req_size, (size_t)512);
+                       chunk_size = min_t(size_t, req_size, 512);
 
                        memcpy(chunk_buffer, firmware, chunk_size);
 /*
index 61b467a7ebdd20d5afe75d97fbff95bcae9b6814..b8a49aad12fd662434ce2a29aaa8edecfb52ba0b 100644 (file)
@@ -493,7 +493,7 @@ mwifiex_regrdwr_write(struct file *file,
 {
        unsigned long addr = get_zeroed_page(GFP_KERNEL);
        char *buf = (char *) addr;
-       size_t buf_size = min(count, (size_t) (PAGE_SIZE - 1));
+       size_t buf_size = min_t(size_t, count, PAGE_SIZE - 1);
        int ret;
        u32 reg_type = 0, reg_offset = 0, reg_value = UINT_MAX;
 
@@ -594,7 +594,7 @@ mwifiex_rdeeprom_write(struct file *file,
 {
        unsigned long addr = get_zeroed_page(GFP_KERNEL);
        char *buf = (char *) addr;
-       size_t buf_size = min(count, (size_t) (PAGE_SIZE - 1));
+       size_t buf_size = min_t(size_t, count, PAGE_SIZE - 1);
        int ret = 0;
        int offset = -1, bytes = -1;
 
index 6e635cfa24c8dea70eb439f3724ee52adc01d27d..b7ab3dfb3de8a758e7d7636970ddfd87918feebd 100644 (file)
@@ -513,7 +513,7 @@ static int p54u_upload_firmware_3887(struct ieee80211_hw *dev)
        if (!buf)
                return -ENOMEM;
 
-       left = block_size = min((size_t)P54U_FW_BLOCK, priv->fw->size);
+       left = block_size = min_t(size_t, P54U_FW_BLOCK, priv->fw->size);
        strcpy(buf, p54u_firmware_upload_3887);
        left -= strlen(p54u_firmware_upload_3887);
        tmp += strlen(p54u_firmware_upload_3887);
index 78fa64d3f2232a85a15a8b88f698765f80c9dfc8..ecbb0546cf3eed4b14f86c64a6d649d808c8eed3 100644 (file)
@@ -644,7 +644,7 @@ prism54_translate_bss(struct net_device *ndev, struct iw_request_info *info,
        wpa_ie_len = prism54_wpa_bss_ie_get(priv, bss->address, wpa_ie);
        if (wpa_ie_len > 0) {
                iwe.cmd = IWEVGENIE;
-               iwe.u.data.length = min(wpa_ie_len, (size_t)MAX_WPA_IE_LEN);
+               iwe.u.data.length = min_t(size_t, wpa_ie_len, MAX_WPA_IE_LEN);
                current_ev = iwe_stream_add_point(info, current_ev, end_buf,
                                                  &iwe, wpa_ie);
        }
index 2e3d1645e68bb68fb827070f126beaefb1b7e3c6..90fdb02b55e79debd5bd89b31104e90a260c596c 100644 (file)
@@ -286,7 +286,7 @@ static ssize_t rt2x00debug_read_queue_dump(struct file *file,
        if (retval)
                return retval;
 
-       status = min((size_t)skb->len, length);
+       status = min_t(size_t, skb->len, length);
        if (copy_to_user(buf, skb->data, status)) {
                status = -EFAULT;
                goto exit;
index 4175a57ac9f537d1f16e886fd7b071d3c1dfb50c..ed88d39134839e34510d83252949dbbb2a964e83 100644 (file)
@@ -800,7 +800,7 @@ size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen)
        size_t len;
 
        /* Make sure we have enough room */
-       len = min(maxlen, (size_t)(PAGE_SIZE - wl->fwlog_size));
+       len = min_t(size_t, maxlen, PAGE_SIZE - wl->fwlog_size);
 
        /* Fill the FW log file, consumed by the sysfs fwlog entry */
        memcpy(wl->fwlog + wl->fwlog_size, memblock, len);
index b2c018dccf1887bb8dbdd5b85d9a88e0d30ff46e..dbe826dd7c23c49a38a08988cb24c50764d3efaa 100644 (file)
@@ -211,7 +211,7 @@ static int __must_check wl12xx_spi_raw_read(struct device *child, int addr,
        u32 chunk_len;
 
        while (len > 0) {
-               chunk_len = min((size_t)WSPI_MAX_CHUNK_SIZE, len);
+               chunk_len = min_t(size_t, WSPI_MAX_CHUNK_SIZE, len);
 
                cmd = &wl->buffer_cmd;
                busy_buf = wl->buffer_busyword;
@@ -285,7 +285,7 @@ static int __must_check wl12xx_spi_raw_write(struct device *child, int addr,
        cmd = &commands[0];
        i = 0;
        while (len > 0) {
-               chunk_len = min((size_t)WSPI_MAX_CHUNK_SIZE, len);
+               chunk_len = min_t(size_t, WSPI_MAX_CHUNK_SIZE, len);
 
                *cmd = 0;
                *cmd |= WSPI_CMD_WRITE;
index 8e583497940d0b0d728ee2151d1cfa0f04def249..24dd288d68098f2e87b12b546c6fe38460501edc 100644 (file)
@@ -152,7 +152,7 @@ static ssize_t wl1271_sysfs_read_fwlog(struct file *filp, struct kobject *kobj,
        }
 
        /* Seeking is not supported - old logs are not kept. Disregard pos. */
-       len = min(count, (size_t)wl->fwlog_size);
+       len = min_t(size_t, count, wl->fwlog_size);
        wl->fwlog_size -= len;
        memcpy(buffer, wl->fwlog, len);