Skip to content

Commit

Permalink
i2c: Fix sparse warnings for type assignment
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stewartsmith committed Mar 1, 2019
1 parent c0ab7b4 commit ee01ef4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ee01ef4

Please sign in to comment.