Re: hwmon: (nct6775) Regression Bisected

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

 



On 9/16/23 12:30, Doug Smythies wrote:
On 2023.09.16 11:11 Guenter wrote:
On 9/16/23 10:45, Ahmad Khalifa wrote:
On 16/09/2023 18:04, Guenter Roeck wrote:

The proper fix should really be in nct6775_in_is_visible(),
which should drop the attribute if there is no alarm bit for it,
similar to, for example, nct6775_fan_is_visible().
Something like

      int nr = index % 5;     /* attribute index */

      if (nr == 1 && data->ALARM_BITS[in] == -1)
                  return 0;

Perfect, that's what I looked for but couldn't figure it out in
a rush. If it's confirmed, I'll convert the fix so it hides the
attribute instead.


I'd suggest to just send a patch. We can always update it with v2
if a revision is needed.

Hi,

And thanks for your quick attention on this.

If I understand all the emails correctly, the above supersedes
the previous patch suggestion.

I tested it with kernel 6.6-rc1, and it fixes the issue.


Excellent, thanks a lot for testing!

Guenter

doug@s19:~/kernel/linux$ git diff
diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c
index 02a71244fc3b..ead5d83f1594 100644
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -1753,6 +1753,9 @@ nct6775_show_alarm(struct device *dev, struct device_attribute *attr, char *buf)
                 return PTR_ERR(data);

         nr = data->ALARM_BITS[sattr->index];
+
+       pr_info("doug: nr: %d  ; index %d\n", nr, sattr->index);
+
         return sprintf(buf, "%u\n",
                        (unsigned int)((data->alarms >> nr) & 0x01));
  }
@@ -1910,6 +1913,10 @@ static umode_t nct6775_in_is_visible(struct kobject *kobj,
         struct device *dev = kobj_to_dev(kobj);
         struct nct6775_data *data = dev_get_drvdata(dev);
         int in = index / 5;     /* voltage index */
+       int nr = index % 5;     /* attribute index */
+
+       if (nr == 1 && data->ALARM_BITS[in] == -1)
+               return 0;

         if (!(data->have_in & BIT(in)))
                 return 0;

You can see I left my pr_info statement in, and got:

Sep 16 12:16:17 s19 kernel: [    3.091829] nct6775: Found NCT6798D or compatible chip at 0x2e:0x290
...
Sep 16 12:16:17 s19 kernel: [    3.744414] nct6775_core: doug: nr: 0  ; index 0
Sep 16 12:16:17 s19 kernel: [    3.744442] nct6775_core: doug: nr: 1  ; index 1
Sep 16 12:16:17 s19 kernel: [    3.744466] nct6775_core: doug: nr: 2  ; index 2
Sep 16 12:16:17 s19 kernel: [    3.744490] nct6775_core: doug: nr: 3  ; index 3
Sep 16 12:16:17 s19 kernel: [    3.744514] nct6775_core: doug: nr: 8  ; index 4
Sep 16 12:16:17 s19 kernel: [    3.744555] nct6775_core: doug: nr: 20  ; index 6
Sep 16 12:16:17 s19 kernel: [    3.744578] nct6775_core: doug: nr: 16  ; index 7
Sep 16 12:16:17 s19 kernel: [    3.744601] nct6775_core: doug: nr: 17  ; index 8
Sep 16 12:16:17 s19 kernel: [    3.744625] nct6775_core: doug: nr: 24  ; index 9
Sep 16 12:16:17 s19 kernel: [    3.744649] nct6775_core: doug: nr: 25  ; index 10
Sep 16 12:16:17 s19 kernel: [    3.744672] nct6775_core: doug: nr: 26  ; index 11
Sep 16 12:16:17 s19 kernel: [    3.744695] nct6775_core: doug: nr: 27  ; index 12
Sep 16 12:16:17 s19 kernel: [    3.744718] nct6775_core: doug: nr: 28  ; index 13
Sep 16 12:16:17 s19 kernel: [    3.744741] nct6775_core: doug: nr: 29  ; index 14
Sep 16 12:16:17 s19 kernel: [    3.744769] nct6775_core: doug: nr: 6  ; index 24
Sep 16 12:16:17 s19 kernel: [    3.744787] nct6775_core: doug: nr: 7  ; index 25
Sep 16 12:16:17 s19 kernel: [    3.744805] nct6775_core: doug: nr: 11  ; index 26
Sep 16 12:16:17 s19 kernel: [    3.744822] nct6775_core: doug: nr: 10  ; index 27
Sep 16 12:16:17 s19 kernel: [    3.744846] nct6775_core: doug: nr: 23  ; index 28
Sep 16 12:16:17 s19 kernel: [    3.744866] nct6775_core: doug: nr: 33  ; index 29
Sep 16 12:16:17 s19 kernel: [    3.752903] nct6775_core: doug: nr: 12  ; index 48
Sep 16 12:16:17 s19 kernel: [    3.752913] nct6775_core: doug: nr: 9  ; index 49
...

... Doug






[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