mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-13 20:33:15 +00:00
gpio: cs5535: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the need of driver callback .remove. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
This commit is contained in:
parent
828e47e453
commit
85bd84f536
@ -320,13 +320,13 @@ static int cs5535_gpio_probe(struct platform_device *pdev)
|
|||||||
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
|
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
dev_err(&pdev->dev, "can't fetch device resource info\n");
|
dev_err(&pdev->dev, "can't fetch device resource info\n");
|
||||||
goto done;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!devm_request_region(&pdev->dev, res->start, resource_size(res),
|
if (!devm_request_region(&pdev->dev, res->start, resource_size(res),
|
||||||
pdev->name)) {
|
pdev->name)) {
|
||||||
dev_err(&pdev->dev, "can't request region\n");
|
dev_err(&pdev->dev, "can't request region\n");
|
||||||
goto done;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up the driver-specific struct */
|
/* set up the driver-specific struct */
|
||||||
@ -348,19 +348,10 @@ static int cs5535_gpio_probe(struct platform_device *pdev)
|
|||||||
mask_orig, mask);
|
mask_orig, mask);
|
||||||
|
|
||||||
/* finally, register with the generic GPIO API */
|
/* finally, register with the generic GPIO API */
|
||||||
err = gpiochip_add_data(&cs5535_gpio_chip.chip, &cs5535_gpio_chip);
|
err = devm_gpiochip_add_data(&pdev->dev, &cs5535_gpio_chip.chip,
|
||||||
|
&cs5535_gpio_chip);
|
||||||
if (err)
|
if (err)
|
||||||
goto done;
|
return err;
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
done:
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cs5535_gpio_remove(struct platform_device *pdev)
|
|
||||||
{
|
|
||||||
gpiochip_remove(&cs5535_gpio_chip.chip);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -370,7 +361,6 @@ static struct platform_driver cs5535_gpio_driver = {
|
|||||||
.name = DRV_NAME,
|
.name = DRV_NAME,
|
||||||
},
|
},
|
||||||
.probe = cs5535_gpio_probe,
|
.probe = cs5535_gpio_probe,
|
||||||
.remove = cs5535_gpio_remove,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module_platform_driver(cs5535_gpio_driver);
|
module_platform_driver(cs5535_gpio_driver);
|
||||||
|
Loading…
Reference in New Issue
Block a user