Re: [U-Boot] [PATCH 6/6] linux/kernel.h: sync min, max, min3, max3 macros with Linux

2014-11-06 Thread Lukasz Majewski
Hi Masahiro,

 U-Boot has never cared about the type when we get max/min of two
 values, but Linux Kernel does.  This commit gets min, max, min3, max3
 macros synced with the kernel introduing type checks.
 
 Many of references of those macros must be fixed to suppress warnings.
 We have two options:
  - Use min, max, min3, max3 only when the arguments have the same type
(or add casts to the arguments)
  - Use min_t/max_t instead with the appropriate type for the first
argument
 
 Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
 ---
 
  arch/arm/cpu/arm1176/tnetv107x/clock.c|  5 ++-
  arch/arm/cpu/armv7/exynos/clock.c |  4 +-
  arch/arm/cpu/armv7/tegra20/display.c  |  4 +-
  arch/avr32/cpu/at32ap700x/clk.c   |  2 +-
  arch/blackfin/cpu/jtag-console.c  |  2 +-
  arch/blackfin/lib/string.c|  2 +-
  arch/powerpc/cpu/mpc85xx/tlb.c|  2 +-
  arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c| 32 ++--
  arch/powerpc/lib/bootm.c  |  2 +-
  arch/sandbox/cpu/start.c  |  2 +-
  arch/x86/cpu/coreboot/pci.c   |  2 +-
  arch/x86/cpu/coreboot/sdram.c |  2 +-
  board/freescale/common/sys_eeprom.c   |  6 +--
  board/gdsys/p1022/controlcenterd-id.c |  5 ++-
  board/imgtec/malta/malta.c|  2 +-
  common/cmd_elf.c  | 12 +++---
  common/cmd_sf.c   | 16 
  common/env_nand.c |  4 +-
  common/fdt_support.c  |  3 +-
  common/lcd.c  |  6 +--
  common/usb_hub.c  |  3 +-
  drivers/block/ahci.c  |  2 +-
  drivers/ddr/fsl/ctrl_regs.c   | 22 +--
  drivers/ddr/fsl/lc_common_dimm_params.c   | 62
 ++-
 drivers/ddr/fsl/main.c|  3 +-
 drivers/dfu/dfu.c |  2 +-
 drivers/i2c/fsl_i2c.c |  2 +-
 drivers/misc/cros_ec_spi.c|  2 +-
 drivers/mmc/fsl_esdhc.c   |  2 +-
 drivers/mmc/pxa_mmc_gen.c |  6 +--
 drivers/mtd/nand/denali_spl.c |  2 +-
 drivers/mtd/spi/sandbox.c |  2 +-
 drivers/mtd/spi/sf_ops.c  |  5 ++-
 drivers/net/netconsole.c  |  2 +-
 drivers/pci/pci.c |  6 ++-
 drivers/pci/pci_auto.c|  2 +-
 drivers/serial/usbtty.c   |  2 +-
 drivers/spi/fsl_espi.c|  4 +-
 drivers/spi/mxc_spi.c |  2 +-
 drivers/spi/spi-uclass.c  |  2 +-
 drivers/tpm/tpm_tis_lpc.c |  2 +-
 drivers/usb/gadget/composite.c|  4 +-
 drivers/usb/gadget/designware_udc.c   |  4 +-
 drivers/usb/gadget/pxa27x_udc.c   |  3 +-
 drivers/usb/gadget/s3c_udc_otg_xfer_dma.c |  4 +-

From my side:
Acked-by: Lukasz Majewski l.majew...@samsung.com

Tested-by: Lukasz Majewski l.majew...@samsung.com

Test HW: Trats2 (Exynos4412)

-- 
Best regards,

Lukasz Majewski

Samsung RD Institute Poland (SRPOL) | Linux Platform Group


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/6] linux/kernel.h: sync min, max, min3, max3 macros with Linux

2014-11-06 Thread Pavel Machek
On Wed 2014-11-05 07:02:23, Marek Vasut wrote:
 On Wednesday, November 05, 2014 at 06:06:09 AM, Masahiro Yamada wrote:
  Hi Pavel,
  
  Thanks for your close checking.
  
  
  On Tue, 4 Nov 2014 20:50:13 +0100
  
  Pavel Machek pa...@denx.de wrote:
   On Tue 2014-11-04 20:26:26, Masahiro Yamada wrote:
U-Boot has never cared about the type when we get max/min of two
values, but Linux Kernel does.  This commit gets min, max, min3, max3
macros synced with the kernel introduing type checks.
   
   introducing
  
  I will fix this.
 
 Are you linting the patches with aspell or something ?

My eyes do this automatically. I tried to find a switch to turn it
off, but could not, so far.

:-),
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/6] linux/kernel.h: sync min, max, min3, max3 macros with Linux

2014-11-05 Thread Masahiro Yamada
Hi Marek,

On Wed, 5 Nov 2014 08:57:50 +0100
Marek Vasut ma...@denx.de wrote:

 On Wednesday, November 05, 2014 at 08:48:19 AM, Masahiro Yamada wrote:
  Hi Marek,
 
 Hi!
 
  (reduced Cc)
  
  On Wed, 5 Nov 2014 07:02:23 +0100
  
  Marek Vasut ma...@denx.de wrote:
   On Wednesday, November 05, 2014 at 06:06:09 AM, Masahiro Yamada wrote:
Hi Pavel,

Thanks for your close checking.


On Tue, 4 Nov 2014 20:50:13 +0100

Pavel Machek pa...@denx.de wrote:
 On Tue 2014-11-04 20:26:26, Masahiro Yamada wrote:
  U-Boot has never cared about the type when we get max/min of two
  values, but Linux Kernel does.  This commit gets min, max, min3,
  max3 macros synced with the kernel introduing type checks.
 
 introducing

I will fix this.
   
   Are you linting the patches with aspell or something ?
  
  No.
  Going forward I will do that. Thaks for your advice!
 
 I was just curious what Pavel does there, since I also got some spelling 
 corrections from him. Please don't take it like I want to add more work
 on your plate.
 

I was not sure if your question was addressed to me or Pavel,
but never mind.

I use nano editor for inputting git-log.
It is just to press Ctrl-T to invoke aspell,
so it will not load me with much work.
Resending a patch just for a typo is a more tedious work.
(Pavel, don't get me wrong.  All you pointed out are good things.)


Best Regards
Masahiro Yamada

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/6] linux/kernel.h: sync min, max, min3, max3 macros with Linux

2014-11-05 Thread Marek Vasut
On Wednesday, November 05, 2014 at 09:12:40 AM, Masahiro Yamada wrote:
 Hi Marek,

Hi Masahiro,

 On Wed, 5 Nov 2014 08:57:50 +0100
 
 Marek Vasut ma...@denx.de wrote:
  On Wednesday, November 05, 2014 at 08:48:19 AM, Masahiro Yamada wrote:
   Hi Marek,
  
  Hi!
  
   (reduced Cc)
   
   On Wed, 5 Nov 2014 07:02:23 +0100
   
   Marek Vasut ma...@denx.de wrote:
On Wednesday, November 05, 2014 at 06:06:09 AM, Masahiro Yamada wrote:
 Hi Pavel,
 
 Thanks for your close checking.
 
 
 On Tue, 4 Nov 2014 20:50:13 +0100
 
 Pavel Machek pa...@denx.de wrote:
  On Tue 2014-11-04 20:26:26, Masahiro Yamada wrote:
   U-Boot has never cared about the type when we get max/min of
   two values, but Linux Kernel does.  This commit gets min, max,
   min3, max3 macros synced with the kernel introduing type
   checks.
  
  introducing
 
 I will fix this.

Are you linting the patches with aspell or something ?
   
   No.
   Going forward I will do that. Thaks for your advice!
  
  I was just curious what Pavel does there, since I also got some spelling
  corrections from him. Please don't take it like I want to add more work
  on your plate.
 
 I was not sure if your question was addressed to me or Pavel,
 but never mind.
 
 I use nano editor for inputting git-log.
 It is just to press Ctrl-T to invoke aspell,
 so it will not load me with much work.
 Resending a patch just for a typo is a more tedious work.

Right, I'd be fine if the committer could just fix it without the need
for resend ...

 (Pavel, don't get me wrong.  All you pointed out are good things.)

btw. I have this precommit hook to invoke checkpatch and you can possibly
add a postcommit (?) hook to invoke aspell too. Just a hint though ...

--8--
marex@bfu:u-boot$ cat .git/hooks/pre-commit
#!/bin/sh
#
# pre-commit hook to run check-patch on the output and stop any commits
# that do not pass. Note, only for git-commit, and not for any of the
# other scenarios
#
# Copyright 2010 Ben Dooks, ben-li...@fluff.org

if git rev-parse --verify HEAD 2/dev/null /dev/null
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

git diff --cached $against -- | ./scripts/checkpatch.pl --no-signoff -
--8--

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 6/6] linux/kernel.h: sync min, max, min3, max3 macros with Linux

