Re: [PATCH] hwmon: f71882fg: code cleanup

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

 



On Wed, 24 Mar 2010 10:09:01 +0100, Giel van Schijndel wrote:
> Some code cleanup: properly using previously defined functions, rather
> than duplicating their code.
> 
> Signed-off-by: Giel van Schijndel <me@xxxxxxxxx>
> ---
>  drivers/hwmon/f71882fg.c |   18 ++++++------------
>  1 files changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
> index 4230729..ca34e5c 100644
> --- a/drivers/hwmon/f71882fg.c
> +++ b/drivers/hwmon/f71882fg.c
> @@ -856,10 +856,8 @@ static inline int superio_inb(int base, int reg)
>  static int superio_inw(int base, int reg)
>  {
>  	int val;
> -	outb(reg++, base);
> -	val = inb(base + 1) << 8;
> -	outb(reg, base);
> -	val |= inb(base + 1);
> +	val  = superio_inb(base, reg) << 8;
> +	val |= superio_inb(base, reg + 1);
>  	return val;
>  }
>  
> @@ -905,10 +903,8 @@ static u16 f71882fg_read16(struct f71882fg_data *data, u8 reg)
>  {
>  	u16 val;
>  
> -	outb(reg++, data->addr + ADDR_REG_OFFSET);
> -	val = inb(data->addr + DATA_REG_OFFSET) << 8;
> -	outb(reg, data->addr + ADDR_REG_OFFSET);
> -	val |= inb(data->addr + DATA_REG_OFFSET);
> +	val  = f71882fg_read8(data, reg) << 8;
> +	val |= f71882fg_read8(data, reg + 1);
>  
>  	return val;
>  }
> @@ -921,10 +917,8 @@ static void f71882fg_write8(struct f71882fg_data *data, u8 reg, u8 val)
>  
>  static void f71882fg_write16(struct f71882fg_data *data, u8 reg, u16 val)
>  {
> -	outb(reg++, data->addr + ADDR_REG_OFFSET);
> -	outb(val >> 8, data->addr + DATA_REG_OFFSET);
> -	outb(reg, data->addr + ADDR_REG_OFFSET);
> -	outb(val & 255, data->addr + DATA_REG_OFFSET);
> +	f71882fg_write8(data, reg,     val >> 8);
> +	f71882fg_write8(data, reg + 1, val & 0xff);
>  }
>  
>  static u16 f71882fg_read_temp(struct f71882fg_data *data, int nr)

Applied, thanks.

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

  Powered by Linux