Abolish MIN, MAX, MIN3, MAX
Subsystems (6)
v2 cover Abolish MIN, MAX, MIN3, MAX
Changes in v2:
- Rebase on commit 9170818a4e004
Masahiro Yamada (2):
cosmetic: replace MIN, MAX with min, max
common.h: remove MIN, MAX, MIN3, MAX3 macros
arch/arm/cpu/arm1176/tnetv107x/clock.c | 2 +- arch/arm/cpu/armv7/mx6/ddr.c | 40 +++++++++++++++++----------------- arch/x86/lib/physmem.c | 4 ++-- board/freescale/common/ics307_clk.c | 2 +- drivers/dma/fsl_dma.c | 2 +- drivers/i2c/ihs_i2c.c | 4 ++-- drivers/mmc/fsl_esdhc.c | 2 +- drivers/serial/usbtty.c | 4 ++-- drivers/usb/gadget/designware_udc.c | 4 ++-- drivers/usb/gadget/ep0.c | 2 +- drivers/usb/gadget/mpc8xx_udc.c | 4 ++-- drivers/usb/gadget/pxa27x_udc.c | 2 +- fs/zfs/zfs.c | 6 ++--- include/common.h | 6 ----- 14 files changed, 39 insertions(+), 45 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/2 cosmetic: replace MIN, MAX with min, max
The macro MIN, MAX is defined as the aliase of min, max, respectively.
---
Changes in v2:
- Rebase on commit 9170818a4e004
arch/arm/cpu/arm1176/tnetv107x/clock.c | 2 +- arch/arm/cpu/armv7/mx6/ddr.c | 40 +++++++++++++++++----------------- arch/x86/lib/physmem.c | 4 ++-- board/freescale/common/ics307_clk.c | 2 +- drivers/dma/fsl_dma.c | 2 +- drivers/i2c/ihs_i2c.c | 4 ++-- drivers/mmc/fsl_esdhc.c | 2 +- drivers/serial/usbtty.c | 4 ++-- drivers/usb/gadget/designware_udc.c | 4 ++-- drivers/usb/gadget/ep0.c | 2 +- drivers/usb/gadget/mpc8xx_udc.c | 4 ++-- drivers/usb/gadget/pxa27x_udc.c | 2 +- fs/zfs/zfs.c | 6 ++--- 13 files changed, 39 insertions(+), 39 deletions(-)
arch/arm/cpu/arm1176/tnetv107x/clock.c +1 -1
@@ -362,7 +362,7 @@ static void init_pll(const struct pll_init_data *data)pllctl_reg_write (data->pll, ctl, tmp); mult = data->pll_freq / fpll; -for (mult =MAX (mult,1 ); mult <=MAX_MULT ; mult++) { +for (mult =max (mult,1 ); mult <=MAX_MULT ; mult++) { div = (fpll * mult) / data->pll_freq;if (div <1 || div >MAX_DIV )continue ;
arch/arm/cpu/armv7/mx6/ddr.c +20 -20
@@ -247,47 +247,47 @@ void mx6_dram_cfg(const struct mx6_ddr_sysinfo *sysinfo,switch (ddr3_cfg->mem_speed) {case 800 : - txp =DIV_ROUND_UP (MAX (3 * clkper,7500 ), clkper) -1 ; - tcke =DIV_ROUND_UP (MAX (3 * clkper,7500 ), clkper) -1 ; + txp =DIV_ROUND_UP (max (3 * clkper,7500 ), clkper) -1 ; + tcke =DIV_ROUND_UP (max (3 * clkper,7500 ), clkper) -1 ;if (ddr3_cfg->pagesz ==1 ) { tfaw =DIV_ROUND_UP (40000 , clkper) -1 ; - trrd =DIV_ROUND_UP (MAX (4 * clkper,10000 ), clkper) -1 ; + trrd =DIV_ROUND_UP (max (4 * clkper,10000 ), clkper) -1 ; }else { tfaw =DIV_ROUND_UP (50000 , clkper) -1 ; - trrd =DIV_ROUND_UP (MAX (4 * clkper,10000 ), clkper) -1 ; + trrd =DIV_ROUND_UP (max (4 * clkper,10000 ), clkper) -1 ; }break ;case 1066 : - txp =DIV_ROUND_UP (MAX (3 * clkper,7500 ), clkper) -1 ; - tcke =DIV_ROUND_UP (MAX (3 * clkper,5625 ), clkper) -1 ; + txp =DIV_ROUND_UP (max (3 * clkper,7500 ), clkper) -1 ; + tcke =DIV_ROUND_UP (max (3 * clkper,5625 ), clkper) -1 ;if (ddr3_cfg->pagesz ==1 ) { tfaw =DIV_ROUND_UP (37500 , clkper) -1 ; - trrd =DIV_ROUND_UP (MAX (4 * clkper,7500 ), clkper) -1 ; + trrd =DIV_ROUND_UP (max (4 * clkper,7500 ), clkper) -1 ; }else { tfaw =DIV_ROUND_UP (50000 , clkper) -1 ; - trrd =DIV_ROUND_UP (MAX (4 * clkper,10000 ), clkper) -1 ; + trrd =DIV_ROUND_UP (max (4 * clkper,10000 ), clkper) -1 ; }break ;case 1333 : - txp =DIV_ROUND_UP (MAX (3 * clkper,6000 ), clkper) -1 ; - tcke =DIV_ROUND_UP (MAX (3 * clkper,5625 ), clkper) -1 ; + txp =DIV_ROUND_UP (max (3 * clkper,6000 ), clkper) -1 ; + tcke =DIV_ROUND_UP (max (3 * clkper,5625 ), clkper) -1 ;if (ddr3_cfg->pagesz ==1 ) { tfaw =DIV_ROUND_UP (30000 , clkper) -1 ; - trrd =DIV_ROUND_UP (MAX (4 * clkper,6000 ), clkper) -1 ; + trrd =DIV_ROUND_UP (max (4 * clkper,6000 ), clkper) -1 ; }else { tfaw =DIV_ROUND_UP (45000 , clkper) -1 ; - trrd =DIV_ROUND_UP (MAX (4 * clkper,7500 ), clkper) -1 ; + trrd =DIV_ROUND_UP (max (4 * clkper,7500 ), clkper) -1 ; }break ;case 1600 : - txp =DIV_ROUND_UP (MAX (3 * clkper,6000 ), clkper) -1 ; - tcke =DIV_ROUND_UP (MAX (3 * clkper,5000 ), clkper) -1 ; + txp =DIV_ROUND_UP (max (3 * clkper,6000 ), clkper) -1 ; + tcke =DIV_ROUND_UP (max (3 * clkper,5000 ), clkper) -1 ;if (ddr3_cfg->pagesz ==1 ) { tfaw =DIV_ROUND_UP (30000 , clkper) -1 ; - trrd =DIV_ROUND_UP (MAX (4 * clkper,6000 ), clkper) -1 ; + trrd =DIV_ROUND_UP (max (4 * clkper,6000 ), clkper) -1 ; }else { tfaw =DIV_ROUND_UP (40000 , clkper) -1 ; - trrd =DIV_ROUND_UP (MAX (4 * clkper,7500 ), clkper) -1 ; + trrd =DIV_ROUND_UP (max (4 * clkper,7500 ), clkper) -1 ; }break ;default :
@@ -295,18 +295,18 @@ void mx6_dram_cfg(const struct mx6_ddr_sysinfo *sysinfo,hang ();break ; } - txpdll =DIV_ROUND_UP (MAX (10 * clkper,24000 ), clkper) -1 ; - tcksre =DIV_ROUND_UP (MAX (5 * clkper,10000 ), clkper); + txpdll =DIV_ROUND_UP (max (10 * clkper,24000 ), clkper) -1 ; + tcksre =DIV_ROUND_UP (max (5 * clkper,10000 ), clkper); taonpd =DIV_ROUND_UP (2000 , clkper) -1 ; tcksrx = tcksre; taofpd = taonpd; twr =DIV_ROUND_UP (15000 , clkper) -1 ; - tmrd =DIV_ROUND_UP (MAX (12 * clkper,15000 ), clkper) -1 ; + tmrd =DIV_ROUND_UP (max (12 * clkper,15000 ), clkper) -1 ; trc =DIV_ROUND_UP (ddr3_cfg->trcmin, clkper /10 ) -1 ; tras =DIV_ROUND_UP (ddr3_cfg->trasmin, clkper /10 ) -1 ; tcl =DIV_ROUND_UP (ddr3_cfg->trcd, clkper /10 ) -3 ; trp =DIV_ROUND_UP (ddr3_cfg->trcd, clkper /10 ) -1 ; - twtr =ROUND (MAX (4 * clkper,7500 ) / clkper,1 ) -1 ; + twtr =ROUND (max (4 * clkper,7500 ) / clkper,1 ) -1 ; trcd = trp; trtp = twtr; cs0_end =4 * sysinfo->cs_density -1 ;
arch/x86/lib/physmem.c +2 -2
@@ -189,7 +189,7 @@ phys_addr_t arch_phys_memset(phys_addr_t start, int c, phys_size_t size)/* Handle memory below 4GB. */ if (start <= max_addr) { -phys_size_t low_size =MIN (max_addr +1 - start, size); +phys_size_t low_size =min (max_addr +1 - start, size);void *start_ptr = (void *)(uintptr_t )start;assert (((phys_addr_t )(uintptr_t )start) == start);
@@ -208,7 +208,7 @@ phys_addr_t arch_phys_memset(phys_addr_t start, int c, phys_size_t size)/* Handle the first partial page. */ if (offset) {phys_addr_t end = -MIN (map_addr +LARGE_PAGE_SIZE , start + size); +min (map_addr +LARGE_PAGE_SIZE , start + size);phys_size_t cur_size = end - start;x86_phys_memset_page (map_addr, offset, c, cur_size); size -= cur_size;
board/freescale/common/ics307_clk.c +1 -1
@@ -67,7 +67,7 @@ unsigned long ics307_sysclk_calculator(unsigned long out_freq)continue ;/* Calculate the temp out frequency */ tmp_out = input_freq *2 * vdw / (rdw * od *1000 ); - diff =MAX (out_freq, tmp_out) -MIN (out_freq, tmp_out); + diff =max (out_freq, tmp_out) -min (out_freq, tmp_out);/* * calculate the percent, the precision is 1/1000 * If greater than 1/1000, continue
drivers/dma/fsl_dma.c +1 -1
@@ -96,7 +96,7 @@ int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t count) {uint xfer_size;while (count) { - xfer_size =MIN (FSL_DMA_MAX_SIZE , count); + xfer_size =min (FSL_DMA_MAX_SIZE , count);out_dma32 (&dma->dar, (u32) (dest &0xFFFFFFFF ));out_dma32 (&dma->sar, (u32) (src &0xFFFFFFFF ));
drivers/i2c/ihs_i2c.c +2 -2
@@ -84,7 +84,7 @@ static int ihs_i2c_address(uchar chip, uint addr, int alen, bool hold_bus)int shift = (alen-1 ) *8 ;while (alen) { -int transfer =MIN (alen,2 ); +int transfer =min (alen,2 );uchar buf[2 ];bool is_last = alen <= transfer;
@@ -113,7 +113,7 @@ static int ihs_i2c_access(struct i2c_adapter *adap, uchar chip, uint addr,return 1 ;while (len) { -int transfer =MIN (len,2 ); +int transfer =min (len,2 );if (ihs_i2c_transfer (chip, buffer, transfer, read, len <= transfer))
drivers/mmc/fsl_esdhc.c +1 -1
@@ -610,7 +610,7 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg)#endif cfg->cfg.f_min =400000 ; - cfg->cfg.f_max =MIN (gd->arch.sdhc_clk,52000000 ); + cfg->cfg.f_max =min (gd->arch.sdhc_clk,52000000 ); cfg->cfg.b_max =CONFIG_SYS_MMC_MAX_BLK_COUNT ;
drivers/serial/usbtty.c +2 -2
@@ -475,7 +475,7 @@ static void __usbtty_puts (const char *str, int len)if (space) {write_buffer (&usbtty_output); - n =MIN (space,MIN (len, maxlen)); + n =min (space,min (len, maxlen));buf_push (&usbtty_output, str, n); str += n;
@@ -882,7 +882,7 @@ static int write_buffer (circbuf_t * buf) space_avail = current_urb->buffer_length - current_urb->actual_length; - popnum =MIN (space_avail, buf->size); + popnum =min (space_avail, buf->size);if (popnum ==0 )break ;
drivers/usb/gadget/designware_udc.c +2 -2
@@ -269,7 +269,7 @@ static void dw_write_noniso_tx_fifo(struct usb_endpoint_instanceUDCDBGA ("urb->buffer %p, buffer_length %d, actual_length %d" , urb->buffer, urb->buffer_length, urb->actual_length); - last =MIN (urb->actual_length - endpoint->sent, + last =min (urb->actual_length - endpoint->sent, endpoint->tx_packetSize);if (last) {
@@ -285,7 +285,7 @@ static void dw_write_noniso_tx_fifo(struct usb_endpoint_instance align = ((ulong )cp %sizeof (int ));if (align) - last =MIN (last,sizeof (int ) - align); + last =min (last,sizeof (int ) - align);UDCDBGA ("endpoint->sent %d, tx_packetSize %d, last %d" , endpoint->sent, endpoint->tx_packetSize, last);
drivers/usb/gadget/ep0.c +1 -1
@@ -315,7 +315,7 @@ static int ep0_get_descriptor (struct usb_device_instance *device,/*copy_config(urb, &report_descriptor->bData[0], report_descriptor->wLength, max); */ if (max - urb->actual_length >0 ) {int length = -MIN (report_descriptor->wLength, +min (report_descriptor->wLength, max - urb->actual_length);memcpy (urb->buffer + urb->actual_length, &report_descriptor->bData[0 ], length);
drivers/usb/gadget/mpc8xx_udc.c +2 -2
@@ -897,7 +897,7 @@ static int mpc8xx_udc_ep_tx (struct usb_endpoint_instance *epi) pkt_len = urb->actual_length - epi->sent;if (pkt_len > epi->tx_packetSize || pkt_len >EP_MAX_PKT ) { - pkt_len =MIN (epi->tx_packetSize,EP_MAX_PKT ); + pkt_len =min (epi->tx_packetSize,EP_MAX_PKT ); }for (x =0 ; x < pkt_len; x++) {
@@ -942,7 +942,7 @@ static int mpc8xx_udc_ep_tx (struct usb_endpoint_instance *epi)/* TX ACK : USB 2.0 8.7.2, Toggle PID, Advance TX */ epi->sent += pkt_len; - epi->last =MIN (urb->actual_length - epi->sent, epi->tx_packetSize); + epi->last =min (urb->actual_length - epi->sent, epi->tx_packetSize);TOGGLE_TX_PID (ep_ref[ep].pid);if (epi->sent >= epi->tx_urb->actual_length) {
drivers/usb/gadget/pxa27x_udc.c +1 -1
@@ -65,7 +65,7 @@ static int udc_write_urb(struct usb_endpoint_instance *endpoint)if (!urb || !urb->actual_length)return -1 ; - n =MIN (urb->actual_length - endpoint->sent, endpoint->tx_packetSize); + n =min (urb->actual_length - endpoint->sent, endpoint->tx_packetSize);if (n <=0 )return -1 ;
fs/zfs/zfs.c +3 -3
@@ -772,7 +772,7 @@ zap_leaf_array_equal(zap_leaf_phys_t *l, zfs_endian_t endian,while (bseen < array_len) {struct zap_leaf_array *la = &ZAP_LEAF_CHUNK (l, blksft, chunk).l_array; -int toread =MIN (array_len - bseen,ZAP_LEAF_ARRAY_BYTES ); +int toread =min (array_len - bseen,ZAP_LEAF_ARRAY_BYTES );if (chunk >=ZAP_LEAF_NUMCHUNKS (blksft))return 0 ;
@@ -794,7 +794,7 @@ zap_leaf_array_get(zap_leaf_phys_t *l, zfs_endian_t endian, int blksft,while (bseen < array_len) {struct zap_leaf_array *la = &ZAP_LEAF_CHUNK (l, blksft, chunk).l_array; -int toread =MIN (array_len - bseen,ZAP_LEAF_ARRAY_BYTES ); +int toread =min (array_len - bseen,ZAP_LEAF_ARRAY_BYTES );if (chunk >=ZAP_LEAF_NUMCHUNKS (blksft))/* Don't use errno because this error is to be ignored. */
@@ -2118,7 +2118,7 @@ zfs_read(zfs_file_t file, char *buf, uint64_t len) data->file_start = blkid * blksz; data->file_end = data->file_start + blksz; - movesize =MIN (length, data->file_end - (int ) file->offset - red); + movesize =min (length, data->file_end - (int )file->offset - red);memmove (buf, data->file_buf + file->offset + red - data->file_start, movesize);
Signature · 1 line
1.9.1
PATCH v2 1/2 cosmetic: replace MIN, MAX with min, max
Quoted 4 lines · Masahiro Yamada
The macro MIN, MAX is defined as the aliase of min, max, respectively.
Signed-off-by Masahiro Yamada <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140925/6ac20caf/attachment.pgp>
PATCH v2 2/2 common.h: remove MIN, MAX, MIN3, MAX3 macros
In reply to Masahiro YamadaNow MIN, MAX, MIN3, MAX are not used.
Going forward, use min, max, min3, max3.
---
Changes in v2: None
include/common.h | 6 ------ 1 file changed, 6 deletions(-)
include/common.h +0 -6
@@ -181,9 +181,6 @@ typedef void (interrupt_handler_t)(void *);typeof (Y) __y = (Y ); \ (__x > __y) ? __x : __y; }) -#define MIN (x, y) min(x, y) -#define MAX (x, y) max(x, y) -#define min3 (X ,Y ,Z ) \ ({ typeof(X) __x = (X); \ typeof(Y) __y = (Y); \
@@ -198,9 +195,6 @@ typedef void (interrupt_handler_t)(void *); __x > __y ? (__x > __z ? __x : __z) : \ (__y > __z ? __y : __z); }) -#define MIN3 (x, y, z) min3(x, y, z) -#define MAX3 (x, y, z) max3(x, y, z) -/* * Return the absolute value of a number. *
Signature · 1 line
1.9.1
PATCH v2 2/2 common.h: remove MIN, MAX, MIN3, MAX3 macros
Quoted 4 lines · Masahiro Yamada
Now MIN, MAX, MIN3, MAX are not used.
Going forward, use min, max, min3, max3.Signed-off-by Masahiro Yamada <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140925/f4b0be1c/attachment.pgp>