All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Daniel Scally <djrscally@gmail.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org,
	Wolfram Sang <wsa@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH RFC 1/2] drivers: fwnode: Extend device_get_match_data() to struct bus_type
Date: Mon, 24 Jul 2023 14:06:07 +0300	[thread overview]
Message-ID: <ZL5bH10uJWDe2SPY@smile.fi.intel.com> (raw)
In-Reply-To: <20230723083721.35384-2-biju.das.jz@bp.renesas.com>

On Sun, Jul 23, 2023 at 09:37:20AM +0100, Biju Das wrote:

Thank you for your contribution!
My comments below.

> Extend device_get_match_data() to buses (for eg: I2C) by adding a
> callback device_get_match_data() to struct bus_type() and call this method
> as a fallback for generic fwnode based device_get_match_data().

> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

You can't just throw one's SoB tag without clear understanding what's going on
here (either wrong authorship or missing Co-developed-by or...?).

> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

...

>  const void *device_get_match_data(const struct device *dev)
>  {
> -	return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev);
> +	const void *data;
> +
> +	data = fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev);
> +	if (!data && dev->bus && dev->bus->get_match_data)
> +		data = dev->bus->get_match_data(dev);
> +
> +	return data;

Much better looking is

	data = fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev);
	if (data)
		return data;

	if (dev->bus && dev->bus->get_match_data)
		return dev->bus->get_match_data(dev);

	return NULL;

>  }

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-07-24 11:08 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-23  8:37 [PATCH RFC 0/2] Extend device_get_match_data() to struct bus_type Biju Das
2023-07-23  8:37 ` [PATCH RFC 1/2] drivers: fwnode: " Biju Das
2023-07-24 11:06   ` Andy Shevchenko [this message]
2023-07-24 11:07     ` Andy Shevchenko
2023-07-24 11:46       ` Biju Das
2023-07-24 12:57         ` Andy Shevchenko
2023-07-24 13:35           ` Biju Das
2023-07-24 12:02     ` Biju Das
2023-07-24 13:00       ` Andy Shevchenko
2023-07-24 13:19         ` Biju Das
2023-07-24 13:50           ` Andy Shevchenko
2023-07-24 13:58             ` Biju Das
2023-07-24 16:38               ` Dmitry Torokhov
2023-07-26  5:33                 ` Biju Das
2023-07-23  8:37 ` [PATCH RFC 2/2] i2c: Add i2c_device_get_match_data() callback Biju Das
2023-07-23 11:18   ` kernel test robot
2023-07-23 11:41     ` Biju Das
2023-07-23 11:28   ` kernel test robot
2023-07-23 11:42     ` Biju Das
2023-07-23 14:03   ` kernel test robot
2023-07-23 20:08   ` Dmitry Torokhov
2023-07-24 14:55   ` Geert Uytterhoeven
2023-07-24 15:06     ` Biju Das
2023-07-24 16:34       ` Dmitry Torokhov
2023-07-24 16:43         ` Geert Uytterhoeven
2023-07-24 16:47           ` Dmitry Torokhov

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=ZL5bH10uJWDe2SPY@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=djrscally@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --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 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.