Skip to content

Commit

Permalink
usb: phy: omap-control-usb: Convert to devm_ioremap_resource()
Browse files Browse the repository at this point in the history
Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages; so all explicit
error messages can be removed from the failure code paths.

Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Sachin Kamat authored and Felipe Balbi committed Mar 4, 2013
1 parent 862421d commit 57ae575
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions drivers/usb/phy/omap-control-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,32 +219,26 @@ static int omap_control_usb_probe(struct platform_device *pdev)

res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"control_dev_conf");
control_usb->dev_conf = devm_request_and_ioremap(&pdev->dev, res);
if (!control_usb->dev_conf) {
dev_err(&pdev->dev, "Failed to obtain io memory\n");
return -EADDRNOTAVAIL;
}
control_usb->dev_conf = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(control_usb->dev_conf))
return PTR_ERR(control_usb->dev_conf);

if (control_usb->type == OMAP_CTRL_DEV_TYPE1) {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"otghs_control");
control_usb->otghs_control = devm_request_and_ioremap(
control_usb->otghs_control = devm_ioremap_resource(
&pdev->dev, res);
if (!control_usb->otghs_control) {
dev_err(&pdev->dev, "Failed to obtain io memory\n");
return -EADDRNOTAVAIL;
}
if (IS_ERR(control_usb->otghs_control))
return PTR_ERR(control_usb->otghs_control);
}

if (control_usb->type == OMAP_CTRL_DEV_TYPE2) {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"phy_power_usb");
control_usb->phy_power = devm_request_and_ioremap(
control_usb->phy_power = devm_ioremap_resource(
&pdev->dev, res);
if (!control_usb->phy_power) {
dev_dbg(&pdev->dev, "Failed to obtain io memory\n");
return -EADDRNOTAVAIL;
}
if (IS_ERR(control_usb->phy_power))
return PTR_ERR(control_usb->phy_power);

control_usb->sys_clk = devm_clk_get(control_usb->dev,
"sys_clkin");
Expand Down

0 comments on commit 57ae575

Please sign in to comment.