[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c58ca576-2763-4f73-bc0e-c33677c5228b@roeck-us.net>
Date: Mon, 29 Jul 2024 11:44:26 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>,
Wolfram Sang <wsa@...nel.org>, Jean Delvare <khali@...ux-fr.org>,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] i2c: smbus: Send alert notifications to all devices
if source not found
On 7/29/24 11:36, Wolfram Sang wrote:
>
>> I looked into the code again. The sequence is (or is supposed to be):
>>
>> 1st loop:
>> if (!alert_pending)
>> break;
>> smbus_do_alert()
>> if (failed at same address)
>> smbus_do_alert_force()
>>
>> 2nd loop:
>> if (!alert_pending)
>> break;
>> smbus_do_alert()
>> if (failed at same address)
>> break;
>>
>> I think what you are suggesting is
> ...
>
> What I am suggesting is more like this:
>
> 1st loop:
>
> smbus_do_alert()
> //impossible to have same address on first run, so go to 2nd loop
>
> 2nd loop:
>
> smbus_do_alert()
> if (failed at same address)
> smbus_do_alert_force()
> break;
>
> As I understand it, your sequence is missing "my" 1st loop with the
> invalid address, so you will end up having 3 loops altogether?
>
> The code I am suggesting is bascially yours without the retries
> variable:
>
> status = device_for_each_child(&ara->adapter->dev, &data,
> smbus_do_alert);
> if (data.addr == prev_addr && status != -EBUSY) {
> device_for_each_child(&ara->adapter->dev, &data,
> smbus_do_alert_force);
> break;
> }
> prev_addr = data.addr;
>
> Makes sense or am I missing something?
>
Yes, that should work and is indeed simpler. You are correct, the
additional loop should not be necessary since smbus_do_alert_force()
should already call all connected drivers and hopefully clear
the alert condition on those.
Thanks,
Guenter
Powered by blists - more mailing lists