Re: [RFC][PATCH] Way for platforms to alter built-in serial ports

From: Russell King
Date: Wed Oct 06 2004 - 02:28:13 EST


On Thu, Sep 30, 2004 at 06:50:48PM +1000, Benjamin Herrenschmidt wrote:
> +#ifndef ARCH_HAS_GET_LEGACY_SERIAL_PORTS
> static struct old_serial_port old_serial_port[] = {
> SERIAL_PORT_DFNS /* defined in asm/serial.h */
> };
> -
> +static inline struct old_serial_port *get_legacy_serial_ports(unsigned int *count)
> +{
> + *count = ARRAY_SIZE(old_serial_port);
> + return old_serial_port;
> +}
> #define UART_NR (ARRAY_SIZE(old_serial_port) + CONFIG_SERIAL_8250_NR_UARTS)
> +#endif /* ARCH_HAS_GET_LEGACY_SERIAL_PORTS */
> +

What happens if 8250.c is built as a module and
ARCH_HAS_GET_LEGACY_SERIAL_PORTS is defined?

> diff -urN linux-2.5/include/linux/serial.h linux-maple/include/linux/serial.h
> --- linux-2.5/include/linux/serial.h 2004-09-30 18:31:55.867785437 +1000
> +++ linux-maple/include/linux/serial.h 2004-09-30 15:36:57.981697919 +1000
> @@ -14,6 +14,21 @@
> #include <asm/page.h>
>
> /*
> + * Definition of a legacy serial port
> + */
> +struct old_serial_port {
> + unsigned int uart;
> + unsigned int baud_base;
> + unsigned int port;
> + unsigned int irq;
> + unsigned int flags;
> + unsigned char hub6;
> + unsigned char io_type;
> + unsigned char *iomem_base;
> + unsigned short iomem_reg_shift;
> +};
> +
> +/*
> * Counters of the input lines (CTS, DSR, RI, CD) interrupts
> */

serial.h is used by userspace programs. We should not expose this
structure to those programs. Instead, maybe creating an 8250.h
header, or even moving the existing 8250.h header ?

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/