Re: [PATCH v2 2/5] input: twl6040-vibra: Do not use wrapper for irqrequest
From: Felipe Balbi
Date: Tue Jul 05 2011 - 09:57:59 EST
On Tue, Jul 05, 2011 at 04:49:32PM +0300, Peter Ujfalusi wrote:
> The twl6040_request_irq/free_irq inline functions are going
> to be removed, so replace them with direct calls.
> The irq number is provided by the core driver via resource.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
> ---
> drivers/input/misc/twl6040-vibra.c | 17 ++++++++++++-----
> 1 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c
> index dbf745d..50e09b0 100644
> --- a/drivers/input/misc/twl6040-vibra.c
> +++ b/drivers/input/misc/twl6040-vibra.c
> @@ -47,6 +47,7 @@ struct vibra_info {
> struct workqueue_struct *workqueue;
> struct work_struct play_work;
> struct mutex mutex;
> + int irq;
>
> bool enabled;
> int weak_speed;
> @@ -277,6 +278,13 @@ static int __devinit twl6040_vibra_probe(struct platform_device *pdev)
> goto err_kzalloc;
> }
>
> + info->irq = platform_get_irq(pdev, 0);
> + if (!info->irq) {
this is wrong. platform_get_irq() will return -ENXIO if it can't find
the IRQ you requested:
55 /**
56 * platform_get_irq - get an IRQ for a device
57 * @dev: platform device
58 * @num: IRQ number index
59 */
60 int platform_get_irq(struct platform_device *dev, unsigned int num)
61 {
62 struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
63
64 return r ? r->start : -ENXIO;
65 }
66 EXPORT_SYMBOL_GPL(platform_get_irq);
--
balbi
Attachment:
signature.asc
Description: Digital signature