Commit 40357058 authored by Wolfram Sang's avatar Wolfram Sang

i2c: tegra-bpmp: make some functions void

They return 0 always, so save some lines and code.
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
Acked-by: default avatarThierry Reding <treding@nvidia.com>
Tested-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 22e06b30
...@@ -38,7 +38,7 @@ struct tegra_bpmp_i2c { ...@@ -38,7 +38,7 @@ struct tegra_bpmp_i2c {
* firmware I2C driver to avoid any issues in future if Linux I2C flags are * firmware I2C driver to avoid any issues in future if Linux I2C flags are
* changed. * changed.
*/ */
static int tegra_bpmp_xlate_flags(u16 flags, u16 *out) static void tegra_bpmp_xlate_flags(u16 flags, u16 *out)
{ {
if (flags & I2C_M_TEN) if (flags & I2C_M_TEN)
*out |= SERIALI2C_TEN; *out |= SERIALI2C_TEN;
...@@ -63,8 +63,6 @@ static int tegra_bpmp_xlate_flags(u16 flags, u16 *out) ...@@ -63,8 +63,6 @@ static int tegra_bpmp_xlate_flags(u16 flags, u16 *out)
if (flags & I2C_M_RECV_LEN) if (flags & I2C_M_RECV_LEN)
*out |= SERIALI2C_RECV_LEN; *out |= SERIALI2C_RECV_LEN;
return 0;
} }
/** /**
...@@ -81,22 +79,19 @@ static int tegra_bpmp_xlate_flags(u16 flags, u16 *out) ...@@ -81,22 +79,19 @@ static int tegra_bpmp_xlate_flags(u16 flags, u16 *out)
* *
* See deserialize_i2c documentation for the data format in the other direction. * See deserialize_i2c documentation for the data format in the other direction.
*/ */
static int tegra_bpmp_serialize_i2c_msg(struct tegra_bpmp_i2c *i2c, static void tegra_bpmp_serialize_i2c_msg(struct tegra_bpmp_i2c *i2c,
struct mrq_i2c_request *request, struct mrq_i2c_request *request,
struct i2c_msg *msgs, struct i2c_msg *msgs,
unsigned int num) unsigned int num)
{ {
char *buf = request->xfer.data_buf; char *buf = request->xfer.data_buf;
unsigned int i, j, pos = 0; unsigned int i, j, pos = 0;
int err;
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
struct i2c_msg *msg = &msgs[i]; struct i2c_msg *msg = &msgs[i];
u16 flags = 0; u16 flags = 0;
err = tegra_bpmp_xlate_flags(msg->flags, &flags); tegra_bpmp_xlate_flags(msg->flags, &flags);
if (err < 0)
return err;
buf[pos++] = msg->addr & 0xff; buf[pos++] = msg->addr & 0xff;
buf[pos++] = (msg->addr & 0xff00) >> 8; buf[pos++] = (msg->addr & 0xff00) >> 8;
...@@ -112,8 +107,6 @@ static int tegra_bpmp_serialize_i2c_msg(struct tegra_bpmp_i2c *i2c, ...@@ -112,8 +107,6 @@ static int tegra_bpmp_serialize_i2c_msg(struct tegra_bpmp_i2c *i2c,
} }
request->xfer.data_size = pos; request->xfer.data_size = pos;
return 0;
} }
/** /**
...@@ -247,12 +240,7 @@ static int tegra_bpmp_i2c_xfer_common(struct i2c_adapter *adapter, ...@@ -247,12 +240,7 @@ static int tegra_bpmp_i2c_xfer_common(struct i2c_adapter *adapter,
memset(&request, 0, sizeof(request)); memset(&request, 0, sizeof(request));
memset(&response, 0, sizeof(response)); memset(&response, 0, sizeof(response));
err = tegra_bpmp_serialize_i2c_msg(i2c, &request, msgs, num); tegra_bpmp_serialize_i2c_msg(i2c, &request, msgs, num);
if (err < 0) {
dev_err(i2c->dev, "failed to serialize message: %d\n", err);
return err;
}
err = tegra_bpmp_i2c_msg_xfer(i2c, &request, &response, atomic); err = tegra_bpmp_i2c_msg_xfer(i2c, &request, &response, atomic);
if (err < 0) { if (err < 0) {
dev_err(i2c->dev, "failed to transfer message: %d\n", err); dev_err(i2c->dev, "failed to transfer message: %d\n", err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment