[PATCH v2 1/3] driver core: Add ability for arch code to setup pdev_archdata

Scott Wood scottwood at freescale.com
Thu Jun 23 03:52:52 EST 2011


On Wed, 22 Jun 2011 10:09:56 -0500
Kumar Gala <galak at kernel.crashing.org> wrote:

> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 1c291af..c25e0c0 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -20,6 +20,7 @@
>  #include <linux/err.h>
>  #include <linux/slab.h>
>  #include <linux/pm_runtime.h>
> +#include <asm/platform_device.h>
>  
>  #include "base.h"
>  
> @@ -173,6 +174,7 @@ struct platform_device *platform_device_alloc(const char *name, int id)
>  		pa->pdev.id = id;
>  		device_initialize(&pa->pdev.dev);
>  		pa->pdev.dev.release = platform_device_release;
> +		arch_setup_pdev_archdata(&pa->pdev);
>  	}
>  
>  	return pa ? &pa->pdev : NULL;

Need to call this from platform_device_register() as well, for devices
which are not dynamically allocated.

> +/*
> + * an architecture can override to define arch_setup_pdev_archdata
> + */
> +#ifndef arch_setup_pdev_archdata
> +static inline void arch_setup_pdev_archdata(struct platform_device *pdev) { }
> +#endif

That's not a particularly useful comment.  More useful would be a statement
of when this hook is called, examples of what it's meant to be used for,
etc.

-Scott



More information about the Linuxppc-dev mailing list