Skip to content

Commit

Permalink
PNP: fix up after Lindent
Browse files Browse the repository at this point in the history
These are manual fixups after running Lindent.  No functional change.

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 9dd7846 commit 07d4e9a
Show file tree
Hide file tree
Showing 20 changed files with 312 additions and 634 deletions.
33 changes: 15 additions & 18 deletions drivers/pnp/card.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* card.c - contains functions for managing groups of PnP devices
*
* Copyright 2002 Adam Belay <[email protected]>
*
*/

#include <linux/module.h>
Expand All @@ -17,12 +16,15 @@ 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)) {
int i = 0;

for (;;) {
int found;
struct pnp_dev *dev;

if (i == PNP_MAX_DEVICES
|| !*drv_id->devs[i].id)
return drv_id;
Expand Down Expand Up @@ -52,6 +54,7 @@ static void card_remove(struct pnp_dev *dev)
static void card_remove_first(struct pnp_dev *dev)
{
struct pnp_card_driver *drv = to_pnp_card_driver(dev->driver);

if (!dev->card || !drv)
return;
if (drv->remove)
Expand Down Expand Up @@ -96,12 +99,11 @@ static int card_probe(struct pnp_card *card, struct pnp_card_driver *drv)
* pnp_add_card_id - adds an EISA id to the specified card
* @id: pointer to a pnp_id structure
* @card: pointer to the desired card
*
*/

int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card)
{
struct pnp_id *ptr;

if (!id)
return -EINVAL;
if (!card)
Expand All @@ -121,6 +123,7 @@ static void pnp_free_card_ids(struct pnp_card *card)
{
struct pnp_id *id;
struct pnp_id *next;

if (!card)
return;
id = card->id;
Expand All @@ -134,6 +137,7 @@ 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);

pnp_free_card_ids(card);
kfree(card);
}
Expand All @@ -143,6 +147,7 @@ static ssize_t pnp_show_card_name(struct device *dmdev,
{
char *str = buf;
struct pnp_card *card = to_pnp_card(dmdev);

str += sprintf(str, "%s\n", card->name);
return (str - buf);
}
Expand All @@ -168,6 +173,7 @@ 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;

Expand All @@ -186,11 +192,11 @@ static int pnp_interface_attach_card(struct pnp_card *card)
* pnp_add_card - adds a PnP card to the PnP Layer
* @card: pointer to the card to add
*/

int pnp_add_card(struct pnp_card *card)
{
int error;
struct list_head *pos, *temp;

if (!card || !card->protocol)
return -EINVAL;

Expand Down Expand Up @@ -233,10 +239,10 @@ int pnp_add_card(struct pnp_card *card)
* pnp_remove_card - removes a PnP card from the PnP Layer
* @card: pointer to the card to remove
*/

void pnp_remove_card(struct pnp_card *card)
{
struct list_head *pos, *temp;

if (!card)
return;
device_unregister(&card->dev);
Expand All @@ -255,7 +261,6 @@ void pnp_remove_card(struct pnp_card *card)
* @card: pointer to the card to add to
* @dev: pointer to the device to add
*/

int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
{
if (!card || !dev || !dev->protocol)
Expand All @@ -275,7 +280,6 @@ int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
* pnp_remove_card_device- removes a device from the specified card
* @dev: pointer to the device to remove
*/

void pnp_remove_card_device(struct pnp_dev *dev)
{
spin_lock(&pnp_lock);
Expand All @@ -291,14 +295,14 @@ void pnp_remove_card_device(struct pnp_dev *dev)
* @id: pointer to a PnP ID structure that explains the rules for finding the device
* @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 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 Down Expand Up @@ -340,10 +344,10 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
* pnp_release_card_device - call this when the driver no longer needs the device
* @dev: pointer to the PnP device stucture
*/

void pnp_release_card_device(struct pnp_dev *dev)
{
struct pnp_card_driver *drv = dev->card_link->driver;

if (!drv)
return;
drv->link.remove = &card_remove;
Expand All @@ -357,6 +361,7 @@ void pnp_release_card_device(struct pnp_dev *dev)
static int card_suspend(struct pnp_dev *dev, pm_message_t state)
{
struct pnp_card_link *link = dev->card_link;

if (link->pm_state.event == state.event)
return 0;
link->pm_state = state;
Expand All @@ -366,6 +371,7 @@ static int card_suspend(struct pnp_dev *dev, pm_message_t state)
static int card_resume(struct pnp_dev *dev)
{
struct pnp_card_link *link = dev->card_link;

if (link->pm_state.event == PM_EVENT_ON)
return 0;
link->pm_state = PMSG_ON;
Expand All @@ -377,7 +383,6 @@ static int card_resume(struct pnp_dev *dev)
* pnp_register_card_driver - registers a PnP card driver with the PnP Layer
* @drv: pointer to the driver to register
*/

int pnp_register_card_driver(struct pnp_card_driver *drv)
{
int error;
Expand Down Expand Up @@ -411,7 +416,6 @@ int pnp_register_card_driver(struct pnp_card_driver *drv)
* pnp_unregister_card_driver - unregisters a PnP card driver from the PnP Layer
* @drv: pointer to the driver to unregister
*/

void pnp_unregister_card_driver(struct pnp_card_driver *drv)
{
spin_lock(&pnp_lock);
Expand All @@ -420,13 +424,6 @@ void pnp_unregister_card_driver(struct pnp_card_driver *drv)
pnp_unregister_driver(&drv->link);
}

#if 0
EXPORT_SYMBOL(pnp_add_card);
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 */
EXPORT_SYMBOL(pnp_request_card_device);
EXPORT_SYMBOL(pnp_release_card_device);
EXPORT_SYMBOL(pnp_register_card_driver);
Expand Down
29 changes: 3 additions & 26 deletions drivers/pnp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* core.c - contains all core device and protocol registration functions
*
* Copyright 2002 Adam Belay <[email protected]>
*
*/

#include <linux/pnp.h>
Expand Down Expand Up @@ -48,7 +47,6 @@ void *pnp_alloc(long size)
*
* Ex protocols: ISAPNP, PNPBIOS, etc
*/

int pnp_register_protocol(struct pnp_protocol *protocol)
{
int nodenum;
Expand Down Expand Up @@ -82,7 +80,6 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
/**
* pnp_protocol_unregister - removes a pnp protocol from the pnp layer
* @protocol: pointer to the corresponding pnp_protocol structure
*
*/
void pnp_unregister_protocol(struct pnp_protocol *protocol)
{
Expand All @@ -96,6 +93,7 @@ static void pnp_free_ids(struct pnp_dev *dev)
{
struct pnp_id *id;
struct pnp_id *next;

if (!dev)
return;
id = dev->id;
Expand All @@ -109,6 +107,7 @@ static void pnp_free_ids(struct pnp_dev *dev)
static void pnp_release_device(struct device *dmdev)
{
struct pnp_dev *dev = to_pnp_dev(dmdev);

pnp_free_option(dev->independent);
pnp_free_option(dev->dependent);
pnp_free_ids(dev);
Expand All @@ -118,6 +117,7 @@ static void pnp_release_device(struct device *dmdev)
int __pnp_add_device(struct pnp_dev *dev)
{
int ret;

pnp_fixup_device(dev);
dev->dev.bus = &pnp_bus_type;
dev->dev.dma_mask = &dev->dma_mask;
Expand All @@ -141,7 +141,6 @@ int __pnp_add_device(struct pnp_dev *dev)
*
* adds to driver model, name database, fixups, interface, etc.
*/

int pnp_add_device(struct pnp_dev *dev)
{
if (!dev || !dev->protocol || dev->card)
Expand All @@ -161,32 +160,10 @@ void __pnp_remove_device(struct pnp_dev *dev)
device_unregister(&dev->dev);
}

/**
* pnp_remove_device - removes a pnp device from the pnp layer
* @dev: pointer to dev to add
*
* this function will free all mem used by dev
*/
#if 0
void pnp_remove_device(struct pnp_dev *dev)
{
if (!dev || dev->card)
return;
__pnp_remove_device(dev);
}
#endif /* 0 */

static int __init pnp_init(void)
{
printk(KERN_INFO "Linux Plug and Play Support v0.97 (c) Adam Belay\n");
return bus_register(&pnp_bus_type);
}

subsys_initcall(pnp_init);

#if 0
EXPORT_SYMBOL(pnp_register_protocol);
EXPORT_SYMBOL(pnp_unregister_protocol);
EXPORT_SYMBOL(pnp_add_device);
EXPORT_SYMBOL(pnp_remove_device);
#endif /* 0 */
20 changes: 9 additions & 11 deletions drivers/pnp/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* driver.c - device id matching, driver model, etc.
*
* Copyright 2002 Adam Belay <[email protected]>
*
*/

#include <linux/string.h>
Expand All @@ -16,6 +15,7 @@
static int compare_func(const char *ida, const char *idb)
{
int i;

/* we only need to compare the last 4 chars */
for (i = 3; i < 7; i++) {
if (ida[i] != 'X' &&
Expand Down Expand Up @@ -44,6 +44,7 @@ static const struct pnp_device_id *match_device(struct pnp_driver *drv,
struct pnp_dev *dev)
{
const struct pnp_device_id *drv_id = drv->id_table;

if (!drv_id)
return NULL;

Expand Down Expand Up @@ -140,6 +141,7 @@ static int pnp_bus_match(struct device *dev, struct device_driver *drv)
{
struct pnp_dev *pnp_dev = to_pnp_dev(dev);
struct pnp_driver *pnp_drv = to_pnp_driver(drv);

if (match_device(pnp_drv, pnp_dev) == NULL)
return 0;
return 1;
Expand Down Expand Up @@ -197,12 +199,12 @@ static int pnp_bus_resume(struct device *dev)
}

struct bus_type pnp_bus_type = {
.name = "pnp",
.match = pnp_bus_match,
.probe = pnp_device_probe,
.remove = pnp_device_remove,
.name = "pnp",
.match = pnp_bus_match,
.probe = pnp_device_probe,
.remove = pnp_device_remove,
.suspend = pnp_bus_suspend,
.resume = pnp_bus_resume,
.resume = pnp_bus_resume,
};

int pnp_register_driver(struct pnp_driver *drv)
Expand All @@ -225,12 +227,11 @@ void pnp_unregister_driver(struct pnp_driver *drv)
* pnp_add_id - adds an EISA id to the specified device
* @id: pointer to a pnp_id structure
* @dev: pointer to the desired device
*
*/

int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev)
{
struct pnp_id *ptr;

if (!id)
return -EINVAL;
if (!dev)
Expand All @@ -248,8 +249,5 @@ int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev)

EXPORT_SYMBOL(pnp_register_driver);
EXPORT_SYMBOL(pnp_unregister_driver);
#if 0
EXPORT_SYMBOL(pnp_add_id);
#endif
EXPORT_SYMBOL(pnp_device_attach);
EXPORT_SYMBOL(pnp_device_detach);
2 changes: 1 addition & 1 deletion drivers/pnp/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*
* Some code, especially possible resource dumping is based on isapnp_proc.c (c) Jaroslav Kysela <[email protected]>
* Copyright 2002 Adam Belay <[email protected]>
*
*/

#include <linux/pnp.h>
Expand Down Expand Up @@ -488,6 +487,7 @@ static DEVICE_ATTR(id, S_IRUGO, pnp_show_current_ids, NULL);
int pnp_interface_attach_device(struct pnp_dev *dev)
{
int rc = device_create_file(&dev->dev, &dev_attr_options);

if (rc)
goto err;
rc = device_create_file(&dev->dev, &dev_attr_resources);
Expand Down
Loading

0 comments on commit 07d4e9a

Please sign in to comment.