Re: [RFC PATCH 1/4] i2c: allow drivers to announce that they are IRQ safe

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

 



Hi Wolfram,

sorry for my late reply. I was on vacation.

On Mon, Sep 03, 2018 at 07:21:48PM +0200, Wolfram Sang wrote:
> 
> > Then I vote for extending the 'struct i2c_algorithm' with an extra
> > callback 'master_xfer_irqless'. The idea was already proposed here.
> 
> Yes, I proposed the idea a few times and now I cooked up an RFC.
> Only build tested and merely a starter for discussion.
> 
> Let me know what you think, people.
> 
> ===
> 
> From: Wolfram Sang <wsa@xxxxxxxxxxxxx>
> Subject: [RFC PATCH] i2c: introduce master_xfer_irqless callback
> 
> We had the request to access devices very late when interrupts are not
> available anymore multiple times now. Mostly to prepare shutdown or
> reboot. Allow adapters to specify a specific callback for this case.
> Note that we fall back to the generic master_xfer callback if this new
> irqless one is not present. This is intentional to preserve the previous
> behaviour and avoid regressions. Because there are drivers not using
> interrupts or because it might have worked "accidently" before.
> 
> Signed-off-by: Wolfram Sang <wsa@xxxxxxxxxxxxx>
> ---
>  drivers/i2c/i2c-core-base.c |  6 +++++-
>  include/linux/i2c.h         | 10 +++++++---
>  2 files changed, 12 insertions(+), 4 deletions(-)

I'm fine with this RFC patch (modulo the missing 'master_xfer_irqless !=
NULL' check already pointed out). It solves my usecase for I2C
poweroff/reboot handlers.

> This is intentional to preserve the previous
> behaviour and avoid regressions. Because there are drivers not using
> interrupts or because it might have worked "accidently" before.

I'm now also on your side for this behaviour and not failing with
"-EOPNOTSUPP". Explicitly breaking existing code, even if it only worked
by chance, is bad, since it will only fail at runtime on a user machine
or device.

Kind regards,
Stefan Lengfeld



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux