public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Zev Weiss <zev@bewilderbeest.net>
Cc: Arnd Bergmann <arnd@arndb.de>,
	openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>
Subject: Re: [PATCH v2 2/2] misc: Add power-efuse driver
Date: Tue, 8 Mar 2022 08:07:57 +0100	[thread overview]
Message-ID: <YicAzSara5Sr3LQ7@kroah.com> (raw)
In-Reply-To: <20220308011811.10353-3-zev@bewilderbeest.net>

On Mon, Mar 07, 2022 at 05:18:10PM -0800, Zev Weiss wrote:
> +static DEVICE_ATTR(operstate, 0644, efuse_show_operstate, efuse_set_operstate);

DEVICE_ATTR_RW()?

> +
> +#define EFUSE_ERROR_ATTR(name, bit)							    \
> +	static ssize_t efuse_show_##name(struct device *dev, struct device_attribute *attr, \
> +					 char *buf)                                         \
> +	{                                                                                   \
> +		struct efuse *efuse = dev_get_drvdata(dev);                                 \
> +		int status = efuse_update_error_flags(efuse);                               \
> +		if (status)                                                                 \
> +			return status;                                                      \
> +		return sysfs_emit(buf, "%d\n", !!(efuse->error_flags.cache & bit));         \
> +	}                                                                                   \
> +	static DEVICE_ATTR(name, 0444, efuse_show_##name, NULL)

DEVICE_ATTR_RO()?

> +EFUSE_ERROR_ATTR(under_voltage, REGULATOR_ERROR_UNDER_VOLTAGE);
> +EFUSE_ERROR_ATTR(over_current, REGULATOR_ERROR_OVER_CURRENT);
> +EFUSE_ERROR_ATTR(regulation_out, REGULATOR_ERROR_REGULATION_OUT);
> +EFUSE_ERROR_ATTR(fail, REGULATOR_ERROR_FAIL);
> +EFUSE_ERROR_ATTR(over_temp, REGULATOR_ERROR_OVER_TEMP);
> +EFUSE_ERROR_ATTR(under_voltage_warn, REGULATOR_ERROR_UNDER_VOLTAGE_WARN);
> +EFUSE_ERROR_ATTR(over_current_warn, REGULATOR_ERROR_OVER_CURRENT_WARN);
> +EFUSE_ERROR_ATTR(over_voltage_warn, REGULATOR_ERROR_OVER_VOLTAGE_WARN);
> +EFUSE_ERROR_ATTR(over_temp_warn, REGULATOR_ERROR_OVER_TEMP_WARN);
> +
> +static struct attribute *efuse_attrs[] = {
> +	&dev_attr_operstate.attr,
> +	&dev_attr_under_voltage.attr,
> +	&dev_attr_over_current.attr,
> +	&dev_attr_regulation_out.attr,
> +	&dev_attr_fail.attr,
> +	&dev_attr_over_temp.attr,
> +	&dev_attr_under_voltage_warn.attr,
> +	&dev_attr_over_current_warn.attr,
> +	&dev_attr_over_voltage_warn.attr,
> +	&dev_attr_over_temp_warn.attr,
> +	NULL,
> +};
> +ATTRIBUTE_GROUPS(efuse);

Shouldn't these all just be what all regulator drivers report?  Or power
drivers?  I find it odd that this would be the first driver that would
need to export these types of attributes.  Surely there's already a
class for this?

thanks,

greg k-h

  parent reply	other threads:[~2022-03-08  7:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08  1:18 [PATCH v2 0/2] misc: Add power-efuse driver Zev Weiss
2022-03-08  1:18 ` [PATCH v2 1/2] dt-bindings: Add power-efuse binding Zev Weiss
2022-03-11 15:24   ` Rob Herring
2022-03-11 21:48     ` Zev Weiss
2022-03-12  0:08       ` Rob Herring
2022-03-12  0:39         ` Zev Weiss
2022-03-08  1:18 ` [PATCH v2 2/2] misc: Add power-efuse driver Zev Weiss
2022-03-08  7:06   ` Greg Kroah-Hartman
2022-03-08  7:45     ` Zev Weiss
2022-03-08  7:07   ` Greg Kroah-Hartman [this message]
2022-03-08  8:23     ` Zev Weiss
2022-04-11 22:09       ` Zev Weiss
2022-04-12  4:53         ` Greg Kroah-Hartman
2022-04-13  9:03           ` Zev Weiss

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=YicAzSara5Sr3LQ7@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=zev@bewilderbeest.net \
    /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