All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Matt Turner" <mattst88@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 5/7] hwmon: Add driver for Marvel AlphaServer environmental sensors
Date: Sat, 14 Nov 2026 17:57:07 +0000	[thread overview]
Message-ID: <sashiko-outbox-214860@kernel.org> (raw)
In-Reply-To: <20261114-marvel-env-v1-5-890328e4b7e5@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] hwmon: (marvel-env) link failure when
  CONFIG_ALPHA_LEGACY_START_ADDRESS=y
- [Low] hwmon: (marvel-env) redundant driver-private mutex instead of
  hwmon_lock()
--

commit 0d0046c1ab7829344c10cd3a7021d92b64106a5d
Author: Matt Turner <mattst88@gmail.com>

hwmon: Add driver for Marvel AlphaServer environmental sensors

This commit adds a hwmon driver for the temperature, fan, voltage, and
power supply sensors exposed by the SRM console configuration tree on
Marvel (EV7) AlphaServers.

> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 18c682e1a4756..50a1bf966f30b 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -1255,6 +1255,17 @@ config SENSORS_MACSMC_HWMON
>  	  This driver can also be built as a module. If so, the module will
>  	  be called macsmc-hwmon.
>  
> +config SENSORS_MARVEL_ENV
> +	tristate "Marvel (EV7) AlphaServer environmental sensors"
> +	depends on ALPHA_MARVEL || ALPHA_GENERIC

[Severity: High]
Does this fail to link when CONFIG_ALPHA_GENERIC=y and
CONFIG_ALPHA_LEGACY_START_ADDRESS=y (as in alpha defconfig and
allmodconfig)?

marvel_env_refresh() calls marvel_cfgtree_partial_update() in
core_marvel.o, which is omitted on ALPHA_GENERIC builds when
CONFIG_ALPHA_LEGACY_START_ADDRESS is enabled:

arch/alpha/kernel/Makefile:
    ifdef CONFIG_ALPHA_GENERIC
    ...
    ifndef CONFIG_ALPHA_LEGACY_START_ADDRESS
    obj-y	 += core_marvel.o core_titan.o core_wildfire.o
    ...
    endif

Should this depend on ALPHA_MARVEL || (ALPHA_GENERIC &&
!ALPHA_LEGACY_START_ADDRESS)?

[ ... ]

> diff --git a/drivers/hwmon/marvel-env.c b/drivers/hwmon/marvel-env.c
> new file mode 100644
> index 0000000000000..cdc7e059e17bb
> --- /dev/null
> +++ b/drivers/hwmon/marvel-env.c

[ ... ]

> +struct marvel_env_data {
> +	struct device *dev;
> +	struct mutex lock;		/* serializes refreshes and reads */
> +	unsigned int update_interval;	/* ms */
> +	struct marvel_env_node *nodes;
> +	unsigned int nr_nodes;
> +	struct marvel_env_chan *chans[hwmon_max];
> +	unsigned int nr_chans[hwmon_max];
> +};

[ ... ]

> +static int marvel_env_read(struct device *dev, enum hwmon_sensor_types type,
> +			   u32 attr, int channel, long *val)
> +{
> +	struct marvel_env_data *data = dev_get_drvdata(dev);
> +	struct marvel_env_chan *c;
> +	struct marvel_env_node *n;
> +	unsigned int pkt;
> +	u8 status;
> +	int ret;
> +
> +	if (type == hwmon_chip) {
> +		*val = data->update_interval;
> +		return 0;
> +	}
> +
> +	c = &data->chans[type][channel];
> +	n = c->node;
> +	pkt = c->pkt;
> +
> +	mutex_lock(&data->lock);

[Severity: Low]
This isn't a bug, but is the driver-private data->lock mutex needed here
and in marvel_env_write()?

The hwmon core already serializes .read and .write callbacks under its
internal lock, and non-hwmon_ops paths (such as the event workqueue added
later in this series) can use hwmon_lock() and hwmon_unlock() instead of
maintaining a separate mutex.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261114-marvel-env-v1-0-890328e4b7e5@gmail.com?part=5

  reply	other threads:[~2026-11-14 17:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 17:39 [PATCH 0/7] alpha: marvel: environmental sensors Matt Turner
2026-11-14 17:39 ` [PATCH 1/7] alpha: marvel: report environmental events without VERBOSE_MCHECK Matt Turner
2026-11-14 17:43   ` sashiko-bot
2026-11-14 17:39 ` [PATCH 2/7] alpha: marvel: fix the environmental subpacket layout Matt Turner
2026-11-14 17:44   ` sashiko-bot
2026-11-14 17:39 ` [PATCH 3/7] alpha: marvel: refresh environmental readings through the console Matt Turner
2026-11-14 17:47   ` sashiko-bot
2026-11-14 17:39 ` [PATCH 4/7] alpha: marvel: register a platform device for the environmental sensors Matt Turner
2026-11-14 17:44   ` sashiko-bot
2026-11-14 17:39 ` [PATCH 5/7] hwmon: Add driver for Marvel AlphaServer " Matt Turner
2026-11-14 17:57   ` sashiko-bot [this message]
2026-11-14 17:39 ` [PATCH 6/7] alpha: marvel: notify environmental events Matt Turner
2026-11-14 17:45   ` sashiko-bot
2026-11-14 17:39 ` [PATCH 7/7] hwmon: (marvel-env) Notify userspace of " Matt Turner
2026-11-14 17:52   ` sashiko-bot

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=sashiko-outbox-214860@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=mattst88@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.