20 #include <linux/bitops.h>
21 #include <linux/module.h>
25 #include <linux/slab.h>
31 #define DRIVER_NAME "uio_pdrv_genirq"
45 pm_runtime_get_sync(&priv->
pdev->dev);
54 pm_runtime_put_sync(&priv->
pdev->dev);
72 static int uio_pdrv_genirq_irqcontrol(
struct uio_info *dev_info,
s32 irq_on)
92 spin_unlock_irqrestore(&priv->
lock, flags);
109 uioinfo = kzalloc(
sizeof(*uioinfo),
GFP_KERNEL);
115 uioinfo->
name = pdev->
dev.of_node->name;
116 uioinfo->
version =
"devicetree";
126 if (!uioinfo || !uioinfo->
name || !uioinfo->
version) {
127 dev_err(&pdev->
dev,
"missing platform_data\n");
133 dev_err(&pdev->
dev,
"interrupt configuration error\n");
157 uiomem = &uioinfo->
mem[0];
168 " I/O memory resources.\n");
174 uiomem->
size = resource_size(r);
192 uioinfo->
handler = uio_pdrv_genirq_handler;
193 uioinfo->
irqcontrol = uio_pdrv_genirq_irqcontrol;
194 uioinfo->
open = uio_pdrv_genirq_open;
195 uioinfo->
release = uio_pdrv_genirq_release;
207 dev_err(&pdev->
dev,
"unable to register uio device\n");
211 platform_set_drvdata(pdev, priv);
215 pm_runtime_disable(&pdev->
dev);
218 if (pdev->
dev.of_node)
229 pm_runtime_disable(&pdev->
dev);
235 if (pdev->
dev.of_node)
242 static int uio_pdrv_genirq_runtime_nop(
struct device *
dev)
259 static const struct dev_pm_ops uio_pdrv_genirq_dev_pm_ops = {
260 .runtime_suspend = uio_pdrv_genirq_runtime_nop,
261 .runtime_resume = uio_pdrv_genirq_runtime_nop,
270 # define uio_of_genirq_match NULL
274 .probe = uio_pdrv_genirq_probe,
275 .remove = uio_pdrv_genirq_remove,
279 .pm = &uio_pdrv_genirq_dev_pm_ops,