Re: [PATCH 3/3] i2c-piix4: Pre-shift the port number

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

 



Le Friday 29 January 2016 à 13:02 +0200, Mika Westerberg a écrit :
> On Fri, Jan 29, 2016 at 10:46:37AM +0100, Jean Delvare wrote:
> > Shift the port number at initialization time, so that it is ready to
> > use at run time. That way we don't have to do it again for every SMBus
> > transaction.
> > 
> > Signed-off-by: Jean Delvare <jdelvare@xxxxxxx>
> > Cc: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> > Cc: Christian Fetzer <fetzer.ch@xxxxxxxxx>
> > Cc: Wolfram Sang <wsa@xxxxxxxxxxxxx>
> > ---
> >  drivers/i2c/busses/i2c-piix4.c |   10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > --- linux-4.5-rc0.orig/drivers/i2c/busses/i2c-piix4.c	2016-01-29 07:57:13.706365999 +0100
> > +++ linux-4.5-rc0/drivers/i2c/busses/i2c-piix4.c	2016-01-29 10:38:34.720453729 +0100
> > @@ -158,7 +158,7 @@ struct i2c_piix4_adapdata {
> >  
> >  	/* SB800 */
> >  	bool sb800_main;
> > -	u8 port;
> > +	u8 port;		/* Port number, shifted */
> >  };
> >  
> >  static int piix4_setup(struct pci_dev *PIIX4_dev,
> > @@ -589,8 +589,8 @@ static s32 piix4_access_sb800(struct i2c
> >  	smba_en_lo = inb_p(SB800_PIIX4_SMB_IDX + 1);
> >  
> >  	port = adapdata->port;
> > -	if ((smba_en_lo & SB800_PIIX4_PORT_IDX_MASK) != (port << 1))
> > -		outb_p((smba_en_lo & ~SB800_PIIX4_PORT_IDX_MASK) | (port << 1),
> > +	if ((smba_en_lo & SB800_PIIX4_PORT_IDX_MASK) != port)
> > +		outb_p((smba_en_lo & ~SB800_PIIX4_PORT_IDX_MASK) | port,
> >  		       SB800_PIIX4_SMB_IDX + 1);
> >  
> >  	retval = piix4_access(adap, addr, flags, read_write,
> > @@ -676,7 +676,7 @@ static int piix4_add_adapter(struct pci_
> >  
> >  	adapdata->smba = smba;
> >  	adapdata->sb800_main = sb800_main;
> > -	adapdata->port = port;
> > +	adapdata->port = port << 1;
> >  
> >  	/* set up the sysfs linkage to our parent device */
> >  	adap->dev.parent = &dev->dev;
> > @@ -812,7 +812,7 @@ static void piix4_adap_remove(struct i2c
> >  
> >  	if (adapdata->smba) {
> >  		i2c_del_adapter(adap);
> > -		if (adapdata->port == 0) {
> > +		if (adapdata->port == (0 << 1)) {
> 
> I suppose this is only for documentation purposes, right?

Yes. This change wasn't originally part of the patch, as I know it is a
no-op, but I thought it was more correct to include it.

> Reviewed-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> 
> >  			release_region(adapdata->smba, SMBIOSIZE);
> >  			if (adapdata->sb800_main)
> >  				release_region(SB800_PIIX4_SMB_IDX, 2);
> > 

Thanks for the reviews!

-- 
Jean Delvare
SUSE L3 Support

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux