WSL2-Linux-Kernel/drivers/zorro
Geert Uytterhoeven a7f4d00a82 zorro: Defer device_register() until all devices have been identified
As the Amiga Zorro II address space is limited to 8.5 MiB and Zorro
devices can contain only one BAR, several Amiga Zorro II expansion
boards (mainly graphics cards) contain multiple Zorro devices: a small
one for the control registers and one (or more) for the graphics memory.

The conversion of cirrusfb to the new driver framework introduced a
regression: the driver contains a zorro_driver for the first Zorro
device, and uses the (old) zorro_find_device() call to find the second
Zorro device.

However, as the Zorro core calls device_register() as soon as a Zorro
device is identified, it may not have identified the second Zorro device
belonging to the same physical Zorro expansion card.  Hence cirrusfb
could no longer find the second part of the Picasso II graphics card,
causing a NULL pointer dereference.

Defer the registration of Zorro devices with the driver framework until
all Zorro devices have been identified to fix this.

Note that the alternative solution (modifying cirrusfb to register a
zorro_driver for all Zorro devices belonging to a graphics card, instead
of only for the first one, and adding a synchronization mechanism to
defer initialization until all have been found), is not an option, as on
some cards one device may be optional (e.g.  the second bank of 2 MiB of
graphics memory on the Picasso IV in Zorro II mode).

Reported-by: Ingo Jürgensmann <ij@2011.bluespice.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22 12:59:35 -07:00
..
.gitignore m68k: zorro - Add devlist.h and gen-devlist to .gitignore 2009-01-12 20:56:33 +01:00
Kconfig Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gen-devlist.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
names.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
proc.c BKL: remove extraneous #include <smp_lock.h> 2010-11-17 08:59:32 -08:00
zorro-driver.c m68k: amiga - Zorro bus modalias support 2010-05-17 21:37:41 +02:00
zorro-sysfs.c sysfs: add struct file* to bin_attr callbacks 2010-05-21 09:37:31 -07:00
zorro.c zorro: Defer device_register() until all devices have been identified 2011-09-22 12:59:35 -07:00
zorro.h m68k: zorro - Kill warn_unused_result warnings 2009-01-12 20:56:41 +01:00
zorro.ids tree-wide: fix typos "ass?o[sc]iac?te" -> "associate" in comments 2010-02-15 15:38:10 +01:00