mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-15 16:53:54 +08:00
nubus: Call bus_register unconditionally
Loading a NuBus driver module on a non-NuBus machine triggers the
BUG_ON(!drv->bus->p) in driver_register(), because bus_register() was
not called, because it is conditional on MACH_IS_MAC.
Fix the crash by calling bus_register() unconditionally. Call it from
a postcore_initcall(), like other busses do.
Hence, the bus type is available for device_register(), which happens
in a subsys initcall, and for driver_register(), which happens in a
device or module initcall.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reported-by: Michael Schmitz <schmitzmic@gmail.com>
Tested-by: Stan Johnson <userm57@yahoo.com>
Fixes: 7f86c765a6
("nubus: Add support for the driver model")
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6be5b5b9c5
commit
bdeeed0988
@ -63,20 +63,15 @@ static struct device nubus_parent = {
|
|||||||
.init_name = "nubus",
|
.init_name = "nubus",
|
||||||
};
|
};
|
||||||
|
|
||||||
int __init nubus_bus_register(void)
|
static int __init nubus_bus_register(void)
|
||||||
{
|
{
|
||||||
int err;
|
return bus_register(&nubus_bus_type);
|
||||||
|
}
|
||||||
|
postcore_initcall(nubus_bus_register);
|
||||||
|
|
||||||
err = device_register(&nubus_parent);
|
int __init nubus_parent_device_register(void)
|
||||||
if (err)
|
{
|
||||||
return err;
|
return device_register(&nubus_parent);
|
||||||
|
|
||||||
err = bus_register(&nubus_bus_type);
|
|
||||||
if (!err)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
device_unregister(&nubus_parent);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nubus_device_release(struct device *dev)
|
static void nubus_device_release(struct device *dev)
|
||||||
|
@ -875,7 +875,7 @@ static int __init nubus_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
nubus_proc_init();
|
nubus_proc_init();
|
||||||
err = nubus_bus_register();
|
err = nubus_parent_device_register();
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
nubus_scan_bus();
|
nubus_scan_bus();
|
||||||
|
@ -163,7 +163,7 @@ void nubus_seq_write_rsrc_mem(struct seq_file *m,
|
|||||||
unsigned char *nubus_dirptr(const struct nubus_dirent *nd);
|
unsigned char *nubus_dirptr(const struct nubus_dirent *nd);
|
||||||
|
|
||||||
/* Declarations relating to driver model objects */
|
/* Declarations relating to driver model objects */
|
||||||
int nubus_bus_register(void);
|
int nubus_parent_device_register(void);
|
||||||
int nubus_device_register(struct nubus_board *board);
|
int nubus_device_register(struct nubus_board *board);
|
||||||
int nubus_driver_register(struct nubus_driver *ndrv);
|
int nubus_driver_register(struct nubus_driver *ndrv);
|
||||||
void nubus_driver_unregister(struct nubus_driver *ndrv);
|
void nubus_driver_unregister(struct nubus_driver *ndrv);
|
||||||
|
Loading…
Reference in New Issue
Block a user