Re: [PATCH v2] staging: kpc2000: kpc_i2c: remove the macros inb_p and outb_p

From: Geordan Neukum
Date: Mon Jun 10 2019 - 22:24:36 EST


On Mon, Jun 10, 2019 at 03:48:24PM +0800, Hao Xu wrote:
> remove inb_p and outb_p to call readq/writeq directly.
>
> Signed-off-by: Hao Xu <haoxu.linuxkernel@xxxxxxxxx>
> ---
> Changes in v2:
> - remove the macros inb_p/outb_p and use readq/writeq directly, per https://lkml.kernel.org/lkml/20190608134505.GA963@xxxxxxxxxxxx/
> ---
> drivers/staging/kpc2000/kpc2000_i2c.c | 112 ++++++++++++++++------------------
> 1 file changed, 53 insertions(+), 59 deletions(-)
>
> diff --git a/drivers/staging/kpc2000/kpc2000_i2c.c b/drivers/staging/kpc2000/kpc2000_i2c.c
> index 69e8773..246d5b3 100644
> --- a/drivers/staging/kpc2000/kpc2000_i2c.c
> +++ b/drivers/staging/kpc2000/kpc2000_i2c.c

> @@ -307,28 +301,28 @@ static int i801_block_transaction_byte_by_byte(struct i2c_device *priv, union i2
> else
> smbcmd = I801_BLOCK_DATA;
> }
> - outb_p(smbcmd | ENABLE_INT9, SMBHSTCNT(priv));
> + writeq(smbcmd | ENABLE_INT9, (void *)SMBHSTCNT(priv));
>
> if (i == 1)
> - outb_p(inb(SMBHSTCNT(priv)) | I801_START, SMBHSTCNT(priv));
> + writeq(inb(SMBHSTCNT(priv)) | I801_START, (void *)SMBHSTCNT(priv));

This inb() call looks like a bug. We perform a 64-bit operation when
talking to this hardware register everywhere else in this driver. Anyone
have more insight into the hardware with which this driver interacts
such that they could shed some light on the subject?

Probably a separate issue, but I did notice it as a result of this patch.

Thanks,
Geordan