Skip to content

Commit

Permalink
parport: add device-model to parport subsystem
Browse files Browse the repository at this point in the history
parport subsystem starts using the device-model. Drivers using the
device-model has to define devmodel as true and should register the
device with parport using parport_register_dev_model().

Tested-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Sudip Mukherjee authored and Greg Kroah-Hartman committed May 31, 2015
1 parent 208250d commit 6fa45a2
Show file tree
Hide file tree
Showing 4 changed files with 379 additions and 28 deletions.
4 changes: 2 additions & 2 deletions drivers/parport/parport_pc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2255,7 +2255,7 @@ struct parport *parport_pc_probe_port(unsigned long int base,
release_region(base+0x3, 5);
release_region(base, 3);
out4:
parport_put_port(p);
parport_del_port(p);
out3:
kfree(priv);
out2:
Expand Down Expand Up @@ -2294,7 +2294,7 @@ void parport_pc_unregister_port(struct parport *p)
priv->dma_handle);
#endif
kfree(p->private_data);
parport_put_port(p);
parport_del_port(p);
kfree(ops); /* hope no-one cached it */
}
EXPORT_SYMBOL(parport_pc_unregister_port);
Expand Down
15 changes: 14 additions & 1 deletion drivers/parport/procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/parport.h>
#include <linux/ctype.h>
#include <linux/sysctl.h>
#include <linux/device.h>

#include <asm/uaccess.h>

Expand Down Expand Up @@ -558,8 +559,18 @@ int parport_device_proc_unregister(struct pardevice *device)

static int __init parport_default_proc_register(void)
{
int ret;

parport_default_sysctl_table.sysctl_header =
register_sysctl_table(parport_default_sysctl_table.dev_dir);
if (!parport_default_sysctl_table.sysctl_header)
return -ENOMEM;
ret = parport_bus_init();
if (ret) {
unregister_sysctl_table(parport_default_sysctl_table.
sysctl_header);
return ret;
}
return 0;
}

Expand All @@ -570,6 +581,7 @@ static void __exit parport_default_proc_unregister(void)
sysctl_header);
parport_default_sysctl_table.sysctl_header = NULL;
}
parport_bus_exit();
}

#else /* no sysctl or no procfs*/
Expand All @@ -596,11 +608,12 @@ int parport_device_proc_unregister(struct pardevice *device)

static int __init parport_default_proc_register (void)
{
return 0;
return parport_bus_init();
}

static void __exit parport_default_proc_unregister (void)
{
parport_bus_exit();
}
#endif

Expand Down
Loading

0 comments on commit 6fa45a2

Please sign in to comment.