Commit a3ac7917 authored by Linus Torvalds's avatar Linus Torvalds

Revert "parport: daisy: use new parport device model"

This reverts commit 1aec4211.

Steven Rostedt reports that it causes a hang at bootup and bisected it
to this commit.

The troigger is apparently a module alias for "parport_lowlevel" that
points to "parport_pc", which causes a hang with

    modprobe -q -- parport_lowlevel

blocking forever with a backtrace like this:

    wait_for_completion_killable+0x1c/0x28
    call_usermodehelper_exec+0xa7/0x108
    __request_module+0x351/0x3d8
    get_lowlevel_driver+0x28/0x41 [parport]
    __parport_register_driver+0x39/0x1f4 [parport]
    daisy_drv_init+0x31/0x4f [parport]
    parport_bus_init+0x5d/0x7b [parport]
    parport_default_proc_register+0x26/0x1000 [parport]
    do_one_initcall+0xc2/0x1e0
    do_init_module+0x50/0x1d4
    load_module+0x1c2e/0x21b3
    sys_init_module+0xef/0x117

Supid says:
 "Due to the new device model daisy driver will now try to find the
  parallel ports while trying to register its driver so that it can bind
  with them. Now, since daisy driver is loaded while parport bus is
  initialising the list of parport is still empty and it tries to load
  the lowlevel driver, which has an alias set to parport_pc, now causes
  a deadlock"

But I don't think the daisy driver should be loaded by the parport
initialization in the first place, so let's revert the whole change.

If the daisy driver can just initialize separately on its own (like a
driver should), instead of hooking into the parport init sequence
directly, this issue probably would go away.
Reported-and-bisected-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Reported-by: default avatarMichal Kubecek <mkubecek@suse.cz>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8c2ffd91
...@@ -213,12 +213,10 @@ void parport_daisy_fini(struct parport *port) ...@@ -213,12 +213,10 @@ void parport_daisy_fini(struct parport *port)
struct pardevice *parport_open(int devnum, const char *name) struct pardevice *parport_open(int devnum, const char *name)
{ {
struct daisydev *p = topology; struct daisydev *p = topology;
struct pardev_cb par_cb;
struct parport *port; struct parport *port;
struct pardevice *dev; struct pardevice *dev;
int daisy; int daisy;
memset(&par_cb, 0, sizeof(par_cb));
spin_lock(&topology_lock); spin_lock(&topology_lock);
while (p && p->devnum != devnum) while (p && p->devnum != devnum)
p = p->next; p = p->next;
...@@ -232,7 +230,7 @@ struct pardevice *parport_open(int devnum, const char *name) ...@@ -232,7 +230,7 @@ struct pardevice *parport_open(int devnum, const char *name)
port = parport_get_port(p->port); port = parport_get_port(p->port);
spin_unlock(&topology_lock); spin_unlock(&topology_lock);
dev = parport_register_dev_model(port, name, &par_cb, devnum); dev = parport_register_device(port, name, NULL, NULL, NULL, 0, NULL);
parport_put_port(port); parport_put_port(port);
if (!dev) if (!dev)
return NULL; return NULL;
...@@ -482,31 +480,3 @@ static int assign_addrs(struct parport *port) ...@@ -482,31 +480,3 @@ static int assign_addrs(struct parport *port)
kfree(deviceid); kfree(deviceid);
return detected; return detected;
} }
static int daisy_drv_probe(struct pardevice *par_dev)
{
struct device_driver *drv = par_dev->dev.driver;
if (strcmp(drv->name, "daisy_drv"))
return -ENODEV;
if (strcmp(par_dev->name, daisy_dev_name))
return -ENODEV;
return 0;
}
static struct parport_driver daisy_driver = {
.name = "daisy_drv",
.probe = daisy_drv_probe,
.devmodel = true,
};
int daisy_drv_init(void)
{
return parport_register_driver(&daisy_driver);
}
void daisy_drv_exit(void)
{
parport_unregister_driver(&daisy_driver);
}
...@@ -257,7 +257,7 @@ static ssize_t parport_read_device_id (struct parport *port, char *buffer, ...@@ -257,7 +257,7 @@ static ssize_t parport_read_device_id (struct parport *port, char *buffer,
ssize_t parport_device_id (int devnum, char *buffer, size_t count) ssize_t parport_device_id (int devnum, char *buffer, size_t count)
{ {
ssize_t retval = -ENXIO; ssize_t retval = -ENXIO;
struct pardevice *dev = parport_open(devnum, daisy_dev_name); struct pardevice *dev = parport_open (devnum, "Device ID probe");
if (!dev) if (!dev)
return -ENXIO; return -ENXIO;
......
...@@ -137,19 +137,11 @@ static struct bus_type parport_bus_type = { ...@@ -137,19 +137,11 @@ static struct bus_type parport_bus_type = {
int parport_bus_init(void) int parport_bus_init(void)
{ {
int retval; return bus_register(&parport_bus_type);
retval = bus_register(&parport_bus_type);
if (retval)
return retval;
daisy_drv_init();
return 0;
} }
void parport_bus_exit(void) void parport_bus_exit(void)
{ {
daisy_drv_exit();
bus_unregister(&parport_bus_type); bus_unregister(&parport_bus_type);
} }
......
...@@ -460,7 +460,6 @@ extern size_t parport_ieee1284_epp_read_addr (struct parport *, ...@@ -460,7 +460,6 @@ extern size_t parport_ieee1284_epp_read_addr (struct parport *,
void *, size_t, int); void *, size_t, int);
/* IEEE1284.3 functions */ /* IEEE1284.3 functions */
#define daisy_dev_name "Device ID probe"
extern int parport_daisy_init (struct parport *port); extern int parport_daisy_init (struct parport *port);
extern void parport_daisy_fini (struct parport *port); extern void parport_daisy_fini (struct parport *port);
extern struct pardevice *parport_open (int devnum, const char *name); extern struct pardevice *parport_open (int devnum, const char *name);
...@@ -469,18 +468,6 @@ extern ssize_t parport_device_id (int devnum, char *buffer, size_t len); ...@@ -469,18 +468,6 @@ extern ssize_t parport_device_id (int devnum, char *buffer, size_t len);
extern void parport_daisy_deselect_all (struct parport *port); extern void parport_daisy_deselect_all (struct parport *port);
extern int parport_daisy_select (struct parport *port, int daisy, int mode); extern int parport_daisy_select (struct parport *port, int daisy, int mode);
#ifdef CONFIG_PARPORT_1284
extern int daisy_drv_init(void);
extern void daisy_drv_exit(void);
#else
static inline int daisy_drv_init(void)
{
return 0;
}
static inline void daisy_drv_exit(void) {}
#endif
/* Lowlevel drivers _can_ call this support function to handle irqs. */ /* Lowlevel drivers _can_ call this support function to handle irqs. */
static inline void parport_generic_irq(struct parport *port) static inline void parport_generic_irq(struct parport *port)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment