diff mbox

[v11,02/12] staging: imx-drm: imx-hdmi: return defer if can't get ddc i2c adapter

Message ID 1415972348-8382-1-git-send-email-andy.yan@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andy Yan Nov. 14, 2014, 1:39 p.m. UTC
drm driver may probe before the i2c bus, so the driver should
defer probing until it is available

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>

---

Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4:
- defer probe ddc i2c adapter

Changes in v3: None
Changes in v2: None

 drivers/staging/imx-drm/imx-hdmi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Daniel Kurtz Nov. 15, 2014, 5:41 a.m. UTC | #1
On Fri, Nov 14, 2014 at 9:39 PM, Andy Yan <andy.yan@rock-chips.com> wrote:
> drm driver may probe before the i2c bus, so the driver should
> defer probing until it is available
>
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>
> ---
>
> Changes in v11: None
> Changes in v10: None
> Changes in v9: None
> Changes in v8: None
> Changes in v7: None
> Changes in v6: None
> Changes in v5: None
> Changes in v4:
> - defer probe ddc i2c adapter
>
> Changes in v3: None
> Changes in v2: None
>
>  drivers/staging/imx-drm/imx-hdmi.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c
> index 79daec4..c2b035a 100644
> --- a/drivers/staging/imx-drm/imx-hdmi.c
> +++ b/drivers/staging/imx-drm/imx-hdmi.c
> @@ -1611,8 +1611,11 @@ static int imx_hdmi_bind(struct device *dev, struct device *master, void *data)
>         ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
>         if (ddc_node) {
>                 hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
> -               if (!hdmi->ddc)
> +               if (!hdmi->ddc) {
>                         dev_dbg(hdmi->dev, "failed to read ddc node\n");
> +                       of_node_put(ddc_node);
> +                       return -EPROBE_DEFER;
> +               }

Nit:  You could move "of_node_put()" above "if (!hdmi->ddc)", and not
need it in two places.

Either way, this one is:
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>

>
>                 of_node_put(ddc_node);
>         } else {
> --
> 1.9.1
>
Andy Yan Nov. 17, 2014, 1:35 a.m. UTC | #2
On 2014?11?15? 13:41, Daniel Kurtz wrote:
> On Fri, Nov 14, 2014 at 9:39 PM, Andy Yan <andy.yan@rock-chips.com> wrote:
>> drm driver may probe before the i2c bus, so the driver should
>> defer probing until it is available
>>
>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>>
>> ---
>>
>> Changes in v11: None
>> Changes in v10: None
>> Changes in v9: None
>> Changes in v8: None
>> Changes in v7: None
>> Changes in v6: None
>> Changes in v5: None
>> Changes in v4:
>> - defer probe ddc i2c adapter
>>
>> Changes in v3: None
>> Changes in v2: None
>>
>>   drivers/staging/imx-drm/imx-hdmi.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c
>> index 79daec4..c2b035a 100644
>> --- a/drivers/staging/imx-drm/imx-hdmi.c
>> +++ b/drivers/staging/imx-drm/imx-hdmi.c
>> @@ -1611,8 +1611,11 @@ static int imx_hdmi_bind(struct device *dev, struct device *master, void *data)
>>          ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
>>          if (ddc_node) {
>>                  hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
>> -               if (!hdmi->ddc)
>> +               if (!hdmi->ddc) {
>>                          dev_dbg(hdmi->dev, "failed to read ddc node\n");
>> +                       of_node_put(ddc_node);
>> +                       return -EPROBE_DEFER;
>> +               }
> Nit:  You could move "of_node_put()" above "if (!hdmi->ddc)", and not
> need it in two places.
  thanks, I will take your advice
>
> Either way, this one is:
> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
>
>>                  of_node_put(ddc_node);
>>          } else {
>> --
>> 1.9.1
>>
>
>
diff mbox

Patch

diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c
index 79daec4..c2b035a 100644
--- a/drivers/staging/imx-drm/imx-hdmi.c
+++ b/drivers/staging/imx-drm/imx-hdmi.c
@@ -1611,8 +1611,11 @@  static int imx_hdmi_bind(struct device *dev, struct device *master, void *data)
 	ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
 	if (ddc_node) {
 		hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
-		if (!hdmi->ddc)
+		if (!hdmi->ddc) {
 			dev_dbg(hdmi->dev, "failed to read ddc node\n");
+			of_node_put(ddc_node);
+			return -EPROBE_DEFER;
+		}
 
 		of_node_put(ddc_node);
 	} else {