Skip to content

Commit

Permalink
usb: chipidea: usbmisc_imx: Use of_device_get_match_data()
Browse files Browse the repository at this point in the history
The retrieval of driver data via of_device_get_match_data() can make
the code simpler.

Use of_device_get_match_data() to simplify the code.

Signed-off-by: Fabio Estevam <[email protected]>
Signed-off-by: Peter Chen <[email protected]>
  • Loading branch information
fabioestevam authored and Peter Chen committed Dec 10, 2020
1 parent 448373d commit 58bcafe
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/usb/chipidea/usbmisc_imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,11 +1134,6 @@ MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids);
static int usbmisc_imx_probe(struct platform_device *pdev)
{
struct imx_usbmisc *data;
const struct of_device_id *of_id;

of_id = of_match_device(usbmisc_imx_dt_ids, &pdev->dev);
if (!of_id)
return -ENODEV;

data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data)
Expand All @@ -1150,7 +1145,7 @@ static int usbmisc_imx_probe(struct platform_device *pdev)
if (IS_ERR(data->base))
return PTR_ERR(data->base);

data->ops = (const struct usbmisc_ops *)of_id->data;
data->ops = of_device_get_match_data(&pdev->dev);
platform_set_drvdata(pdev, data);

return 0;
Expand Down

0 comments on commit 58bcafe

Please sign in to comment.