Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d5821a7 authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by Vincent Abriou
Browse files

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: default avatarVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Reviewed-by: default avatarVincent Abriou <vincent.abriou@st.com>
parent 807642d7
Loading
Loading
Loading
Loading
+6 −11
Original line number Diff line number Diff line
@@ -793,15 +793,12 @@ 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) {
		hdmi->ddc_adapt = of_get_i2c_adapter_by_node(ddc);
		of_node_put(ddc);
		if (!hdmi->ddc_adapt)
			return -EPROBE_DEFER;
	}

		of_node_put(ddc);
	}

	hdmi->dev = pdev->dev;

	/* Get resources */
@@ -888,8 +885,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;
}
@@ -898,10 +894,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;
}