Tested-by: Vlado Plaga <rech...@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 <tred...@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 <tred...@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 via email to