Linux Input Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH RESEND] input: mouse: convert to i2c_new_scanned_device
@ 2020-02-10 16:59 Wolfram Sang
  2020-02-15 23:49 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2020-02-10 16:59 UTC (permalink / raw)
  To: linux-input; +Cc: Dmitry Torokhov, linux-i2c, Wolfram Sang

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only.

 drivers/input/mouse/psmouse-smbus.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/input/mouse/psmouse-smbus.c b/drivers/input/mouse/psmouse-smbus.c
index 027efdd2b2ad..27358e543283 100644
--- a/drivers/input/mouse/psmouse-smbus.c
+++ b/drivers/input/mouse/psmouse-smbus.c
@@ -190,6 +190,7 @@ static int psmouse_smbus_create_companion(struct device *dev, void *data)
 	struct psmouse_smbus_dev *smbdev = data;
 	unsigned short addr_list[] = { smbdev->board.addr, I2C_CLIENT_END };
 	struct i2c_adapter *adapter;
+	struct i2c_client *client;
 
 	adapter = i2c_verify_adapter(dev);
 	if (!adapter)
@@ -198,12 +199,12 @@ static int psmouse_smbus_create_companion(struct device *dev, void *data)
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HOST_NOTIFY))
 		return 0;
 
-	smbdev->client = i2c_new_probed_device(adapter, &smbdev->board,
-					       addr_list, NULL);
-	if (!smbdev->client)
+	client = i2c_new_scanned_device(adapter, &smbdev->board, addr_list, NULL);
+	if (IS_ERR(client))
 		return 0;
 
 	/* We have our(?) device, stop iterating i2c bus. */
+	smbdev->client = client;
 	return 1;
 }
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND] input: mouse: convert to i2c_new_scanned_device
  2020-02-10 16:59 [PATCH RESEND] input: mouse: convert to i2c_new_scanned_device Wolfram Sang
@ 2020-02-15 23:49 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2020-02-15 23:49 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-input, linux-i2c

On Mon, Feb 10, 2020 at 05:59:02PM +0100, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied, thank you.

> ---
> 
> Build tested only.
> 
>  drivers/input/mouse/psmouse-smbus.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/mouse/psmouse-smbus.c b/drivers/input/mouse/psmouse-smbus.c
> index 027efdd2b2ad..27358e543283 100644
> --- a/drivers/input/mouse/psmouse-smbus.c
> +++ b/drivers/input/mouse/psmouse-smbus.c
> @@ -190,6 +190,7 @@ static int psmouse_smbus_create_companion(struct device *dev, void *data)
>  	struct psmouse_smbus_dev *smbdev = data;
>  	unsigned short addr_list[] = { smbdev->board.addr, I2C_CLIENT_END };
>  	struct i2c_adapter *adapter;
> +	struct i2c_client *client;
>  
>  	adapter = i2c_verify_adapter(dev);
>  	if (!adapter)
> @@ -198,12 +199,12 @@ static int psmouse_smbus_create_companion(struct device *dev, void *data)
>  	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HOST_NOTIFY))
>  		return 0;
>  
> -	smbdev->client = i2c_new_probed_device(adapter, &smbdev->board,
> -					       addr_list, NULL);
> -	if (!smbdev->client)
> +	client = i2c_new_scanned_device(adapter, &smbdev->board, addr_list, NULL);
> +	if (IS_ERR(client))
>  		return 0;
>  
>  	/* We have our(?) device, stop iterating i2c bus. */
> +	smbdev->client = client;
>  	return 1;
>  }
>  
> -- 
> 2.20.1
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10 16:59 [PATCH RESEND] input: mouse: convert to i2c_new_scanned_device Wolfram Sang
2020-02-15 23:49 ` Dmitry Torokhov

Linux Input Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-input/0 linux-input/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-input linux-input/ https://lore.kernel.org/linux-input \
		linux-input@vger.kernel.org
	public-inbox-index linux-input

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-input


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git