All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Othacehe <m.othacehe@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	linux-iio <linux-iio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 4/4] iio: vcnl4000: Add buffer support for VCNL4010/20.
Date: Wed, 22 Apr 2020 10:14:21 +0200	[thread overview]
Message-ID: <87tv1cos2q.fsf@gmail.com> (raw)
In-Reply-To: <CAHp75VfXBgQad1oCBe+oqcC_oRa-3q8OBYcAOV8WfCo7n1wXWw@mail.gmail.com> (Andy Shevchenko's message of "Tue, 21 Apr 2020 15:27:14 +0300")


>> +static int vcnl4010_buffer_predisable(struct iio_dev *indio_dev)
>> +{
>> +       struct vcnl4000_data *data = iio_priv(indio_dev);
>> +       int ret, ret_disable;
>> +
>> +       ret = i2c_smbus_write_byte_data(data->client, VCNL4010_INT_CTRL, 0);
>> +       if (ret < 0)
>> +               goto end;
>> +
>> +       ret = i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND, 0);
>> +
>> +end:
>
>> +       ret_disable = iio_triggered_buffer_predisable(indio_dev);
>> +       if (ret == 0)
>> +               ret = ret_disable;
>
> What is this?
>
> Can't you rather call IIO API first, and then try to handle the rest?

Well, iio_triggered_buffer_predisable will call free_irq which requires
that the interruption source is disabled, hence this strange pattern.

However, this may be some misunderstanding from me, but I noticed
something strange here. In a configuration with one CPU and
CONFIG_PREEMPT disabled, I have kernel lockups when disabling the
buffer.

This is because free_irq calls synchronize_irq that will wait for any
IRQ handler to be over. If the kthread handling the interruption is
still running, it has no chances to terminate, and synchronize_irq waits
forever. So maybe I'm missing something.

Anyway, I'll send a v5 addressing your remarks.

Thanks,

Mathieu

  reply	other threads:[~2020-04-22  8:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21  7:55 [PATCH v4 0/4] iio: vcnl: Add interrupts support for VCNL4010/20 Mathieu Othacehe
2020-04-21  7:55 ` [PATCH v4 1/4] iio: vcnl4000: Factorize data reading and writing Mathieu Othacehe
2020-04-21  7:55 ` [PATCH v4 2/4] iio: vcnl4000: Add event support for VCNL4010/20 Mathieu Othacehe
2020-04-21 11:24   ` Andy Shevchenko
2020-04-22  8:02     ` Mathieu Othacehe
2020-04-22  8:25       ` Andy Shevchenko
2020-04-25 19:47   ` Jonathan Cameron
2020-04-21  7:55 ` [PATCH v4 3/4] iio: vcnl4000: Add sampling frequency " Mathieu Othacehe
2020-04-21 12:22   ` Andy Shevchenko
2020-04-25 15:52     ` Jonathan Cameron
2020-04-25 17:14       ` Andy Shevchenko
2020-04-25 19:49   ` Jonathan Cameron
2020-04-21  7:55 ` [PATCH v4 4/4] iio: vcnl4000: Add buffer " Mathieu Othacehe
2020-04-21 12:27   ` Andy Shevchenko
2020-04-22  8:14     ` Mathieu Othacehe [this message]
2020-04-25 16:09       ` Jonathan Cameron
2020-04-25 15:57     ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tv1cos2q.fsf@gmail.com \
    --to=m.othacehe@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.