[PATCH 4/4] staging: panel: use parport in device-model

From: Sudip Mukherjee
Date: Wed Apr 15 2015 - 03:49:55 EST


modified the required functions to start using the new parport
device-model

Signed-off-by: Sudip Mukherjee <sudip@xxxxxxxxxxxxxxx>
---
drivers/staging/panel/panel.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index ea54fb4..475c690 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2188,25 +2188,26 @@ static struct notifier_block panel_notifier = {
0
};

-static void panel_attach(struct parport *port)
+static int panel_attach(struct parport *port,
+ struct parport_driver *drv)
{
if (port->number != parport)
- return;
+ return -ENODEV;

if (pprt) {
pr_err("%s: port->number=%d parport=%d, already registered!\n",
__func__, port->number, parport);
- return;
+ return -EAGAIN;
}

- pprt = parport_register_device(port, "panel", NULL, NULL, /* pf, kf */
+ pprt = parport_register_dev(port, "panel", NULL, NULL, /* pf, kf */
NULL,
/*PARPORT_DEV_EXCL */
- 0, (void *)&pprt);
+ 0, (void *)&pprt, drv);
if (pprt == NULL) {
pr_err("%s: port->number=%d parport=%d, parport_register_device() failed\n",
__func__, port->number, parport);
- return;
+ return -ENODEV;
}

if (parport_claim(pprt)) {
@@ -2230,7 +2231,7 @@ static void panel_attach(struct parport *port)
goto err_lcd_unreg;
}
register_reboot_notifier(&panel_notifier);
- return;
+ return 0;

err_lcd_unreg:
if (lcd.enabled)
@@ -2238,6 +2239,7 @@ err_lcd_unreg:
err_unreg_device:
parport_unregister_device(pprt);
pprt = NULL;
+ return -ENODEV;
}

static void panel_detach(struct parport *port)
@@ -2270,7 +2272,7 @@ static void panel_detach(struct parport *port)

static struct parport_driver panel_driver = {
.name = "panel",
- .attach = panel_attach,
+ .attach_ret = panel_attach,
.detach = panel_detach,
};

@@ -2380,7 +2382,7 @@ static int __init panel_init_module(void)
return -ENODEV;
}

- err = parport_register_driver(&panel_driver);
+ err = parport_register_drv(&panel_driver);
if (err) {
pr_err("could not register with parport. Aborting.\n");
return err;
--
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/