Skip to content

Commit

Permalink
PNP: Lindent all source files
Browse files Browse the repository at this point in the history
Run Lindent on all PNP source files.

Produced by:

    $ quilt new pnp-lindent
    $ find drivers/pnp -name \*.[ch] | xargs quilt add
    $ quilt add include/linux/{pnp.h,pnpbios.h}
    $ scripts/Lindent drivers/pnp/*.c drivers/pnp/*/*.c include/linux/pnp*.h
    $ quilt refresh --sort

Signed-off-by: Bjorn Helgaas <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Adam Belay <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Bjorn Helgaas authored and Linus Torvalds committed Jul 26, 2007
1 parent 8ec3cf7 commit 9dd7846
Show file tree
Hide file tree
Showing 20 changed files with 1,652 additions and 1,302 deletions.
135 changes: 73 additions & 62 deletions drivers/pnp/card.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,28 @@
LIST_HEAD(pnp_cards);
static LIST_HEAD(pnp_card_drivers);


static const struct pnp_card_device_id * match_card(struct pnp_card_driver * drv, struct pnp_card * card)
static const struct pnp_card_device_id *match_card(struct pnp_card_driver *drv,
struct pnp_card *card)
{
const struct pnp_card_device_id * drv_id = drv->id_table;
while (*drv_id->id){
if (compare_pnp_id(card->id,drv_id->id)) {
const struct pnp_card_device_id *drv_id = drv->id_table;
while (*drv_id->id) {
if (compare_pnp_id(card->id, drv_id->id)) {
int i = 0;
for (;;) {
int found;
struct pnp_dev *dev;
if (i == PNP_MAX_DEVICES || ! *drv_id->devs[i].id)
if (i == PNP_MAX_DEVICES
|| !*drv_id->devs[i].id)
return drv_id;
found = 0;
card_for_each_dev(card, dev) {
if (compare_pnp_id(dev->id, drv_id->devs[i].id)) {
if (compare_pnp_id
(dev->id, drv_id->devs[i].id)) {
found = 1;
break;
}
}
if (! found)
if (!found)
break;
i++;
}
Expand All @@ -42,14 +44,14 @@ static const struct pnp_card_device_id * match_card(struct pnp_card_driver * drv
return NULL;
}

static void card_remove(struct pnp_dev * dev)
static void card_remove(struct pnp_dev *dev)
{
dev->card_link = NULL;
}

static void card_remove_first(struct pnp_dev * dev)
static void card_remove_first(struct pnp_dev *dev)
{
struct pnp_card_driver * drv = to_pnp_card_driver(dev->driver);
struct pnp_card_driver *drv = to_pnp_card_driver(dev->driver);
if (!dev->card || !drv)
return;
if (drv->remove)
Expand All @@ -67,7 +69,7 @@ static int card_probe(struct pnp_card *card, struct pnp_card_driver *drv)

if (!drv->probe)
return 0;
id = match_card(drv,card);
id = match_card(drv, card);
if (!id)
return 0;

Expand Down Expand Up @@ -97,9 +99,9 @@ static int card_probe(struct pnp_card *card, struct pnp_card_driver *drv)
*
*/

int pnp_add_card_id(struct pnp_id *id, struct pnp_card * card)
int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card)
{
struct pnp_id * ptr;
struct pnp_id *ptr;
if (!id)
return -EINVAL;
if (!card)
Expand All @@ -115,9 +117,9 @@ int pnp_add_card_id(struct pnp_id *id, struct pnp_card * card)
return 0;
}

static void pnp_free_card_ids(struct pnp_card * card)
static void pnp_free_card_ids(struct pnp_card *card)
{
struct pnp_id * id;
struct pnp_id *id;
struct pnp_id *next;
if (!card)
return;
Expand All @@ -131,49 +133,52 @@ static void pnp_free_card_ids(struct pnp_card * card)

static void pnp_release_card(struct device *dmdev)
{
struct pnp_card * card = to_pnp_card(dmdev);
struct pnp_card *card = to_pnp_card(dmdev);
pnp_free_card_ids(card);
kfree(card);
}


static ssize_t pnp_show_card_name(struct device *dmdev, struct device_attribute *attr, char *buf)
static ssize_t pnp_show_card_name(struct device *dmdev,
struct device_attribute *attr, char *buf)
{
char *str = buf;
struct pnp_card *card = to_pnp_card(dmdev);
str += sprintf(str,"%s\n", card->name);
str += sprintf(str, "%s\n", card->name);
return (str - buf);
}

static DEVICE_ATTR(name,S_IRUGO,pnp_show_card_name,NULL);
static DEVICE_ATTR(name, S_IRUGO, pnp_show_card_name, NULL);

static ssize_t pnp_show_card_ids(struct device *dmdev, struct device_attribute *attr, char *buf)
static ssize_t pnp_show_card_ids(struct device *dmdev,
struct device_attribute *attr, char *buf)
{
char *str = buf;
struct pnp_card *card = to_pnp_card(dmdev);
struct pnp_id * pos = card->id;
struct pnp_id *pos = card->id;

while (pos) {
str += sprintf(str,"%s\n", pos->id);
str += sprintf(str, "%s\n", pos->id);
pos = pos->next;
}
return (str - buf);
}

static DEVICE_ATTR(card_id,S_IRUGO,pnp_show_card_ids,NULL);
static DEVICE_ATTR(card_id, S_IRUGO, pnp_show_card_ids, NULL);

static int pnp_interface_attach_card(struct pnp_card *card)
{
int rc = device_create_file(&card->dev,&dev_attr_name);
if (rc) return rc;
int rc = device_create_file(&card->dev, &dev_attr_name);
if (rc)
return rc;

rc = device_create_file(&card->dev,&dev_attr_card_id);
if (rc) goto err_name;
rc = device_create_file(&card->dev, &dev_attr_card_id);
if (rc)
goto err_name;

return 0;

err_name:
device_remove_file(&card->dev,&dev_attr_name);
err_name:
device_remove_file(&card->dev, &dev_attr_name);
return rc;
}

Expand All @@ -182,14 +187,15 @@ static int pnp_interface_attach_card(struct pnp_card *card)
* @card: pointer to the card to add
*/

int pnp_add_card(struct pnp_card * card)
int pnp_add_card(struct pnp_card *card)
{
int error;
struct list_head * pos, * temp;
struct list_head *pos, *temp;
if (!card || !card->protocol)
return -EINVAL;

sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, card->number);
sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number,
card->number);
card->dev.parent = &card->protocol->dev;
card->dev.bus = NULL;
card->dev.release = &pnp_release_card;
Expand All @@ -205,18 +211,21 @@ int pnp_add_card(struct pnp_card * card)
/* we wait until now to add devices in order to ensure the drivers
* will be able to use all of the related devices on the card
* without waiting any unresonable length of time */
list_for_each(pos,&card->devices){
list_for_each(pos, &card->devices) {
struct pnp_dev *dev = card_to_pnp_dev(pos);
__pnp_add_device(dev);
}

/* match with card drivers */
list_for_each_safe(pos,temp,&pnp_card_drivers){
struct pnp_card_driver * drv = list_entry(pos, struct pnp_card_driver, global_list);
card_probe(card,drv);
list_for_each_safe(pos, temp, &pnp_card_drivers) {
struct pnp_card_driver *drv =
list_entry(pos, struct pnp_card_driver,
global_list);
card_probe(card, drv);
}
} else
pnp_err("sysfs failure, card '%s' will be unavailable", card->dev.bus_id);
pnp_err("sysfs failure, card '%s' will be unavailable",
card->dev.bus_id);
return error;
}

Expand All @@ -225,7 +234,7 @@ int pnp_add_card(struct pnp_card * card)
* @card: pointer to the card to remove
*/

void pnp_remove_card(struct pnp_card * card)
void pnp_remove_card(struct pnp_card *card)
{
struct list_head *pos, *temp;
if (!card)
Expand All @@ -235,7 +244,7 @@ void pnp_remove_card(struct pnp_card * card)
list_del(&card->global_list);
list_del(&card->protocol_list);
spin_unlock(&pnp_lock);
list_for_each_safe(pos,temp,&card->devices){
list_for_each_safe(pos, temp, &card->devices) {
struct pnp_dev *dev = card_to_pnp_dev(pos);
pnp_remove_card_device(dev);
}
Expand All @@ -247,14 +256,14 @@ void pnp_remove_card(struct pnp_card * card)
* @dev: pointer to the device to add
*/

int pnp_add_card_device(struct pnp_card * card, struct pnp_dev * dev)
int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
{
if (!card || !dev || !dev->protocol)
return -EINVAL;
dev->dev.parent = &card->dev;
dev->card_link = NULL;
snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%02x:%02x.%02x", dev->protocol->number,
card->number,dev->number);
snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%02x:%02x.%02x",
dev->protocol->number, card->number, dev->number);
spin_lock(&pnp_lock);
dev->card = card;
list_add_tail(&dev->card_list, &card->devices);
Expand All @@ -267,7 +276,7 @@ int pnp_add_card_device(struct pnp_card * card, struct pnp_dev * dev)
* @dev: pointer to the device to remove
*/

void pnp_remove_card_device(struct pnp_dev * dev)
void pnp_remove_card_device(struct pnp_dev *dev)
{
spin_lock(&pnp_lock);
dev->card = NULL;
Expand All @@ -283,12 +292,13 @@ void pnp_remove_card_device(struct pnp_dev * dev)
* @from: Starting place to search from. If NULL it will start from the begining.
*/

struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char * id, struct pnp_dev * from)
struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
const char *id, struct pnp_dev *from)
{
struct list_head * pos;
struct pnp_dev * dev;
struct pnp_card_driver * drv;
struct pnp_card * card;
struct list_head *pos;
struct pnp_dev *dev;
struct pnp_card_driver *drv;
struct pnp_card *card;
if (!clink || !id)
goto done;
card = clink->card;
Expand All @@ -302,15 +312,15 @@ struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char
}
while (pos != &card->devices) {
dev = card_to_pnp_dev(pos);
if ((!dev->card_link) && compare_pnp_id(dev->id,id))
if ((!dev->card_link) && compare_pnp_id(dev->id, id))
goto found;
pos = pos->next;
}

done:
done:
return NULL;

found:
found:
dev->card_link = clink;
dev->dev.driver = &drv->link.driver;
if (pnp_bus_type.probe(&dev->dev))
Expand All @@ -320,7 +330,7 @@ struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char

return dev;

err_out:
err_out:
dev->dev.driver = NULL;
dev->card_link = NULL;
return NULL;
Expand All @@ -331,9 +341,9 @@ struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char
* @dev: pointer to the PnP device stucture
*/

void pnp_release_card_device(struct pnp_dev * dev)
void pnp_release_card_device(struct pnp_dev *dev)
{
struct pnp_card_driver * drv = dev->card_link->driver;
struct pnp_card_driver *drv = dev->card_link->driver;
if (!drv)
return;
drv->link.remove = &card_remove;
Expand Down Expand Up @@ -368,7 +378,7 @@ static int card_resume(struct pnp_dev *dev)
* @drv: pointer to the driver to register
*/

int pnp_register_card_driver(struct pnp_card_driver * drv)
int pnp_register_card_driver(struct pnp_card_driver *drv)
{
int error;
struct list_head *pos, *temp;
Expand All @@ -389,9 +399,10 @@ int pnp_register_card_driver(struct pnp_card_driver * drv)
list_add_tail(&drv->global_list, &pnp_card_drivers);
spin_unlock(&pnp_lock);

list_for_each_safe(pos,temp,&pnp_cards){
struct pnp_card *card = list_entry(pos, struct pnp_card, global_list);
card_probe(card,drv);
list_for_each_safe(pos, temp, &pnp_cards) {
struct pnp_card *card =
list_entry(pos, struct pnp_card, global_list);
card_probe(card, drv);
}
return 0;
}
Expand All @@ -401,7 +412,7 @@ int pnp_register_card_driver(struct pnp_card_driver * drv)
* @drv: pointer to the driver to unregister
*/

void pnp_unregister_card_driver(struct pnp_card_driver * drv)
void pnp_unregister_card_driver(struct pnp_card_driver *drv)
{
spin_lock(&pnp_lock);
list_del(&drv->global_list);
Expand All @@ -415,7 +426,7 @@ EXPORT_SYMBOL(pnp_remove_card);
EXPORT_SYMBOL(pnp_add_card_device);
EXPORT_SYMBOL(pnp_remove_card_device);
EXPORT_SYMBOL(pnp_add_card_id);
#endif /* 0 */
#endif /* 0 */
EXPORT_SYMBOL(pnp_request_card_device);
EXPORT_SYMBOL(pnp_release_card_device);
EXPORT_SYMBOL(pnp_register_card_driver);
Expand Down
Loading

0 comments on commit 9dd7846

Please sign in to comment.