Skip to contentSkip to conversation

PNP Lindent

PATCH New Bjorn Helgaas 1 participant 2 messages Jul 26, 2007

Subsystems (3)
lore
Share & tools
lore
#1 lore raw

PATCH 2/2 PNP: fix up after Lindent

In reply to Bjorn Helgaas

These are manual fixups after running Lindent. No functional change.

drivers/pnp/card.c +15 -18
Index: w/drivers/pnp/card.c
===================================================================
@@ -2,7 +2,6 @@
  * card.c - contains functions for managing groups of PnP devices
  *
  * Copyright 2002 Adam Belay <[email protected]>
- *
  */
 
 #include <linux/module.h>
@@ -17,12 +16,15 @@
 						   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;
@@ -52,6 +54,7 @@
 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)
@@ -96,12 +99,11 @@
  * 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)
@@ -121,6 +123,7 @@
 {
 	struct pnp_id *id;
 	struct pnp_id *next;
+
 	if (!card)
 		return;
 	id = card->id;
@@ -134,6 +137,7 @@
 static void pnp_release_card(struct device *dmdev)
 {
 	struct pnp_card *card = to_pnp_card(dmdev);
+
 	pnp_free_card_ids(card);
 	kfree(card);
 }
@@ -143,6 +147,7 @@
 {
 	char *str = buf;
 	struct pnp_card *card = to_pnp_card(dmdev);
+
 	str += sprintf(str, "%s\n", card->name);
 	return (str - buf);
 }
@@ -168,6 +173,7 @@
 static int pnp_interface_attach_card(struct pnp_card *card)
 {
 	int rc = device_create_file(&card->dev, &dev_attr_name);
+
 	if (rc)
 		return rc;
 
@@ -186,11 +192,11 @@
  * 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;
 
@@ -233,10 +239,10 @@
  * 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);
@@ -255,7 +261,6 @@
  * @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)
@@ -275,7 +280,6 @@
  * 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);
@@ -291,7 +295,6 @@
  * @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)
 {
@@ -299,6 +302,7 @@
 	struct pnp_dev *dev;
 	struct pnp_card_driver *drv;
 	struct pnp_card *card;
+
 	if (!clink || !id)
 		goto done;
 	card = clink->card;
@@ -340,10 +344,10 @@
  * 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;
@@ -357,6 +361,7 @@
 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;
@@ -366,6 +371,7 @@
 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;
@@ -377,7 +383,6 @@
  * 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;
@@ -411,7 +416,6 @@
  * 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);
@@ -420,13 +424,6 @@
 	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);
drivers/pnp/core.c +3 -26
Index: w/drivers/pnp/core.c
===================================================================
@@ -2,7 +2,6 @@
  * core.c - contains all core device and protocol registration functions
  *
  * Copyright 2002 Adam Belay <[email protected]>
- *
  */
 
 #include <linux/pnp.h>
@@ -48,7 +47,6 @@
  *
  *  Ex protocols: ISAPNP, PNPBIOS, etc
  */
-
 int pnp_register_protocol(struct pnp_protocol *protocol)
 {
 	int nodenum;
@@ -82,7 +80,6 @@
 /**
  * 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)
 {
@@ -96,6 +93,7 @@
 {
 	struct pnp_id *id;
 	struct pnp_id *next;
+
 	if (!dev)
 		return;
 	id = dev->id;
@@ -109,6 +107,7 @@
 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);
@@ -118,6 +117,7 @@
 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;
@@ -141,7 +141,6 @@
  *
  *  adds to driver model, name database, fixups, interface, etc.
  */
-
 int pnp_add_device(struct pnp_dev *dev)
 {
 	if (!dev || !dev->protocol || dev->card)
@@ -161,21 +160,6 @@
 	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");
@@ -183,10 +167,3 @@
 }
 
 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  */
drivers/pnp/driver.c +9 -11
Index: w/drivers/pnp/driver.c
===================================================================
@@ -2,7 +2,6 @@
  * driver.c - device id matching, driver model, etc.
  *
  * Copyright 2002 Adam Belay <[email protected]>
- *
  */
 
 #include <linux/string.h>
@@ -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' &&
@@ -44,6 +44,7 @@
 						struct pnp_dev *dev)
 {
 	const struct pnp_device_id *drv_id = drv->id_table;
+
 	if (!drv_id)
 		return NULL;
 
@@ -140,6 +141,7 @@
 {
 	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;
@@ -192,12 +194,12 @@
 }
 
 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)
