aboutsummaryrefslogtreecommitdiff
path: root/drivers/uio
diff options
context:
space:
mode:
authorAlexandru Ardelean2020-11-20 09:56:25 +0200
committerGreg Kroah-Hartman2020-12-09 19:58:22 +0100
commitba022851f3b161040e79cc61c2bd760917490016 (patch)
treec98c5529e35dcbd63fa2d386cce9eaea62269b85 /drivers/uio
parent44dccc4a2bd10abfacd25b7d125fb5c3abbb263d (diff)
uio: uio_dmem_genirq: finalize conversion of probe to devm_ handlers
This moves move pm_runtime_disable on a devm_add_action_or_reset() handler. And with the use of the devm_uio_register_device() function, the remove hook is no longer required. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20201120075625.12272-2-alexandru.ardelean@analog.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/uio')
-rw-r--r--drivers/uio/uio_dmem_genirq.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
index 72aa372d6ba6..6b5cfa5b0673 100644
--- a/drivers/uio/uio_dmem_genirq.c
+++ b/drivers/uio/uio_dmem_genirq.c
@@ -143,6 +143,13 @@ static int uio_dmem_genirq_irqcontrol(struct uio_info *dev_info, s32 irq_on)
return 0;
}
+static void uio_dmem_genirq_pm_disable(void *data)
+{
+ struct device *dev = data;
+
+ pm_runtime_disable(dev);
+}
+
static int uio_dmem_genirq_probe(struct platform_device *pdev)
{
struct uio_dmem_genirq_pdata *pdata = dev_get_platdata(&pdev->dev);
@@ -280,25 +287,11 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
*/
pm_runtime_enable(&pdev->dev);
- ret = uio_register_device(&pdev->dev, priv->uioinfo);
- if (ret) {
- dev_err(&pdev->dev, "unable to register uio device\n");
- pm_runtime_disable(&pdev->dev);
+ ret = devm_add_action_or_reset(&pdev->dev, uio_dmem_genirq_pm_disable, &pdev->dev);
+ if (ret)
return ret;
- }
-
- platform_set_drvdata(pdev, priv);
- return 0;
-}
-
-static int uio_dmem_genirq_remove(struct platform_device *pdev)
-{
- struct uio_dmem_genirq_platdata *priv = platform_get_drvdata(pdev);
-
- uio_unregister_device(priv->uioinfo);
- pm_runtime_disable(&pdev->dev);
- return 0;
+ return devm_uio_register_device(&pdev->dev, priv->uioinfo);
}
static int uio_dmem_genirq_runtime_nop(struct device *dev)
@@ -332,7 +325,6 @@ MODULE_DEVICE_TABLE(of, uio_of_genirq_match);
static struct platform_driver uio_dmem_genirq = {
.probe = uio_dmem_genirq_probe,
- .remove = uio_dmem_genirq_remove,
.driver = {
.name = DRIVER_NAME,
.pm = &uio_dmem_genirq_dev_pm_ops,