Commit a4cf1b14 authored by Peter Chen's avatar Peter Chen Committed by Greg Kroah-Hartman

usb: chipidea: imx: simplify the usbmisc callers

Move struct imx_usbmisc_data NULL pointer judgement from caller to
each API, it can simplify the caller.
Signed-off-by: default avatarPeter Chen <peter.chen@freescale.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 73dea4a9
...@@ -149,14 +149,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) ...@@ -149,14 +149,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
if (ret) if (ret)
goto err_clk; goto err_clk;
if (data->usbmisc_data) {
ret = imx_usbmisc_init(data->usbmisc_data); ret = imx_usbmisc_init(data->usbmisc_data);
if (ret) { if (ret) {
dev_err(&pdev->dev, "usbmisc init failed, ret=%d\n", dev_err(&pdev->dev, "usbmisc init failed, ret=%d\n", ret);
ret);
goto err_clk; goto err_clk;
} }
}
data->ci_pdev = ci_hdrc_add_device(&pdev->dev, data->ci_pdev = ci_hdrc_add_device(&pdev->dev,
pdev->resource, pdev->num_resources, pdev->resource, pdev->num_resources,
...@@ -169,14 +166,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) ...@@ -169,14 +166,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
goto err_clk; goto err_clk;
} }
if (data->usbmisc_data) {
ret = imx_usbmisc_init_post(data->usbmisc_data); ret = imx_usbmisc_init_post(data->usbmisc_data);
if (ret) { if (ret) {
dev_err(&pdev->dev, "usbmisc post failed, ret=%d\n", dev_err(&pdev->dev, "usbmisc post failed, ret=%d\n", ret);
ret);
goto disable_device; goto disable_device;
} }
}
platform_set_drvdata(pdev, data); platform_set_drvdata(pdev, data);
......
...@@ -265,8 +265,12 @@ static const struct usbmisc_ops vf610_usbmisc_ops = { ...@@ -265,8 +265,12 @@ static const struct usbmisc_ops vf610_usbmisc_ops = {
int imx_usbmisc_init(struct imx_usbmisc_data *data) int imx_usbmisc_init(struct imx_usbmisc_data *data)
{ {
struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); struct imx_usbmisc *usbmisc;
if (!data)
return 0;
usbmisc = dev_get_drvdata(data->dev);
if (!usbmisc->ops->init) if (!usbmisc->ops->init)
return 0; return 0;
return usbmisc->ops->init(data); return usbmisc->ops->init(data);
...@@ -275,8 +279,12 @@ EXPORT_SYMBOL_GPL(imx_usbmisc_init); ...@@ -275,8 +279,12 @@ EXPORT_SYMBOL_GPL(imx_usbmisc_init);
int imx_usbmisc_init_post(struct imx_usbmisc_data *data) int imx_usbmisc_init_post(struct imx_usbmisc_data *data)
{ {
struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); struct imx_usbmisc *usbmisc;
if (!data)
return 0;
usbmisc = dev_get_drvdata(data->dev);
if (!usbmisc->ops->post) if (!usbmisc->ops->post)
return 0; return 0;
return usbmisc->ops->post(data); return usbmisc->ops->post(data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment