All of lore.kernel.org
 help / color / mirror / Atom feed
From: <ye.xingchen@zte.com.cn>
To: <lee@kernel.org>
Cc: <tony@atomide.com>, <linux-omap@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH linux-next] mfd: palmas: Use device_get_match_data() to simplify the code
Date: Thu, 17 Nov 2022 19:52:24 +0800 (CST)	[thread overview]
Message-ID: <202211171952240424511@zte.com.cn> (raw)

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

             reply	other threads:[~2022-11-17 11:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17 11:52 ye.xingchen [this message]
2022-11-17 11:56 ` [PATCH linux-next] mfd: palmas: Use device_get_match_data() to simplify the code Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202211171952240424511@zte.com.cn \
    --to=ye.xingchen@zte.com.cn \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.