linux/include
Benjamin Herrenschmidt 116af37820 Driver core: add notification of bus events
I finally did as you suggested and added the notifier to the struct
bus_type itself. There are still problems to be expected is something
attaches to a bus type where the code can hook in different struct
device sub-classes (which is imho a big bogosity but I won't even try to
argue that case now) but it will solve nicely a number of issues I've
had so far.

That also means that clients interested in registering for such
notifications have to do it before devices are added and after bus types
are registered. Fortunately, most bus types that matter for the various
usage scenarios I have in mind are registerd at postcore_initcall time,
which means I have a really nice spot at arch_initcall time to add my
notifiers.

There are 4 notifications provided. Device being added (before hooked to
the bus) and removed (failure of previous case or after being unhooked
from the bus), along with driver being bound to a device and about to be
unbound.

The usage I have for these are:

 - The 2 first ones are used to maintain a struct device_ext that is
hooked to struct device.firmware_data. This structure contains for now a
pointer to the Open Firmware node related to the device (if any), the
NUMA node ID (for quick access to it) and the DMA operations pointers &
iommu table instance for DMA to/from this device. For bus types I own
(like IBM VIO or EBUS), I just maintain that structure directly from the
bus code when creating the devices. But for bus types managed by generic
code like PCI or platform (actually, of_platform which is a variation of
platform linked to Open Firmware device-tree), I need this notifier.

 - The other two ones have a completely different usage scenario. I have
cases where multiple devices and their drivers depend on each other. For
example, the IBM EMAC network driver needs to attach to a MAL DMA engine
which is a separate device, and a PHY interface which is also a separate
device. They are all of_platform_device's (well, about to be with my
upcoming patches) but there is no say in what precise order the core
will "probe" them and instanciate the various modules. The solution I
found for that is to have the drivers for emac to use multithread_probe,
and wait for a driver to be bound to the target MAL and PHY control
devices (the device-tree contains reference to the MAL and PHY interface
nodes, which I can then match to of_platform_devices). Right now, I've
been polling, but with that notifier, I can more cleanly wait (with a
timeout of course).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-12-01 14:51:58 -08:00
..
acpi ACPI: Processor native C-states using MWAIT 2006-10-14 00:35:39 -04:00
asm-alpha [PATCH] Consolidate check_signature 2006-10-11 11:14:23 -07:00
asm-arm [ARM] 3943/1: share declaration of struct pxa2xx_udc_mach_info between multiple platforms 2006-11-29 20:23:07 +00:00
asm-arm26 fix file specification in comments 2006-10-03 23:01:26 +02:00
asm-avr32 AVR32: Wire up sys_epoll_pwait 2006-11-06 14:07:15 +01:00
asm-cris [PATCH] remove remaining errno and __KERNEL_SYSCALLS__ references 2006-10-02 07:57:23 -07:00
asm-frv [PATCH] FRV: Use the correct preemption primitives in kmap_atomic() and co 2006-10-16 08:32:29 -07:00
asm-generic Add "pure_initcall" for static variable initialization 2006-11-20 11:47:18 -08:00
asm-h8300 [PATCH] remove remaining errno and __KERNEL_SYSCALLS__ references 2006-10-02 07:57:23 -07:00
asm-i386 [PATCH] i386: Fix compilation with UP genericarch 2006-11-28 20:12:59 +01:00
asm-ia64 [PATCH] mspec driver build fix 2006-11-13 07:40:42 -08:00
asm-m32r [PATCH] Consolidate check_signature 2006-10-11 11:14:23 -07:00
asm-m68k [PATCH] sun3_ioremap() prototype 2006-10-15 11:00:58 -07:00
asm-m68knommu [PATCH] m68knommu: fix up for the irq_handler_t changes 2006-11-20 10:16:49 -08:00
asm-mips [PATCH] make au1xxx-ide compile again 2006-11-22 23:34:02 +00:00
asm-parisc [PATCH] Fix incorrent type of flags in <asm/semaphore.h> 2006-11-26 16:30:29 -08:00
asm-powerpc [POWERPC] Revert "[POWERPC] Add powerpc get/set_rtc_time interface to new generic rtc class" 2006-11-22 12:13:36 +11:00
asm-ppc [PATCH] Consolidate check_signature 2006-10-11 11:14:23 -07:00
asm-s390 [S390] Fix pte type checking. 2006-10-18 18:30:51 +02:00
asm-sh sh: Fix IPR-IRQ's for IRQ-chip change breakage. 2006-10-31 12:53:28 +09:00
asm-sh64 [PATCH] Consolidate check_signature 2006-10-11 11:14:23 -07:00
asm-sparc [SPARC]: Fix robust futex syscalls and wire up migrate_pages. 2006-11-05 16:51:03 -08:00
asm-sparc64 [SPARC]: Fix robust futex syscalls and wire up migrate_pages. 2006-11-05 16:51:03 -08:00
asm-um [PATCH] uml: add INITCALLS 2006-10-31 08:07:00 -08:00
asm-v850 [PATCH] remove remaining errno and __KERNEL_SYSCALLS__ references 2006-10-02 07:57:23 -07:00
asm-x86_64 [PATCH] x86-64: Fix race in exit_idle 2006-11-14 16:57:46 +01:00
asm-xtensa fix file specification in comments 2006-10-03 23:01:26 +02:00
crypto
keys
linux Driver core: add notification of bus events 2006-12-01 14:51:58 -08:00
math-emu
media V4L/DVB (4666): Ensure the WM8775 driver is loaded generically for any board. 2006-10-03 15:13:48 -03:00
mtd Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-10-01 17:55:53 +01:00
net [NET]: Re-fix of doc-comment in sock.h 2006-11-25 15:16:51 -08:00
pcmcia
rdma RDMA/addr: Use client registration to fix module unload race 2006-11-02 14:26:04 -08:00
rxrpc
scsi [PATCH] add missing libsas include to fix s390 compilation. 2006-11-28 17:26:50 -08:00
sound [ALSA] version 1.0.13 2006-11-28 15:07:33 +01:00
video fix file specification in comments 2006-10-03 23:01:26 +02:00
Kbuild