* [PATCH 0/1] input: replace i2c_new_probed_device with an ERR_PTR variant
@ 2019-12-16 12:29 Wolfram Sang
2019-12-16 12:29 ` [PATCH 1/1] input: mouse: convert to i2c_new_scanned_device Wolfram Sang
0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2019-12-16 12:29 UTC (permalink / raw)
To: linux-i2c; +Cc: Wolfram Sang, linux-input, linux-kernel
In the on-going mission to let i2c_new_* calls return an ERR_PTR instead of
NULL, here is a series for this subsystem converting i2c_new_probed_device() to
the newly introduced i2c_new_scanned_device(). Based on v5.5-rc1 and build tested.
Please apply via your tree.
Thanks,
Wolfram
Changes since RFC:
* use a local variable and populate the private struct only on success
(Thanks Dmitry!)
* rebased to v5.5-rc1
Wolfram Sang (1):
input: mouse: convert to i2c_new_scanned_device
drivers/input/mouse/psmouse-smbus.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] input: mouse: convert to i2c_new_scanned_device
2019-12-16 12:29 [PATCH 0/1] input: replace i2c_new_probed_device with an ERR_PTR variant Wolfram Sang
@ 2019-12-16 12:29 ` Wolfram Sang
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2019-12-16 12:29 UTC (permalink / raw)
To: linux-i2c; +Cc: Wolfram Sang, Dmitry Torokhov, linux-input, linux-kernel
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 related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-16 12:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-16 12:29 [PATCH 0/1] input: replace i2c_new_probed_device with an ERR_PTR variant Wolfram Sang
2019-12-16 12:29 ` [PATCH 1/1] input: mouse: convert to i2c_new_scanned_device Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).