Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9dd78466 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Linus Torvalds
Browse files

PNP: Lindent all source files



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: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8ec3cf7d
Loading
Loading
Loading
Loading
+73 −62
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@
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) {
@@ -23,11 +23,13 @@ static const struct pnp_card_device_id * match_card(struct pnp_card_driver * drv
			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;
					}
@@ -136,8 +138,8 @@ static void pnp_release_card(struct device *dmdev)
	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);
@@ -147,7 +149,8 @@ static ssize_t pnp_show_card_name(struct device *dmdev, struct device_attribute

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);
@@ -165,10 +168,12 @@ 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;
	if (rc)
		return rc;

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

	return 0;

@@ -189,7 +194,8 @@ int pnp_add_card(struct pnp_card * card)
	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;
@@ -212,11 +218,14 @@ int pnp_add_card(struct pnp_card * card)

		/* 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);
			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;
}

@@ -253,8 +262,8 @@ int pnp_add_card_device(struct pnp_card * card, struct pnp_dev * dev)
		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);
@@ -283,7 +292,8 @@ 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;
@@ -390,7 +400,8 @@ int pnp_register_card_driver(struct pnp_card_driver * drv)
	spin_unlock(&pnp_lock);

	list_for_each_safe(pos, temp, &pnp_cards) {
		struct pnp_card *card = list_entry(pos, struct pnp_card, global_list);
		struct pnp_card *card =
		    list_entry(pos, struct pnp_card, global_list);
		card_probe(card, drv);
	}
	return 0;
+12 −13
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@

#include "base.h"


static LIST_HEAD(pnp_protocols);
LIST_HEAD(pnp_global);
DEFINE_SPINLOCK(pnp_lock);
@@ -93,7 +92,6 @@ void pnp_unregister_protocol(struct pnp_protocol *protocol)
	device_unregister(&protocol->dev);
}


static void pnp_free_ids(struct pnp_dev *dev)
{
	struct pnp_id *id;
@@ -149,7 +147,8 @@ int pnp_add_device(struct pnp_dev *dev)
	if (!dev || !dev->protocol || dev->card)
		return -EINVAL;
	dev->dev.parent = &dev->protocol->dev;
	sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, dev->number);
	sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number,
		dev->number);
	return __pnp_add_device(dev);
}

+29 −29
Original line number Diff line number Diff line
@@ -17,11 +17,9 @@ 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++)
	{
	for (i = 3; i < 7; i++) {
		if (ida[i] != 'X' &&
		    idb[i] != 'X' &&
		    toupper(ida[i]) != toupper(idb[i]))
		    idb[i] != 'X' && toupper(ida[i]) != toupper(idb[i]))
			return 0;
	}
	return 1;
@@ -42,7 +40,8 @@ int compare_pnp_id(struct pnp_id *pos, const char *id)
	return 0;
}

static const struct pnp_device_id * match_device(struct pnp_driver *drv, struct pnp_dev *dev)
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)
@@ -86,7 +85,8 @@ static int pnp_device_probe(struct device *dev)
	pnp_dev = to_pnp_dev(dev);
	pnp_drv = to_pnp_driver(dev->driver);

	pnp_dbg("match found with the PnP device '%s' and the driver '%s'", dev->bus_id,pnp_drv->name);
	pnp_dbg("match found with the PnP device '%s' and the driver '%s'",
		dev->bus_id, pnp_drv->name);

	error = pnp_device_attach(pnp_dev);
	if (error < 0)
+122 −93
Original line number Diff line number Diff line
@@ -48,14 +48,18 @@ static int pnp_printf(pnp_info_buffer_t * buffer, char *fmt,...)
	return res;
}

static void pnp_print_port(pnp_info_buffer_t *buffer, char *space, struct pnp_port *port)
static void pnp_print_port(pnp_info_buffer_t * buffer, char *space,
			   struct pnp_port *port)
{
	pnp_printf(buffer, "%sport 0x%x-0x%x, align 0x%x, size 0x%x, %i-bit address decoding\n",
			space, port->min, port->max, port->align ? (port->align-1) : 0, port->size,
	pnp_printf(buffer,
		   "%sport 0x%x-0x%x, align 0x%x, size 0x%x, %i-bit address decoding\n",
		   space, port->min, port->max,
		   port->align ? (port->align - 1) : 0, port->size,
		   port->flags & PNP_PORT_FLAG_16BITADDR ? 16 : 10);
}

static void pnp_print_irq(pnp_info_buffer_t *buffer, char *space, struct pnp_irq *irq)
static void pnp_print_irq(pnp_info_buffer_t * buffer, char *space,
			  struct pnp_irq *irq)
{
	int first = 1, i;

@@ -85,7 +89,8 @@ static void pnp_print_irq(pnp_info_buffer_t *buffer, char *space, struct pnp_irq
	pnp_printf(buffer, "\n");
}

static void pnp_print_dma(pnp_info_buffer_t *buffer, char *space, struct pnp_dma *dma)
static void pnp_print_dma(pnp_info_buffer_t * buffer, char *space,
			  struct pnp_dma *dma)
{
	int first = 1, i;
	char *s;
@@ -136,7 +141,8 @@ static void pnp_print_dma(pnp_info_buffer_t *buffer, char *space, struct pnp_dma
	pnp_printf(buffer, " %s\n", s);
}

static void pnp_print_mem(pnp_info_buffer_t *buffer, char *space, struct pnp_mem *mem)
static void pnp_print_mem(pnp_info_buffer_t * buffer, char *space,
			  struct pnp_mem *mem)
{
	char *s;

@@ -204,8 +210,8 @@ static void pnp_print_option(pnp_info_buffer_t *buffer, char *space,
		pnp_print_mem(buffer, space, mem);
}


static ssize_t pnp_show_options(struct device *dmdev, struct device_attribute *attr, char *buf)
static ssize_t pnp_show_options(struct device *dmdev,
				struct device_attribute *attr, char *buf)
{
	struct pnp_dev *dev = to_pnp_dev(dmdev);
	struct pnp_option *independent = dev->independent;
@@ -235,8 +241,9 @@ static ssize_t pnp_show_options(struct device *dmdev, struct device_attribute *a

static DEVICE_ATTR(options, S_IRUGO, pnp_show_options, NULL);


static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_attribute *attr, char *buf)
static ssize_t pnp_show_current_resources(struct device *dmdev,
					  struct device_attribute *attr,
					  char *buf)
{
	struct pnp_dev *dev = to_pnp_dev(dmdev);
	int i, ret;
@@ -265,8 +272,10 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at
				pnp_printf(buffer, " disabled\n");
			else
				pnp_printf(buffer, " 0x%llx-0x%llx\n",
					(unsigned long long)pnp_port_start(dev, i),
					(unsigned long long)pnp_port_end(dev, i));
					   (unsigned long long)
					   pnp_port_start(dev, i),
					   (unsigned long long)pnp_port_end(dev,
									    i));
		}
	}
	for (i = 0; i < PNP_MAX_MEM; i++) {
@@ -276,8 +285,10 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at
				pnp_printf(buffer, " disabled\n");
			else
				pnp_printf(buffer, " 0x%llx-0x%llx\n",
					(unsigned long long)pnp_mem_start(dev, i),
					(unsigned long long)pnp_mem_end(dev, i));
					   (unsigned long long)
					   pnp_mem_start(dev, i),
					   (unsigned long long)pnp_mem_end(dev,
									   i));
		}
	}
	for (i = 0; i < PNP_MAX_IRQ; i++) {
@@ -308,7 +319,8 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at
extern struct semaphore pnp_res_mutex;

static ssize_t
pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr, const char * ubuf, size_t count)
pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
			  const char *ubuf, size_t count)
{
	struct pnp_dev *dev = to_pnp_dev(dmdev);
	char *buf = (void *)ubuf;
@@ -316,7 +328,8 @@ pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr,

	if (dev->status & PNP_ATTACHED) {
		retval = -EBUSY;
		pnp_info("Device %s cannot be configured because it is in use.", dev->dev.bus_id);
		pnp_info("Device %s cannot be configured because it is in use.",
			 dev->dev.bus_id);
		goto done;
	}

@@ -370,17 +383,21 @@ pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr,
				buf += 2;
				while (isspace(*buf))
					++buf;
				dev->res.port_resource[nport].start = simple_strtoul(buf,&buf,0);
				dev->res.port_resource[nport].start =
				    simple_strtoul(buf, &buf, 0);
				while (isspace(*buf))
					++buf;
				if (*buf == '-') {
					buf += 1;
					while (isspace(*buf))
						++buf;
					dev->res.port_resource[nport].end = simple_strtoul(buf,&buf,0);
					dev->res.port_resource[nport].end =
					    simple_strtoul(buf, &buf, 0);
				} else
					dev->res.port_resource[nport].end = dev->res.port_resource[nport].start;
				dev->res.port_resource[nport].flags = IORESOURCE_IO;
					dev->res.port_resource[nport].end =
					    dev->res.port_resource[nport].start;
				dev->res.port_resource[nport].flags =
				    IORESOURCE_IO;
				nport++;
				if (nport >= PNP_MAX_PORT)
					break;
@@ -390,17 +407,21 @@ pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr,
				buf += 3;
				while (isspace(*buf))
					++buf;
				dev->res.mem_resource[nmem].start = simple_strtoul(buf,&buf,0);
				dev->res.mem_resource[nmem].start =
				    simple_strtoul(buf, &buf, 0);
				while (isspace(*buf))
					++buf;
				if (*buf == '-') {
					buf += 1;
					while (isspace(*buf))
						++buf;
					dev->res.mem_resource[nmem].end = simple_strtoul(buf,&buf,0);
					dev->res.mem_resource[nmem].end =
					    simple_strtoul(buf, &buf, 0);
				} else
					dev->res.mem_resource[nmem].end = dev->res.mem_resource[nmem].start;
				dev->res.mem_resource[nmem].flags = IORESOURCE_MEM;
					dev->res.mem_resource[nmem].end =
					    dev->res.mem_resource[nmem].start;
				dev->res.mem_resource[nmem].flags =
				    IORESOURCE_MEM;
				nmem++;
				if (nmem >= PNP_MAX_MEM)
					break;
@@ -411,8 +432,10 @@ pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr,
				while (isspace(*buf))
					++buf;
				dev->res.irq_resource[nirq].start =
				dev->res.irq_resource[nirq].end = simple_strtoul(buf,&buf,0);
				dev->res.irq_resource[nirq].flags = IORESOURCE_IRQ;
				    dev->res.irq_resource[nirq].end =
				    simple_strtoul(buf, &buf, 0);
				dev->res.irq_resource[nirq].flags =
				    IORESOURCE_IRQ;
				nirq++;
				if (nirq >= PNP_MAX_IRQ)
					break;
@@ -423,8 +446,10 @@ pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr,
				while (isspace(*buf))
					++buf;
				dev->res.dma_resource[ndma].start =
				dev->res.dma_resource[ndma].end = simple_strtoul(buf,&buf,0);
				dev->res.dma_resource[ndma].flags = IORESOURCE_DMA;
				    dev->res.dma_resource[ndma].end =
				    simple_strtoul(buf, &buf, 0);
				dev->res.dma_resource[ndma].flags =
				    IORESOURCE_DMA;
				ndma++;
				if (ndma >= PNP_MAX_DMA)
					break;
@@ -444,7 +469,8 @@ pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr,
static DEVICE_ATTR(resources, S_IRUGO | S_IWUSR,
		   pnp_show_current_resources, pnp_set_current_resources);

static ssize_t pnp_show_current_ids(struct device *dmdev, struct device_attribute *attr, char *buf)
static ssize_t pnp_show_current_ids(struct device *dmdev,
				    struct device_attribute *attr, char *buf)
{
	char *str = buf;
	struct pnp_dev *dev = to_pnp_dev(dmdev);
@@ -462,11 +488,14 @@ 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;
	if (rc)
		goto err;
	rc = device_create_file(&dev->dev, &dev_attr_resources);
	if (rc) goto err_opt;
	if (rc)
		goto err_opt;
	rc = device_create_file(&dev->dev, &dev_attr_id);
	if (rc) goto err_res;
	if (rc)
		goto err_res;

	return 0;

+14 −16
Original line number Diff line number Diff line
@@ -12,21 +12,19 @@
#include <linux/isapnp.h>
#include <linux/string.h>

static void pnp_convert_id(char *buf, unsigned short vendor, unsigned short device)
static void pnp_convert_id(char *buf, unsigned short vendor,
			   unsigned short device)
{
	sprintf(buf, "%c%c%c%x%x%x%x",
		'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 & 0x0f, (device >> 12) & 0x0f, (device >> 8) & 0x0f);
}

struct pnp_card *pnp_find_card(unsigned short vendor,
			       unsigned short device,
			       struct pnp_card *from)
			       unsigned short device, struct pnp_card *from)
{
	char id[8];
	char any[8];
@@ -47,8 +45,7 @@ struct pnp_card *pnp_find_card(unsigned short vendor,

struct pnp_dev *pnp_find_dev(struct pnp_card *card,
			     unsigned short vendor,
			     unsigned short function,
			     struct pnp_dev *from)
			     unsigned short function, struct pnp_dev *from)
{
	char id[8];
	char any[8];
@@ -63,7 +60,8 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,

		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;
		}
Loading