Re: [PATCH] IDE: Fix platform device registration in Swarm IDE driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 28 Sep 2008, Sergei Shtylyov wrote:
> Ralf Baechle wrote:
> 
> > > > +{
> 
> > > [...]
> 
> > > > +	pdev = platform_device_register_simple(DEV_NAME, -1,
> > > > +		       swarm_ide_resource, ARRAY_SIZE(swarm_ide_resource));
> 
> > >  If you have the resources as static array anyway, why not have the
> > > device in the static variable too and use platform_device_register()?
> 
> > It saves a few lines of code.
> 
>    And wastes few words of static data since platform_device_register_simple()
> will kmalloc() the resources and do a copy from these resources after which
> they are not needed -- so, it's worth making swarm_ide_resource[] __initdata
> at least.
>    If you were using platform_device_register() with static platform device,
> no memory allocation would have happened, and no data would have been wasted.

Indeed, there are different static/dynamic memory usage patterns for the
various ways to register platform devices. Unfortunately (AFAIK) it's not
properly documented which to use when.

E.g. if some devices may be present (as indicated by e.g. firmware),
which one is the most optimal to use?

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux