[linux-cirrus] Re: kobject_add failed for physmap-flash.0

On Tue, Feb 13, 2007 at 03:45:34PM -0600, NZG wrote:

> A little grepping yielded
> 
> #ifdef CONFIG_MTD_PHYSMAP_LEN
> #if CONFIG_MTD_PHYSMAP_LEN != 0
> #warning using PHYSMAP compat code
> #define PHYSMAP_COMPAT
> #endif
> #endif
> 
> and
> 
> static int __init physmap_init(void)
> {
>       int err;
> 
>       err = platform_driver_register(&physmap_flash_driver);
> #ifdef PHYSMAP_COMPAT
>       if (err == 0)
>               platform_device_register(&physmap_flash);
> #endif
> 
>       return err;
> }
> 
> which looks suspicious as the crash claims something is being registered 
> twice.
> 
> Indeed, setting 
> 
> CONFIG_MTD_PHYSMAP_LEN = 0
> 
> fixes the problem, the flash autodetects to the correct size and everything 
> works.
> 
> I guess the problem is solved but I'm not sure why.

Physmap used to be configured by .config options.  This was never the best
thing to do, so a while ago, physmap was rewritten as a platform driver.
This would break .config users, however, so I made it so that if you've
defined the .config variables, it'll instantiate a platform device for you.

We should probably delete the COMPAT stuff for 2.6.21 or 2.6.22.

Other related posts: