pnp: increase number of devices supported per protocol

Increase the PNP "number of devices" limit. We currently use an unsigned
char, which limits us to 256 devices per protocol. This patch changes that to
an unsigned int.

Not all backends can take advantage of this: we limit ISAPNP to 10 devices in
isapnp_cfg_begin(), and PNPBIOS is limited to 256 devices because the BIOS
interfaces use a one-byte device node number.

But there is no limit on the number of PNPACPI devices we may have. Large HP
Integrity machines have more than 256, which causes the current "unsigned char
number" to wrap around. This causes errors like this:

pnp: PnP ACPI init
kobject_add failed for 00:00 with -EEXIST, don't try to register things with the same name in the same directory.

Call Trace:
[<a000000100010720>] show_stack+0x40/0xa0
[<a0000001000107b0>] dump_stack+0x30/0x60
[<a0000001001dbdf0>] kobject_add+0x290/0x2c0
[<a0000001002bfd40>] device_add+0x160/0x860
[<a0000001002c0470>] device_register+0x30/0x60
[<a00000010026ba70>] __pnp_add_device+0x130/0x180
[<a00000010026bb70>] pnp_add_device+0xb0/0xe0
[<a0000001007f2730>] pnpacpi_add_device+0x510/0x5a0
[<a0000001007f2810>] pnpacpi_add_device_handler+0x50/0x80

This patch increases the limit to fix this PNPACPI problem. It should not
have any adverse effect on ISAPNP or PNPBIOS because their limits are still
enforced in the backends.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Bjorn Helgaas and committed by Linus Torvalds 544451a1 bd2ab670

+1 -1
+1 -1
include/linux/pnp.h
··· 175 175 struct pnp_dev { 176 176 struct device dev; /* Driver Model device interface */ 177 177 u64 dma_mask; 178 - unsigned char number; /* used as an index, must be unique */ 178 + unsigned int number; /* used as an index, must be unique */ 179 179 int status; 180 180 181 181 struct list_head global_list; /* node in global list of devices */