summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.ibm.com>2019-03-01 15:09:00 +1100
committerStewart Smith <stewart@linux.ibm.com>2019-03-01 16:01:00 +1100
commitee01ef4ed82aa78fcf5516ffd6d49a92b8e912bf (patch)
treea8ff20db27540d49d4657d498f2485f23172fbfa /core
parentc0ab7b45db3dc44daf001f61324bd1418091dede (diff)
downloadtalos-skiboot-ee01ef4ed82aa78fcf5516ffd6d49a92b8e912bf.tar.gz
talos-skiboot-ee01ef4ed82aa78fcf5516ffd6d49a92b8e912bf.zip
i2c: Fix sparse warnings for type assignment
Use the correct beXX_to_cpu() macros. core/i2c.c:105:29: warning: incorrect type in assignment (different base types) core/i2c.c:105:29: expected unsigned int [usertype] offset core/i2c.c:105:29: got restricted beint32_t [usertype] subaddr core/i2c.c:110:29: warning: incorrect type in assignment (different base types) core/i2c.c:110:29: expected unsigned int [usertype] offset core/i2c.c:110:29: got restricted beint32_t [usertype] subaddr core/i2c.c:117:23: warning: incorrect type in assignment (different base types) core/i2c.c:117:23: expected unsigned int [usertype] dev_addr core/i2c.c:117:23: got restricted beint16_t [usertype] addr core/i2c.c:118:21: warning: incorrect type in assignment (different base types) core/i2c.c:118:21: expected unsigned int [usertype] rw_len core/i2c.c:118:21: got restricted beint32_t [usertype] size core/i2c.c:119:24: warning: cast from restricted beint64_t Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/i2c.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/i2c.c b/core/i2c.c
index 3c600024..00dac0d1 100644
--- a/core/i2c.c
+++ b/core/i2c.c
@@ -102,21 +102,21 @@ static int opal_i2c_request(uint64_t async_token, uint32_t bus_id,
break;
case OPAL_I2C_SM_READ:
req->op = SMBUS_READ;
- req->offset = oreq->subaddr;
+ req->offset = be32_to_cpu(oreq->subaddr);
req->offset_bytes = oreq->subaddr_sz;
break;
case OPAL_I2C_SM_WRITE:
req->op = SMBUS_WRITE;
- req->offset = oreq->subaddr;
+ req->offset = be32_to_cpu(oreq->subaddr);
req->offset_bytes = oreq->subaddr_sz;
break;
default:
free(req);
return OPAL_PARAMETER;
}
- req->dev_addr = oreq->addr;
- req->rw_len = oreq->size;
- req->rw_buf = (void *)oreq->buffer_ra;
+ req->dev_addr = be16_to_cpu(oreq->addr);
+ req->rw_len = be32_to_cpu(oreq->size);
+ req->rw_buf = (void *)be64_to_cpu(oreq->buffer_ra);
req->completion = opal_i2c_request_complete;
req->user_data = (void *)(unsigned long)async_token;
req->bus = bus;
OpenPOWER on IntegriCloud