All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] gpu: host1x: Call ->remove() only when a device is bound
@ 2014-12-19 15:24 Thierry Reding
  2014-12-19 15:24 ` [PATCH 2/5] gpu: host1x: Call host1x_device_add() under lock Thierry Reding
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Thierry Reding @ 2014-12-19 15:24 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-tegra, Mark Zhang

From: Thierry Reding <treding@nvidia.com>

When a driver's ->probe() function fails, the host1x bus must not call
its ->remove() function because the driver will already have cleaned up
in the error handling path in ->probe().

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/host1x/bus.c | 9 +++++++--
 include/linux/host1x.h   | 2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index aaf54859adb0..e4182e68e29c 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -116,7 +116,10 @@ static void host1x_subdev_register(struct host1x_device *device,
 	if (list_empty(&device->subdevs)) {
 		err = device->driver->probe(device);
 		if (err < 0)
-			dev_err(&device->dev, "probe failed: %d\n", err);
+			dev_err(&device->dev, "probe failed for %ps: %d\n",
+				device->driver, err);
+		else
+			device->bound = true;
 	}
 }
 
@@ -130,10 +133,12 @@ static void __host1x_subdev_unregister(struct host1x_device *device,
 	 * If all subdevices have been activated, we're about to remove the
 	 * first active subdevice, so unload the driver first.
 	 */
-	if (list_empty(&device->subdevs)) {
+	if (list_empty(&device->subdevs) && device->bound) {
 		err = device->driver->remove(device);
 		if (err < 0)
 			dev_err(&device->dev, "remove failed: %d\n", err);
+
+		device->bound = false;
 	}
 
 	/*
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index bb9840fd1e18..7890b553d12e 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -272,6 +272,8 @@ struct host1x_device {
 
 	struct mutex clients_lock;
 	struct list_head clients;
+
+	bool bound;
 };
 
 static inline struct host1x_device *to_host1x_device(struct device *dev)
-- 
2.1.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-01-06  2:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-19 15:24 [PATCH 1/5] gpu: host1x: Call ->remove() only when a device is bound Thierry Reding
2014-12-19 15:24 ` [PATCH 2/5] gpu: host1x: Call host1x_device_add() under lock Thierry Reding
2014-12-19 15:24 ` [PATCH 3/5] gpu: host1x: Factor out __host1x_device_del() Thierry Reding
     [not found] ` <1419002698-4963-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-12-19 15:24   ` [PATCH 4/5] gpu: host1x: Provide a proper struct bus_type Thierry Reding
     [not found]     ` <1419002698-4963-4-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-12-23  7:30       ` Mark Zhang
     [not found]         ` <54991A0C.4050203-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-01-05 14:49           ` Thierry Reding
     [not found]             ` <20150105144941.GE12010-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2015-01-06  2:03               ` Mark Zhang
2015-01-05 15:47     ` Sean Paul
2014-12-19 15:24 ` [PATCH 5/5] drm/tegra: Add minimal power management Thierry Reding
     [not found]   ` <1419002698-4963-5-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-12-23  7:32     ` Mark Zhang
     [not found]       ` <54991A9B.5070703-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-01-05 14:50         ` Thierry Reding
     [not found]           ` <20150105145043.GF12010-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2015-01-06  2:06             ` Mark Zhang
2015-01-05 15:48   ` Sean Paul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.