Commit 824b1a97 authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by David S. Miller

net: plip: use new parport device model

Modify plip driver to use the new parallel port device model.
Signed-off-by: default avatarSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d86cdfcd
...@@ -1249,6 +1249,7 @@ static void plip_attach (struct parport *port) ...@@ -1249,6 +1249,7 @@ static void plip_attach (struct parport *port)
struct net_device *dev; struct net_device *dev;
struct net_local *nl; struct net_local *nl;
char name[IFNAMSIZ]; char name[IFNAMSIZ];
struct pardev_cb plip_cb;
if ((parport[0] == -1 && (!timid || !port->devices)) || if ((parport[0] == -1 && (!timid || !port->devices)) ||
plip_searchfor(parport, port->number)) { plip_searchfor(parport, port->number)) {
...@@ -1273,9 +1274,15 @@ static void plip_attach (struct parport *port) ...@@ -1273,9 +1274,15 @@ static void plip_attach (struct parport *port)
nl = netdev_priv(dev); nl = netdev_priv(dev);
nl->dev = dev; nl->dev = dev;
nl->pardev = parport_register_device(port, dev->name, plip_preempt,
plip_wakeup, plip_interrupt, memset(&plip_cb, 0, sizeof(plip_cb));
0, dev); plip_cb.private = dev;
plip_cb.preempt = plip_preempt;
plip_cb.wakeup = plip_wakeup;
plip_cb.irq_func = plip_interrupt;
nl->pardev = parport_register_dev_model(port, dev->name,
&plip_cb, unit);
if (!nl->pardev) { if (!nl->pardev) {
printk(KERN_ERR "%s: parport_register failed\n", name); printk(KERN_ERR "%s: parport_register failed\n", name);
...@@ -1315,10 +1322,23 @@ static void plip_detach (struct parport *port) ...@@ -1315,10 +1322,23 @@ static void plip_detach (struct parport *port)
/* Nothing to do */ /* Nothing to do */
} }
static int plip_probe(struct pardevice *par_dev)
{
struct device_driver *drv = par_dev->dev.driver;
int len = strlen(drv->name);
if (strncmp(par_dev->name, drv->name, len))
return -ENODEV;
return 0;
}
static struct parport_driver plip_driver = { static struct parport_driver plip_driver = {
.name = "plip", .name = "plip",
.attach = plip_attach, .probe = plip_probe,
.detach = plip_detach .match_port = plip_attach,
.detach = plip_detach,
.devmodel = true,
}; };
static void __exit plip_cleanup_module (void) static void __exit plip_cleanup_module (void)
...@@ -1326,8 +1346,6 @@ static void __exit plip_cleanup_module (void) ...@@ -1326,8 +1346,6 @@ static void __exit plip_cleanup_module (void)
struct net_device *dev; struct net_device *dev;
int i; int i;
parport_unregister_driver (&plip_driver);
for (i=0; i < PLIP_MAX; i++) { for (i=0; i < PLIP_MAX; i++) {
if ((dev = dev_plip[i])) { if ((dev = dev_plip[i])) {
struct net_local *nl = netdev_priv(dev); struct net_local *nl = netdev_priv(dev);
...@@ -1339,6 +1357,8 @@ static void __exit plip_cleanup_module (void) ...@@ -1339,6 +1357,8 @@ static void __exit plip_cleanup_module (void)
dev_plip[i] = NULL; dev_plip[i] = NULL;
} }
} }
parport_unregister_driver(&plip_driver);
} }
#ifndef MODULE #ifndef MODULE
......
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