lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <29cc431c-0020-4546-8658-6f06d84aa84b@lunn.ch>
Date: Fri, 13 Sep 2024 15:28:42 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Sanman Pradhan <sanmanpradhan@...a.com>
Cc: netdev@...r.kernel.org, alexanderduyck@...com, kuba@...nel.org,
	kernel-team@...a.com, davem@...emloft.net, edumazet@...gle.com,
	pabeni@...hat.com, jdelvare@...e.com, linux@...ck-us.net,
	horms@...nel.org, mohsin.bashr@...il.com,
	linux-hwmon@...r.kernel.org
Subject: Re: [PATCH net-next] eth: fbnic: Add hardware monitoring support

> +static int fbnic_hwmon_sensor_id(enum hwmon_sensor_types type)
> +{
> +	if (type == hwmon_temp)
> +		return FBNIC_SENSOR_TEMP;
> +	if (type == hwmon_in)
> +		return FBNIC_SENSOR_VOLTAGE;
> +
> +	return -EOPNOTSUPP;
> +}

> +static int fbnic_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
> +			    u32 attr, int channel, long *val)
> +{
> +	struct fbnic_dev *fbd = dev_get_drvdata(dev);
> +	const struct fbnic_mac *mac = fbd->mac;
> +	int id;
> +
> +	id = fbnic_hwmon_sensor_id(type);
> +	if (id < 0)
> +		return -EOPNOTSUPP;

fbnic_hwmon_sensor_id() itself returns EOPNOTSUPP, so just use it.

> +void fbnic_hwmon_register(struct fbnic_dev *fbd)
> +{
> +	if (!IS_REACHABLE(CONFIG_HWMON))
> +		return;
> +
> +	fbd->hwmon = hwmon_device_register_with_info(fbd->dev, "fbnic",
> +						     fbd, &fbnic_chip_info,
> +						     NULL);
> +	if (IS_ERR(fbd->hwmon)) {
> +		dev_err(fbd->dev,
> +			"Cannot register hwmon device %pe, aborting\n",
> +			fbd->hwmon);

aborting is probably the wrong word, because you keep going
independent of it working or not.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