public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] driver/base: add BUS_NOTIFY_UNBOUND_DRIVER event
@ 2009-04-24 12:57 Joerg Roedel
  2009-04-24 18:44 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Joerg Roedel @ 2009-04-24 12:57 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Ingo Molnar, linux-kernel, iommu, Joerg Roedel

This patch adds a new bus notifier event which is emitted _after_ a
device is removed from its driver. This event will be used by the
dma-api debug code to check if a driver has released all dma allocations
for that device.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 drivers/base/dd.c      |    4 ++++
 include/linux/device.h |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 742cbe6..efd00de 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -320,6 +320,10 @@ static void __device_release_driver(struct device *dev)
 		devres_release_all(dev);
 		dev->driver = NULL;
 		klist_remove(&dev->p->knode_driver);
+		if (dev->bus)
+			blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
+						     BUS_NOTIFY_UNBOUND_DRIVER,
+						     dev);
 	}
 }
 
diff --git a/include/linux/device.h b/include/linux/device.h
index 6a69caa..ac69c22 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -116,6 +116,8 @@ extern int bus_unregister_notifier(struct bus_type *bus,
 #define BUS_NOTIFY_BOUND_DRIVER		0x00000003 /* driver bound to device */
 #define BUS_NOTIFY_UNBIND_DRIVER	0x00000004 /* driver about to be
 						      unbound */
+#define BUS_NOTIFY_UNBOUND_DRIVER	0x00000005 /* driver is unbound
+						      from the device */
 
 extern struct kset *bus_get_kset(struct bus_type *bus);
 extern struct klist *bus_get_device_klist(struct bus_type *bus);
-- 
1.6.2.3



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

* Re: [PATCH] driver/base: add BUS_NOTIFY_UNBOUND_DRIVER event
  2009-04-24 12:57 [PATCH] driver/base: add BUS_NOTIFY_UNBOUND_DRIVER event Joerg Roedel
@ 2009-04-24 18:44 ` Greg KH
  2009-04-24 23:24   ` Joerg Roedel
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2009-04-24 18:44 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Ingo Molnar, linux-kernel, iommu

On Fri, Apr 24, 2009 at 02:57:00PM +0200, Joerg Roedel wrote:
> This patch adds a new bus notifier event which is emitted _after_ a
> device is removed from its driver. This event will be used by the
> dma-api debug code to check if a driver has released all dma allocations
> for that device.

Heh, I was wondering if people were going to need that.  I'll queue it
up for 2.6.31, is that ok with you?  Do you have patches that depend on
it?

thanks,

greg k-h

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

* Re: [PATCH] driver/base: add BUS_NOTIFY_UNBOUND_DRIVER event
  2009-04-24 18:44 ` Greg KH
@ 2009-04-24 23:24   ` Joerg Roedel
  2009-04-24 23:44     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Joerg Roedel @ 2009-04-24 23:24 UTC (permalink / raw)
  To: Greg KH; +Cc: Joerg Roedel, iommu, Ingo Molnar, linux-kernel

On Fri, Apr 24, 2009 at 11:44:25AM -0700, Greg KH wrote:
> On Fri, Apr 24, 2009 at 02:57:00PM +0200, Joerg Roedel wrote:
> > This patch adds a new bus notifier event which is emitted _after_ a
> > device is removed from its driver. This event will be used by the
> > dma-api debug code to check if a driver has released all dma allocations
> > for that device.
> 
> Heh, I was wondering if people were going to need that.  I'll queue it
> up for 2.6.31, is that ok with you?  Do you have patches that depend on
> it?

2.6.31 is ok for me. I sent Ingo a patch to remove the broken feature
which uses the wrong event for 2.6.30. I can reintroduce the fixed
version for 2.6.31 too.
Other way may be to send this patch to 2.6.30 which makes a smaller fix
possible for dma-api debugging. But I am not sure if this new event
could go in after the merge window. So I choosed this way :)
For me, 2.6.31 for this patch is fine.

Thanks,

	Joerg

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

* Re: [PATCH] driver/base: add BUS_NOTIFY_UNBOUND_DRIVER event
  2009-04-24 23:24   ` Joerg Roedel
@ 2009-04-24 23:44     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2009-04-24 23:44 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Joerg Roedel, iommu, Ingo Molnar, linux-kernel

On Sat, Apr 25, 2009 at 01:24:47AM +0200, Joerg Roedel wrote:
> On Fri, Apr 24, 2009 at 11:44:25AM -0700, Greg KH wrote:
> > On Fri, Apr 24, 2009 at 02:57:00PM +0200, Joerg Roedel wrote:
> > > This patch adds a new bus notifier event which is emitted _after_ a
> > > device is removed from its driver. This event will be used by the
> > > dma-api debug code to check if a driver has released all dma allocations
> > > for that device.
> > 
> > Heh, I was wondering if people were going to need that.  I'll queue it
> > up for 2.6.31, is that ok with you?  Do you have patches that depend on
> > it?
> 
> 2.6.31 is ok for me. I sent Ingo a patch to remove the broken feature
> which uses the wrong event for 2.6.30. I can reintroduce the fixed
> version for 2.6.31 too.
> Other way may be to send this patch to 2.6.30 which makes a smaller fix
> possible for dma-api debugging. But I am not sure if this new event
> could go in after the merge window. So I choosed this way :)
> For me, 2.6.31 for this patch is fine.

Great, it will go in for 2.6.31 then.

thanks,

greg k-h

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

end of thread, other threads:[~2009-04-24 23:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-24 12:57 [PATCH] driver/base: add BUS_NOTIFY_UNBOUND_DRIVER event Joerg Roedel
2009-04-24 18:44 ` Greg KH
2009-04-24 23:24   ` Joerg Roedel
2009-04-24 23:44     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox