linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Biju Das <biju.das.jz@bp.renesas.com>,
	Andi Shyti <andi.shyti@kernel.org>
Cc: Wolfram Sang <wsa@kernel.org>,
	linux-i2c@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v5 RESEND 2/4] i2c: Add i2c_device_get_match_data() callback
Date: Thu, 3 Aug 2023 15:06:33 +0300	[thread overview]
Message-ID: <ZMuYSdVfiCiUXU8L@smile.fi.intel.com> (raw)
In-Reply-To: <20230803103102.323987-3-biju.das.jz@bp.renesas.com>

On Thu, Aug 03, 2023 at 11:31:00AM +0100, Biju Das wrote:
> Add i2c_device_get_match_data() callback to struct bus_type().
> 
> While at it, introduced i2c_get_match_data_helper() to avoid code
> duplication with i2c_get_match_data().

It seems you are missing to Cc Andi for all these... (not your fault,
rather unfortunately).

Yes, while he is not directly involved into core changes the drivers
are pretty much should consider this change.

...

>  	data = device_get_match_data(&client->dev);
> -	if (!data) {
> -		match = i2c_match_id(driver->id_table, client);
> -		if (!match)
> -			return NULL;
> +	if (data)
> +		return data;
>  
> -		data = (const void *)match->driver_data;
> -	}
> -
> -	return data;

Looking at this, it _might_ make sense to split another patch to prepare for
better difference here.

 -	if (!data) {
 -		match = i2c_match_id(driver->id_table, client);
 -		if (!match)
 -			return NULL;
 +	if (data)
 +		return data;
 +
 +	match = i2c_match_id(driver->id_table, client);
 +	if (!match)
 +		return NULL;
 +
 +	return (const void *)match->driver_data;

 Just play with this idea.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-08-03 12:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03 10:30 [PATCH v5 RESEND 0/4] Extend device_get_match_data() to struct bus_type Biju Das
2023-08-03 10:31 ` [PATCH v5 RESEND 2/4] i2c: Add i2c_device_get_match_data() callback Biju Das
2023-08-03 12:06   ` Andy Shevchenko [this message]
2023-08-03 13:52     ` Biju Das
2023-08-04  4:05       ` Andy Shevchenko
2023-08-03 10:31 ` [PATCH v5 RESEND 3/4] i2c: i2c-core-of: Convert i2c_of_match_device_sysfs() to non-static Biju Das
2023-08-03 12:08   ` Andy Shevchenko
2023-08-03 10:31 ` [PATCH v5 RESEND 4/4] i2c: Extend i2c_device_get_match_data() to support i2c sysfs Biju Das
2023-08-03 12:10   ` Andy Shevchenko
2023-08-03 12:13 ` [PATCH v5 RESEND 0/4] Extend device_get_match_data() to struct bus_type Andy Shevchenko

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=ZMuYSdVfiCiUXU8L@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=andi.shyti@kernel.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=wsa@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).