diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 02:06:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 02:06:24 -0400 |
commit | f0deb97ab13ad1f89cd0993f7339655d59788405 (patch) | |
tree | 41572e643cb4983115707ae330b5896ae76e1ea1 /drivers/uio | |
parent | 184475029a724b6b900d88fc3a5f462a6107d5af (diff) | |
parent | 21d541aa19e90752232bf6c43002f019f204f988 (diff) |
Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6:
updated Documentation/ja_JP/SubmittingPatches
debugfs: add documentation for debugfs_create_x64
uio: uio_pdrv_genirq: Add OF support
firmware: gsmi: remove sysfs entries when unload the module
Documentation/zh_CN: Fix messy code file email-clients.txt
driver core: add more help description for "path to uevent helper"
driver-core: modify FIRMWARE_IN_KERNEL help message
driver-core: Kconfig grammar corrections in firmware configuration
DOCUMENTATION: Replace create_device() with device_create().
DOCUMENTATION: Update overview.txt in Doc/driver-model.
pti: pti_tty_install documentation mispelling.
Diffstat (limited to 'drivers/uio')
-rw-r--r-- | drivers/uio/uio_pdrv_genirq.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c index 31e799d9efe5..bae96d246760 100644 --- a/drivers/uio/uio_pdrv_genirq.c +++ b/drivers/uio/uio_pdrv_genirq.c | |||
@@ -23,6 +23,10 @@ | |||
23 | #include <linux/pm_runtime.h> | 23 | #include <linux/pm_runtime.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | 25 | ||
26 | #include <linux/of.h> | ||
27 | #include <linux/of_platform.h> | ||
28 | #include <linux/of_address.h> | ||
29 | |||
26 | #define DRIVER_NAME "uio_pdrv_genirq" | 30 | #define DRIVER_NAME "uio_pdrv_genirq" |
27 | 31 | ||
28 | struct uio_pdrv_genirq_platdata { | 32 | struct uio_pdrv_genirq_platdata { |
@@ -97,6 +101,27 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) | |||
97 | int ret = -EINVAL; | 101 | int ret = -EINVAL; |
98 | int i; | 102 | int i; |
99 | 103 | ||
104 | if (!uioinfo) { | ||
105 | int irq; | ||
106 | |||
107 | /* alloc uioinfo for one device */ | ||
108 | uioinfo = kzalloc(sizeof(*uioinfo), GFP_KERNEL); | ||
109 | if (!uioinfo) { | ||
110 | ret = -ENOMEM; | ||
111 | dev_err(&pdev->dev, "unable to kmalloc\n"); | ||
112 | goto bad2; | ||
113 | } | ||
114 | uioinfo->name = pdev->dev.of_node->name; | ||
115 | uioinfo->version = "devicetree"; | ||
116 | |||
117 | /* Multiple IRQs are not supported */ | ||
118 | irq = platform_get_irq(pdev, 0); | ||
119 | if (irq == -ENXIO) | ||
120 | uioinfo->irq = UIO_IRQ_NONE; | ||
121 | else | ||
122 | uioinfo->irq = irq; | ||
123 | } | ||
124 | |||
100 | if (!uioinfo || !uioinfo->name || !uioinfo->version) { | 125 | if (!uioinfo || !uioinfo->name || !uioinfo->version) { |
101 | dev_err(&pdev->dev, "missing platform_data\n"); | 126 | dev_err(&pdev->dev, "missing platform_data\n"); |
102 | goto bad0; | 127 | goto bad0; |
@@ -180,6 +205,10 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) | |||
180 | kfree(priv); | 205 | kfree(priv); |
181 | pm_runtime_disable(&pdev->dev); | 206 | pm_runtime_disable(&pdev->dev); |
182 | bad0: | 207 | bad0: |
208 | /* kfree uioinfo for OF */ | ||
209 | if (pdev->dev.of_node) | ||
210 | kfree(uioinfo); | ||
211 | bad2: | ||
183 | return ret; | 212 | return ret; |
184 | } | 213 | } |
185 | 214 | ||
@@ -193,6 +222,10 @@ static int uio_pdrv_genirq_remove(struct platform_device *pdev) | |||
193 | priv->uioinfo->handler = NULL; | 222 | priv->uioinfo->handler = NULL; |
194 | priv->uioinfo->irqcontrol = NULL; | 223 | priv->uioinfo->irqcontrol = NULL; |
195 | 224 | ||
225 | /* kfree uioinfo for OF */ | ||
226 | if (pdev->dev.of_node) | ||
227 | kfree(priv->uioinfo); | ||
228 | |||
196 | kfree(priv); | 229 | kfree(priv); |
197 | return 0; | 230 | return 0; |
198 | } | 231 | } |
@@ -219,6 +252,15 @@ static const struct dev_pm_ops uio_pdrv_genirq_dev_pm_ops = { | |||
219 | .runtime_resume = uio_pdrv_genirq_runtime_nop, | 252 | .runtime_resume = uio_pdrv_genirq_runtime_nop, |
220 | }; | 253 | }; |
221 | 254 | ||
255 | #ifdef CONFIG_OF | ||
256 | static const struct of_device_id __devinitconst uio_of_genirq_match[] = { | ||
257 | { /* empty for now */ }, | ||
258 | }; | ||
259 | MODULE_DEVICE_TABLE(of, uio_of_genirq_match); | ||
260 | #else | ||
261 | # define uio_of_genirq_match NULL | ||
262 | #endif | ||
263 | |||
222 | static struct platform_driver uio_pdrv_genirq = { | 264 | static struct platform_driver uio_pdrv_genirq = { |
223 | .probe = uio_pdrv_genirq_probe, | 265 | .probe = uio_pdrv_genirq_probe, |
224 | .remove = uio_pdrv_genirq_remove, | 266 | .remove = uio_pdrv_genirq_remove, |
@@ -226,6 +268,7 @@ static struct platform_driver uio_pdrv_genirq = { | |||
226 | .name = DRIVER_NAME, | 268 | .name = DRIVER_NAME, |
227 | .owner = THIS_MODULE, | 269 | .owner = THIS_MODULE, |
228 | .pm = &uio_pdrv_genirq_dev_pm_ops, | 270 | .pm = &uio_pdrv_genirq_dev_pm_ops, |
271 | .of_match_table = uio_of_genirq_match, | ||
229 | }, | 272 | }, |
230 | }; | 273 | }; |
231 | 274 | ||