Skip to content

Commit

Permalink
V4L/DVB (8040): soc-camera: remove soc_camera_host_class class
Browse files Browse the repository at this point in the history
Devices can either be class devices or bus devices, not both at the
same time. Soc-camera host devices usually have a platform device as
their parent. Trying to also register them with a class crashes the
kernel, when linked statically. Interestingly, it works when built
as a module. Thanks to Paulius Zaleckas for reporting.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
  • Loading branch information
Guennadi Liakhovetski authored and Mauro Carvalho Chehab committed Jun 26, 2008
1 parent 02da465 commit 3cfdc7f
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions drivers/media/video/soc_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,15 +763,6 @@ static struct device_driver ic_drv = {
.owner = THIS_MODULE,
};

/*
* Image capture host - this is a host device, not a bus device, so,
* no bus reference, no probing.
*/
static struct class soc_camera_host_class = {
.owner = THIS_MODULE,
.name = "camera_host",
};

static void dummy_release(struct device *dev)
{
}
Expand Down Expand Up @@ -801,7 +792,6 @@ int soc_camera_host_register(struct soc_camera_host *ici)

/* Number might be equal to the platform device ID */
sprintf(ici->dev.bus_id, "camera_host%d", ici->nr);
ici->dev.class = &soc_camera_host_class;

mutex_lock(&list_lock);
list_for_each_entry(ix, &hosts, list) {
Expand Down Expand Up @@ -1003,22 +993,16 @@ static int __init soc_camera_init(void)
ret = driver_register(&ic_drv);
if (ret)
goto edrvr;
ret = class_register(&soc_camera_host_class);
if (ret)
goto eclr;

return 0;

eclr:
driver_unregister(&ic_drv);
edrvr:
bus_unregister(&soc_camera_bus_type);
return ret;
}

static void __exit soc_camera_exit(void)
{
class_unregister(&soc_camera_host_class);
driver_unregister(&ic_drv);
bus_unregister(&soc_camera_bus_type);
}
Expand Down

0 comments on commit 3cfdc7f

Please sign in to comment.