Re: [PATCH v2 3/4] hwmon (it87): Test for chipset before entering configuration mode

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

 



On 4/27/24 21:31, Frank Crawford wrote:

On Sat, 2024-04-27 at 10:00 -0700, Guenter Roeck wrote:
On 4/27/24 04:53, Frank Crawford wrote:
On Sat, 2024-04-27 at 04:11 -0700, Guenter Roeck wrote:
On 4/27/24 01:33, Frank Crawford wrote:
...
@@ -3144,7 +3186,7 @@ static int __init it87_find(int sioaddr,
unsigned short *address,
     }
   exit:
- superio_exit(sioaddr, config ? has_noconf(config) : false);
+ superio_exit(sioaddr, opened && config &&
has_noconf(config));

If 'opened' is false, this could be an affected chip. Are you
sure
that it makes sense to pass 'false' as parameter here in that
case ?
Doesn't that mean that the chip might be one of the affected
chips,
but the superio exit sequence would be executed anyway ?
Am I missing something ?

Ohh, you may be right, I think I have got myself confused here with
opened and how it is used in superio_exit.


It took me a while to understand as well. The double negation of the
'noentry' parameter makes it difficult to understand.

I think it should be !opened, but I will just check I still haven't
messed it up.


Maybe it should be something like
  !config && !opened || /* no or unknown chip, not enabled */
  config && has_noconf(config) /* chip known to be affected */

which would translate "don't disable configuration mode for affected
chips
and for unknown chips if configuration mode was not enabled".

In fact, I think in this case that entire expression can be simplified
to just "!opened", as we only want to perform the exit code when the
entry code was given, and it is only set to true in those cases.


Not really, because it is at least theoretically possible that it was
necessary to enter configuration mode to determine that the chip
is one of the broken ones. I'll leave that up to you to make the call,
though.

Guenter





[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux