Skip to contentSkip to conversation

Replace min with min_t found by checkpatch.pl

PATCH New Darshana Padmadas 1 participant 3 messages Mar 8, 2015 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover Replace min with min_t found by checkpatch.pl

This pactch set replaces min with min_t found by checkpatch.pl.

Darshana Padmadas (2):
Changes in v2:
- Combined patch 2/3 and 3/3 in v1 into a single patch.
- Changed subject of patch 1/3.
- Changed patch description to show only a single instance of fixed warning.

drivers: staging: dgnc: Replace min with min_t
staging: rtl8192e: Replace min with min_t

 drivers/staging/dgnc/dgnc_neo.c      |  2 +-
 drivers/staging/rtl8192e/rtllib_rx.c | 10 +++++-----
 drivers/staging/rtl8192e/rtllib_wx.c |  4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/2 drivers: staging: dgnc: Replace min with min_t

This patch replaces min with min_t and eliminates
the following warning found by checkpatch.pl:

WARNING: min() should probably be min_t(uint, n, 12)

---
 drivers/staging/dgnc/dgnc_neo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/dgnc/dgnc_neo.c +1 -1
index c9a8a98..1268aa9 100644
@@ -1203,7 +1203,7 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
 		 * IBM pSeries platform.
 		 * 15 bytes max appears to be the magic number.
 		 */
-		n = min((uint) n, (uint) 12);
+		n = min_t(uint, n, 12);
 
 		/*
 		 * Since we are grabbing the linestatus register, which
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/2 staging: rtl8192e: Replace min with min_t

In reply to Darshana Padmadas

This patch replaces min with min_t and eliminates the following warnings found by checkpatch.pl:

WARNING: min() should probably be min_t

---
 drivers/staging/rtl8192e/rtllib_rx.c | 10 +++++-----
 drivers/staging/rtl8192e/rtllib_wx.c |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +5 -5
index 1664040..0386568 100644
@@ -1908,7 +1908,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 				   info_element->data[2] == 0x4c &&
 				   info_element->data[3] == 0x033) {
 
-						tmp_htcap_len = min(info_element->len, (u8)MAX_IE_LEN);
+						tmp_htcap_len = min_t(u8, info_element->len, MAX_IE_LEN);
 						if (tmp_htcap_len != 0) {
 							network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
 							network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf) ?
@@ -1932,7 +1932,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 				    info_element->data[1] == 0x90 &&
 				    info_element->data[2] == 0x4c &&
 				    info_element->data[3] == 0x034) {
-					tmp_htinfo_len = min(info_element->len, (u8)MAX_IE_LEN);
+					tmp_htinfo_len = min_t(u8, info_element->len, MAX_IE_LEN);
 					if (tmp_htinfo_len != 0) {
 						network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
 						if (tmp_htinfo_len) {
@@ -1953,7 +1953,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 					    info_element->data[1] == 0xe0 &&
 					    info_element->data[2] == 0x4c &&
 					    info_element->data[3] == 0x02) {
-						ht_realtek_agg_len = min(info_element->len, (u8)MAX_IE_LEN);
+						ht_realtek_agg_len = min_t(u8, info_element->len, MAX_IE_LEN);
 						memcpy(ht_realtek_agg_buf, info_element->data, info_element->len);
 					}
 					if (ht_realtek_agg_len >= 5) {
@@ -2083,7 +2083,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 		case MFIE_TYPE_HT_CAP:
 			RTLLIB_DEBUG_SCAN("MFIE_TYPE_HT_CAP: %d bytes\n",
 					     info_element->len);
-			tmp_htcap_len = min(info_element->len, (u8)MAX_IE_LEN);
+			tmp_htcap_len = min_t(u8, info_element->len, MAX_IE_LEN);
 			if (tmp_htcap_len != 0) {
 				network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
 				network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf) ?
@@ -2110,7 +2110,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 		case MFIE_TYPE_HT_INFO:
 			RTLLIB_DEBUG_SCAN("MFIE_TYPE_HT_INFO: %d bytes\n",
 					     info_element->len);
-			tmp_htinfo_len = min(info_element->len, (u8)MAX_IE_LEN);
+			tmp_htinfo_len = min_t(u8, info_element->len, MAX_IE_LEN);
 			if (tmp_htinfo_len) {
 				network->bssht.bdHTSpecVer = HT_SPEC_VER_IEEE;
 				network->bssht.bdHTInfoLen = tmp_htinfo_len >
drivers/staging/rtl8192e/rtllib_wx.c +2 -2
index 309cda0..2e665ed 100644
@@ -74,7 +74,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
 	iwe.cmd = SIOCGIWESSID;
 	iwe.u.data.flags = 1;
 	if (network->ssid_len > 0) {
-		iwe.u.data.length = min(network->ssid_len, (u8)32);
+		iwe.u.data.length = min_t(u8, network->ssid_len, 32);
 		start = iwe_stream_add_point_rsl(info, start, stop, &iwe,
 						 network->ssid);
 	} else if (network->hidden_ssid_len == 0) {
@@ -82,7 +82,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
 		start = iwe_stream_add_point_rsl(info, start, stop,
 						 &iwe, "<hidden>");
 	} else {
-		iwe.u.data.length = min(network->hidden_ssid_len, (u8)32);
+		iwe.u.data.length = min_t(u8, network->hidden_ssid_len, 32);
 		start = iwe_stream_add_point_rsl(info, start, stop, &iwe,
 						 network->hidden_ssid);
 	}
Signature · 1 line
1.9.1