linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Tristan Bastian <tristan-c.bastian@gmx.de>
Cc: Wolfram Sang <wsa@the-dreams.de>,
	Vlado Plaga <rechner@vlado-do.de>,
	dri-devel@lists.freedesktop.org, Rob Herring <robh+dt@kernel.org>,
	linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH v2] i2c: of: Try to find an I2C adapter matching the parent
Date: Mon, 28 Jan 2019 09:10:55 +0100	[thread overview]
Message-ID: <20190128081055.GE18124@ulmo> (raw)
In-Reply-To: <20190128080815.GD18124@ulmo>


[-- Attachment #1.1: Type: text/plain, Size: 3226 bytes --]

On Mon, Jan 28, 2019 at 09:08:15AM +0100, Thierry Reding wrote:
> On Sat, Jan 26, 2019 at 01:37:34PM +0100, Tristan Bastian wrote:
> > Am 25.01.19 um 14:11 schrieb Thierry Reding:
> > > 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.
> > > 
> > > This fixes a regression on Tegra124-based Chromebooks (Nyan) where the
> > > eDP controller registers an I2C adapter that is used to read to EDID.
> > > After commit 993a815dcbb2 ("dt-bindings: panel: Add missing .txt
> > > suffix") this stopped working because the I2C adapter could no longer
> > > be found. The approach in this patch fixes the regression without
> > > introducing the issues that the above commit solved.
> > > 
> > > Fixes: 17ab7806de0c ("drm: don't link DP aux i2c adapter to the hardware device node")
> > > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > > ---
> > > Changes in v2:
> > > - check for both device and parent device tree nodes for each device
> > >    instead of looping through the list of devices twice
> > > 
> > >   drivers/i2c/i2c-core-of.c | 14 +++++++++++++-
> > >   1 file changed, 13 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c
> > > index 6cb7ad608bcd..0f01cdba9d2c 100644
> > > --- a/drivers/i2c/i2c-core-of.c
> > > +++ b/drivers/i2c/i2c-core-of.c
> > > @@ -121,6 +121,17 @@ static int of_dev_node_match(struct device *dev, void *data)
> > >   	return dev->of_node == data;
> > >   }
> > > +static int of_dev_or_parent_node_match(struct device *dev, void *data)
> > > +{
> > > +	if (dev->of_node == data)
> > > +		return 1;
> > > +
> > > +	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)
> > >   {
> > > @@ -145,7 +156,8 @@ struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
> > >   	struct device *dev;
> > >   	struct i2c_adapter *adapter;
> > > -	dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match);
> > > +	dev = bus_find_device(&i2c_bus_type, NULL, node,
> > > +			      of_dev_or_parent_node_match);
> > >   	if (!dev)
> > >   		return NULL;
> > 
> > I've tested this and can confirm that this fixes the issue on the nyan-big
> > chromebook.
> 
> Excellent, thanks for testing! Typically if you've tested a patch and
> verified that it fixes the problem that you were seeing, it's good to
> send this on a line by itself along with your reply:
> 
> Tested-by: Tristan Bastian <tristan-c.bastian@gmx.de>

Oh my... that was stupid. I think patchwork might now pick this up...

This also made me realize that I should've credited both Tristan and
Vlado as reporters in the commit message. I'll resend this.

Tristan, is it okay if I include your Tested-by: tag in the v2?

Thierry

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

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

  reply	other threads:[~2019-01-28  8:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 13:11 [PATCH v2] i2c: of: Try to find an I2C adapter matching the parent Thierry Reding
2019-01-26 12:37 ` Tristan Bastian
2019-01-28  8:08   ` Thierry Reding
2019-01-28  8:10     ` Thierry Reding [this message]
2019-01-28  9:19       ` Tristan Bastian
2019-01-28  9:26       ` Tristan Bastian
2019-02-05 12:44 ` Wolfram Sang
2019-02-06  9:38   ` Wolfram Sang
2019-02-06  9:49     ` Wolfram Sang
2019-02-06 12:07       ` Thierry Reding
2019-02-08 18:35         ` Wolfram Sang

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=20190128081055.GE18124@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=rechner@vlado-do.de \
    --cc=robh+dt@kernel.org \
    --cc=tristan-c.bastian@gmx.de \
    --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;
as well as URLs for NNTP newsgroup(s).