[PATCH RFC 080/111] staging: etnaviv: move mutex around component_{un, }bind_all()
Lucas Stach
l.stach at pengutronix.de
Thu Apr 2 08:30:22 PDT 2015
From: Russell King <rmk+kernel at arm.linux.org.uk>
Hold the mutex while calling component_{un,}bind_all() so that
components can perform initialisation in their bind and unbind
callbacks from the component helper.
Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
---
drivers/staging/etnaviv/etnaviv_drv.c | 11 ++++++-----
drivers/staging/etnaviv/etnaviv_gpu.c | 2 +-
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/etnaviv/etnaviv_drv.c b/drivers/staging/etnaviv/etnaviv_drv.c
index 4bef6542daf3..2eb33d0074aa 100644
--- a/drivers/staging/etnaviv/etnaviv_drv.c
+++ b/drivers/staging/etnaviv/etnaviv_drv.c
@@ -99,10 +99,11 @@ static int etnaviv_unload(struct drm_device *dev)
if (g)
etnaviv_gpu_pm_suspend(g);
}
- mutex_unlock(&dev->struct_mutex);
component_unbind_all(dev->dev, dev);
+ mutex_unlock(&dev->struct_mutex);
+
dev->dev_private = NULL;
kfree(priv);
@@ -116,8 +117,6 @@ static void load_gpu(struct drm_device *dev)
struct etnaviv_drm_private *priv = dev->dev_private;
unsigned int i;
- mutex_lock(&dev->struct_mutex);
-
for (i = 0; i < ETNA_MAX_PIPES; i++) {
struct etnaviv_gpu *g = priv->gpu[i];
@@ -132,8 +131,6 @@ static void load_gpu(struct drm_device *dev)
}
}
}
-
- mutex_unlock(&dev->struct_mutex);
}
static int etnaviv_load(struct drm_device *dev, unsigned long flags)
@@ -157,12 +154,16 @@ static int etnaviv_load(struct drm_device *dev, unsigned long flags)
platform_set_drvdata(pdev, dev);
+ mutex_lock(&dev->struct_mutex);
+
err = component_bind_all(dev->dev, dev);
if (err < 0)
return err;
load_gpu(dev);
+ mutex_unlock(&dev->struct_mutex);
+
return 0;
}
diff --git a/drivers/staging/etnaviv/etnaviv_gpu.c b/drivers/staging/etnaviv/etnaviv_gpu.c
index 7f041a261d54..6492214865b9 100644
--- a/drivers/staging/etnaviv/etnaviv_gpu.c
+++ b/drivers/staging/etnaviv/etnaviv_gpu.c
@@ -991,7 +991,7 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master,
WARN_ON(!list_empty(&gpu->active_list));
if (gpu->buffer) {
- drm_gem_object_unreference_unlocked(gpu->buffer);
+ drm_gem_object_unreference(gpu->buffer);
gpu->buffer = NULL;
}
--
2.1.4
More information about the dri-devel
mailing list