All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] Use standard min/max macros [1/3]
@ 2006-07-31 22:13 Clément Stenac
  2006-07-31 22:25 ` [KJ] [PATCH] Use standard min/max macros [2/3] Clément Stenac
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Clément Stenac @ 2006-07-31 22:13 UTC (permalink / raw)
  To: kernel-janitors

Remove some custom type-unsafe MIN/MAX macros in favor of type-checking
min/max from kernel.h

Signed-off-by: Clément Stenac <zorglub@diwi.org>
--- 

This is my very first patch submission, reviews are welcome.

As this patch switches to type-checking macros, it reveals a number of
warnings due to bogus comparisons (mostly signed/unsigned). I plan to do
another set of patches for some of these.

diff --git a/drivers/isdn/hardware/eicon/debug.c b/drivers/isdn/hardware/eicon/debug.c
index 6851c62..f55d679 100644
--- a/drivers/isdn/hardware/eicon/debug.c
+++ b/drivers/isdn/hardware/eicon/debug.c
@@ -756,14 +756,14 @@ int diva_get_driver_info (dword id, byte
 
     data_length -= 9;
 
-    if ((to_copy = MIN(strlen(clients[id].drvName), data_length-1))) {
+    if ((to_copy = min(strlen(clients[id].drvName), data_length-1))) {
       memcpy (p, clients[id].drvName, to_copy);
       p += to_copy;
       data_length -= to_copy;
       if ((data_length >= 4) && clients[id].hDbg->drvTag[0]) {
         *p++ = '(';
         data_length -= 1;
-        if ((to_copy = MIN(strlen(clients[id].hDbg->drvTag), data_length-2))) {
+        if ((to_copy = min(strlen(clients[id].hDbg->drvTag), data_length-2))) {
           memcpy (p, clients[id].hDbg->drvTag, to_copy);
           p += to_copy;
           data_length -= to_copy;
diff --git a/drivers/isdn/hardware/eicon/di.c b/drivers/isdn/hardware/eicon/di.c
index 0617d7c..6e65d2c 100644
--- a/drivers/isdn/hardware/eicon/di.c
+++ b/drivers/isdn/hardware/eicon/di.c
@@ -133,7 +133,7 @@ #endif
     i = this->XCurrent;
     X = PTR_X(a,this);
     while(i<this->XNum && length<270) {
-      clength = MIN((word)(270-length),X[i].PLength-this->XOffset);
+      clength = min((word)(270-length),X[i].PLength-this->XOffset);
       a->ram_out_buffer(a,
                         &ReqOut->XBuffer.P[length],
                         PTR_P(a,this,&X[i].P[this->XOffset]),
@@ -622,7 +622,7 @@ #endif
                                                      sizeof(a->stream_buffer),
                                                      &final, NULL, NULL);
         }
-        IoAdapter->RBuffer.length = MIN(MLength, 270);
+        IoAdapter->RBuffer.length = min(MLength, 270);
         if (IoAdapter->RBuffer.length != MLength) {
           this->complete = 0;
         } else {
@@ -676,9 +676,9 @@ #endif
         this->RCurrent++;
       }
       if (cma) {
-        clength = MIN(MLength, R[this->RCurrent].PLength-this->ROffset);
+        clength = min(MLength, R[this->RCurrent].PLength-this->ROffset);
       } else {
-        clength = MIN(a->ram_inw(a, &RBuffer->length)-offset,
+        clength = min(a->ram_inw(a, &RBuffer->length)-offset,
                       R[this->RCurrent].PLength-this->ROffset);
       }
       if(R[this->RCurrent].P) {
diff --git a/drivers/isdn/hardware/eicon/io.c b/drivers/isdn/hardware/eicon/io.c
index 4a27e23..7e197c7 100644
--- a/drivers/isdn/hardware/eicon/io.c
+++ b/drivers/isdn/hardware/eicon/io.c
@@ -262,7 +262,7 @@ #endif
     case IDI_SYNC_REQ_XDI_GET_CAPI_PARAMS: {
        diva_xdi_get_capi_parameters_t prms, *pI = &syncReq->xdi_capi_prms.info;
        memset (&prms, 0x00, sizeof(prms));
-       prms.structure_length = MIN(sizeof(prms), pI->structure_length);
+       prms.structure_length = min(sizeof(prms), pI->structure_length);
        memset (pI, 0x00, pI->structure_length);
        prms.flag_dynamic_l1_down    = (IoAdapter->capi_cfg.cfg_1 & \
          DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON) ? 1 : 0;
diff --git a/drivers/isdn/hardware/eicon/istream.c b/drivers/isdn/hardware/eicon/istream.c
index 2313966..87133db 100644
--- a/drivers/isdn/hardware/eicon/istream.c
+++ b/drivers/isdn/hardware/eicon/istream.c
@@ -92,7 +92,7 @@ #endif
     return (-1); /* was not able to write       */
    break;     /* only part of message was written */
   }
-  to_write = MIN(length, DIVA_DFIFO_DATA_SZ);
+  to_write = min(length, DIVA_DFIFO_DATA_SZ);
   if (to_write) {
    a->ram_out_buffer (a,
 #ifdef PLATFORM_GT_32BIT
@@ -176,7 +176,7 @@ #endif
     return (-1); /* was not able to read */
    break;
   }
-  to_read = MIN(max_length, tmp[1]);
+  to_read = min(max_length, tmp[1]);
   if (to_read) {
    a->ram_in_buffer(a,
 #ifdef PLATFORM_GT_32BIT
diff --git a/drivers/isdn/hardware/eicon/platform.h b/drivers/isdn/hardware/eicon/platform.h
index a66836c..2444811 100644
--- a/drivers/isdn/hardware/eicon/platform.h
+++ b/drivers/isdn/hardware/eicon/platform.h
@@ -83,14 +83,6 @@ #ifndef	NULL
 #define	NULL	((void *) 0)
 #endif
 
-#ifndef	MIN
-#define MIN(a,b)	((a)>(b) ? (b) : (a))
-#endif
-
-#ifndef	MAX
-#define MAX(a,b)	((a)>(b) ? (a) : (b))
-#endif
-
 #ifndef	far
 #define far
 #endif
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c
index 567efff..6d943df 100644
--- a/drivers/net/wan/pc300_drv.c
+++ b/drivers/net/wan/pc300_drv.c
@@ -270,13 +270,6 @@ static struct pci_device_id cpc_pci_dev_
 };
 MODULE_DEVICE_TABLE(pci, cpc_pci_dev_id);
 
-#ifndef cpc_min
-#define	cpc_min(a,b)	(((a)<(b))?(a):(b))
-#endif
-#ifndef cpc_max
-#define	cpc_max(a,b)	(((a)>(b))?(a):(b))
-#endif
-
 /* prototypes */
 static void tx_dma_buf_pt_init(pc300_t *, int);
 static void tx_dma_buf_init(pc300_t *, int);
@@ -477,7 +470,7 @@ static int dma_buf_write(pc300_t * card,
 	for (i = 0; i < nbuf; i++) {
 		ptdescr = (card->hw.rambase +
 					  TX_BD_ADDR(ch, card->chan[ch].tx_next_bd));
-		nchar = cpc_min(BD_DEF_LEN, tosend);
+		nchar = min(BD_DEF_LEN, tosend);
 		if (cpc_readb(&ptdescr->status) & DST_OSB) {
 			memcpy_toio((card->hw.rambase + cpc_readl(&ptdescr->ptbuf)),
 				    &ptdata[len - tosend], nchar);
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
index 1cb0607..35918be 100644
--- a/include/net/irda/irda.h
+++ b/include/net/irda/irda.h
@@ -46,10 +46,6 @@ #ifndef SMALL
 #define SMALL 5
 #endif
 
-#ifndef IRDA_MIN /* Lets not mix this MIN with other header files */
-#define IRDA_MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
-
 #ifndef IRDA_ALIGN
 #  define IRDA_ALIGN __attribute__((aligned))
 #endif
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 3bcdb46..584752d 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -854,7 +854,7 @@ static void ircomm_tty_wait_until_sent(s
 	orig_jiffies = jiffies;
 
 	/* Set poll time to 200 ms */
-	poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200));
+	poll_time = min(timeout, msecs_to_jiffies(200));
 
 	spin_lock_irqsave(&self->spinlock, flags);
 	while (self->tx_skb && self->tx_skb->len) {
@@ -1201,7 +1201,7 @@ static int ircomm_tty_control_indication
 
 	clen = skb->data[0];
 
-	irda_param_extract_all(self, skb->data+1, IRDA_MIN(skb->len-1, clen), 
+	irda_param_extract_all(self, skb->data+1, min(skb->len-1, clen), 
 			       &ircomm_param_info);
 
 	/* No need to kfree_skb - see ircomm_control_indication() */
diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c
index 99f5edd..539293e 100644
--- a/net/irda/ircomm/ircomm_tty_attach.c
+++ b/net/irda/ircomm/ircomm_tty_attach.c
@@ -543,7 +543,7 @@ void ircomm_tty_connect_indication(void 
 	clen = skb->data[0];
 	if (clen)
 		irda_param_extract_all(self, skb->data+1, 
-				       IRDA_MIN(skb->len, clen), 
+				       min(skb->len, clen), 
 				       &ircomm_param_info);
 
 	ircomm_tty_do_event(self, IRCOMM_TTY_CONNECT_INDICATION, NULL, NULL);
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index ccb983b..73cfd18 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -378,7 +378,7 @@ void irlap_send_discovery_xid_frame(stru
 		info = skb_put(tx_skb, 1);
 		info[0] = discovery->data.charset;
 
-		len = IRDA_MIN(discovery->name_len, skb_tailroom(tx_skb));
+		len = min(discovery->name_len, skb_tailroom(tx_skb));
 		info = skb_put(tx_skb, len);
 		memcpy(info, discovery->data.info, len);
 	}
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 42acf1c..3a2480e 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -1216,7 +1216,7 @@ static void irttp_connect_confirm(void *
 		plen = skb->data[0];
 
 		ret = irda_param_extract_all(self, skb->data+1,
-					     IRDA_MIN(skb->len-1, plen),
+					     min(skb->len-1, plen),
 					     &param_info);
 
 		/* Any errors in the parameter list? */
@@ -1229,7 +1229,7 @@ static void irttp_connect_confirm(void *
 			return;
 		}
 		/* Remove parameters */
-		skb_pull(skb, IRDA_MIN(skb->len, plen+1));
+		skb_pull(skb, min(skb->len, plen+1));
 	}
 
 	IRDA_DEBUG(4, "%s() send=%d,avail=%d,remote=%d\n", __FUNCTION__,
@@ -1293,7 +1293,7 @@ void irttp_connect_indication(void *inst
 		plen = skb->data[0];
 
 		ret = irda_param_extract_all(self, skb->data+1,
-					     IRDA_MIN(skb->len-1, plen),
+					     min(skb->len-1, plen),
 					     &param_info);
 
 		/* Any errors in the parameter list? */
@@ -1307,7 +1307,7 @@ void irttp_connect_indication(void *inst
 		}
 
 		/* Remove parameters */
-		skb_pull(skb, IRDA_MIN(skb->len, plen+1));
+		skb_pull(skb, min(skb->len, plen+1));
 	}
 
 	if (self->notify.connect_indication) {
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [KJ] [PATCH] Use standard min/max macros [2/3]
  2006-07-31 22:13 [KJ] [PATCH] Use standard min/max macros [1/3] Clément Stenac
@ 2006-07-31 22:25 ` Clément Stenac
  2006-07-31 22:26 ` [KJ] [PATCH] Use standard min/max macros [3/3] Clément Stenac
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Clément Stenac @ 2006-07-31 22:25 UTC (permalink / raw)
  To: kernel-janitors

Remove some custom type-unsafe MIN/MAX macros in favor of type-checking
min/max from kernel.h

Signed-off-by: Clément Stenac <zorglub@diwi.org>
---

diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h
index df3346b..c58ac6a 100644
--- a/drivers/scsi/aic7xxx/aic79xx.h
+++ b/drivers/scsi/aic7xxx/aic79xx.h
@@ -53,14 +53,6 @@ struct ahd_platform_data;
 struct scb_platform_data;
 
 /****************************** Useful Macros *********************************/
-#ifndef MAX
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-
-#ifndef MIN
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
 #ifndef TRUE
 #define TRUE 1
 #endif
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 653818d..a4018fb 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -2850,14 +2850,14 @@ ahd_devlimited_syncrate(struct ahd_softc
 		transinfo = &tinfo->goal;
 	*ppr_options &= (transinfo->ppr_options|MSG_EXT_PPR_PCOMP_EN);
 	if (transinfo->width = MSG_EXT_WDTR_BUS_8_BIT) {
-		maxsync = MAX(maxsync, AHD_SYNCRATE_ULTRA2);
+		maxsync = max(maxsync, AHD_SYNCRATE_ULTRA2);
 		*ppr_options &= ~MSG_EXT_PPR_DT_REQ;
 	}
 	if (transinfo->period = 0) {
 		*period = 0;
 		*ppr_options = 0;
 	} else {
-		*period = MAX(*period, transinfo->period);
+		*period = max(*period, transinfo->period);
 		ahd_find_syncrate(ahd, period, ppr_options, maxsync);
 	}
 }
@@ -2924,12 +2924,12 @@ ahd_validate_offset(struct ahd_softc *ah
 			maxoffset = MAX_OFFSET_PACED;
 	} else
 		maxoffset = MAX_OFFSET_NON_PACED;
-	*offset = MIN(*offset, maxoffset);
+	*offset = min(*offset, maxoffset);
 	if (tinfo != NULL) {
 		if (role = ROLE_TARGET)
-			*offset = MIN(*offset, tinfo->user.offset);
+			*offset = min(*offset, tinfo->user.offset);
 		else
-			*offset = MIN(*offset, tinfo->goal.offset);
+			*offset = min(*offset, tinfo->goal.offset);
 	}
 }
 
@@ -2955,9 +2955,9 @@ ahd_validate_width(struct ahd_softc *ahd
 	}
 	if (tinfo != NULL) {
 		if (role = ROLE_TARGET)
-			*bus_width = MIN(tinfo->user.width, *bus_width);
+			*bus_width = min(tinfo->user.width, *bus_width);
 		else
-			*bus_width = MIN(tinfo->goal.width, *bus_width);
+			*bus_width = min(tinfo->goal.width, *bus_width);
 	}
 }
 
@@ -6057,9 +6057,9 @@ #ifdef AHD_DEBUG
 #endif
 	}
 
-	newcount = MIN(scb_data->sense_left, scb_data->scbs_left);
-	newcount = MIN(newcount, scb_data->sgs_left);
-	newcount = MIN(newcount, (AHD_SCB_MAX_ALLOC - scb_data->numscbs));
+	newcount = min(scb_data->sense_left, scb_data->scbs_left);
+	newcount = min(newcount, scb_data->sgs_left);
+	newcount = min(newcount, (AHD_SCB_MAX_ALLOC - scb_data->numscbs));
 	for (i = 0; i < newcount; i++) {
 		struct scb_platform_data *pdata;
 		u_int col_tag;
@@ -8668,7 +8668,7 @@ ahd_resolve_seqaddr(struct ahd_softc *ah
 		if (skip_addr > i) {
 			int end_addr;
 
-			end_addr = MIN(address, skip_addr);
+			end_addr = min(address, skip_addr);
 			address_offset += end_addr - i;
 			i = skip_addr;
 		} else {
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 998999c..f10ad1b 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1813,7 +1813,7 @@ ahd_linux_handle_scsi_status(struct ahd_
 			u_int sense_offset;
 
 			if (scb->flags & SCB_SENSE) {
-				sense_size = MIN(sizeof(struct scsi_sense_data)
+				sense_size = min(sizeof(struct scsi_sense_data)
 					       - ahd_get_sense_residual(scb),
 						 sizeof(cmd->sense_buffer));
 				sense_offset = 0;
@@ -1824,7 +1824,7 @@ ahd_linux_handle_scsi_status(struct ahd_
 				 */
 				siu = (struct scsi_status_iu_header *)
 				    scb->sense_data;
-				sense_size = MIN(scsi_4btoul(siu->sense_length),
+				sense_size = min(scsi_4btoul(siu->sense_length),
 						sizeof(cmd->sense_buffer));
 				sense_offset = SIU_SENSE_OFFSET(siu);
 			}
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h
index 62ff8c3..4850820 100644
--- a/drivers/scsi/aic7xxx/aic7xxx.h
+++ b/drivers/scsi/aic7xxx/aic7xxx.h
@@ -54,14 +54,6 @@ struct scb_platform_data;
 struct seeprom_descriptor;
 
 /****************************** Useful Macros *********************************/
-#ifndef MAX
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-
-#ifndef MIN
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
 #ifndef TRUE
 #define TRUE 1
 #endif
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 93e4e40..6405669 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -1671,7 +1671,7 @@ ahc_devlimited_syncrate(struct ahc_softc
 		transinfo = &tinfo->goal;
 	*ppr_options &= transinfo->ppr_options;
 	if (transinfo->width = MSG_EXT_WDTR_BUS_8_BIT) {
-		maxsync = MAX(maxsync, AHC_SYNCRATE_ULTRA2);
+		maxsync = max(maxsync, AHC_SYNCRATE_ULTRA2);
 		*ppr_options &= ~MSG_EXT_PPR_DT_REQ;
 	}
 	if (transinfo->period = 0) {
@@ -1679,7 +1679,7 @@ ahc_devlimited_syncrate(struct ahc_softc
 		*ppr_options = 0;
 		return (NULL);
 	}
-	*period = MAX(*period, transinfo->period);
+	*period = max(*period, transinfo->period);
 	return (ahc_find_syncrate(ahc, period, ppr_options, maxsync));
 }
 
@@ -1804,12 +1804,12 @@ ahc_validate_offset(struct ahc_softc *ah
 		else
 			maxoffset = MAX_OFFSET_8BIT;
 	}
-	*offset = MIN(*offset, maxoffset);
+	*offset = min(*offset, maxoffset);
 	if (tinfo != NULL) {
 		if (role = ROLE_TARGET)
-			*offset = MIN(*offset, tinfo->user.offset);
+			*offset = min(*offset, tinfo->user.offset);
 		else
-			*offset = MIN(*offset, tinfo->goal.offset);
+			*offset = min(*offset, tinfo->goal.offset);
 	}
 }
 
@@ -1835,9 +1835,9 @@ ahc_validate_width(struct ahc_softc *ahc
 	}
 	if (tinfo != NULL) {
 		if (role = ROLE_TARGET)
-			*bus_width = MIN(tinfo->user.width, *bus_width);
+			*bus_width = min(tinfo->user.width, *bus_width);
 		else
-			*bus_width = MIN(tinfo->goal.width, *bus_width);
+			*bus_width = min(tinfo->goal.width, *bus_width);
 	}
 }
 
@@ -4406,7 +4406,7 @@ ahc_alloc_scbs(struct ahc_softc *ahc)
 	physaddr = sg_map->sg_physaddr;
 
 	newcount = (PAGE_SIZE / (AHC_NSEG * sizeof(struct ahc_dma_seg)));
-	newcount = MIN(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs));
+	newcount = min(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs));
 	for (i = 0; i < newcount; i++) {
 		struct scb_platform_data *pdata;
 #ifndef __linux__
@@ -6442,7 +6442,7 @@ ahc_download_instr(struct ahc_softc *ahc
 			if (skip_addr > i) {
 				int end_addr;
 
-				end_addr = MIN(address, skip_addr);
+				end_addr = min(address, skip_addr);
 				address_offset += end_addr - i;
 				i = skip_addr;
 			} else {
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index aa4be8a..8d2c467 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1875,7 +1875,7 @@ ahc_linux_handle_scsi_status(struct ahc_
 		if (scb->flags & SCB_SENSE) {
 			u_int sense_size;
 
-			sense_size = MIN(sizeof(struct scsi_sense_data)
+			sense_size = min(sizeof(struct scsi_sense_data)
 				       - ahc_get_sense_residual(scb),
 					 sizeof(cmd->sense_buffer));
 			memcpy(cmd->sense_buffer,
diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h
index f46c382..8264f55 100644
--- a/drivers/scsi/ips.h
+++ b/drivers/scsi/ips.h
@@ -120,10 +120,6 @@ #include <linux/version.h>
       #define MDELAY mdelay
    #endif
 
-   #ifndef min
-      #define min(x,y) ((x) < (y) ? x : y)
-   #endif
-   
    #ifndef __iomem       /* For clean compiles in earlier kernels without __iomem annotations */
       #define __iomem
    #endif
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [KJ] [PATCH] Use standard min/max macros [3/3]
  2006-07-31 22:13 [KJ] [PATCH] Use standard min/max macros [1/3] Clément Stenac
  2006-07-31 22:25 ` [KJ] [PATCH] Use standard min/max macros [2/3] Clément Stenac
