Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: limzhineng2@gmail.com
Cc: alexanderduyck@fb.com, kuba@kernel.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	linux@roeck-us.net, horms@kernel.org, mohsin.bashr@gmail.com,
	kernel-team@meta.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	zinclim@meta.com
Subject: Re: [net-next,v2,2/6] eth: fbnic: expose all hwmon attributes unconditionally as read-only
Date: Thu, 03 Sep 2026 03:24:07 +0000	[thread overview]
Message-ID: <178840584782.3394541.7997326009686113604@kernel.org> (raw)
In-Reply-To: <20260831212234.1212971-3-limzhineng2@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider:

Critical: 0 · High: 0 · Medium: 0 · Low: 1

- [Low] fbnic_hwmon_is_visible() is reduced to an unconditional `return
  0444;` that ignores all four of its arguments (drvdata, type, attr,…

--

eth: fbnic: expose all hwmon attributes unconditionally as read-only

This changes fbnic_hwmon_is_visible() so that it returns 0444 for every
sensor type and attribute instead of matching on hwmon_temp_input and
hwmon_in_input.  The stated motivation is to prepare for threshold and
alarm attributes added later in the series.

> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c b/drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c
> index 6c8c66ab86c13..38bb26cb8e6cb 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_hwmon.c
> @@ -20,12 +20,7 @@ static umode_t fbnic_hwmon_is_visible(const void *drvdata,
>  				      enum hwmon_sensor_types type,
>  				      u32 attr, int channel)
>  {
> -	if (type == hwmon_temp && attr == hwmon_temp_input)
> -		return 0444;
> -	if (type == hwmon_in && attr == hwmon_in_input)
> -		return 0444;
> -
> -	return 0;
> +	return 0444;
>  }

[Severity: Low]
This isn't a bug, but now that fbnic_hwmon_is_visible() ignores all four
of its parameters (drvdata, type, attr and channel) and returns a constant,
could the static visibility field in struct hwmon_ops be used instead?

include/linux/hwmon.h documents it that way:

  /**
   * struct hwmon_ops - hwmon device operations
   * @visible:	Static visibility. If non-zero, 'is_visible' is ignored.
   * @is_visible: Callback to return attribute visibility. Mandatory unless
   *		'visible' is non-zero.

and hwmon_device_register_with_info() accepts either form, so
fbnic_hwmon_ops could become:

  static const struct hwmon_ops fbnic_hwmon_ops = {
	.visible = 0444,
	.read = fbnic_hwmon_read,
  };

with fbnic_hwmon_is_visible() deleted entirely.  Other drivers such as
drivers/net/phy/realtek/realtek_hwmon.c already use the .visible form.

This shape persists through the end of the series (fbnic_hwmon_is_visible()
is still a plain "return 0444;" installed via .is_visible at the last
patch), so a later patch does not convert it.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260831212234.1212971-1-limzhineng2%40gmail.com

  reply	other threads:[~2026-09-03  3:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 21:22 [PATCH net-next v2 0/6] eth: fbnic: expand hwmon sensor support Zinc Lim
2026-08-31 21:22 ` [PATCH net-next v2 1/6] eth: fbnic: move sensor read logic out of fbnic_mac Zinc Lim
2026-08-31 21:22 ` [PATCH net-next v2 2/6] eth: fbnic: expose all hwmon attributes unconditionally as read-only Zinc Lim
2026-09-03  3:24   ` netdev-bot+sashiko [this message]
2026-08-31 21:22 ` [PATCH net-next v2 3/6] eth: fbnic: cache hwmon sensor readings Zinc Lim
2026-09-03  3:24   ` [net-next,v2,3/6] " netdev-bot+sashiko
2026-08-31 21:22 ` [PATCH net-next v2 4/6] eth: fbnic: report temperature and voltage thresholds via hwmon Zinc Lim
2026-09-03  3:24   ` [net-next,v2,4/6] " netdev-bot+sashiko
2026-08-31 21:22 ` [PATCH net-next v2 5/6] eth: fbnic: report temperature and voltage alarms " Zinc Lim
2026-09-03  3:24   ` [net-next,v2,5/6] " netdev-bot+sashiko
2026-08-31 21:22 ` [PATCH net-next v2 6/6] eth: fbnic: firmware notifies hwmon on sensor threshold events Zinc Lim
2026-09-03  3:24   ` [net-next,v2,6/6] " netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178840584782.3394541.7997326009686113604@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=alexanderduyck@fb.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=limzhineng2@gmail.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mohsin.bashr@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=zinclim@meta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox