public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@kernel.org>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-rtc@vger.kernel.org" <linux-rtc@vger.kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	"linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v2] i2c: Add i2c_get_match_data()
Date: Mon, 5 Jun 2023 12:01:16 +0200	[thread overview]
Message-ID: <ZH2ybOmr8fyWOtmg@shikoro> (raw)
In-Reply-To: <OS0PR01MB5922300F70EF37359C53D646864DA@OS0PR01MB5922.jpnprd01.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 814 bytes --]


> You mean like below?? The new helper function will do both I2C and DT-based matching??
> const void *i2c_get_match_data(const struct i2c_client *client)
> {
> 	struct device_driver *drv = client->dev.driver;
> 	struct i2c_driver *driver = to_i2c_driver(drv);
> 	const struct i2c_device_id *match;
> 	const void *match_data;
> 
> 	if (client->dev.of_node){
> 		match_data = of_device_get_match_data(&client->dev);
> 	} else {
> 	      match = i2c_match_id(driver->id_table, client);
> 	      if (!match)
> 		   return NULL;
> 	
> 		match_data = (const void *)match->driver_data;
> 	}
> 
> 	return match_data;
> }
> EXPORT_SYMBOL(i2c_get_match_data);

Yes. Not good? I thought a function named 'i2c_get_match_data' should
get match_data and find out itself where it is coming from. No?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-06-05 10:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01 17:17 [PATCH v2] i2c: Add i2c_get_match_data() Biju Das
2023-06-02  6:45 ` Geert Uytterhoeven
2023-06-05  9:25 ` Wolfram Sang
2023-06-05  9:47   ` Biju Das
2023-06-05 10:01     ` Wolfram Sang [this message]
2023-06-05 10:24       ` Biju Das

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=ZH2ybOmr8fyWOtmg@shikoro \
    --to=wsa@kernel.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox