[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <272065fe-950a-24e9-ba8f-8b1a782c203f@gmail.com>
Date: Mon, 7 Sep 2020 17:31:37 +0300
From: Dmitry Osipenko <digetx@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Laxman Dewangan <ldewangan@...dia.com>,
Wolfram Sang <wsa@...-dreams.de>,
Michał Mirosław <mirq-linux@...e.qmqm.pl>,
linux-i2c <linux-i2c@...r.kernel.org>,
linux-tegra@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 01/36] i2c: tegra: Make tegra_i2c_flush_fifos() usable
in atomic transfer
07.09.2020 10:56, Andy Shevchenko пишет:
> On Sun, Sep 6, 2020 at 9:51 PM Dmitry Osipenko <digetx@...il.com> wrote:
>>
>> The tegra_i2c_flush_fifos() shouldn't sleep in atomic transfer and jiffies
>> are not updating if interrupts are disabled. Let's switch to use iopoll
>> API helpers for register-polling. The iopoll API provides helpers for both
>> atomic and non-atomic cases.
>>
>> Note that this patch doesn't fix any known problem because normally FIFO
>> is flushed at the time of starting a new transfer.
>
> ...
>
>> + if (i2c_dev->is_curr_atomic_xfer)
>> + err = readl_relaxed_poll_timeout_atomic(addr, val, !(val & mask),
>> + 1000, 1000000);
>> + else
>> + err = readl_relaxed_poll_timeout(addr, val, !(val & mask),
>> + 1000, 1000000);
>> +
>> + if (err) {
>> + dev_err(i2c_dev->dev, "failed to flush FIFO\n");
>
>> + return err;
>> }
>> return 0;
>
> return err; ?
>
The return 0 is intentional here because returned "err" implies that
error happened and error code is returned, while 0 explicitly shows the
success status. Hence it's always cleaner and more expressive to
directly return 0 on success, IMO. I'd prefer to keep this part as-is.
Powered by blists - more mailing lists