Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24351
b: refs/heads/master
c: 982c609
h: refs/heads/master
i:
  24349: 3f3e6e0
  24347: ace20a9
  24343: c36c2df
  24335: 863975e
  24319: 41d7a06
v: v3
  • Loading branch information
Bjorn Helgaas authored and Linus Torvalds committed Mar 27, 2006
1 parent cae0119 commit 08fa7ec
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 070c6999831dc4cfd9b07c74c2fea1964d7adfec
refs/heads/master: 982c609448b9d724e1c3a0d5aeee388c064479f0
3 changes: 3 additions & 0 deletions trunk/Documentation/pnp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ pnp_unregister_protocol
pnp_register_driver
- adds a PnP driver to the Plug and Play Layer
- this includes driver model integration
- returns zero for success or a negative error number for failure; count
calls to the .add() method if you need to know how many devices bind to
the driver

pnp_unregister_driver
- removes a PnP driver from the Plug and Play Layer
Expand Down
16 changes: 7 additions & 9 deletions trunk/drivers/pnp/card.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static void card_remove(struct pnp_dev * dev)
{
dev->card_link = NULL;
}

static void card_remove_first(struct pnp_dev * dev)
{
struct pnp_card_driver * drv = to_pnp_card_driver(dev->driver);
Expand Down Expand Up @@ -361,7 +361,7 @@ static int card_resume(struct pnp_dev *dev)

int pnp_register_card_driver(struct pnp_card_driver * drv)
{
int count;
int error;
struct list_head *pos, *temp;

drv->link.name = drv->name;
Expand All @@ -372,21 +372,19 @@ int pnp_register_card_driver(struct pnp_card_driver * drv)
drv->link.suspend = drv->suspend ? card_suspend : NULL;
drv->link.resume = drv->resume ? card_resume : NULL;

count = pnp_register_driver(&drv->link);
if (count < 0)
return count;
error = pnp_register_driver(&drv->link);
if (error < 0)
return error;

spin_lock(&pnp_lock);
list_add_tail(&drv->global_list, &pnp_card_drivers);
spin_unlock(&pnp_lock);

count = 0;

list_for_each_safe(pos,temp,&pnp_cards){
struct pnp_card *card = list_entry(pos, struct pnp_card, global_list);
count += card_probe(card,drv);
card_probe(card,drv);
}
return count;
return 0;
}

/**
Expand Down
19 changes: 1 addition & 18 deletions trunk/drivers/pnp/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,31 +201,14 @@ struct bus_type pnp_bus_type = {
.resume = pnp_bus_resume,
};


static int count_devices(struct device * dev, void * c)
{
int * count = c;
(*count)++;
return 0;
}

int pnp_register_driver(struct pnp_driver *drv)
{
int count;

pnp_dbg("the driver '%s' has been registered", drv->name);

drv->driver.name = drv->name;
drv->driver.bus = &pnp_bus_type;

count = driver_register(&drv->driver);

/* get the number of initial matches */
if (count >= 0){
count = 0;
driver_for_each_device(&drv->driver, NULL, &count, count_devices);
}
return count;
return driver_register(&drv->driver);
}

void pnp_unregister_driver(struct pnp_driver *drv)
Expand Down

0 comments on commit 08fa7ec

Please sign in to comment.