The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: Liguang Zhang <zhangliguang@linux.alibaba.com>
Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipmi:ssif: make ssif_i2c_send() void
Date: Mon, 1 Mar 2021 09:23:46 -0600	[thread overview]
Message-ID: <20210301152346.GD507977@minyard.net> (raw)
In-Reply-To: <20210301140515.18951-1-zhangliguang@linux.alibaba.com>

This looks ok, it's queued for 5.12.

Thanks,

-corey

On Mon, Mar 01, 2021 at 10:05:15PM +0800, Liguang Zhang wrote:
> This function actually needs no return value. So remove the unneeded
> check and make it void.
> 
> Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
> ---
>  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
> 

      reply	other threads:[~2021-03-01 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 14:05 [PATCH] ipmi:ssif: make ssif_i2c_send() void Liguang Zhang
2021-03-01 15:23 ` Corey Minyard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210301152346.GD507977@minyard.net \
    --to=minyard@acm.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=zhangliguang@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox