summaryrefslogtreecommitdiffstats
path: root/drivers/char/ppdev.c
diff options
context:
space:
mode:
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>2016-02-12 08:03:45 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-14 20:43:50 -0500
commite7223f18603374d235d8bb0398532323e5f318b9 (patch)
tree9a62c592b5c5a14d140da9aad484171b9f4c92f4 /drivers/char/ppdev.c
parent3c8db584323875a50696718c89d94cef0ed54f30 (diff)
ppdev: use new parport device model
Modify ppdev driver to use the new parallel port device model. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char/ppdev.c')
-rw-r--r--drivers/char/ppdev.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index bccc15a4b25d..6152c09e89d9 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -286,7 +286,7 @@ static int register_device(int minor, struct pp_struct *pp)
286 struct parport *port; 286 struct parport *port;
287 struct pardevice *pdev = NULL; 287 struct pardevice *pdev = NULL;
288 char *name; 288 char *name;
289 int fl; 289 struct pardev_cb ppdev_cb;
290 290
291 name = kasprintf(GFP_KERNEL, CHRDEV "%x", minor); 291 name = kasprintf(GFP_KERNEL, CHRDEV "%x", minor);
292 if (name == NULL) 292 if (name == NULL)
@@ -299,9 +299,11 @@ static int register_device(int minor, struct pp_struct *pp)
299 return -ENXIO; 299 return -ENXIO;
300 } 300 }
301 301
302 fl = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0; 302 memset(&ppdev_cb, 0, sizeof(ppdev_cb));
303 pdev = parport_register_device(port, name, NULL, 303 ppdev_cb.irq_func = pp_irq;
304 NULL, pp_irq, fl, pp); 304 ppdev_cb.flags = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0;
305 ppdev_cb.private = pp;
306 pdev = parport_register_dev_model(port, name, &ppdev_cb, minor);
305 parport_put_port(port); 307 parport_put_port(port);
306 308
307 if (!pdev) { 309 if (!pdev) {
@@ -799,10 +801,23 @@ static void pp_detach(struct parport *port)
799 device_destroy(ppdev_class, MKDEV(PP_MAJOR, port->number)); 801 device_destroy(ppdev_class, MKDEV(PP_MAJOR, port->number));
800} 802}
801 803
804static int pp_probe(struct pardevice *par_dev)
805{
806 struct device_driver *drv = par_dev->dev.driver;
807 int len = strlen(drv->name);
808
809 if (strncmp(par_dev->name, drv->name, len))
810 return -ENODEV;
811
812 return 0;
813}
814
802static struct parport_driver pp_driver = { 815static struct parport_driver pp_driver = {
803 .name = CHRDEV, 816 .name = CHRDEV,
804 .attach = pp_attach, 817 .probe = pp_probe,
818 .match_port = pp_attach,
805 .detach = pp_detach, 819 .detach = pp_detach,
820 .devmodel = true,
806}; 821};
807 822
808static int __init ppdev_init(void) 823static int __init ppdev_init(void)