@ 2006-07-31 22:26 ` Clément Stenac
  2006-08-01  1:55 ` Alexey Dobriyan
  2006-08-02 19:57 ` Clément Stenac
  3 siblings, 0 replies; 5+ messages in thread
From: Clément Stenac @ 2006-07-31 22:26 UTC (permalink / raw)
  To: kernel-janitors

Remove some custom type-unsafe MIN/MAX macros in favor of type-checking
min/max from kernel.h

Signed-off-by: Clément Stenac <zorglub@diwi.org>
---

diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c
index 40f0bee..ea8c8a5 100644
--- a/drivers/acpi/executer/exfldio.c
+++ b/drivers/acpi/executer/exfldio.c
@@ -752,7 +752,7 @@ acpi_ex_extract_from_field(union acpi_op
 		/* Write merged datum to target buffer */
 
 		ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum,
-			    ACPI_MIN(obj_desc->common_field.access_byte_width,
+			         min(obj_desc->common_field.access_byte_width,
 				     buffer_length - buffer_offset));
 
 		buffer_offset += obj_desc->common_field.access_byte_width;
@@ -771,7 +771,7 @@ acpi_ex_extract_from_field(union acpi_op
 	/* Write the last datum to the buffer */
 
 	ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum,
-		    ACPI_MIN(obj_desc->common_field.access_byte_width,
+		         min(obj_desc->common_field.access_byte_width,
 			     buffer_length - buffer_offset));
 
 	return_ACPI_STATUS(AE_OK);
@@ -850,7 +850,7 @@ acpi_ex_insert_into_field(union acpi_ope
 	/* Get initial Datum from the input buffer */
 
 	ACPI_MEMCPY(&raw_datum, buffer,
-		    ACPI_MIN(obj_desc->common_field.access_byte_width,
+		         min(obj_desc->common_field.access_byte_width,
 			     buffer_length - buffer_offset));
 
 	merged_datum @@ -903,7 +903,7 @@ acpi_ex_insert_into_field(union acpi_ope
 
 		buffer_offset += obj_desc->common_field.access_byte_width;
 		ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset,
-			    ACPI_MIN(obj_desc->common_field.access_byte_width,
+			         min(obj_desc->common_field.access_byte_width,
 				     buffer_length - buffer_offset));
 		merged_datum | 		    raw_datum << obj_desc->common_field.start_field_bit_offset;
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 84dfc42..15cd662 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -627,8 +627,6 @@ static unsigned int	stli_baudrates[] = {
 /*
  *	Define some handy local macros...
  */
-#undef MIN
-#define	MIN(a,b)	(((a) <= (b)) ? (a) : (b))
 
 #undef	TOLOWER
 #define	TOLOWER(x)	((((x) >= 'A') && ((x) <= 'Z')) ? ((x) + 0x20) : (x))
@@ -1455,12 +1453,12 @@ static int stli_write(struct tty_struct 
 		stlen = len;
 	}
 
-	len = MIN(len, count);
+	len = min(len, count);
 	count = 0;
 	shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->txoffset);
 
 	while (len > 0) {
-		stlen = MIN(len, stlen);
+		stlen = min(len, stlen);
 		memcpy_toio(shbuf + head, chbuf, stlen);
 		chbuf += stlen;
 		len -= stlen;
@@ -1574,13 +1572,13 @@ static void stli_flushchars(struct tty_s
 		stlen = len;
 	}
 
-	len = MIN(len, cooksize);
+	len = min(len, cooksize);
 	count = 0;
 	shbuf = (char *) EBRDGETMEMPTR(brdp, portp->txoffset);
 	buf = stli_txcookbuf;
 
 	while (len > 0) {
-		stlen = MIN(len, stlen);
+		stlen = min(len, stlen);
 		memcpy_toio(shbuf + head, buf, stlen);
 		buf += stlen;
 		len -= stlen;
@@ -2416,7 +2414,7 @@ static void stli_read(stlibrd_t *brdp, s
 	while (len > 0) {
 		unsigned char *cptr;
 
-		stlen = MIN(len, stlen);
+		stlen = min(len, stlen);
 		tty_prepare_flip_string(tty, &cptr, stlen);
 		memcpy_fromio(cptr, shbuf + tail, stlen);
 		len -= stlen;
@@ -4219,7 +4217,7 @@ static ssize_t stli_memread(struct file 
 	if (off >= brdp->memsize || off + count < off)
 		return 0;
 
-	size = MIN(count, (brdp->memsize - off));
+	size = min(count, (brdp->memsize - off));
 
 	/*
 	 *	Copy the data a page at a time
@@ -4233,8 +4231,8 @@ static ssize_t stli_memread(struct file 
 		spin_lock_irqsave(&brd_lock, flags);
 		EBRDENABLE(brdp);
 		memptr = (void *) EBRDGETMEMPTR(brdp, off);
-		n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize)));
-		n = MIN(n, PAGE_SIZE);
+		n = min(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize)));
+		n = min(n, PAGE_SIZE);
 		memcpy_fromio(p, memptr, n);
 		EBRDDISABLE(brdp);
 		spin_unlock_irqrestore(&brd_lock, flags);
@@ -4285,7 +4283,7 @@ static ssize_t stli_memwrite(struct file
 		return 0;
 
 	chbuf = (char __user *) buf;
-	size = MIN(count, (brdp->memsize - off));
+	size = min(count, (brdp->memsize - off));
 
 	/*
 	 *	Copy the data a page at a time
@@ -4296,8 +4294,8 @@ static ssize_t stli_memwrite(struct file
 		return -ENOMEM;
 
 	while (size > 0) {
-		n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize)));
-		n = MIN(n, PAGE_SIZE);
+		n = min(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize)));
+		n = min(n, PAGE_SIZE);
 		if (copy_from_user(p, chbuf, n)) {
 			if (count = 0)
 				count = -EFAULT;
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 3beb220..2e3a326 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -445,9 +445,6 @@ static unsigned int	stl_baudrates[] = {
 /*
  *	Define some handy local macros...
  */
-#undef	MIN
-#define	MIN(a,b)	(((a) <= (b)) ? (a) : (b))
-
 #undef	TOLOWER
 #define	TOLOWER(x)	((((x) >= 'A') && ((x) <= 'Z')) ? ((x) + 0x20) : (x))
 
@@ -1201,10 +1198,10 @@ #endif
 		stlen = len;
 	}
 
-	len = MIN(len, count);
+	len = min(len, count);
 	count = 0;
 	while (len > 0) {
-		stlen = MIN(len, stlen);
+		stlen = min(len, stlen);
 		memcpy(head, chbuf, stlen);
 		len -= stlen;
 		chbuf += stlen;
@@ -3936,9 +3933,9 @@ #endif
 		}
 		outb(srer, (ioaddr + EREG_DATA));
 	} else {
-		len = MIN(len, CD1400_TXFIFOSIZE);
+		len = min(len, CD1400_TXFIFOSIZE);
 		portp->stats.txtotal += len;
-		stlen = MIN(len, ((portp->tx.buf + STL_TXBUFSIZE) - tail));
+		stlen = min(len, ((portp->tx.buf + STL_TXBUFSIZE) - tail));
 		outb((TDR + portp->uartaddr), ioaddr);
 		outsb((ioaddr + EREG_DATA), tail, stlen);
 		len -= stlen;
@@ -3993,13 +3990,13 @@ #endif
 		outb((RDCR + portp->uartaddr), ioaddr);
 		len = inb(ioaddr + EREG_DATA);
 		if (tty = NULL || (buflen = tty_buffer_request_room(tty, len)) = 0) {
-			len = MIN(len, sizeof(stl_unwanted));
+			len = min(len, sizeof(stl_unwanted));
 			outb((RDSR + portp->uartaddr), ioaddr);
 			insb((ioaddr + EREG_DATA), &stl_unwanted[0], len);
 			portp->stats.rxlost += len;
 			portp->stats.rxtotal += len;
 		} else {
-			len = MIN(len, buflen);
+			len = min(len, buflen);
 			if (len > 0) {
 				unsigned char *ptr;
 				outb((RDSR + portp->uartaddr), ioaddr);
@@ -4897,9 +4894,9 @@ #endif
 			outb(mr0, (ioaddr + XP_DATA));
 		}
 	} else {
-		len = MIN(len, SC26198_TXFIFOSIZE);
+		len = min(len, SC26198_TXFIFOSIZE);
 		portp->stats.txtotal += len;
-		stlen = MIN(len, ((portp->tx.buf + STL_TXBUFSIZE) - tail));
+		stlen = min(len, ((portp->tx.buf + STL_TXBUFSIZE) - tail));
 		outb(GTXFIFO, (ioaddr + XP_ADDR));
 		outsb((ioaddr + XP_DATA), tail, stlen);
 		len -= stlen;
@@ -4942,13 +4939,13 @@ #endif
 
 	if ((iack & IVR_TYPEMASK) = IVR_RXDATA) {
 		if (tty = NULL || (buflen = tty_buffer_request_room(tty, len)) = 0) {
-			len = MIN(len, sizeof(stl_unwanted));
+			len = min(len, sizeof(stl_unwanted));
 			outb(GRXFIFO, (ioaddr + XP_ADDR));
 			insb((ioaddr + XP_DATA), &stl_unwanted[0], len);
 			portp->stats.rxlost += len;
 			portp->stats.rxtotal += len;
 		} else {
-			len = MIN(len, buflen);
+			len = min(len, buflen);
 			if (len > 0) {
 				unsigned char *ptr;
 				outb(GRXFIFO, (ioaddr + XP_ADDR));
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 912c03e..c585c6f 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -590,8 +590,6 @@ EXPORT_SYMBOL(pccard_get_next_tuple);
 
 /*==================================*/
 
-#define _MIN(a, b)		(((a) < (b)) ? (a) : (b))
-
 int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple)
 {
     u_int len;
@@ -607,7 +605,7 @@ int pccard_get_tuple_data(struct pcmcia_
 	return CS_SUCCESS;
     read_cis_cache(s, SPACE(tuple->Flags),
 		   tuple->CISOffset + tuple->TupleOffset,
-		   _MIN(len, tuple->TupleDataMax), tuple->TupleData);
+		   min(len, tuple->TupleDataMax), tuple->TupleData);
     return CS_SUCCESS;
 }
 EXPORT_SYMBOL(pccard_get_tuple_data);
diff --git a/drivers/s390/crypto/z90common.h b/drivers/s390/crypto/z90common.h
index dbbcda3..569120e 100644
--- a/drivers/s390/crypto/z90common.h
+++ b/drivers/s390/crypto/z90common.h
@@ -160,7 +160,6 @@ #else
 #define PDEBUG(fmt, args...) do {} while (0)
 #endif
 
-#define UMIN(a,b) ((a) < (b) ? (a) : (b))
 #define IS_EVEN(x) ((x) = (2 * ((x) / 2)))
 
 #endif
diff --git a/drivers/s390/crypto/z90main.c b/drivers/s390/crypto/z90main.c
index b2f20ab..c347995 100644
--- a/drivers/s390/crypto/z90main.c
+++ b/drivers/s390/crypto/z90main.c
@@ -2119,7 +2119,7 @@ #define LBUFSIZE 1200
 	if (count <= 0)
 		return 0;
 
-	local_count = UMIN((unsigned int)count, LBUFSIZE-1);
+	local_count = min((unsigned int)count, LBUFSIZE-1);
 
 	if (copy_from_user(lbuf, buffer, local_count) != 0) {
 		kfree(lbuf);
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index 192fa09..3caf144 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -54,7 +54,6 @@ #define ACPI_HIBYTE(l)                  
 
 #define ACPI_SET_BIT(target,bit)        ((target) |= (bit))
 #define ACPI_CLEAR_BIT(target,bit)      ((target) &= ~(bit))
-#define ACPI_MIN(a,b)                   (((a)<(b))?(a):(b))
 
 /* Size calculation */
 

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [KJ] [PATCH] Use standard min/max macros [3/3]
  2006-07-31 22:13 [KJ] [PATCH] Use standard min/max macros [1/3] Clément Stenac
  2006-07-31 22:25 ` [KJ] [PATCH] Use standard min/max macros [2/3] Clément Stenac
  2006-07-31 22:26 ` [KJ] [PATCH] Use standard min/max macros [3/3] Clément Stenac
@ 2006-08-01  1:55 ` Alexey Dobriyan
  2006-08-02 19:57 ` Clément Stenac
  3 siblings, 0 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2006-08-01  1:55 UTC (permalink / raw)
  To: kernel-janitors

On Tue, Aug 01, 2006 at 12:26:01AM +0200, Clément Stenac wrote:
> Remove some custom type-unsafe MIN/MAX macros in favor of type-checking
> min/max from kernel.h

> --- a/drivers/acpi/executer/exfldio.c
> +++ b/drivers/acpi/executer/exfldio.c
> @@ -752,7 +752,7 @@ acpi_ex_extract_from_field(union acpi_op
>  		/* Write merged datum to target buffer */
>  
>  		ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum,
> -			    ACPI_MIN(obj_desc->common_field.access_byte_width,
> +			         min(obj_desc->common_field.access_byte_width,
>  				     buffer_length - buffer_offset));
>  
>  		buffer_offset += obj_desc->common_field.access_byte_width;
> @@ -771,7 +771,7 @@ acpi_ex_extract_from_field(union acpi_op
>  	/* Write the last datum to the buffer */
>  
>  	ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum,
> -		    ACPI_MIN(obj_desc->common_field.access_byte_width,
> +		         min(obj_desc->common_field.access_byte_width,
>  			     buffer_length - buffer_offset));
>  
>  	return_ACPI_STATUS(AE_OK);
> @@ -850,7 +850,7 @@ acpi_ex_insert_into_field(union acpi_ope
>  	/* Get initial Datum from the input buffer */
>  
>  	ACPI_MEMCPY(&raw_datum, buffer,
> -		    ACPI_MIN(obj_desc->common_field.access_byte_width,
> +		         min(obj_desc->common_field.access_byte_width,
>  			     buffer_length - buffer_offset));
>  
>  	merged_datum > @@ -903,7 +903,7 @@ acpi_ex_insert_into_field(union acpi_ope
>  
>  		buffer_offset += obj_desc->common_field.access_byte_width;
>  		ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset,
> -			    ACPI_MIN(obj_desc->common_field.access_byte_width,
> +			         min(obj_desc->common_field.access_byte_width,
>  				     buffer_length - buffer_offset));
>  		merged_datum |>  		    raw_datum << obj_desc->common_field.start_field_bit_offset;

ACPI wants to keep code shared between multiple OSms so save this part
for better day. :-(

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [KJ] [PATCH] Use standard min/max macros [3/3]
  2006-07-31 22:13 [KJ] [PATCH] Use standard min/max macros [1/3] Clément Stenac
                   ` (2 preceding siblings ...)
  2006-08-01  1:55 ` Alexey Dobriyan
@ 2006-08-02 19:57 ` Clément Stenac
  3 siblings, 0 replies; 5+ messages in thread
