aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorArchit Taneja <architt@codeaurora.org>2015-08-19 17:31:23 +0530
committerSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2015-11-17 09:22:30 +0000
commit81f6262e3903e43da0d4de6eb6dd8884264c6c83 (patch)
treeedccd641ca19b87c3dc7aa4a155e9964ea7227d3 /drivers/gpu/drm
parent8ebd0d988d9ed23c46322797108412f35149199a (diff)
drm/mipi_dsi: check for used channels
We don't check whether a previous mipi_dsi_device under the same host shares the same virtual channel. Before registering, check if any of the registered devices doesn't already have the same virtual channel. Signed-off-by: Archit Taneja <architt@codeaurora.org>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/drm_mipi_dsi.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 583b3bc10495..3a507fe534fd 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -108,6 +108,22 @@ struct mipi_dsi_device_info {
struct device_node *node;
};
+static int __dsi_check_chan_busy(struct device *dev, void *data)
+{
+ struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
+ u32 reg = *(u32 *) data;
+
+ if (dsi && dsi->channel == reg)
+ return -EBUSY;
+
+ return 0;
+}
+
+static int mipi_dsi_check_chan_busy(struct mipi_dsi_host *host, u32 reg)
+{
+ return device_for_each_child(&host->dev, &reg, __dsi_check_chan_busy);
+}
+
static struct mipi_dsi_device *
mipi_dsi_device_new(struct mipi_dsi_host *host,
struct mipi_dsi_device_info *info)
@@ -136,13 +152,18 @@ mipi_dsi_device_new(struct mipi_dsi_host *host,
dev_set_name(&dsi->dev, "%s.%d", dev_name(host->dev), info->reg);
+ r = mipi_dsi_check_chan_busy(host, info->reg);
+ if (r)
+ goto err;
+
r = device_register(&dsi->dev);
- if (r) {
- kfree(dsi);
- return ERR_PTR(r);
- }
+ if (r)
+ goto err;
return dsi;
+err:
+ kfree(dsi);
+ return ERR_PTR(r);
}
static struct mipi_dsi_device *