Skip to content

Commit

Permalink
Kobject: the cris iop_fw_load.c code is broken
Browse files Browse the repository at this point in the history
This code is really really really broken.  So much so that it's almost
impossible to fix with a simple patch, so just comment out the offending
registration with the kobject core, and mark the driver as broken.

The problem is that the code is trying to register a "raw" struct
device, which is not allowed.  struct device is only for use within the
driver model.  This is being done to try to use the firmware layer which
wants a struct device.  To properly fix this, use something easy, like a
platform device, which is a struct device and can be used for this kind
of thing.

Cc: Mikael Starvik <starvik@axis.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Greg Kroah-Hartman committed Jan 25, 2008
1 parent 542eb75 commit 52840bd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions arch/cris/arch-v32/drivers/iop_fw_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

#define IOP_TIMEOUT 100

#error "This driver is broken with regard to its driver core usage."
#error "Please contact <greg@kroah.com> for details on how to fix it properly."

static struct device iop_spu_device[2] = {
{ .bus_id = "iop-spu0", },
{ .bus_id = "iop-spu1", },
Expand Down Expand Up @@ -192,6 +195,13 @@ int iop_start_mpu(unsigned int start_addr)

static int __init iop_fw_load_init(void)
{
#if 0
/*
* static struct devices can not be added directly to sysfs by ignoring
* the driver model infrastructure. To fix this properly, please use
* the platform_bus to register these devices to be able to properly
* use the firmware infrastructure.
*/
device_initialize(&iop_spu_device[0]);
kobject_set_name(&iop_spu_device[0].kobj, "iop-spu0");
kobject_add(&iop_spu_device[0].kobj);
Expand All @@ -201,6 +211,7 @@ static int __init iop_fw_load_init(void)
device_initialize(&iop_mpu_device);
kobject_set_name(&iop_mpu_device.kobj, "iop-mpu");
kobject_add(&iop_mpu_device.kobj);
#endif
return 0;
}

Expand Down

0 comments on commit 52840bd

Please sign in to comment.