From: Clément Stenac @ 2006-08-02 19:57 UTC (permalink / raw)
  To: kernel-janitors

Remove some custom type-unsafe MIN/MAX macros in favor of type-checking
min/max from kernel.h

Signed-off-by: Clément Stenac <zorglub@diwi.org>
---
This version removes the ACPI part so as to keep it totally
OS-independent.

Should I copy the macro itself or just let it as such ?

diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 84dfc42..15cd662 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -627,8 +627,6 @@ static unsigned int	stli_baudrates[] = {
 /*
  *	Define some handy local macros...
  */
-#undef MIN
-#define	MIN(a,b)	(((a) <= (b)) ? (a) : (b))
 
 #undef	TOLOWER
 #define	TOLOWER(x)	((((x) >= 'A') && ((x) <= 'Z')) ? ((x) + 0x20) : (x))
@@ -1455,12 +1453,12 @@ static int stli_write(struct tty_struct 
 		stlen = len;
 	}
 
-	len = MIN(len, count);
+	len = min(len, count);
 	count = 0;
 	shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->txoffset);
 
 	while (len > 0) {
-		stlen = MIN(len, stlen);
+		stlen = min(len, stlen);
 		memcpy_toio(shbuf + head, chbuf, stlen);
 		chbuf += stlen;
 		len -= stlen;
@@ -1574,13 +1572,13 @@ static void stli_flushchars(struct tty_s
 		stlen = len;
 	}
 
-	len = MIN(len, cooksize);
+	len = min(len, cooksize);
 	count = 0;
 	shbuf = (char *) EBRDGETMEMPTR(brdp, portp->txoffset);
 	buf = stli_txcookbuf;
 
 	while (len > 0) {
-		stlen = MIN(len, stlen);
+		stlen = min(len, stlen);
 		memcpy_toio(shbuf + head, buf, stlen);
 		buf += stlen;
 		len -= stlen;
@@ -2416,7 +2414,7 @@ static void stli_read(stlibrd_t *brdp, s
 	while (len > 0) {
 		unsigned char *cptr;
 
-		stlen = MIN(len, stlen);
+		stlen = min(len, stlen);
 		tty_prepare_flip_string(tty, &cptr, stlen);
 		memcpy_fromio(cptr, shbuf + tail, stlen);
 		len -= stlen;
@@ -4219,7 +4217,7 @@ static ssize_t stli_memread(struct file 
 	if (off >= brdp->memsize || off + count < off)
 		return 0;
 
-	size = MIN(count, (brdp->memsize - off));
+	size = min(count, (brdp->memsize - off));
 
 	/*
 	 *	Copy the data a page at a time
@@ -4233,8 +4231,8 @@ static ssize_t stli_memread(struct file 
 		spin_lock_irqsave(&brd_lock, flags);
 		EBRDENABLE(brdp);
 		memptr = (void *) EBRDGETMEMPTR(brdp, off);
-		n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize)));
-		n = MIN(n, PAGE_SIZE);
+		n = min(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize)));
+		n = min(n, PAGE_SIZE);
 		memcpy_fromio(p, memptr, n);
 		EBRDDISABLE(brdp);
 		spin_unlock_irqrestore(&brd_lock, flags);
@@ -4285,7 +4283,7 @@ static ssize_t stli_memwrite(struct file
 		return 0;
 
 	chbuf = (char __user *) buf;
-	size = MIN(count, (brdp->memsize - off));
+	size = min(count, (brdp->memsize - off));
 
 	/*
 	 *	Copy the data a page at a time
@@ -4296,8 +4294,8 @@ static ssize_t stli_memwrite(struct file
 		return -ENOMEM;
 
 	while (size > 0) {
-		n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize)));
-		n = MIN(n, PAGE_SIZE);
+		n = min(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize)));
+		n = min(n, PAGE_SIZE);
 		if (copy_from_user(p, chbuf, n)) {
 			if (count = 0)
 				count = -EFAULT;
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 3beb220..2e3a326 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -445,9 +445,6 @@ static unsigned int	stl_baudrates[] = {
 /*
  *	Define some handy local macros...
  */
-#undef	MIN
-#define	MIN(a,b)	(((a) <= (b)) ? (a) : (b))
-
 #undef	TOLOWER
 #define	TOLOWER(x)	((((x) >= 'A') && ((x) <= 'Z')) ? ((x) + 0x20) : (x))
 
@@ -1201,10 +1198,10 @@ #endif
 		stlen = len;
 	}
 
-	len = MIN(len, count);
+	len = min(len, count);
 	count = 0;
 	while (len > 0) {
-		stlen = MIN(len, stlen);
+		stlen = min(len, stlen);
 		memcpy(head, chbuf, stlen);
 		len -= stlen;
 		chbuf += stlen;
@@ -3936,9 +3933,9 @@ #endif
 		}
 		outb(srer, (ioaddr + EREG_DATA));
 	} else {
-		len = MIN(len, CD1400_TXFIFOSIZE);
+		len = min(len, CD1400_TXFIFOSIZE);
 		portp->stats.txtotal += len;
-		stlen = MIN(len, ((portp->tx.buf + STL_TXBUFSIZE) - tail));
+		stlen = min(len, ((portp->tx.buf + STL_TXBUFSIZE) - tail));
 		outb((TDR + portp->uartaddr), ioaddr);
 		outsb((ioaddr + EREG_DATA), tail, stlen);
 		len -= stlen;
@@ -3993,13 +3990,13 @@ #endif
 		outb((RDCR + portp->uartaddr), ioaddr);
 		len = inb(ioaddr + EREG_DATA);
 		if (tty = NULL || (buflen = tty_buffer_request_room(tty, len)) = 0) {
-			len = MIN(len, sizeof(stl_unwanted));
+			len = min(len, sizeof(stl_unwanted));
 			outb((RDSR + portp->uartaddr), ioaddr);
 			insb((ioaddr + EREG_DATA), &stl_unwanted[0], len);
 			portp->stats.rxlost += len;
 			portp->stats.rxtotal += len;
 		} else {
-			len = MIN(len, buflen);
+			len = min(len, buflen);
 			if (len > 0) {
 				unsigned char *ptr;
 				outb((RDSR + portp->uartaddr), ioaddr);
@@ -4897,9 +4894,9 @@ #endif
 			outb(mr0, (ioaddr + XP_DATA));
 		}
 	} else {
-		len = MIN(len, SC26198_TXFIFOSIZE);
+		len = min(len, SC26198_TXFIFOSIZE);
 		portp->stats.txtotal += len;
-		stlen = MIN(len, ((portp->tx.buf + STL_TXBUFSIZE) - tail));
+		stlen = min(len, ((portp->tx.buf + STL_TXBUFSIZE) - tail));
 		outb(GTXFIFO, (ioaddr + XP_ADDR));
 		outsb((ioaddr + XP_DATA), tail, stlen);
 		len -= stlen;
@@ -4942,13 +4939,13 @@ #endif
 
 	if ((iack & IVR_TYPEMASK) = IVR_RXDATA) {
 		if (tty = NULL || (buflen = tty_buffer_request_room(tty, len)) = 0) {
-			len = MIN(len, sizeof(stl_unwanted));
+			len = min(len, sizeof(stl_unwanted));
 			outb(GRXFIFO, (ioaddr + XP_ADDR));
 			insb((ioaddr + XP_DATA), &stl_unwanted[0], len);
 			portp->stats.rxlost += len;
 			portp->stats.rxtotal += len;
 		} else {
-			len = MIN(len, buflen);
+			len = min(len, buflen);
 			if (len > 0) {
 				unsigned char *ptr;
 				outb(GRXFIFO, (ioaddr + XP_ADDR));
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 912c03e..c585c6f 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -590,8 +590,6 @@ EXPORT_SYMBOL(pccard_get_next_tuple);
 
 /*==================================*/
 
-#define _MIN(a, b)		(((a) < (b)) ? (a) : (b))
-
 int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple)
 {
     u_int len;
@@ -607,7 +605,7 @@ int pccard_get_tuple_data(struct pcmcia_
 	return CS_SUCCESS;
     read_cis_cache(s, SPACE(tuple->Flags),
 		   tuple->CISOffset + tuple->TupleOffset,
-		   _MIN(len, tuple->TupleDataMax), tuple->TupleData);
+		   min(len, tuple->TupleDataMax), tuple->TupleData);
     return CS_SUCCESS;
 }
 EXPORT_SYMBOL(pccard_get_tuple_data);
diff --git a/drivers/s390/crypto/z90common.h b/drivers/s390/crypto/z90common.h
index dbbcda3..569120e 100644
--- a/drivers/s390/crypto/z90common.h
+++ b/drivers/s390/crypto/z90common.h
@@ -160,7 +160,6 @@ #else
 #define PDEBUG(fmt, args...) do {} while (0)
 #endif
 
-#define UMIN(a,b) ((a) < (b) ? (a) : (b))
 #define IS_EVEN(x) ((x) = (2 * ((x) / 2)))
 
 #endif
diff --git a/drivers/s390/crypto/z90main.c b/drivers/s390/crypto/z90main.c
index b2f20ab..c347995 100644
--- a/drivers/s390/crypto/z90main.c
+++ b/drivers/s390/crypto/z90main.c
@@ -2119,7 +2119,7 @@ #define LBUFSIZE 1200
 	if (count <= 0)
 		return 0;
 
-	local_count = UMIN((unsigned int)count, LBUFSIZE-1);
+	local_count = min((unsigned int)count, LBUFSIZE-1);
 
 	if (copy_from_user(lbuf, buffer, local_count) != 0) {
 		kfree(lbuf);
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-08-02 19:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31 22:13 [KJ] [PATCH] Use standard min/max macros [1/3] Clément Stenac
2006-07-31 22:25 ` [KJ] [PATCH] Use standard min/max macros [2/3] Clément Stenac
2006-07-31 22:26 ` [KJ] [PATCH] Use standard min/max macros [3/3] Clément Stenac
2006-08-01  1:55 ` Alexey Dobriyan
2006-08-02 19:57 ` Clément Stenac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.