2014-11-04 Thread Masahiro Yamada
U-Boot has never cared about the type when we get max/min of two
values, but Linux Kernel does.  This commit gets min, max, min3, max3
macros synced with the kernel introduing type checks.

Many of references of those macros must be fixed to suppress warnings.
We have two options:
 - Use min, max, min3, max3 only when the arguments have the same type
   (or add casts to the arguments)
 - Use min_t/max_t instead with the appropriate type for the first
   argument

Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

 arch/arm/cpu/arm1176/tnetv107x/clock.c|  5 ++-
 arch/arm/cpu/armv7/exynos/clock.c |  4 +-
 arch/arm/cpu/armv7/tegra20/display.c  |  4 +-
 arch/avr32/cpu/at32ap700x/clk.c   |  2 +-
 arch/blackfin/cpu/jtag-console.c  |  2 +-
 arch/blackfin/lib/string.c|  2 +-
 arch/powerpc/cpu/mpc85xx/tlb.c|  2 +-
 arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c| 32 ++--
 arch/powerpc/lib/bootm.c  |  2 +-
 arch/sandbox/cpu/start.c  |  2 +-
 arch/x86/cpu/coreboot/pci.c   |  2 +-
 arch/x86/cpu/coreboot/sdram.c |  2 +-
 board/freescale/common/sys_eeprom.c   |  6 +--
 board/gdsys/p1022/controlcenterd-id.c |  5 ++-
 board/imgtec/malta/malta.c|  2 +-
 common/cmd_elf.c  | 12 +++---
 common/cmd_sf.c   | 16 
 common/env_nand.c |  4 +-
 common/fdt_support.c  |  3 +-
 common/lcd.c  |  6 +--
 common/usb_hub.c  |  3 +-
 drivers/block/ahci.c  |  2 +-
 drivers/ddr/fsl/ctrl_regs.c   | 22 +--
 drivers/ddr/fsl/lc_common_dimm_params.c   | 62 ++-
 drivers/ddr/fsl/main.c|  3 +-
 drivers/dfu/dfu.c |  2 +-
 drivers/i2c/fsl_i2c.c |  2 +-
 drivers/misc/cros_ec_spi.c|  2 +-
 drivers/mmc/fsl_esdhc.c   |  2 +-
 drivers/mmc/pxa_mmc_gen.c |  6 +--
 drivers/mtd/nand/denali_spl.c |  2 +-
 drivers/mtd/spi/sandbox.c |  2 +-
 drivers/mtd/spi/sf_ops.c  |  5 ++-
 drivers/net/netconsole.c  |  2 +-
 drivers/pci/pci.c |  6 ++-
 drivers/pci/pci_auto.c|  2 +-
 drivers/serial/usbtty.c   |  2 +-
 drivers/spi/fsl_espi.c|  4 +-
 drivers/spi/mxc_spi.c |  2 +-
 drivers/spi/spi-uclass.c  |  2 +-
 drivers/tpm/tpm_tis_lpc.c |  2 +-
 drivers/usb/gadget/composite.c|  4 +-
 drivers/usb/gadget/designware_udc.c   |  4 +-
 drivers/usb/gadget/pxa27x_udc.c   |  3 +-
 drivers/usb/gadget/s3c_udc_otg_xfer_dma.c |  4 +-
 drivers/usb/host/dwc2.c   | 14 +++
 drivers/usb/host/ehci-hcd.c   |  2 +-
 drivers/usb/host/xhci-ring.c  |  2 +-
 drivers/usb/host/xhci.c   |  2 +-
 drivers/video/cfb_console.c   | 18 -
 fs/ext4/dev.c | 13 +++
 fs/fat/fat.c  |  2 +-
 include/linux/kernel.h| 17 ++---
 53 files changed, 179 insertions(+), 158 deletions(-)

diff --git a/arch/arm/cpu/arm1176/tnetv107x/clock.c 
b/arch/arm/cpu/arm1176/tnetv107x/clock.c
index 47c23bb..ecff24d 100644
--- a/arch/arm/cpu/arm1176/tnetv107x/clock.c
+++ b/arch/arm/cpu/arm1176/tnetv107x/clock.c
@@ -362,12 +362,13 @@ 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, 1UL); mult = MAX_MULT; mult++) {
div = (fpll * mult) / data-pll_freq;
if (div  1 || div  MAX_DIV)
continue;
 
-   for (postdiv = 1; postdiv = min(div, MAX_POSTDIV); postdiv++) {
+   for (postdiv = 1; postdiv = min(div, (unsigned 
long)MAX_POSTDIV);
+   postdiv++) {
prediv = div / postdiv;
if (prediv  1 || prediv  MAX_PREDIV)
continue;
diff --git a/arch/arm/cpu/armv7/exynos/clock.c 
b/arch/arm/cpu/armv7/exynos/clock.c
index 7558eff..c0c95fb 100644
--- a/arch/arm/cpu/armv7/exynos/clock.c
+++ b/arch/arm/cpu/armv7/exynos/clock.c
@@ -1422,8 +1422,8 @@ static int clock_calc_best_scalar(unsigned int 
main_scaler_bits,
return 1;
 
for (i = 1; i = loops; i++) {
-   const unsigned int effective_div = max(min(input_rate / i /
-   target_rate, cap), 1);
+   const unsigned int effective_div =
+   

Re: [U-Boot] [PATCH 6/6] linux/kernel.h: sync min, max, min3, max3 macros with Linux

2014-11-04 Thread Pavel Machek
On Tue 2014-11-04 20:26:26, Masahiro Yamada wrote:
 U-Boot has never cared about the type when we get max/min of two
 values, but Linux Kernel does.  This commit gets min, max, min3, max3
 macros synced with the kernel introduing type checks.

introducing

 Many of references of those macros must be fixed to suppress warnings.
 We have two options:
  - Use min, max, min3, max3 only when the arguments have the same type
(or add casts to the arguments)
  - Use min_t/max_t instead with the appropriate type for the first
argument
 
 Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com

Acked-by: Pavel Machek pa...@denx.de

[I guess the conversion is okay, as is, still, there are places where
code could be cleaned up afterwards...]

 - for (postdiv = 1; postdiv = min(div, MAX_POSTDIV); postdiv++) {
 + for (postdiv = 1; postdiv = min(div, (unsigned 
 long)MAX_POSTDIV);
 + postdiv++) {

It might be cleaner to change MAX_POSTDIV definition to include UL?


 @@ -1838,12 +1838,18 @@ static void program_tr(unsigned long *dimm_populated,
   else
   sdram_ddr1 = false;
  
 - t_rcd_ns = max(t_rcd_ns, 
 spd_read(iic0_dimm_addr[dimm_num], 29)  2);
 - t_rrd_ns = max(t_rrd_ns, 
 spd_read(iic0_dimm_addr[dimm_num], 28)  2);
 - t_rp_ns  = max(t_rp_ns,  
 spd_read(iic0_dimm_addr[dimm_num], 27)  2);
 - t_ras_ns = max(t_ras_ns, 
 spd_read(iic0_dimm_addr[dimm_num], 30));
 - t_rc_ns  = max(t_rc_ns,  
 spd_read(iic0_dimm_addr[dimm_num], 41));
 - t_rfc_ns = max(t_rfc_ns, 
 spd_read(iic0_dimm_addr[dimm_num], 42));
 + t_rcd_ns = max(t_rcd_ns,
 +(unsigned 
 long)spd_read(iic0_dimm_addr[dimm_num], 29)  2);
 + t_rrd_ns = max(t_rrd_ns,
 +(unsigned 
 long)spd_read(iic0_dimm_addr[dimm_num], 28)  2);
 + t_rp_ns  = max(t_rp_ns,
 +(unsigned 
 long)spd_read(iic0_dimm_addr[dimm_num], 27)  2);
 + t_ras_ns = max(t_ras_ns,
 +(unsigned 
 long)spd_read(iic0_dimm_addr[dimm_num], 30));
 + t_rc_ns  = max(t_rc_ns,
 +(unsigned 
 long)spd_read(iic0_dimm_addr[dimm_num], 41));
 + t_rfc_ns = max(t_rfc_ns,
 +(unsigned 
 long)spd_read(iic0_dimm_addr[dimm_num], 42));
   }
   }

Would it be feasible to make spd_read return unsigned long?

 diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
 index b3d7051..b7e12ab 100644
 --- a/arch/sandbox/cpu/start.c
 +++ b/arch/sandbox/cpu/start.c
 @@ -38,7 +38,7 @@ int sandbox_early_getopt_check(void)
  
   max_arg_len = 0;
   for (i = 0; i  num_options; ++i)
 - max_arg_len = max(strlen(sb_opt[i]-flag), max_arg_len);
 + max_arg_len = max((int)strlen(sb_opt[i]-flag), max_arg_len);
   max_noarg_len = max_arg_len + 7;
  
   for (i = 0; i  num_options; ++i) {

make max_arg_len size_t?

 diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
 index 623f749..677c89f 100644
 --- a/drivers/net/netconsole.c
 +++ b/drivers/net/netconsole.c
 @@ -256,7 +256,7 @@ static void nc_puts(struct stdio_dev *dev, const char *s)
  
   len = strlen(s);
   while (len) {
 - int send_len = min(len, sizeof(input_buffer));
 + int send_len = min(len, (int)sizeof(input_buffer));
   nc_send_packet(s, send_len);
   len -= send_len;
   s += send_len;

Looks like len/send_len wants to be size_t here.

Actually, I'd argue that anytime you need to explicitly cast one
argument would be good time to use _t variant... but that would mean
redoing rather big patch.

min((int) a, b) - min_t(int, a, b).

Thanks,
Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/6] linux/kernel.h: sync min, max, min3, max3 macros with Linux

2014-11-04 Thread Masahiro Yamada
Hi Pavel,

Thanks for your close checking.


On Tue, 4 Nov 2014 20:50:13 +0100
Pavel Machek pa...@denx.de wrote:

 On Tue 2014-11-04 20:26:26, Masahiro Yamada wrote:
  U-Boot has never cared about the type when we get max/min of two
  values, but Linux Kernel does.  This commit gets min, max, min3, max3
  macros synced with the kernel introduing type checks.
 
 introducing


I will fix this.



  Many of references of those macros must be fixed to suppress warnings.
  We have two options:
   - Use min, max, min3, max3 only when the arguments have the same type
 (or add casts to the arguments)
   - Use min_t/max_t instead with the appropriate type for the first
 argument
  
  Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
 
 Acked-by: Pavel Machek pa...@denx.de
 
 [I guess the conversion is okay, as is, still, there are places where
 code could be cleaned up afterwards...]

Fully agreed.
In some places, I think we should change the variable types as you suggested
but it is beyond the motivation of this series.





  -   for (postdiv = 1; postdiv = min(div, MAX_POSTDIV); postdiv++) {
  +   for (postdiv = 1; postdiv = min(div, (unsigned 
  long)MAX_POSTDIV);
  +   postdiv++) {
 
 It might be cleaner to change MAX_POSTDIV definition to include UL?


Sounds good to me.



 
  @@ -1838,12 +1838,18 @@ static void program_tr(unsigned long 
  *dimm_populated,
  else
  sdram_ddr1 = false;
   
  -   t_rcd_ns = max(t_rcd_ns, 
  spd_read(iic0_dimm_addr[dimm_num], 29)  2);
  -   t_rrd_ns = max(t_rrd_ns, 
  spd_read(iic0_dimm_addr[dimm_num], 28)  2);
  -   t_rp_ns  = max(t_rp_ns,  
  spd_read(iic0_dimm_addr[dimm_num], 27)  2);
  -   t_ras_ns = max(t_ras_ns, 
  spd_read(iic0_dimm_addr[dimm_num], 30));
  -   t_rc_ns  = max(t_rc_ns,  
  spd_read(iic0_dimm_addr[dimm_num], 41));
  -   t_rfc_ns = max(t_rfc_ns, 
  spd_read(iic0_dimm_addr[dimm_num], 42));
  +   t_rcd_ns = max(t_rcd_ns,
  +  (unsigned 
  long)spd_read(iic0_dimm_addr[dimm_num], 29)  2);
  +   t_rrd_ns = max(t_rrd_ns,
  +  (unsigned 
  long)spd_read(iic0_dimm_addr[dimm_num], 28)  2);
  +   t_rp_ns  = max(t_rp_ns,
  +  (unsigned 
  long)spd_read(iic0_dimm_addr[dimm_num], 27)  2);
  +   t_ras_ns = max(t_ras_ns,
  +  (unsigned 
  long)spd_read(iic0_dimm_addr[dimm_num], 30));
  +   t_rc_ns  = max(t_rc_ns,
  +  (unsigned 
  long)spd_read(iic0_dimm_addr[dimm_num], 41));
  +   t_rfc_ns = max(t_rfc_ns,
  +  (unsigned 
  long)spd_read(iic0_dimm_addr[dimm_num], 42));
  }
  }
 
 Would it be feasible to make spd_read return unsigned long?


I am not familiar enough with this code
to judge this.




  diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
  index b3d7051..b7e12ab 100644
  --- a/arch/sandbox/cpu/start.c
  +++ b/arch/sandbox/cpu/start.c
  @@ -38,7 +38,7 @@ int sandbox_early_getopt_check(void)
   
  max_arg_len = 0;
  for (i = 0; i  num_options; ++i)
  -   max_arg_len = max(strlen(sb_opt[i]-flag), max_arg_len);
  +   max_arg_len = max((int)strlen(sb_opt[i]-flag), max_arg_len);
  max_noarg_len = max_arg_len + 7;
   
  for (i = 0; i  num_options; ++i) {
 
 make max_arg_len size_t?
 
  diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
  index 623f749..677c89f 100644
  --- a/drivers/net/netconsole.c
  +++ b/drivers/net/netconsole.c
  @@ -256,7 +256,7 @@ static void nc_puts(struct stdio_dev *dev, const char 
  *s)
   
  len = strlen(s);
  while (len) {
  -   int send_len = min(len, sizeof(input_buffer));
  +   int send_len = min(len, (int)sizeof(input_buffer));
  nc_send_packet(s, send_len);
  len -= send_len;
  s += send_len;
 
 Looks like len/send_len wants to be size_t here.
 
 Actually, I'd argue that anytime you need to explicitly cast one
 argument would be good time to use _t variant... but that would mean
 redoing rather big patch.
 
 min((int) a, b) - min_t(int, a, b).


Agreed but I think we should do this
after we understand the code well.



Best Regards
Masahiro Yamada

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/6] linux/kernel.h: sync min, max, min3, max3 macros with Linux

2014-11-04 Thread Marek Vasut
On Wednesday, November 05, 2014 at 06:06:09 AM, Masahiro Yamada wrote:
 Hi Pavel,
 
 Thanks for your close checking.
 
 
 On Tue, 4 Nov 2014 20:50:13 +0100
 
 Pavel Machek pa...@denx.de wrote:
  On Tue 2014-11-04 20:26:26, Masahiro Yamada wrote:
   U-Boot has never cared about the type when we get max/min of two
   values, but Linux Kernel does.  This commit gets min, max, min3, max3
   macros synced with the kernel introduing type checks.
  
  introducing
 
 I will fix this.

Are you linting the patches with aspell or something ?
[...]
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/6] linux/kernel.h: sync min, max, min3, max3 macros with Linux

2014-11-04 Thread Masahiro Yamada
Hi Marek,
(reduced Cc)

On Wed, 5 Nov 2014 07:02:23 +0100
Marek Vasut ma...@denx.de wrote:

 On Wednesday, November 05, 2014 at 06:06:09 AM, Masahiro Yamada wrote:
  Hi Pavel,
  
  Thanks for your close checking.
  
  
  On Tue, 4 Nov 2014 20:50:13 +0100
  
  Pavel Machek pa...@denx.de wrote:
   On Tue 2014-11-04 20:26:26, Masahiro Yamada wrote:
U-Boot has never cared about the type when we get max/min of two
values, but Linux Kernel does.  This commit gets min, max, min3, max3
macros synced with the kernel introduing type checks.
   
   introducing
  
  I will fix this.
 
 Are you linting the patches with aspell or something ?

No.
Going forward I will do that. Thaks for your advice!

Best Regards
Masahiro Yamada

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/6] linux/kernel.h: sync min, max, min3, max3 macros with Linux

2014-11-04 Thread Marek Vasut
On Wednesday, November 05, 2014 at 08:48:19 AM, Masahiro Yamada wrote:
 Hi Marek,

Hi!

 (reduced Cc)
 
 On Wed, 5 Nov 2014 07:02:23 +0100
 
 Marek Vasut ma...@denx.de wrote:
  On Wednesday, November 05, 2014 at 06:06:09 AM, Masahiro Yamada wrote:
   Hi Pavel,
   
   Thanks for your close checking.
   
   
   On Tue, 4 Nov 2014 20:50:13 +0100
   
   Pavel Machek pa...@denx.de wrote:
On Tue 2014-11-04 20:26:26, Masahiro Yamada wrote:
 U-Boot has never cared about the type when we get max/min of two
 values, but Linux Kernel does.  This commit gets min, max, min3,
 max3 macros synced with the kernel introduing type checks.

introducing
   
   I will fix this.
  
  Are you linting the patches with aspell or something ?
 
 No.
 Going forward I will do that. Thaks for your advice!

I was just curious what Pavel does there, since I also got some spelling 
corrections from him. Please don't take it like I want to add more work
on your plate.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot