Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54627
b: refs/heads/master
c: a7d801a
h: refs/heads/master
i:
  54625: bf4bb02
  54623: 7968207
v: v3
  • Loading branch information
Jean Delvare authored and Linus Torvalds committed May 8, 2007
1 parent 7c68894 commit 38273ac
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c15a3837d2aa30e3ea41aed49d80abed355ab6bd
refs/heads/master: a7d801afc3d4d1c8aaa0449f17b9f9ce62e16236
39 changes: 39 additions & 0 deletions trunk/drivers/parport/parport_pc.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/pnp.h>
#include <linux/platform_device.h>
#include <linux/sysctl.h>

#include <asm/io.h>
Expand Down Expand Up @@ -2156,6 +2157,17 @@ struct parport *parport_pc_probe_port (unsigned long int base,
struct resource *base_res;
struct resource *ECR_res = NULL;
struct resource *EPP_res = NULL;
struct platform_device *pdev = NULL;

if (!dev) {
/* We need a physical device to attach to, but none was
* provided. Create our own. */
pdev = platform_device_register_simple("parport_pc",
base, NULL, 0);
if (IS_ERR(pdev))
return NULL;
dev = &pdev->dev;
}

ops = kmalloc(sizeof (struct parport_operations), GFP_KERNEL);
if (!ops)
Expand Down Expand Up @@ -2359,6 +2371,8 @@ struct parport *parport_pc_probe_port (unsigned long int base,
out2:
kfree (ops);
out1:
if (pdev)
platform_device_unregister(pdev);
return NULL;
}

Expand Down Expand Up @@ -3106,6 +3120,21 @@ static struct pnp_driver parport_pc_pnp_driver = {
};


static int __devinit parport_pc_platform_probe(struct platform_device *pdev)
{
/* Always succeed, the actual probing is done in
* parport_pc_probe_port(). */
return 0;
}

static struct platform_driver parport_pc_platform_driver = {
.driver = {
.owner = THIS_MODULE,
.name = "parport_pc",
},
.probe = parport_pc_platform_probe,
};

/* This is called by parport_pc_find_nonpci_ports (in asm/parport.h) */
static int __devinit __attribute__((unused))
parport_pc_find_isa_ports (int autoirq, int autodma)
Expand Down Expand Up @@ -3381,9 +3410,15 @@ __setup("parport_init_mode=",parport_init_mode_setup);

static int __init parport_pc_init(void)
{
int err;

if (parse_parport_params())
return -EINVAL;

err = platform_driver_register(&parport_pc_platform_driver);
if (err)
return err;

if (io[0]) {
int i;
/* Only probe the ports we were given. */
Expand All @@ -3408,6 +3443,7 @@ static void __exit parport_pc_exit(void)
pci_unregister_driver (&parport_pc_pci_driver);
if (pnp_registered_parport)
pnp_unregister_driver (&parport_pc_pnp_driver);
platform_driver_unregister(&parport_pc_platform_driver);

spin_lock(&ports_lock);
while (!list_empty(&ports_list)) {
Expand All @@ -3416,6 +3452,9 @@ static void __exit parport_pc_exit(void)
priv = list_entry(ports_list.next,
struct parport_pc_private, list);
port = priv->port;
if (port->dev && port->dev->bus == &platform_bus_type)
platform_device_unregister(
to_platform_device(port->dev));
spin_unlock(&ports_lock);
parport_pc_unregister_port(port);
spin_lock(&ports_lock);
Expand Down

0 comments on commit 38273ac

Please sign in to comment.