Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "drm/panel: Add device_link from panel device to DRM device"

This reverts commit 0c08754b59da5557532d946599854e6df28edc22.

commit 0c08754b59da
("drm/panel: Add device_link from panel device to DRM device")
creates a circular dependency under these circumstances:

1. The panel depends on dsi-host because it is MIPI-DSI child
device.
2. dsi-host depends on the drm parent device (connector->dev->dev)
this should be allowed.
3. drm parent dev (connector->dev->dev) depends on the panel
after this patch.

This makes the dependency circular and while it appears it
does not affect any in-tree drivers (they do not seem to have
dsi hosts depending on the same parent device) this does not
seem right.

As noted in a response from Andrzej Hajda, the intent is
likely to make the panel dependent on the DRM device
(connector->dev) not its parent. But we have no way of
doing that since the DRM device doesn't contain any
struct device on its own (arguably it should).

Revert this until a proper approach is figured out.

Cc: Jyri Sarha <jsarha@ti.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180927124130.9102-1-linus.walleij@linaro.org

authored by

Linus Walleij and committed by
Sean Paul
d6a77ba0 337fe9f5

-11
-10
drivers/gpu/drm/drm_panel.c
··· 24 24 #include <linux/err.h> 25 25 #include <linux/module.h> 26 26 27 - #include <drm/drm_device.h> 28 27 #include <drm/drm_crtc.h> 29 28 #include <drm/drm_panel.h> 30 29 ··· 104 105 if (panel->connector) 105 106 return -EBUSY; 106 107 107 - panel->link = device_link_add(connector->dev->dev, panel->dev, 0); 108 - if (!panel->link) { 109 - dev_err(panel->dev, "failed to link panel to %s\n", 110 - dev_name(connector->dev->dev)); 111 - return -EINVAL; 112 - } 113 - 114 108 panel->connector = connector; 115 109 panel->drm = connector->dev; 116 110 ··· 125 133 */ 126 134 int drm_panel_detach(struct drm_panel *panel) 127 135 { 128 - device_link_del(panel->link); 129 - 130 136 panel->connector = NULL; 131 137 panel->drm = NULL; 132 138
-1
include/drm/drm_panel.h
··· 89 89 struct drm_device *drm; 90 90 struct drm_connector *connector; 91 91 struct device *dev; 92 - struct device_link *link; 93 92 94 93 const struct drm_panel_funcs *funcs; 95 94