Revert "usb: chipidea: remove duplicate dev_set_drvdata for host_start"

This reverts commit 14b4099c07

It moved platform_set_drvdata(pdev, ci) before hcd is created,
and the hcd will assign itself as ci controller's drvdata during
the hcd creation function (in usb_create_shared_hcd), so it
overwrites the real ci's drvdata which we want to use.

So, if the controller is at host mode, the system suspend
API will get the wrong struct ci_hdrc pointer, and cause the
oops.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Peter Chen 2014-12-24 11:33:17 +08:00 committed by Greg Kroah-Hartman
parent 440893398a
commit 24c498df1c
2 changed files with 2 additions and 1 deletions

View File

@ -669,7 +669,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
if (!ci) if (!ci)
return -ENOMEM; return -ENOMEM;
platform_set_drvdata(pdev, ci);
ci->dev = dev; ci->dev = dev;
ci->platdata = dev_get_platdata(dev); ci->platdata = dev_get_platdata(dev);
ci->imx28_write_fix = !!(ci->platdata->flags & ci->imx28_write_fix = !!(ci->platdata->flags &
@ -783,6 +782,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
} }
} }
platform_set_drvdata(pdev, ci);
ret = devm_request_irq(dev, ci->irq, ci_irq, IRQF_SHARED, ret = devm_request_irq(dev, ci->irq, ci_irq, IRQF_SHARED,
ci->platdata->name, ci); ci->platdata->name, ci);
if (ret) if (ret)

View File

@ -91,6 +91,7 @@ static int host_start(struct ci_hdrc *ci)
if (!hcd) if (!hcd)
return -ENOMEM; return -ENOMEM;
dev_set_drvdata(ci->dev, ci);
hcd->rsrc_start = ci->hw_bank.phys; hcd->rsrc_start = ci->hw_bank.phys;
hcd->rsrc_len = ci->hw_bank.size; hcd->rsrc_len = ci->hw_bank.size;
hcd->regs = ci->hw_bank.abs; hcd->regs = ci->hw_bank.abs;