public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Vlado Plaga <rechner@vlado-do.de>
To: Thierry Reding <thierry.reding@gmail.com>,
	Wolfram Sang <wsa@the-dreams.de>
Cc: rechner@vlado-do.de, dri-devel@lists.freedesktop.org,
	linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH] i2c: of: Try to find an I2C adapter matching the parent
Date: Wed, 26 Sep 2018 20:20:42 +0200	[thread overview]
Message-ID: <e84a1565-5d88-ebfa-54ae-e4b3254f4287@vlado-do.de> (raw)
In-Reply-To: <20180925160611.17736-1-thierry.reding@gmail.com>

Tested-by: Vlado Plaga <rechner@vlado-do.de>

This patch works for me - without it my screen stays black (Acer CB5-311).

On 25/09/2018 18:06, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> If an I2C adapter doesn't match the provided device tree node, also try
> matching the parent's device tree node. This allows finding an adapter
> based on the device node of the parent device that was used to register
> it.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
[...]
>  drivers/i2c/i2c-core-of.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c
> index 6cb7ad608bcd..37d34885ea2d 100644
> --- a/drivers/i2c/i2c-core-of.c
> +++ b/drivers/i2c/i2c-core-of.c
> @@ -121,6 +121,14 @@ static int of_dev_node_match(struct device *dev, void *data)
>  	return dev->of_node == data;
>  }
>  
> +static int of_parent_node_match(struct device *dev, void *data)
> +{
> +	if (dev->parent)
> +		return dev->parent->of_node == data;
> +
> +	return 0;
> +}
> +
>  /* must call put_device() when done with returned i2c_client device */
>  struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
>  {
> @@ -146,6 +154,9 @@ struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
>  	struct i2c_adapter *adapter;
>  
>  	dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match);
> +	if (!dev)
> +		dev = bus_find_device(&i2c_bus_type, NULL, node, of_parent_node_match);
> +
>  	if (!dev)
>  		return NULL;
>  

-- 

Vlado Plaga
http://vlado-do.de/
akualisiert: 2018-05-08

"Wer das Geld hat, hat die Macht und wer die Macht hat, hat das Recht"
aus 'Der Kampf geht weiter', Rio Reiser und R.P.S. Lanrue, 1971

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-09-26 18:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180925160618epcas1p1f2a4263fcce9c70aa3808999ebe72315@epcas1p1.samsung.com>
2018-09-25 16:06 ` [PATCH] i2c: of: Try to find an I2C adapter matching the parent Thierry Reding
2018-09-26 18:20   ` Vlado Plaga [this message]
2018-09-30 23:02   ` Wolfram Sang
2018-12-11 19:43     ` Wolfram Sang
2018-10-02 12:12   ` Andrzej Hajda

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=e84a1565-5d88-ebfa-54ae-e4b3254f4287@vlado-do.de \
    --to=rechner@vlado-do.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=wsa@the-dreams.de \
    /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