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

Benjamin Herrenschmidt benh at kernel.crashing.org
Wed Oct 6 18:15:11 EST 2004


On Wed, 2004-10-06 at 17:26, Russell King wrote:
> 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?

It well call get_legacy_serial_ports() which is hopefully exported by
the arch code.

> 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 ?

Hrm... ok. Or adding a #ifdef __KERNEL__ (sic !) :)

I'll send you a new patch later today as I had to do another fix, we
tend to "force" register_console() apparently even when we have nothing
to register because we set the "ops" to all ports even those who were
never configured and we test "ops" to decide wether to succeed or fail
in the console setup() callback.

Ben.





More information about the Linuxppc64-dev mailing list