lkml.org 
[lkml]   [2005]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Au1x00 8250 uart support (Updated - take #2).
On Wed, Sep 21, 2005 at 07:14:09PM +0300, Pantelis Antoniou wrote:
> > This is also buggy - the problem this has is that although you're
> > unregistering the platform device, references can still remain after
> > the module has been unloaded. This means you have two options:
> >
> > 1. never allow code with statically allocated platform devices to be
> > modules.
> > 2. use something like platform_device_register_simple() (which doesn't
> > currently exist in a useful form for devices with platform data.)
> >
>
> Yes, this is stinking mess. I resorted to just not allowing a module build.
>
> BTW, the current platform_device_register_simple suffers from the same bug.
>
> ! struct platform_device *platform_device_register_simple(char *name, unsigned int id,
> ! struct resource *res, unsigned int num)
> !
>
> later on in the function body we have...
>
> ! pobj->pdev.name = name;
>
> It's clearly buggy, since the typical calling sequence passes a constant
> string as a 'name' argument, which is located in the read only segment
> of the module (.text or .rodata).
>
> To fix this space for the name must be allocated just like the resources...

Is this true? platform_device_register uses pdev.name to construct the
bus id. pdev.name is also used when matching against drivers.

However, once a platform device is unregistered, it is no longer available
to be matched against drivers, so pdev.name is unused. Therefore, I don't
think this is a problem.

> +#ifdef CONFIG_SERIAL_8250_AU1X00_MODULE
> +#error This file can not yet be compiled as a module.
> +#endif

This isn't how we prevent modular builds...

> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -207,6 +207,14 @@ config SERIAL_8250_ACORN
> system, say Y to this option. The driver can handle 1, 2, or 3 port
> cards. If unsure, say N.
>
> +config SERIAL_8250_AU1X00
> + tristate "AU1X00 serial port support"

We prevent them by setting this to 'bool'.

> + depends on SOC_AU1X00 && SERIAL_8250

It doens't really depend on SERIAL_8250 - it can live independently of it.
However, it can be built in when SERIAL_8250 isn't, so this dependency
should be SERIAL_8250 != n.

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

\
 
 \ /
  Last update: 2005-09-21 21:20    [W:0.077 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site