[PATCH 1/4] device: update id support to allow device without id

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Thu Aug 18 02:27:20 EDT 2011


On 07:26 Thu 18 Aug     , Sascha Hauer wrote:
> 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.
we can add a proper define

> 
> 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.
I chosse to do it in two step for platfrom_device

I first switch everyone to the function and then introduce the new struct
I've not yet finish completly the new struct but it's on its way

Best Regards,
J.



More information about the barebox mailing list