linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] mfd: palmas: Use device_get_match_data() to simplify the code
@ 2022-11-17 11:52 ye.xingchen
  2022-11-17 11:56 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: ye.xingchen @ 2022-11-17 11:52 UTC (permalink / raw)
  To: lee; +Cc: tony, linux-omap, linux-kernel

From: ye xingchen <ye.xingchen@zte.com.cn>

Directly get the match data with device_get_match_data().

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 drivers/mfd/palmas.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index 8b7429bd2e3e..5105c6488d3d 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -512,7 +512,6 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
 	int ret = 0, i;
 	unsigned int reg, addr;
 	int slave;
-	const struct of_device_id *match;

 	pdata = dev_get_platdata(&i2c->dev);

@@ -536,12 +535,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
 	palmas->dev = &i2c->dev;
 	palmas->irq = i2c->irq;

-	match = of_match_device(of_palmas_match_tbl, &i2c->dev);
-
-	if (!match)
-		return -ENODATA;
-
-	driver_data = (struct palmas_driver_data *)match->data;
+	driver_data = (struct palmas_driver_data *) device_get_match_data(&i2c->dev);
 	palmas->features = *driver_data->features;

 	for (i = 0; i < PALMAS_NUM_CLIENTS; i++) {
-- 
2.25.1

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

* Re: [PATCH linux-next] mfd: palmas: Use device_get_match_data() to simplify the code
  2022-11-17 11:52 [PATCH linux-next] mfd: palmas: Use device_get_match_data() to simplify the code ye.xingchen
@ 2022-11-17 11:56 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2022-11-17 11:56 UTC (permalink / raw)
  To: ye.xingchen; +Cc: tony, linux-omap, linux-kernel

On Thu, 17 Nov 2022, ye.xingchen@zte.com.cn wrote:

> From: ye xingchen <ye.xingchen@zte.com.cn>
> 
> Directly get the match data with device_get_match_data().
> 
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> ---
>  drivers/mfd/palmas.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]

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

end of thread, other threads:[~2022-11-17 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-17 11:52 [PATCH linux-next] mfd: palmas: Use device_get_match_data() to simplify the code ye.xingchen
2022-11-17 11:56 ` Lee Jones

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).