@@ -36,15 +36,9 @@ static void qube_front_led_set(struct led_classdev *led_cdev,
static int cobalt_qube_led_probe(struct platform_device *pdev)
{
- struct resource *res;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -EBUSY;
-
- led_port = devm_ioremap(&pdev->dev, res->start, resource_size(res));
- if (!led_port)
- return -ENOMEM;
+ led_port = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(led_port))
+ return PTR_ERR(led_port);
led_value = LED_FRONT_LEFT | LED_FRONT_RIGHT;
writeb(led_value, led_port);
@@ -65,16 +65,11 @@ static void raq_power_off_led_set(struct led_classdev *led_cdev,
static int cobalt_raq_led_probe(struct platform_device *pdev)
{
- struct resource *res;
int retval;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -EBUSY;
-
- led_port = devm_ioremap(&pdev->dev, res->start, resource_size(res));
- if (!led_port)
- return -ENOMEM;
+ led_port = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(led_port))
+ return PTR_ERR(led_port);
retval = led_classdev_register(&pdev->dev, &raq_power_off_led);
if (retval)
@@ -90,6 +85,7 @@ static int cobalt_raq_led_probe(struct platform_device *pdev)
led_classdev_unregister(&raq_power_off_led);
err_null:
+ devm_ioremap_release(&pdev->dev, led_port);
led_port = NULL;
return retval;