@@ -220,12 +222,11 @@
  * 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)
@@ -243,8 +244,5 @@
 
 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);
drivers/pnp/interface.c +1 -1
Index: w/drivers/pnp/interface.c
===================================================================
@@ -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>
@@ -488,6 +487,7 @@
 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);
drivers/pnp/isapnp/compat.c +12 -11
Index: w/drivers/pnp/isapnp/compat.c
===================================================================
@@ -3,11 +3,8 @@
  *            the old isapnp APIs. If possible use the new APIs instead.
  *
  * Copyright 2002 Adam Belay <[email protected]>
- *
  */
 
-/* TODO: see if more isapnp functions are needed here */
-
 #include <linux/module.h>
 #include <linux/isapnp.h>
 #include <linux/string.h>
@@ -19,16 +16,17 @@
 		'A' + ((vendor >> 2) & 0x3f) - 1,
 		'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
 		'A' + ((vendor >> 8) & 0x1f) - 1,
-		(device >> 4) & 0x0f,
-		device & 0x0f, (device >> 12) & 0x0f, (device >> 8) & 0x0f);
+		(device >> 4) & 0x0f, device & 0x0f,
+		(device >> 12) & 0x0f, (device >> 8) & 0x0f);
 }
 
-struct pnp_card *pnp_find_card(unsigned short vendor,
-			       unsigned short device, struct pnp_card *from)
+struct pnp_card *pnp_find_card(unsigned short vendor, unsigned short device,
+			       struct pnp_card *from)
 {
 	char id[8];
 	char any[8];
 	struct list_head *list;
+
 	pnp_convert_id(id, vendor, device);
 	pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID);
 
@@ -36,6 +34,7 @@
 
 	while (list != &pnp_cards) {
 		struct pnp_card *card = global_to_pnp_card(list);
+
 		if (compare_pnp_id(card->id, id) || (memcmp(id, any, 7) == 0))
 			return card;
 		list = list->next;
@@ -43,12 +42,12 @@
 	return NULL;
 }
 
