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

From: Scott Wood
Date: Wed Jun 22 2011 - 13:53:04 EST


On Wed, 22 Jun 2011 10:09:56 -0500
Kumar Gala <galak@xxxxxxxxxxxxxxxxxxx> 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/