[PATCH] ipmi:ssif: make ssif_i2c_send() void

From: Liguang Zhang
Date: Mon Mar 01 2021 - 09:07:47 EST


This function actually needs no return value. So remove the unneeded
check and make it void.

Signed-off-by: Liguang Zhang <zhangliguang@xxxxxxxxxxxxxxxxx>
---
drivers/char/ipmi/ipmi_ssif.c | 81 +++++++++--------------------------
1 file changed, 20 insertions(+), 61 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index 0416b9c9d410..20d5af92966d 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -510,7 +510,7 @@ static int ipmi_ssif_thread(void *data)
return 0;
}

-static int ssif_i2c_send(struct ssif_info *ssif_info,
+static void ssif_i2c_send(struct ssif_info *ssif_info,
ssif_i2c_done handler,
int read_write, int command,
unsigned char *data, unsigned int size)
@@ -522,7 +522,6 @@ static int ssif_i2c_send(struct ssif_info *ssif_info,
ssif_info->i2c_data = data;
ssif_info->i2c_size = size;
complete(&ssif_info->wake_thread);
- return 0;
}


@@ -531,22 +530,12 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,

static void start_get(struct ssif_info *ssif_info)
{
- int rv;
-
ssif_info->rtc_us_timer = 0;
ssif_info->multi_pos = 0;

- rv = ssif_i2c_send(ssif_info, msg_done_handler, I2C_SMBUS_READ,
- SSIF_IPMI_RESPONSE,
- ssif_info->recv, I2C_SMBUS_BLOCK_DATA);
- if (rv < 0) {
- /* request failed, just return the error. */
- if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
- dev_dbg(&ssif_info->client->dev,
- "Error from i2c_non_blocking_op(5)\n");
-
- msg_done_handler(ssif_info, -EIO, NULL, 0);
- }
+ ssif_i2c_send(ssif_info, msg_done_handler, I2C_SMBUS_READ,
+ SSIF_IPMI_RESPONSE,
+ ssif_info->recv, I2C_SMBUS_BLOCK_DATA);
}

static void retry_timeout(struct timer_list *t)
@@ -620,7 +609,6 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
{
struct ipmi_smi_msg *msg;
unsigned long oflags, *flags;
- int rv;

/*
* We are single-threaded here, so no need for a lock until we
@@ -666,17 +654,10 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
ssif_info->multi_len = len;
ssif_info->multi_pos = 1;

- rv = ssif_i2c_send(ssif_info, msg_done_handler, I2C_SMBUS_READ,
- SSIF_IPMI_MULTI_PART_RESPONSE_MIDDLE,
- ssif_info->recv, I2C_SMBUS_BLOCK_DATA);
- if (rv < 0) {
- if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
- dev_dbg(&ssif_info->client->dev,
- "Error from i2c_non_blocking_op(1)\n");
-
- result = -EIO;
- } else
- return;
+ ssif_i2c_send(ssif_info, msg_done_handler, I2C_SMBUS_READ,
+ SSIF_IPMI_MULTI_PART_RESPONSE_MIDDLE,
+ ssif_info->recv, I2C_SMBUS_BLOCK_DATA);
+ return;
} else if (ssif_info->multi_pos) {
/* Middle of multi-part read. Start the next transaction. */
int i;
@@ -738,19 +719,12 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,

ssif_info->multi_pos++;

- rv = ssif_i2c_send(ssif_info, msg_done_handler,
- I2C_SMBUS_READ,
- SSIF_IPMI_MULTI_PART_RESPONSE_MIDDLE,
- ssif_info->recv,
- I2C_SMBUS_BLOCK_DATA);
- if (rv < 0) {
- if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
- dev_dbg(&ssif_info->client->dev,
- "Error from ssif_i2c_send\n");
-
- result = -EIO;
- } else
- return;
+ ssif_i2c_send(ssif_info, msg_done_handler,
+ I2C_SMBUS_READ,
+ SSIF_IPMI_MULTI_PART_RESPONSE_MIDDLE,
+ ssif_info->recv,
+ I2C_SMBUS_BLOCK_DATA);
+ return;
}
}

@@ -908,8 +882,6 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
static void msg_written_handler(struct ssif_info *ssif_info, int result,
unsigned char *data, unsigned int len)
{
- int rv;
-
/* We are single-threaded here, so no need for a lock. */
if (result < 0) {
ssif_info->retries_left--;
@@ -972,18 +944,9 @@ static void msg_written_handler(struct ssif_info *ssif_info, int result,
ssif_info->multi_data = NULL;
}

- rv = ssif_i2c_send(ssif_info, msg_written_handler,
- I2C_SMBUS_WRITE, cmd,
- data_to_send, I2C_SMBUS_BLOCK_DATA);
- if (rv < 0) {
- /* request failed, just return the error. */
- ssif_inc_stat(ssif_info, send_errors);
-
- if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
- dev_dbg(&ssif_info->client->dev,
- "Error from i2c_non_blocking_op(3)\n");
- msg_done_handler(ssif_info, -EIO, NULL, 0);
- }
+ ssif_i2c_send(ssif_info, msg_written_handler,
+ I2C_SMBUS_WRITE, cmd,
+ data_to_send, I2C_SMBUS_BLOCK_DATA);
} else {
/* Ready to request the result. */
unsigned long oflags, *flags;
@@ -1012,7 +975,6 @@ static void msg_written_handler(struct ssif_info *ssif_info, int result,

static int start_resend(struct ssif_info *ssif_info)
{
- int rv;
int command;

ssif_info->got_alert = false;
@@ -1034,12 +996,9 @@ static int start_resend(struct ssif_info *ssif_info)
ssif_info->data[0] = ssif_info->data_len;
}

- rv = ssif_i2c_send(ssif_info, msg_written_handler, I2C_SMBUS_WRITE,
- command, ssif_info->data, I2C_SMBUS_BLOCK_DATA);
- if (rv && (ssif_info->ssif_debug & SSIF_DEBUG_MSG))
- dev_dbg(&ssif_info->client->dev,
- "Error from i2c_non_blocking_op(4)\n");
- return rv;
+ ssif_i2c_send(ssif_info, msg_written_handler, I2C_SMBUS_WRITE,
+ command, ssif_info->data, I2C_SMBUS_BLOCK_DATA);
+ return 0;
}

static int start_send(struct ssif_info *ssif_info,
--
2.19.1.6.gb485710b