From: Russell King The UPF_RESOURCES flag was added to the serial layer to cater for the idiosyncrasies of the PCMCIA layer, where the PCMCIA core code handles the claiming of busy resources. However, the PCMCIA core has progressed, and now does not claim busy resources - IOW, it now behaves just like any other bus driver, where resources are allocated non-busy and its up to the drivers to mark their regions busy using request_region / request_mem_region. The effect of this is that the UPF_RESOURCES hack in the serial layer is now redundant, and can now be removed - 8250 devices should now always use request_region / request_mem_region unconditionally. In theory, this should only affect the 8250 driver, but I see some other drivers (au1x00) also using this flag. However, since this flag is always set in the driver, it's rather pointless. Signed-off-by: Andrew Morton --- 25-akpm/drivers/serial/8250.c | 33 ++++++++++++--------------------- 25-akpm/drivers/serial/8250_acorn.c | 3 +-- 25-akpm/drivers/serial/8250_acpi.c | 2 +- 25-akpm/drivers/serial/8250_pci.c | 2 +- 25-akpm/drivers/serial/8250_pnp.c | 2 +- 25-akpm/drivers/serial/au1x00_uart.c | 7 ++----- 25-akpm/drivers/serial/bast_sio.c | 2 +- 25-akpm/include/linux/serial_core.h | 1 - 8 files changed, 19 insertions(+), 33 deletions(-) diff -puN drivers/serial/8250_acorn.c~remove-upf_resources drivers/serial/8250_acorn.c --- 25/drivers/serial/8250_acorn.c~remove-upf_resources Tue Jun 29 14:31:00 2004 +++ 25-akpm/drivers/serial/8250_acorn.c Tue Jun 29 14:31:00 2004 @@ -43,8 +43,7 @@ serial_register_onedev(unsigned long bad memset(&req, 0, sizeof(req)); req.irq = irq; - req.flags = UPF_AUTOPROBE | UPF_RESOURCES | - UPF_SHARE_IRQ; + req.flags = UPF_AUTOPROBE | UPF_SHARE_IRQ; req.baud_base = baud_base; req.io_type = UPIO_MEM; req.iomem_base = vaddr; diff -puN drivers/serial/8250_acpi.c~remove-upf_resources drivers/serial/8250_acpi.c --- 25/drivers/serial/8250_acpi.c~remove-upf_resources Tue Jun 29 14:31:00 2004 +++ 25-akpm/drivers/serial/8250_acpi.c Tue Jun 29 14:31:00 2004 @@ -123,7 +123,7 @@ static int acpi_serial_add(struct acpi_d } serial_req.baud_base = BASE_BAUD; - serial_req.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_RESOURCES; + serial_req.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; priv->line = register_serial(&serial_req); if (priv->line < 0) { diff -puN drivers/serial/8250.c~remove-upf_resources drivers/serial/8250.c --- 25/drivers/serial/8250.c~remove-upf_resources Tue Jun 29 14:31:00 2004 +++ 25-akpm/drivers/serial/8250.c Tue Jun 29 14:31:00 2004 @@ -1696,8 +1696,6 @@ static void serial8250_release_port(stru struct uart_8250_port *up = (struct uart_8250_port *)port; unsigned long start, offset = 0, size = 0; - if (!(up->port.flags & UPF_RESOURCES)) - return; if (up->port.type == PORT_RSA) { offset = UART_RSA_BASE << up->port.regshift; size = 8; @@ -1742,16 +1740,14 @@ static int serial8250_request_port(struc struct resource *res = NULL, *res_rsa = NULL; int ret = 0; - if (up->port.flags & UPF_RESOURCES) { - if (up->port.type == PORT_RSA) { - ret = serial8250_request_rsa_resource(up, &res_rsa); - if (ret < 0) - return ret; - } - - ret = serial8250_request_std_resource(up, &res); + if (up->port.type == PORT_RSA) { + ret = serial8250_request_rsa_resource(up, &res_rsa); + if (ret < 0) + return ret; } + ret = serial8250_request_std_resource(up, &res); + /* * If we have a mapbase, then request that as well. */ @@ -1791,17 +1787,13 @@ static void serial8250_config_port(struc * Find the region that we can probe for. This in turn * tells us whether we can probe for the type of port. */ - if (up->port.flags & UPF_RESOURCES) { - ret = serial8250_request_std_resource(up, &res_std); - if (ret < 0) - return; + ret = serial8250_request_std_resource(up, &res_std); + if (ret < 0) + return; - ret = serial8250_request_rsa_resource(up, &res_rsa); - if (ret < 0) - probeflags &= ~PROBE_RSA; - } else { + ret = serial8250_request_rsa_resource(up, &res_rsa); + if (ret < 0) probeflags &= ~PROBE_RSA; - } if (flags & UART_CONFIG_TYPE) autoconfig(up, probeflags); @@ -1876,8 +1868,7 @@ static void __init serial8250_isa_init_p up->port.iobase = old_serial_port[i].port; up->port.irq = irq_canonicalize(old_serial_port[i].irq); up->port.uartclk = old_serial_port[i].baud_base * 16; - up->port.flags = old_serial_port[i].flags | - UPF_RESOURCES; + up->port.flags = old_serial_port[i].flags; up->port.hub6 = old_serial_port[i].hub6; up->port.membase = old_serial_port[i].iomem_base; up->port.iotype = old_serial_port[i].io_type; diff -puN drivers/serial/8250_pci.c~remove-upf_resources drivers/serial/8250_pci.c --- 25/drivers/serial/8250_pci.c~remove-upf_resources Tue Jun 29 14:31:00 2004 +++ 25-akpm/drivers/serial/8250_pci.c Tue Jun 29 14:31:00 2004 @@ -1665,7 +1665,7 @@ pciserial_init_one(struct pci_dev *dev, for (i = 0; i < nr_ports; i++) { memset(&serial_req, 0, sizeof(serial_req)); serial_req.flags = UPF_SKIP_TEST | UPF_AUTOPROBE | - UPF_RESOURCES | UPF_SHARE_IRQ; + UPF_SHARE_IRQ; serial_req.baud_base = board->base_baud; serial_req.irq = get_pci_irq(dev, board, i); if (quirk->setup(dev, board, &serial_req, i)) diff -puN drivers/serial/8250_pnp.c~remove-upf_resources drivers/serial/8250_pnp.c --- 25/drivers/serial/8250_pnp.c~remove-upf_resources Tue Jun 29 14:31:00 2004 +++ 25-akpm/drivers/serial/8250_pnp.c Tue Jun 29 14:31:00 2004 @@ -413,7 +413,7 @@ serial_pnp_probe(struct pnp_dev * dev, c serial_req.port, serial_req.irq, serial_req.io_type); #endif - serial_req.flags = UPF_SKIP_TEST | UPF_AUTOPROBE | UPF_RESOURCES; + serial_req.flags = UPF_SKIP_TEST | UPF_AUTOPROBE; serial_req.baud_base = 115200; line = register_serial(&serial_req); diff -puN drivers/serial/au1x00_uart.c~remove-upf_resources drivers/serial/au1x00_uart.c --- 25/drivers/serial/au1x00_uart.c~remove-upf_resources Tue Jun 29 14:31:00 2004 +++ 25-akpm/drivers/serial/au1x00_uart.c Tue Jun 29 14:31:00 2004 @@ -969,9 +969,7 @@ static int serial8250_request_port(struc struct resource *res = NULL, *res_rsa = NULL; int ret = 0; - if (up->port.flags & UPF_RESOURCES) { - ret = serial8250_request_std_resource(up, &res); - } + ret = serial8250_request_std_resource(up, &res); /* * If we have a mapbase, then request that as well. @@ -1072,8 +1070,7 @@ static void __init serial8250_isa_init_p up->port.iobase = old_serial_port[i].port; up->port.irq = old_serial_port[i].irq; up->port.uartclk = get_au1x00_uart_baud_base(); - up->port.flags = old_serial_port[i].flags | - UPF_RESOURCES; + up->port.flags = old_serial_port[i].flags; up->port.hub6 = old_serial_port[i].hub6; up->port.membase = old_serial_port[i].iomem_base; up->port.iotype = old_serial_port[i].io_type; diff -puN drivers/serial/bast_sio.c~remove-upf_resources drivers/serial/bast_sio.c --- 25/drivers/serial/bast_sio.c~remove-upf_resources Tue Jun 29 14:31:00 2004 +++ 25-akpm/drivers/serial/bast_sio.c Tue Jun 29 14:31:00 2004 @@ -24,7 +24,7 @@ static int __init serial_bast_register(u printk("BAST: SuperIO serial (%08lx,%d)\n", port, irq); #endif - serial_req.flags = UPF_AUTOPROBE | UPF_RESOURCES | UPF_SHARE_IRQ; + serial_req.flags = UPF_AUTOPROBE | UPF_SHARE_IRQ; serial_req.baud_base = BASE_BAUD; serial_req.irq = irq; serial_req.io_type = UPIO_MEM; diff -puN include/linux/serial_core.h~remove-upf_resources include/linux/serial_core.h --- 25/include/linux/serial_core.h~remove-upf_resources Tue Jun 29 14:31:00 2004 +++ 25-akpm/include/linux/serial_core.h Tue Jun 29 14:31:00 2004 @@ -207,7 +207,6 @@ struct uart_port { #define UPF_CONS_FLOW (1 << 23) #define UPF_SHARE_IRQ (1 << 24) #define UPF_BOOT_AUTOCONF (1 << 28) -#define UPF_RESOURCES (1 << 30) #define UPF_IOREMAP (1 << 31) #define UPF_CHANGE_MASK (0x17fff) _