Re: [PATCH net-next] eth: fbnic: Add hardware monitoring support

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

 



> +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




[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