[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <153c5be4-158e-421a-83a5-5632a9263e87@roeck-us.net>
Date: Fri, 13 Sep 2024 09:53:25 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Andrew Lunn <andrew@...n.ch>, 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, horms@...nel.org,
mohsin.bashr@...il.com, linux-hwmon@...r.kernel.org
Subject: Re: [PATCH net-next] eth: fbnic: Add hardware monitoring support
On 9/13/24 06:28, Andrew Lunn wrote:
>> +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.
>
I have not seen the original patch, and it doesn't seem to be available
on the networking mailing list, so I can not really comment on the patch
as a whole. For hwmon drivers in drivers/hwmon, I don't accept patches
with dev_err() which is then ignored ... because ignoring the error
means that it is not really an error. This should be dev_warn()
or better dev_notice().
Guenter
Powered by blists - more mailing lists