[PATCH 6/6] i2c: Make remove callback return void

Corey Minyard minyard at acm.org
Tue Jul 5 22:11:56 CEST 2022


On Tue, Jun 28, 2022 at 04:03:12PM +0200, Uwe Kleine-König wrote:
> From: Uwe Kleine-König <uwe at kleine-koenig.org>
> 
> The value returned by an i2c driver's remove function is mostly ignored.
> (Only an error message is printed if the value is non-zero that the
> error is ignored.)
> 
> So change the prototype of the remove function to return no value. This
> way driver authors are not tempted to assume that passing an error to
> the upper layer is a good idea. All drivers are adapted accordingly.
> There is no intended change of behaviour, all callbacks were prepared to
> return 0 before.

For IPMI portions below:

Acked-by: Corey Minyard <cninyard at mvista.com>

>  
>  static const struct i2c_device_id lcd2s_i2c_id[] = {
> diff --git a/drivers/char/ipmi/ipmb_dev_int.c b/drivers/char/ipmi/ipmb_dev_int.c
> index db40037eb347..a0e9e80d92ee 100644
> --- a/drivers/char/ipmi/ipmb_dev_int.c
> +++ b/drivers/char/ipmi/ipmb_dev_int.c
> @@ -341,14 +341,12 @@ static int ipmb_probe(struct i2c_client *client)
>  	return 0;
>  }
>  
> -static int ipmb_remove(struct i2c_client *client)
> +static void ipmb_remove(struct i2c_client *client)
>  {
>  	struct ipmb_dev *ipmb_dev = i2c_get_clientdata(client);
>  
>  	i2c_slave_unregister(client);
>  	misc_deregister(&ipmb_dev->miscdev);
> -
> -	return 0;
>  }
>  
>  static const struct i2c_device_id ipmb_id[] = {
> diff --git a/drivers/char/ipmi/ipmi_ipmb.c b/drivers/char/ipmi/ipmi_ipmb.c
> index ab19b4b3317e..25c010c9ec25 100644
> --- a/drivers/char/ipmi/ipmi_ipmb.c
> +++ b/drivers/char/ipmi/ipmi_ipmb.c
> @@ -424,7 +424,7 @@ static void ipmi_ipmb_request_events(void *send_info)
>  	/* We don't fetch events here. */
>  }
>  
> -static int ipmi_ipmb_remove(struct i2c_client *client)
> +static void ipmi_ipmb_remove(struct i2c_client *client)
>  {
>  	struct ipmi_ipmb_dev *iidev = i2c_get_clientdata(client);
>  
> @@ -438,8 +438,6 @@ static int ipmi_ipmb_remove(struct i2c_client *client)
>  	ipmi_ipmb_stop_thread(iidev);
>  
>  	ipmi_unregister_smi(iidev->intf);
> -
> -	return 0;
>  }
>  
>  static int ipmi_ipmb_probe(struct i2c_client *client)
> diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> index fc742ee9c046..13da021e7c6b 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -1281,13 +1281,13 @@ static void shutdown_ssif(void *send_info)
>  	}
>  }
>  
> -static int ssif_remove(struct i2c_client *client)
> +static void ssif_remove(struct i2c_client *client)
>  {
>  	struct ssif_info *ssif_info = i2c_get_clientdata(client);
>  	struct ssif_addr_info *addr_info;
>  
>  	if (!ssif_info)
> -		return 0;
> +		return;
>  
>  	/*
>  	 * After this point, we won't deliver anything asychronously
> @@ -1303,8 +1303,6 @@ static int ssif_remove(struct i2c_client *client)
>  	}
>  
>  	kfree(ssif_info);
> -
> -	return 0;
>  }
>  
>  static int read_response(struct i2c_client *client, unsigned char *resp)


More information about the Alsa-devel mailing list