diff mbox series

pinctrl: sx150x: Simplify probe()

Message ID 20230909110459.12453-1-biju.das.jz@bp.renesas.com
State Accepted
Commit 70a3894c0aa0c45cc3cd1200fac4ec6408753913
Headers show
Series pinctrl: sx150x: Simplify probe() | expand

Commit Message

Biju Das Sept. 9, 2023, 11:04 a.m. UTC
Simpilfy probe() by replacing of_device_get_match_data() and ID lookup for
retrieving match data by i2c_get_match_data().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/pinctrl/pinctrl-sx150x.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Linus Walleij Sept. 12, 2023, 8:13 a.m. UTC | #1
On Sat, Sep 9, 2023 at 1:05 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:

> Simpilfy probe() by replacing of_device_get_match_data() and ID lookup for
> retrieving match data by i2c_get_match_data().
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Patch applied.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinctrl-sx150x.c b/drivers/pinctrl/pinctrl-sx150x.c
index fef1ee7b7945..fd0331a87cda 100644
--- a/drivers/pinctrl/pinctrl-sx150x.c
+++ b/drivers/pinctrl/pinctrl-sx150x.c
@@ -1116,7 +1116,6 @@  static const struct regmap_config sx150x_regmap_config = {
 
 static int sx150x_probe(struct i2c_client *client)
 {
-	const struct i2c_device_id *id = i2c_client_get_device_id(client);
 	static const u32 i2c_funcs = I2C_FUNC_SMBUS_BYTE_DATA |
 				     I2C_FUNC_SMBUS_WRITE_WORD_DATA;
 	struct device *dev = &client->dev;
@@ -1135,11 +1134,7 @@  static int sx150x_probe(struct i2c_client *client)
 	pctl->dev = dev;
 	pctl->client = client;
 
-	if (dev->of_node)
-		pctl->data = of_device_get_match_data(dev);
-	else
-		pctl->data = (struct sx150x_device_data *)id->driver_data;
-
+	pctl->data = i2c_get_match_data(client);
 	if (!pctl->data)
 		return -EINVAL;