-struct pnp_dev *pnp_find_dev(struct pnp_card *card,
-			     unsigned short vendor,
+struct pnp_dev *pnp_find_dev(struct pnp_card *card, unsigned short vendor,
 			     unsigned short function, struct pnp_dev *from)
 {
 	char id[8];
 	char any[8];
+
 	pnp_convert_id(id, vendor, function);
 	pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID);
 	if (card == NULL) {	/* look for a logical device from all cards */
@@ -60,8 +59,9 @@
 
 		while (list != &pnp_global) {
 			struct pnp_dev *dev = global_to_pnp_dev(list);
-			if (compare_pnp_id(dev->id, id)
-			    || (memcmp(id, any, 7) == 0))
+
+			if (compare_pnp_id(dev->id, id) ||
+			    (memcmp(id, any, 7) == 0))
 				return dev;
 			list = list->next;
 		}
@@ -76,6 +76,7 @@
 		}
 		while (list != &card->devices) {
 			struct pnp_dev *dev = card_to_pnp_dev(list);
+
 			if (compare_pnp_id(dev->id, id))
 				return dev;
 			list = list->next;
drivers/pnp/isapnp/core.c +5 -25
Index: w/drivers/pnp/isapnp/core.c
===================================================================
@@ -252,7 +252,6 @@
  *	Perform an isolation. The port selection code now tries to avoid
  *	"dangerous to read" ports.
  */
-
 static int __init isapnp_isolate_rdp_select(void)
 {
 	isapnp_wait();
@@ -281,7 +280,6 @@
 /*
  *  Isolate (assign uniqued CSN) to all ISA PnP devices.
  */
-
 static int __init isapnp_isolate(void)
 {
 	unsigned char checksum = 0x6a;
@@ -352,7 +350,6 @@
 /*
  *  Read one tag from stream.
  */
-
 static int __init isapnp_read_tag(unsigned char *type, unsigned short *size)
 {
 	unsigned char tag, tmp[2];
@@ -380,7 +377,6 @@
 /*
  *  Skip specified number of bytes from stream.
  */
-
 static void __init isapnp_skip_bytes(int count)
 {
 	isapnp_peek(NULL, count);
@@ -389,11 +385,11 @@
 /*
  *  Parse EISA id.
  */
-
 static void isapnp_parse_id(struct pnp_dev *dev, unsigned short vendor,
 			    unsigned short device)
 {
 	struct pnp_id *id;
+
 	if (!dev)
 		return;
 	id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
@@ -411,7 +407,6 @@
 /*
  *  Parse logical device tag.
  */
-
 static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card,
 						  int size, int number)
 {
@@ -440,7 +435,6 @@
 /*
  *  Add IRQ resource to resources list.
  */
-
 static void __init isapnp_parse_irq_resource(struct pnp_option *option,
 					     int size)
 {
@@ -459,13 +453,11 @@
 	else
 		irq->flags = IORESOURCE_IRQ_HIGHEDGE;
 	pnp_register_irq_resource(option, irq);
-	return;
 }
 
 /*
  *  Add DMA resource to resources list.
  */
-
 static void __init isapnp_parse_dma_resource(struct pnp_option *option,
 					     int size)
 {
@@ -479,13 +471,11 @@
 	dma->map = tmp[0];
 	dma->flags = tmp[1];
 	pnp_register_dma_resource(option, dma);
-	return;
 }
 
 /*
  *  Add port resource to resources list.
  */
-
 static void __init isapnp_parse_port_resource(struct pnp_option *option,
 					      int size)
 {
@@ -502,13 +492,11 @@
 	port->size = tmp[6];
 	port->flags = tmp[0] ? PNP_PORT_FLAG_16BITADDR : 0;
 	pnp_register_port_resource(option, port);
-	return;
 }
 
 /*
  *  Add fixed port resource to resources list.
  */
-
 static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
 						    int size)
 {
@@ -524,13 +512,11 @@
 	port->align = 0;
 	port->flags = PNP_PORT_FLAG_FIXED;
 	pnp_register_port_resource(option, port);
-	return;
 }
 
 /*
  *  Add memory resource to resources list.
  */
-
 static void __init isapnp_parse_mem_resource(struct pnp_option *option,
 					     int size)
 {
@@ -547,13 +533,11 @@
 	mem->size = ((tmp[8] << 8) | tmp[7]) << 8;
 	mem->flags = tmp[0];
 	pnp_register_mem_resource(option, mem);
-	return;
 }
 
 /*
  *  Add 32-bit memory resource to resources list.
  */
-
 static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
 					       int size)
 {
@@ -577,7 +561,6 @@
 /*
  *  Add 32-bit fixed memory resource to resources list.
  */
-
 static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option,
 						     int size)
 {
@@ -599,7 +582,6 @@
 /*
  *  Parse card name for ISA PnP device.
  */
-
 static void __init
 isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size)
 {
@@ -619,7 +601,6 @@
 /*
  *  Parse resource map for logical device.
  */
-
 static int __init isapnp_create_device(struct pnp_card *card,
 				       unsigned short size)
 {
@@ -627,6 +608,7 @@
 	unsigned char type, tmp[17];
 	struct pnp_option *option;
 	struct pnp_dev *dev;
+
 	if ((dev = isapnp_parse_device(card, size, number++)) == NULL)
 		return 1;
 	option = pnp_register_independent_option(dev);
@@ -761,7 +743,6 @@
 /*
  *  Parse resource map for ISA PnP card.
  */
-
 static void __init isapnp_parse_resource_map(struct pnp_card *card)
 {
 	unsigned char type, tmp[17];
@@ -816,7 +797,6 @@
 /*
  *  Compute ISA PnP checksum for first eight bytes.
  */
-
 static unsigned char __init isapnp_checksum(unsigned char *data)
 {
 	int i, j;
@@ -839,11 +819,11 @@
 /*
  *  Parse EISA id for ISA PnP card.
  */
-
 static void isapnp_parse_card_id(struct pnp_card *card, unsigned short vendor,
 				 unsigned short device)
 {
 	struct pnp_id *id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
+
 	if (!id)
 		return;
 	sprintf(id->id, "%c%c%c%x%x%x%x",
@@ -858,7 +838,6 @@
 /*
  *  Build device list for all present ISA PnP devices.
  */
-
 static int __init isapnp_build_device_list(void)
 {
 	int csn;
@@ -911,6 +890,7 @@
 int isapnp_present(void)
 {
 	struct pnp_card *card;
+
 	pnp_for_each_card(card) {
 		if (card->protocol == &isapnp_protocol)
 			return 1;
@@ -953,7 +933,7 @@
 }
 
 /*
- *  Inititialization.
+ *  Initialization.
  */
 
 EXPORT_SYMBOL(isapnp_protocol);
drivers/pnp/isapnp/proc.c +3 -4
Index: w/drivers/pnp/isapnp/proc.c
===================================================================
@@ -2,7 +2,6 @@
  *  ISA Plug & Play support
  *  Copyright (c) by Jaroslav Kysela <[email protected]>
  *
- *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
  *   the Free Software Foundation; either version 2 of the License, or
@@ -16,7 +15,6 @@
  *   You should have received a copy of the GNU General Public License
  *   along with this program; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  */
 
 #include <linux/module.h>
@@ -139,11 +137,12 @@
 	remove_proc_entry(name, isapnp_proc_bus_dir);
 	return 0;
 }
-#endif /* MODULE */
+#endif				/* MODULE */
 
 int __init isapnp_proc_init(void)
 {
 	struct pnp_dev *dev;
+
 	isapnp_proc_bus_dir = proc_mkdir("isapnp", proc_bus);
 	protocol_for_each_dev(&isapnp_protocol, dev) {
 		isapnp_proc_attach_device(dev);
@@ -167,4 +166,4 @@
 		remove_proc_entry("isapnp", proc_bus);
 	return 0;
 }
-#endif /* MODULE */
+#endif				/* MODULE */
drivers/pnp/manager.c +6 -18
Index: w/drivers/pnp/manager.c
===================================================================
@@ -3,7 +3,6 @@
  *
  * based on isapnp.c resource management (c) Jaroslav Kysela <[email protected]>
  * Copyright 2003 Adam Belay <[email protected]>
- *
  */
 
 #include <linux/errno.h>
@@ -222,11 +221,11 @@
 /**
  * pnp_init_resources - Resets a resource table to default values.
  * @table: pointer to the desired resource table
- *
  */
 void pnp_init_resource_table(struct pnp_resource_table *table)
 {
 	int idx;
+
 	for (idx = 0; idx < PNP_MAX_IRQ; idx++) {
 		table->irq_resource[idx].name = NULL;
 		table->irq_resource[idx].start = -1;
@@ -260,11 +259,11 @@
 /**
  * pnp_clean_resources - clears resources that were not manually set
  * @res: the resources to clean
- *
  */
 static void pnp_clean_resource_table(struct pnp_resource_table *res)
 {
 	int idx;
+
 	for (idx = 0; idx < PNP_MAX_IRQ; idx++) {
 		if (!(res->irq_resource[idx].flags & IORESOURCE_AUTO))
 			continue;
@@ -410,6 +409,7 @@
 {
 	int i;
 	struct pnp_resource_table *bak;
+
 	if (!dev || !res)
 		return -EINVAL;
 	if (!pnp_can_configure(dev))
@@ -454,7 +454,6 @@
 /**
  * pnp_auto_config_dev - automatically assigns resources to a device
  * @dev: pointer to the desired device
- *
  */
 int pnp_auto_config_dev(struct pnp_dev *dev)
 {
@@ -491,9 +490,8 @@
  * pnp_start_dev - low-level start of the PnP device
  * @dev: pointer to the desired device
  *
- * assumes that resources have alread been allocated
+ * assumes that resources have already been allocated
  */
-
 int pnp_start_dev(struct pnp_dev *dev)
 {
 	if (!pnp_can_write(dev)) {
@@ -508,7 +506,6 @@
 	}
 
 	pnp_info("Device %s activated.", dev->dev.bus_id);
-
 	return 0;
 }
 
@@ -518,7 +515,6 @@
  *
  * does not free resources
  */
-
 int pnp_stop_dev(struct pnp_dev *dev)
 {
 	if (!pnp_can_disable(dev)) {
@@ -532,7 +528,6 @@
 	}
 
 	pnp_info("Device %s disabled.", dev->dev.bus_id);
-
 	return 0;
 }
 
@@ -548,9 +543,8 @@
 
 	if (!dev)
 		return -EINVAL;
-	if (dev->active) {
+	if (dev->active)
 		return 0;	/* the device is already active */
-	}
 
 	/* ensure resources are allocated */
 	if (pnp_auto_config_dev(dev))
@@ -561,7 +555,6 @@
 		return error;
 
 	dev->active = 1;
-
 	return 1;
 }
 
@@ -577,9 +570,8 @@
 
 	if (!dev)
 		return -EINVAL;
-	if (!dev->active) {
+	if (!dev->active)
 		return 0;	/* the device is already disabled */
-	}
 
 	error = pnp_stop_dev(dev);
 	if (error)
@@ -600,7 +592,6 @@
  * @resource: pointer to resource to be changed
  * @start: start of region
  * @size: size of region
- *
  */
 void pnp_resource_change(struct resource *resource, resource_size_t start,
 			 resource_size_t size)
@@ -613,9 +604,6 @@
 }
 
 EXPORT_SYMBOL(pnp_manual_config_dev);
-#if 0
-EXPORT_SYMBOL(pnp_auto_config_dev);
-#endif
 EXPORT_SYMBOL(pnp_start_dev);
 EXPORT_SYMBOL(pnp_stop_dev);
 EXPORT_SYMBOL(pnp_activate_dev);
drivers/pnp/pnpacpi/core.c +12 -13
Index: w/drivers/pnp/pnpacpi/core.c
===================================================================
@@ -31,13 +31,15 @@
  * used by the kernel (PCI root, ...), as it is harmless and there were
  * already present in pnpbios. But there is an exception for devices that
  * have irqs (PIC, Timer) because we call acpi_register_gsi.
- * Finaly only devices that have a CRS method need to be in this list.
+ * Finally, only devices that have a CRS method need to be in this list.
  */
-static char __initdata excluded_id_list[] = "PNP0C09,"	/* EC */
+static char __initdata excluded_id_list[] =
+    "PNP0C09,"			/* EC */
     "PNP0C0F,"			/* Link device */
     "PNP0000,"			/* PIC */
     "PNP0100,"			/* Timer */
     ;
+
 static inline int is_exclusive_device(struct acpi_device *dev)
 {
 	return (!acpi_match_ids(dev, excluded_id_list));
@@ -82,6 +84,7 @@
 				 struct pnp_resource_table *res)
 {
 	acpi_status status;
+
 	status = pnpacpi_parse_allocated_resource((acpi_handle) dev->data,
 						  &dev->res);
 	return ACPI_FAILURE(status) ? -ENODEV : 0;
@@ -121,9 +124,9 @@
 }
 
 static struct pnp_protocol pnpacpi_protocol = {
-	.name = "Plug and Play ACPI",
-	.get = pnpacpi_get_resources,
-	.set = pnpacpi_set_resources,
+	.name	 = "Plug and Play ACPI",
+	.get	 = pnpacpi_get_resources,
+	.set	 = pnpacpi_set_resources,
 	.disable = pnpacpi_disable_resources,
 };
 
@@ -146,7 +149,7 @@
 		return -ENOMEM;
 	}
 	dev->data = device->handle;
-	/* .enabled means if the device can decode the resources */
+	/* .enabled means the device can decode the resources */
 	dev->active = device->status.enabled;
 	status = acpi_get_handle(device->handle, "_SRS", &temp);
 	if (ACPI_SUCCESS(status))
@@ -178,8 +181,8 @@
 
 	if (dev->active) {
 		/* parse allocated resource */
-		status =
-		    pnpacpi_parse_allocated_resource(device->handle, &dev->res);
+		status = pnpacpi_parse_allocated_resource(device->handle,
+							  &dev->res);
 		if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
 			pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s",
 				dev_id->id);
@@ -272,7 +275,7 @@
  * pnpdev->dev.archdata.acpi_handle point to its ACPI sibling.
  */
 static struct acpi_bus_type __initdata acpi_pnp_bus = {
-	.bus = &pnp_bus_type,
+	.bus	     = &pnp_bus_type,
 	.find_device = acpi_pnp_find_device,
 };
 
@@ -305,7 +308,3 @@
 }
 
 __setup("pnpacpi=", pnpacpi_setup);
-
-#if 0
-EXPORT_SYMBOL(pnpacpi_protocol);
-#endif
drivers/pnp/pnpacpi/rsparser.c +61 -99

310 lines not on this page · raw message

drivers/pnp/pnpbios/bioscalls.c +44 -117

317 lines not on this page · raw message

drivers/pnp/pnpbios/core.c +13 -15
Index: w/drivers/pnp/pnpbios/core.c
===================================================================
@@ -100,25 +100,24 @@
 /*
  * (Much of this belongs in a shared routine somewhere)
  */
-
 static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
 {
 	char *argv[3], **envp, *buf, *scratch;
 	int i = 0, value;
 
-	if (!current->fs->root) {
+	if (!current->fs->root)
 		return -EAGAIN;
-	}
-	if (!(envp = kcalloc(20, sizeof(char *), GFP_KERNEL))) {
+	if (!(envp = kcalloc(20, sizeof(char *), GFP_KERNEL)))
 		return -ENOMEM;
-	}
 	if (!(buf = kzalloc(256, GFP_KERNEL))) {
 		kfree(envp);
 		return -ENOMEM;
 	}
 
-	/* FIXME: if there are actual users of this, it should be integrated into
-	 * the driver core and use the usual infrastructure like sysfs and uevents */
+	/* FIXME: if there are actual users of this, it should be
+	 * integrated into the driver core and use the usual infrastructure
+	 * like sysfs and uevents
+	 */
 	argv[0] = "/sbin/pnpbios";
 	argv[1] = "dock";
 	argv[2] = NULL;
@@ -146,7 +145,7 @@
 			   info->location_id, info->serial, info->capabilities);
 	envp[i] = NULL;
 
-	value = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC);
+	value = call_usermodehelper(argv [0], argv, envp, UMH_WAIT_EXEC);
 	kfree(buf);
 	kfree(envp);
 	return 0;
@@ -159,6 +158,7 @@
 {
 	static struct pnp_docking_station_info now;
 	int docked = -1, d = 0;
+
 	set_freezable();
 	while (!unloading) {
 		int status;
@@ -203,7 +203,7 @@
 	complete_and_exit(&unload_sem, 0);
 }
 
-#endif /* CONFIG_HOTPLUG */
+#endif				/* CONFIG_HOTPLUG */
 
 static int pnpbios_get_resources(struct pnp_dev *dev,
 				 struct pnp_resource_table *res)
@@ -211,7 +211,6 @@
 	u8 nodenum = dev->number;
 	struct pnp_bios_node *node;
 
-	/* just in case */
 	if (!pnpbios_is_dynamic(dev))
 		return -EPERM;
 
@@ -235,7 +234,6 @@
 	struct pnp_bios_node *node;
 	int ret;
 
-	/* just in case */
 	if (!pnpbios_is_dynamic(dev))
 		return -EPERM;
 
@@ -263,6 +261,7 @@
 	unsigned char *end = (char *)(node->data + node->size);
 	unsigned int len;
 	int i;
+
 	while ((char *)p < (char *)end) {
 		if (p[0] & 0x80) {	/* large tag */
 			len = (p[2] << 8) | p[1];
@@ -287,7 +286,6 @@
 	u8 nodenum = dev->number;
 	int ret;
 
-	/* just in case */
 	if (dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev))
 		return -EPERM;
 
@@ -418,8 +416,8 @@
  *
  */
 
-static int pnpbios_disabled;	/* = 0 */
-int pnpbios_dont_use_current_config;	/* = 0 */
+static int pnpbios_disabled;
+int pnpbios_dont_use_current_config;
 
 #ifndef MODULE
 static int __init pnpbios_setup(char *str)
@@ -551,7 +549,7 @@
 		printk(KERN_INFO "PnPBIOS: Disabled by ACPI PNP\n");
 		return -ENODEV;
 	}
-#endif /* CONFIG_ACPI */
+#endif				/* CONFIG_ACPI */
 
 	/* scan the system for pnpbios support */
 	if (!pnpbios_probe_system())
drivers/pnp/pnpbios/proc.c +0 -5
Index: w/drivers/pnp/pnpbios/proc.c
===================================================================
@@ -18,9 +18,6 @@
  * The other files are human-readable.
  */
 
-//#include <pcmcia/config.h>
-//#include <pcmcia/k_compat.h>
-
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
@@ -297,6 +294,4 @@
 	remove_proc_entry("devices", proc_pnp);
 	remove_proc_entry("boot", proc_pnp);
 	remove_proc_entry("pnp", proc_bus);
-
-	return;
 }
drivers/pnp/pnpbios/rsparser.c +46 -53

321 lines not on this page · raw message

drivers/pnp/quirks.c +0 -1
Index: w/drivers/pnp/quirks.c
===================================================================
@@ -105,7 +105,6 @@
 	if (changed)
 		printk(KERN_INFO
 		       "pnp: SB audio device quirk - increasing port range\n");
-	return;
 }
 
 static int quirk_smc_fir_enabled(struct pnp_dev *dev)
drivers/pnp/resource.c +13 -20
Index: w/drivers/pnp/resource.c
===================================================================
@@ -3,7 +3,6 @@
  *
  * based on isapnp.c resource management (c) Jaroslav Kysela <[email protected]>
  * Copyright 2003 Adam Belay <[email protected]>
- *
  */
 
 #include <linux/module.h>
@@ -20,10 +19,10 @@
 #include <linux/pnp.h>
 #include "base.h"
 
-static int pnp_reserve_irq[16] = {[0...15] = -1 };	/* reserve (don't use) some IRQ */
-static int pnp_reserve_dma[8] = {[0...7] = -1 };	/* reserve (don't use) some DMA */
-static int pnp_reserve_io[16] = {[0...15] = -1 };	/* reserve (don't use) some I/O region */
-static int pnp_reserve_mem[16] = {[0...15] = -1 };	/* reserve (don't use) some memory region */
+static int pnp_reserve_irq[16] = {[0 ... 15] = -1 };	/* reserve (don't use) some IRQ */
+static int pnp_reserve_dma[8] = {[0 ... 7] = -1 };	/* reserve (don't use) some DMA */
+static int pnp_reserve_io[16] = {[0 ... 15] = -1 };	/* reserve (don't use) some I/O region */
+static int pnp_reserve_mem[16] = {[0 ... 15] = -1 };	/* reserve (don't use) some memory region */
 
 /*
  * option registration
@@ -33,7 +32,6 @@
 {
 	struct pnp_option *option = pnp_alloc(sizeof(struct pnp_option));
 
-	/* check if pnp_alloc ran out of memory */
 	if (!option)
 		return NULL;
 
@@ -48,6 +46,7 @@
 struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
 {
 	struct pnp_option *option;
+
 	if (!dev)
 		return NULL;
 
@@ -64,6 +63,7 @@
 						 int priority)
 {
 	struct pnp_option *option;
+
 	if (!dev)
 		return NULL;
 
@@ -82,6 +82,7 @@
 int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data)
 {
 	struct pnp_irq *ptr;
+
 	if (!option)
 		return -EINVAL;
 	if (!data)
@@ -110,6 +111,7 @@
 int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data)
 {
 	struct pnp_dma *ptr;
+
 	if (!option)
 		return -EINVAL;
 	if (!data)
@@ -129,6 +131,7 @@
 int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data)
 {
 	struct pnp_port *ptr;
+
 	if (!option)
 		return -EINVAL;
 	if (!data)
@@ -148,6 +151,7 @@
 int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data)
 {
 	struct pnp_mem *ptr;
+
 	if (!option)
 		return -EINVAL;
 	if (!data)
@@ -240,6 +244,7 @@
 	int tmp;
 	struct pnp_dev *tdev;
 	resource_size_t *port, *end, *tport, *tend;
+
 	port = &dev->res.port_resource[idx].start;
 	end = &dev->res.port_resource[idx].end;
 
@@ -297,6 +302,7 @@
 	int tmp;
 	struct pnp_dev *tdev;
 	resource_size_t *addr, *end, *taddr, *tend;
+
 	addr = &dev->res.mem_resource[idx].start;
 	end = &dev->res.mem_resource[idx].end;
 
@@ -474,22 +480,12 @@
 
 	return 1;
 #else
-	/* IA64 hasn't legacy DMA */
+	/* IA64 does not have legacy DMA */
 	return 0;
 #endif
 }
 
-#if 0
-EXPORT_SYMBOL(pnp_register_dependent_option);
-EXPORT_SYMBOL(pnp_register_independent_option);
-EXPORT_SYMBOL(pnp_register_irq_resource);
-EXPORT_SYMBOL(pnp_register_dma_resource);
-EXPORT_SYMBOL(pnp_register_port_resource);
-EXPORT_SYMBOL(pnp_register_mem_resource);
-#endif /*  0  */
-
 /* format is: pnp_reserve_irq=irq1[,irq2] .... */
-
 static int __init pnp_setup_reserve_irq(char *str)
 {
 	int i;
@@ -503,7 +499,6 @@
 __setup("pnp_reserve_irq=", pnp_setup_reserve_irq);
 
 /* format is: pnp_reserve_dma=dma1[,dma2] .... */
-
 static int __init pnp_setup_reserve_dma(char *str)
 {
 	int i;
@@ -517,7 +512,6 @@
 __setup("pnp_reserve_dma=", pnp_setup_reserve_dma);
 
 /* format is: pnp_reserve_io=io1,size1[,io2,size2] .... */
-
 static int __init pnp_setup_reserve_io(char *str)
 {
 	int i;
@@ -531,7 +525,6 @@
 __setup("pnp_reserve_io=", pnp_setup_reserve_io);
 
 /* format is: pnp_reserve_mem=mem1,size1[,mem2,size2] .... */
-
 static int __init pnp_setup_reserve_mem(char *str)
 {
 	int i;
drivers/pnp/support.c +3 -5
Index: w/drivers/pnp/support.c
===================================================================
@@ -1,8 +1,7 @@
 /*
- * support.c - provides standard pnp functions for the use of pnp protocol drivers,
+ * support.c - standard functions for the use of pnp protocol drivers
  *
  * Copyright 2003 Adam Belay <[email protected]>
- *
  */
 
 #include <linux/module.h>
@@ -11,11 +10,10 @@
 #include "base.h"
 
 /**
- * pnp_is_active - Determines if a device is active based on its current resources
+ * pnp_is_active - Determines if a device is active based on its current
+ *	resources
  * @dev: pointer to the desired PnP device
- *
  */
-
 int pnp_is_active(struct pnp_dev *dev)
 {
 	if (!pnp_port_start(dev, 0) && pnp_port_len(dev, 0) <= 1 &&
drivers/pnp/system.c +4 -8
Index: w/drivers/pnp/system.c
===================================================================
@@ -45,8 +45,7 @@
 	 * example do reserve stuff they know about too, so we may well
 	 * have double reservations.
 	 */
-	printk(KERN_INFO
-	       "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n",
+	printk(KERN_INFO "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n",
 	       pnpid, port ? "ioport" : "iomem",
 	       (unsigned long long)start, (unsigned long long)end,
 	       NULL != res ? "has been" : "could not be");
@@ -85,8 +84,6 @@
 		reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i),
 			      pnp_mem_end(dev, i), 0);
 	}
-
-	return;
 }
 
 static int system_pnp_probe(struct pnp_dev *dev,
@@ -97,11 +94,10 @@
 }
 
 static struct pnp_driver system_pnp_driver = {
-	.name = "system",
+	.name     = "system",
 	.id_table = pnp_dev_table,
-	.flags = PNP_DRIVER_RES_DO_NOT_CHANGE,
-	.probe = system_pnp_probe,
-	.remove = NULL,
+	.flags    = PNP_DRIVER_RES_DO_NOT_CHANGE,
+	.probe    = system_pnp_probe,
 };
 
 static int __init pnp_system_init(void)
include/linux/pnp.h +63 -175

321 lines not on this page · raw message

include/linux/pnpbios.h +1 -9
Index: w/include/linux/pnpbios.h
===================================================================
@@ -134,7 +134,7 @@
 extern struct pnp_dev_node_info node_info;
 
 extern int pnp_bios_dev_node_info(struct pnp_dev_node_info *data);
-extern int pnp_bios_get_dev_node(u8 * nodenum, char config,
+extern int pnp_bios_get_dev_node(u8 *nodenum, char config,
 				 struct pnp_bios_node *data);
 extern int pnp_bios_set_dev_node(u8 nodenum, char config,
 				 struct pnp_bios_node *data);
@@ -143,14 +143,6 @@
 extern int pnp_bios_escd_info(struct escd_info_struc *data);
 extern int pnp_bios_read_escd(char *data, u32 nvram_base);
 extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data);
-#define needed 0
-#if needed
-extern int pnp_bios_get_event(u16 * message);
-extern int pnp_bios_send_message(u16 message);
-extern int pnp_bios_set_stat_res(char *info);
-extern int pnp_bios_apm_id_table(char *table, u16 * size);
-extern int pnp_bios_write_escd(char *data, u32 nvram_base);
-#endif
 
 #endif /* CONFIG_PNPBIOS */
 

--

#0 lore raw

cover PNP Lindent

Run PNP files through Lindent. These patches contain no functional changes. I verified that the i386 object files before and after are identical like this:

    $ grep PNP .config
    # CONFIG_IP_PNP is not set
    CONFIG_PNP=y
    CONFIG_PNP_DEBUG=y
    CONFIG_ISAPNP=y
    CONFIG_PNPBIOS=y
    CONFIG_PNPBIOS_PROC_FS=y
    CONFIG_PNPACPI=y
    CONFIG_BLK_DEV_IDEPNP=y
    CONFIG_SERIAL_8250_PNP=y
    $ quilt pop -a
    $ make bzImage
    $ mkdir /tmp/before
    $ cp -pr * /tmp/before/
    $ quilt push 2
    $ make bzImage
    $ find . -name \*.o -exec cmp /tmp/before/'{}' '{}' \;

Andrew and Len, thanks for your flexibility. I know patches like these are a nuisance.

Bjorn

--