[PATCH 2/2] ARM: S3C64XX: Prototype SPI devices

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Sep 9 07:33:09 EDT 2010


On Thu, Sep 09, 2010 at 08:18:10PM +0900, Kukjin Kim wrote:
> Mark Brown wrote:

> > It'll have been something along the lines of:

> > 's3c64xx_device_iis0' not declared; should it be static?

> > for each device.  Possibly generated by sparse rather than GCC - I
> > always build with sparse as well.

> You mean the build warning is 's3c64xx_device_iis0' is not declared..right?

Yes, or words to that effect.

> Hmm...the 's3c64xx_device_iis0' used only in a mach-s3c64xx/mach-smartq.c
> file.
> And defined it as extern struct in a plat-samsung/include/plat/devs.h file.
> ...So...why need to modify mach-s3c64xx/dev-spi.c for it?

The complaint is that the symbol has been defined in the C file with
global scope but there's no declaration for it.  This means that either
the symbol is not supposed to be global scope and should be static
instead (which isn't the case here, machines are supposed to be able to
reference it) or that there is nothing checking that the declaration
that other files use to talk about the symbol matches the defintion.  If
the users are using a different declaration then the memory layout and
alignment may not be correct for them, causing errors at runtime.

In other words the file has:

struct platform_device s3c64xx_device_iis0 = {
	...
};

and the compiler/sparse is expecting to see:

struct platform_device s3c64xx_device_iis0;

before that, which comes from devs.h.



More information about the linux-arm-kernel mailing list