On Friday, February 07, 2014 11:36 AM, Peter Chen wrote:
> On Wed, Feb 05, 2014 at 10:30:35AM +0900, Jingoo Han wrote:
> > Use the wrapper function for retrieving the platform data instead
> > of accessing dev->platform_data directly. This is a cosmetic change
> > to make the code simpler and enhance the readability.
> >
> > Signed-off-by: Jingoo Han <jg1....@samsung.com>
> > ---
> >  drivers/usb/chipidea/core.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> > index 33f22bc..2fab79d 100644
> > --- a/drivers/usb/chipidea/core.c
> > +++ b/drivers/usb/chipidea/core.c
> > @@ -532,7 +532,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
> >     int             ret;
> >     enum usb_dr_mode dr_mode;
> >
> > -   if (!dev->platform_data) {
> > +   if (!dev_get_platdata(dev)) {
> >             dev_err(dev, "platform data missing\n");
> >             return -ENODEV;
> >     }
> 
> Thanks for reviewing/patching code.
> 
> If dev_get_platdata(dev) gets error, the platform device will not be created,
> thus, the probe will not be called. The dev_get_platdata is called
> before platform device is created.
> 
> > @@ -549,7 +549,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
> >     }
> >
> >     ci->dev = dev;
> > -   ci->platdata = dev->platform_data;
> > +   ci->platdata = dev_get_platdata(dev);
> >     ci->imx28_write_fix = !!(ci->platdata->flags &
> >             CI_HDRC_IMX28_WRITE_FIX);
> >
> 
> The return value of dev_get_platdata is not platform data.
> In fact, the dev->platform_data has already filled by dev_get_platdata.

Sorry, but I cannot understand what you mean. :-(
Did you look at dev_get_platdata(dev)?

./include/linux/device.h
static inline void *dev_get_platdata(const struct device *dev)
{
        return dev->platform_data;
}

There is no functional change. This is just a cosmetic change.
'dev_get_platdata(dev)' and 'dev->platform_data' are the same.

Best regards,
Jingoo Han

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to