Re: [PATCH v4 4/4] iio: vcnl4000: Add buffer support for VCNL4010/20.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> +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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux