Message ID | 1442850687-13002-2-git-send-email-vladimir_zapolskiy@mentor.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Vladimir, Thank you for the patches. I will integrate them in the next drm/sti pull request that should be sent by next week. BR Vincent > -----Original Message----- > From: Vladimir Zapolskiy [mailto:vladimir_zapolskiy@mentor.com] > Sent: lundi 21 septembre 2015 17:51 > To: Benjamin Gaignard; Vincent ABRIOU > Cc: David Airlie; dri-devel@lists.freedesktop.org > Subject: [PATCH 2/2] drm: sti_hdmi: use of_get_i2c_adapter_by_node > interface > > This change is needed to properly lock I2C bus device and driver, which serve > DDC lines. Without this change I2C bus driver module may gone in runtime > and this won't be noticed by the driver. > > Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> > --- > drivers/gpu/drm/sti/sti_hdmi.c | 17 ++++++----------- > 1 file changed, 6 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c > index c23b580..b892f29a 100644 > --- a/drivers/gpu/drm/sti/sti_hdmi.c > +++ b/drivers/gpu/drm/sti/sti_hdmi.c > @@ -792,13 +792,10 @@ static int sti_hdmi_probe(struct platform_device > *pdev) > > ddc = of_parse_phandle(pdev->dev.of_node, "ddc", 0); > if (ddc) { > - hdmi->ddc_adapt = of_find_i2c_adapter_by_node(ddc); > - if (!hdmi->ddc_adapt) { > - of_node_put(ddc); > - return -EPROBE_DEFER; > - } > - > + hdmi->ddc_adapt = of_get_i2c_adapter_by_node(ddc); > of_node_put(ddc); > + if (!hdmi->ddc_adapt) > + return -EPROBE_DEFER; > } > > hdmi->dev = pdev->dev; > @@ -887,8 +884,7 @@ static int sti_hdmi_probe(struct platform_device > *pdev) > return component_add(&pdev->dev, &sti_hdmi_ops); > > release_adapter: > - if (hdmi->ddc_adapt) > - put_device(&hdmi->ddc_adapt->dev); > + i2c_put_adapter(hdmi->ddc_adapt); > > return ret; > } > @@ -897,10 +893,9 @@ static int sti_hdmi_remove(struct platform_device > *pdev) { > struct sti_hdmi *hdmi = dev_get_drvdata(&pdev->dev); > > - if (hdmi->ddc_adapt) > - put_device(&hdmi->ddc_adapt->dev); > - > + i2c_put_adapter(hdmi->ddc_adapt); > component_del(&pdev->dev, &sti_hdmi_ops); > + > return 0; > } > > -- > 2.5.0
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index c23b580..b892f29a 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -792,13 +792,10 @@ static int sti_hdmi_probe(struct platform_device *pdev) ddc = of_parse_phandle(pdev->dev.of_node, "ddc", 0); if (ddc) { - hdmi->ddc_adapt = of_find_i2c_adapter_by_node(ddc); - if (!hdmi->ddc_adapt) { - of_node_put(ddc); - return -EPROBE_DEFER; - } - + hdmi->ddc_adapt = of_get_i2c_adapter_by_node(ddc); of_node_put(ddc); + if (!hdmi->ddc_adapt) + return -EPROBE_DEFER; } hdmi->dev = pdev->dev; @@ -887,8 +884,7 @@ static int sti_hdmi_probe(struct platform_device *pdev) return component_add(&pdev->dev, &sti_hdmi_ops); release_adapter: - if (hdmi->ddc_adapt) - put_device(&hdmi->ddc_adapt->dev); + i2c_put_adapter(hdmi->ddc_adapt); return ret; } @@ -897,10 +893,9 @@ static int sti_hdmi_remove(struct platform_device *pdev) { struct sti_hdmi *hdmi = dev_get_drvdata(&pdev->dev); - if (hdmi->ddc_adapt) - put_device(&hdmi->ddc_adapt->dev); - + i2c_put_adapter(hdmi->ddc_adapt); component_del(&pdev->dev, &sti_hdmi_ops); + return 0; }
This change is needed to properly lock I2C bus device and driver, which serve DDC lines. Without this change I2C bus driver module may gone in runtime and this won't be noticed by the driver. Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> --- drivers/gpu/drm/sti/sti_hdmi.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)