[PATCH 2/2] usb: chipidea: imx: Add system suspend/resume API

Russell King - ARM Linux linux at arm.linux.org.uk
Fri Jan 18 05:59:02 EST 2013


On Fri, Jan 18, 2013 at 10:50:28AM +0800, Peter Chen wrote:
> +#ifdef CONFIG_PM
> +static int ci13xxx_imx_suspend(struct device *dev)
> +{
> +	struct ci13xxx_imx_data *data =
> +		platform_get_drvdata(to_platform_device(dev));

Is there a reason not to use dev_get_drvdata() here?  Hint:

#define to_platform_device(x) container_of((x), struct platform_device, dev)

static inline void *platform_get_drvdata(const struct platform_device *pdev)
{
        return dev_get_drvdata(&pdev->dev);
}

So, you're going from a dev => platform device => the same dev again.

It's perfectly valid to use dev_get_drvdata() here because we're not going
to separate these two (it makes absolutely no sense to.)



More information about the linux-arm-kernel mailing list