aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2018-08-23 13:47:32 +1000
committerStewart Smith <stewart@linux.ibm.com>2018-09-17 21:39:02 -0500
commit801462feb7d6c303cfc4c3338351d4d57de70c50 (patch)
tree6054bb6b270bfd0b5821118e5d0fd7b100ba88d1 /core
parentbb27c7219dc62eebc1a35d0d83222c40fbb0a384 (diff)
downloadskiboot-801462feb7d6c303cfc4c3338351d4d57de70c50.zip
skiboot-801462feb7d6c303cfc4c3338351d4d57de70c50.tar.gz
skiboot-801462feb7d6c303cfc4c3338351d4d57de70c50.tar.bz2
core/i2c: Remove bus specific alloc and free callbacks
These are now pointless and they can be replaced with zalloc() and free(). Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/i2c.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/core/i2c.c b/core/i2c.c
index b0d5d34..26926fc 100644
--- a/core/i2c.c
+++ b/core/i2c.c
@@ -51,7 +51,7 @@ static void opal_i2c_request_complete(int rc, struct i2c_request *req)
uint64_t token = (uint64_t)(unsigned long)req->user_data;
opal_queue_msg(OPAL_MSG_ASYNC_COMP, NULL, NULL, token, rc);
- i2c_free_req(req);
+ free(req);
}
static int opal_i2c_request(uint64_t async_token, uint32_t bus_id,
@@ -80,7 +80,7 @@ static int opal_i2c_request(uint64_t async_token, uint32_t bus_id,
return OPAL_PARAMETER;
}
- req = i2c_alloc_req(bus);
+ req = zalloc(sizeof(*req));
if (!req) {
/**
* @fwts-label I2CFailedAllocation
@@ -110,7 +110,7 @@ static int opal_i2c_request(uint64_t async_token, uint32_t bus_id,
req->offset_bytes = oreq->subaddr_sz;
break;
default:
- bus->free_req(req);
+ free(req);
return OPAL_PARAMETER;
}
req->dev_addr = oreq->addr;
@@ -121,14 +121,14 @@ static int opal_i2c_request(uint64_t async_token, uint32_t bus_id,
req->bus = bus;
if (i2c_check_quirk(req, &rc)) {
- i2c_free_req(req);
+ free(req);
return rc;
}
/* Finally, queue the OPAL i2c request and return */
rc = i2c_queue_req(req);
if (rc) {
- i2c_free_req(req);
+ free(req);
return rc;
}
@@ -189,7 +189,7 @@ int i2c_request_send(int bus_id, int dev_addr, int read_write,
return OPAL_PARAMETER;
}
- req = i2c_alloc_req(bus);
+ req = zalloc(sizeof(*req));
if (!req) {
/**
* @fwts-label I2CAllocationFailed
@@ -197,10 +197,11 @@ int i2c_request_send(int bus_id, int dev_addr, int read_write,
* i2c_request. This points to an OPAL bug as OPAL run out of
* memory and this should never happen.
*/
- prlog(PR_ERR, "I2C: i2c_alloc_req failed\n");
+ prlog(PR_ERR, "I2C: allocating i2c_request failed\n");
return OPAL_INTERNAL_ERROR;
}
+ req->bus = bus;
req->dev_addr = dev_addr;
req->op = read_write;
req->offset = offset;
@@ -239,7 +240,7 @@ int i2c_request_send(int bus_id, int dev_addr, int read_write,
(rc) ? "!!!!" : "----", req->op, req->offset,
*(uint64_t*) buf, req->rw_len, tb_to_msecs(waited), timeout, rc);
- i2c_free_req(req);
+ free(req);
if (rc)
return OPAL_HARDWARE;