Re: [PATCH 01/20] drivers_base: platform: use always ->name for uevent

From: Grant Likely
Date: Mon Aug 15 2011 - 10:56:31 EST


On Mon, Aug 15, 2011 at 8:51 AM, Sebastian Andrzej Siewior
<bigeasy@xxxxxxxxxxxxx> wrote:
> If id_entry is available then it is used. However if we remove first the
> driver followed by the device, then the id_entry is pointing to driver's
> memory which is long gone.
> Since id->name and plat->name are equal there is no point in
> distinguishing them.
>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
> Cc: Grant Likely <grant.likely@xxxxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
>  drivers/base/platform.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 0cad9c7..cd71575 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -614,7 +614,7 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env)
>                return rc;
>
>        add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX,
> -               (pdev->id_entry) ? pdev->id_entry->name : pdev->name);
> +                       pdev->name);

Yes, this looks like the right thing to do to me. Also, I think the
original code is suspect because it causes the uevent data to be
different after binding a driver to a device.

g.
--
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/