remove inb_p and outb_p to call readq/writeq directly.
Signed-off-by: Hao Xu
---
Changes in v2:
- remove the macros inb_p/outb_p and use readq/writeq directly, per
https://lkml.kernel.org/lkml/20190608134505.ga...@arch-01.home/
---
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
@@ -122,12 +122,6 @@ struct i2c_device {
/* Not really a feature, but it's convenient to handle it as such */
#define FEATURE_IDF BIT(15)
-// FIXME!
-#undef inb_p
-#define inb_p(a) readq((void *)a)
-#undef outb_p
-#define outb_p(d, a) writeq(d, (void *)a)
-
/* Make sure the SMBus host is ready to start transmitting.
* Return 0 if it is, -EBUSY if it is not.
*/
@@ -135,7 +129,7 @@ static int i801_check_pre(struct i2c_device *priv)
{
int status;
- status = inb_p(SMBHSTSTS(priv));
+ status = readq((void *)SMBHSTSTS(priv));
if (status & SMBHSTSTS_HOST_BUSY) {
dev_err(>adapter.dev, "SMBus is busy, can't use it!
(status=%x)\n", status);
return -EBUSY;
@@ -144,8 +138,8 @@ static int i801_check_pre(struct i2c_device *priv)
status &= STATUS_FLAGS;
if (status) {
//dev_dbg(>adapter.dev, "Clearing status flags (%02x)\n",
status);
- outb_p(status, SMBHSTSTS(priv));
- status = inb_p(SMBHSTSTS(priv)) & STATUS_FLAGS;
+ writeq(status, (void *)SMBHSTSTS(priv));
+ status = readq((void *)SMBHSTSTS(priv)) & STATUS_FLAGS;
if (status) {
dev_err(>adapter.dev, "Failed clearing status
flags (%02x)\n", status);
return -EBUSY;
@@ -164,15 +158,15 @@ static int i801_check_post(struct i2c_device *priv, int
status, int timeout)
dev_err(>adapter.dev, "Transaction timeout\n");
/* try to stop the current command */
dev_dbg(>adapter.dev, "Terminating the current
operation\n");
- outb_p(inb_p(SMBHSTCNT(priv)) | SMBHSTCNT_KILL,
SMBHSTCNT(priv));
+ writeq(readq((void *)SMBHSTCNT(priv)) | SMBHSTCNT_KILL, (void
*)SMBHSTCNT(priv));
usleep_range(1000, 2000);
- outb_p(inb_p(SMBHSTCNT(priv)) & (~SMBHSTCNT_KILL),
SMBHSTCNT(priv));
+ writeq(readq((void *)SMBHSTCNT(priv)) & (~SMBHSTCNT_KILL),
(void *)SMBHSTCNT(priv));
/* Check if it worked */
- status = inb_p(SMBHSTSTS(priv));
+ status = readq((void *)SMBHSTSTS(priv));
if ((status & SMBHSTSTS_HOST_BUSY) || !(status &
SMBHSTSTS_FAILED))
dev_err(>adapter.dev, "Failed terminating the
transaction\n");
- outb_p(STATUS_FLAGS, SMBHSTSTS(priv));
+ writeq(STATUS_FLAGS, (void *)SMBHSTSTS(priv));
return -ETIMEDOUT;
}
@@ -191,8 +185,8 @@ static int i801_check_post(struct i2c_device *priv, int
status, int timeout)
if (result) {
/* Clear error flags */
- outb_p(status & STATUS_FLAGS, SMBHSTSTS(priv));
- status = inb_p(SMBHSTSTS(priv)) & STATUS_FLAGS;
+ writeq(status & STATUS_FLAGS, (void *)SMBHSTSTS(priv));
+ status = readq((void *)SMBHSTSTS(priv)) & STATUS_FLAGS;
if (status)
dev_warn(>adapter.dev, "Failed clearing status
flags at end of transaction (%02x)\n", status);
}
@@ -212,19 +206,19 @@ static int i801_transaction(struct i2c_device *priv, int
xact)
/* the current contents of SMBHSTCNT can be overwritten, since PEC,
* INTREN, SMBSCMD are passed in xact
*/
- outb_p(xact | I801_START, SMBHSTCNT(priv));
+ writeq(xact | I801_START, (void *)SMBHSTCNT(priv));
/* We will always wait for a fraction of a second! */
do {
usleep_range(250, 500);
- status = inb_p(SMBHSTSTS(priv));
+ status = readq((void *)SMBHSTSTS(priv));
} while ((status & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_RETRIES));
result = i801_check_post(priv, status, timeout > MAX_RETRIES);
if (result < 0)
return result;
- outb_p(SMBHSTSTS_INTR, SMBHSTSTS(priv));
+ writeq(SMBHSTSTS_INTR, (void *)SMBHSTSTS(priv));
return 0;
}
@@ -236,13 +230,13 @@ static void i801_wait_hwpec(struct i2c_device *priv)
do {
usleep_range(250, 500);
- status = inb_p(SMBHSTSTS(priv));
+ status = readq((vo