[PATCH 2/3] hwmon: adm9240 updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Grant:

* Grant Coady <grant_lkml at dodo.com.au> [2005-09-14 08:50:10 +1000]:
> 
> hwmon: adm9240 update 2/3: cleanups
> 
> make SCALE function return zero for zero input,
> remove i2c read/write wrapper interface,
> change kmalloc + memset to kzalloc 
> 
> Signed-off-by: Grant Coady <gcoady at gmail.com>
> 
> ---
>  adm9240.c |   94 ++++++++++++++++++++++++++++++--------------------------------
>  1 files changed, 46 insertions(+), 48 deletions(-)
> 
> --- linux-2.6.14-rc1b/drivers/hwmon/adm9240.c-whitespace	2005-09-14 07:10:45.000000000 +1000
> +++ linux-2.6.14-rc1b/drivers/hwmon/adm9240.c	2005-09-14 07:26:43.000000000 +1000
> @@ -81,6 +81,8 @@
>  /* generalised scaling with integer rounding */
>  static inline int SCALE(long val, int mul, int div)
>  {
> +	if (val == 0)
> +		return 0;
>  	if (val < 0)
>  		return (val * mul - div / 2) / div;
>  	else

Just for reference, here's the whole original function:

orig > static inline int SCALE(long val, int mul, int div)
orig > {
orig >         if (val < 0)
orig >                 return (val * mul - div / 2) / div;
orig >         else
orig >                 return (val * mul + div / 2) / div;
orig > }

So... exactly what value of div would require this fix?

> [cut rest of patch which looks ok]

Regards,

-- 
Mark M. Hoffman
mhoffman at lightlink.com





[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux