[PATCH 1/4] device: update id support to allow device without id
Sascha Hauer
s.hauer at pengutronix.de
Thu Aug 18 01:26:20 EDT 2011
On Tue, Aug 16, 2011 at 07:36:04AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> as in linux use -1 for this
>
> as example on bus we may have only one device so no need to have
> devname<number>
>
> for automatic id use -2 now
> udpate all the device that use -1 to -2
>
> device that really want -1 will have to update later
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> ---
> diff --git a/arch/arm/boards/a9m2410/a9m2410.c b/arch/arm/boards/a9m2410/a9m2410.c
> index 44ac44b..0d26da9 100644
> --- a/arch/arm/boards/a9m2410/a9m2410.c
> +++ b/arch/arm/boards/a9m2410/a9m2410.c
> @@ -131,14 +131,14 @@ static int a9m2410_devices_init(void)
> writel(reg, MISCCR);
>
> /* ----------- the devices the boot loader should work with -------- */
> - add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0,
> + add_generic_device("s3c24x0_nand", -2, NULL, S3C24X0_NAND_BASE, 0,
> IORESOURCE_MEM, &nand_info);
-1 has a special meaning without being a define, but we should not
introduce another arbitrary numbered special meaning.
But I don't think we want this anyway. In a later patch you convert
all drivers/devices to platform_*_register without having a
platform_device. If we want to go this way we should go it all the
way and have a struct platform_device which embeds a struct device_d.
The 'id' field would then be a part of the platform_device rather
than the device itself.
The 'id' field is only present because we have no better way of
numbering the instances of devices on a platform bus. With PCI/USB
devices this numbering would come from the position on the bus.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list