<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Didn't knew about that line, sorry..</div>
<div>Sure you can include that.</div>
<div>I'm hoping patchwork won't thing it got tested twice by me..</div>
<div> </div>
<div>Tested-by: Tristan Bastian <tristan-c.bastian@gmx.de></div>
<div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Montag, 28. Januar 2019 um 09:10 Uhr<br/>
<b>Von:</b> "Thierry Reding" <thierry.reding@gmail.com><br/>
<b>An:</b> "Tristan Bastian" <tristan-c.bastian@gmx.de><br/>
<b>Cc:</b> "Wolfram Sang" <wsa@the-dreams.de>, "Rob Herring" <robh+dt@kernel.org>, "Lucas Stach" <l.stach@pengutronix.de>, "Andrzej Hajda" <a.hajda@samsung.com>, "Vlado Plaga" <rechner@vlado-do.de>, linux-i2c@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org<br/>
<b>Betreff:</b> Re: [PATCH v2] i2c: of: Try to find an I2C adapter matching the parent</div>
<div name="quoted-content">On Mon, Jan 28, 2019 at 09:08:15AM +0100, Thierry Reding wrote:<br/>
> On Sat, Jan 26, 2019 at 01:37:34PM +0100, Tristan Bastian wrote:<br/>
> > Am 25.01.19 um 14:11 schrieb Thierry Reding:<br/>
> > > From: Thierry Reding <treding@nvidia.com><br/>
> > ><br/>
> > > If an I2C adapter doesn't match the provided device tree node, also try<br/>
> > > matching the parent's device tree node. This allows finding an adapter<br/>
> > > based on the device node of the parent device that was used to register<br/>
> > > it.<br/>
> > ><br/>
> > > This fixes a regression on Tegra124-based Chromebooks (Nyan) where the<br/>
> > > eDP controller registers an I2C adapter that is used to read to EDID.<br/>
> > > After commit 993a815dcbb2 ("dt-bindings: panel: Add missing .txt<br/>
> > > suffix") this stopped working because the I2C adapter could no longer<br/>
> > > be found. The approach in this patch fixes the regression without<br/>
> > > introducing the issues that the above commit solved.<br/>
> > ><br/>
> > > Fixes: 17ab7806de0c ("drm: don't link DP aux i2c adapter to the hardware device node")<br/>
> > > Signed-off-by: Thierry Reding <treding@nvidia.com><br/>
> > > ---<br/>
> > > Changes in v2:<br/>
> > > - check for both device and parent device tree nodes for each device<br/>
> > > instead of looping through the list of devices twice<br/>
> > ><br/>
> > > drivers/i2c/i2c-core-of.c | 14 +++++++++++++-<br/>
> > > 1 file changed, 13 insertions(+), 1 deletion(-)<br/>
> > ><br/>
> > > diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c<br/>
> > > index 6cb7ad608bcd..0f01cdba9d2c 100644<br/>
> > > --- a/drivers/i2c/i2c-core-of.c<br/>
> > > +++ b/drivers/i2c/i2c-core-of.c<br/>
> > > @@ -121,6 +121,17 @@ static int of_dev_node_match(struct device *dev, void *data)<br/>
> > > return dev->of_node == data;<br/>
> > > }<br/>
> > > +static int of_dev_or_parent_node_match(struct device *dev, void *data)<br/>
> > > +{<br/>
> > > + if (dev->of_node == data)<br/>
> > > + return 1;<br/>
> > > +<br/>
> > > + if (dev->parent)<br/>
> > > + return dev->parent->of_node == data;<br/>
> > > +<br/>
> > > + return 0;<br/>
> > > +}<br/>
> > > +<br/>
> > > /* must call put_device() when done with returned i2c_client device */<br/>
> > > struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)<br/>
> > > {<br/>
> > > @@ -145,7 +156,8 @@ struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)<br/>
> > > struct device *dev;<br/>
> > > struct i2c_adapter *adapter;<br/>
> > > - dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match);<br/>
> > > + dev = bus_find_device(&i2c_bus_type, NULL, node,<br/>
> > > + of_dev_or_parent_node_match);<br/>
> > > if (!dev)<br/>
> > > return NULL;<br/>
> ><br/>
> > I've tested this and can confirm that this fixes the issue on the nyan-big<br/>
> > chromebook.<br/>
><br/>
> Excellent, thanks for testing! Typically if you've tested a patch and<br/>
> verified that it fixes the problem that you were seeing, it's good to<br/>
> send this on a line by itself along with your reply:<br/>
><br/>
> Tested-by: Tristan Bastian <tristan-c.bastian@gmx.de><br/>
<br/>
Oh my... that was stupid. I think patchwork might now pick this up...<br/>
<br/>
This also made me realize that I should've credited both Tristan and<br/>
Vlado as reporters in the commit message. I'll resend this.<br/>
<br/>
Tristan, is it okay if I include your Tested-by: tag in the v2?<br/>
<br/>
Thierry</div>
</div>
</div>
</div></div></body></html>