Re: [PATCH v2] mfd: ADP5520 Multifunction LCD Backlight and Keypad Input Device Driver

Andrew Morton
2009-09-29T21:21:59Z

On Wed, 23 Sep 2009 01:11:04 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> +static void adp5520_irq_work(struct work_struct *work)
> +{
> + struct adp5520_chip *chip =
> + container_of(work, struct adp5520_chip, irq_work);
> + unsigned int events;
> + uint8_t reg_val;
> + int ret;
> +
> + ret = __adp5520_read(chip->client, MODE_STATUS, &reg_val);
> + if (ret)
> + goto out;
> +
> + events = reg_val & (OVP_INT | CMPR_INT | GPI_INT | KR_INT | KP_INT);
> +
> + blocking_notifier_call_chain(&chip->notifier_list, events, NULL);
> + /* ACK, Sticky bits are W1C */
> + __adp5520_ack_bits(chip->client, MODE_STATUS, events);
> +
> +out:
> + enable_irq(chip->client->irq);
> +}
> +
> +static irqreturn_t adp5520_irq_handler(int irq, void *data)
> +{
> + struct adp5520_chip *chip = data;
> +
> + disable_irq_nosync(irq);
> + schedule_work(&chip->irq_work);
> +
> + return IRQ_HANDLED;
> +}

Disabling interrutps for an arbitrarily long period of time is pretty
nasty. Especially if some poor innocent device is trying to share that
irq (can this happen?).

Is there no other way?