[PATCH v6 2/2] drivers: hwmon: sophgo: Add SG2042 external hardware monitor support
Guenter Roeck
linux at roeck-us.net
Sat Jul 6 18:19:54 PDT 2024
On 7/6/24 17:31, Inochi Amaoto wrote:
> On Sat, Jul 06, 2024 at 07:52:47AM GMT, Guenter Roeck wrote:
>> On 7/2/24 19:30, Inochi Amaoto wrote:
>>> SG2042 use an external MCU to provide basic hardware information
>>> and thermal sensors.
>>>
>>> Add driver support for the onboard MCU of SG2042.
>>>
>>> Signed-off-by: Inochi Amaoto <inochiama at outlook.com>
>>> ---
>>> Documentation/hwmon/index.rst | 1 +
>>> Documentation/hwmon/sgmcu.rst | 44 +++
>>> drivers/hwmon/Kconfig | 11 +
>>> drivers/hwmon/Makefile | 1 +
>>> drivers/hwmon/sgmcu.c | 585 ++++++++++++++++++++++++++++++++++
>>> 5 files changed, 642 insertions(+)
>>> create mode 100644 Documentation/hwmon/sgmcu.rst
>>> create mode 100644 drivers/hwmon/sgmcu.c
>>>
...
>>> +
>>> +static int sg2042_mcu_read_temp(struct device *dev,
>>> + u32 attr, int channel,
>>> + long *val)
>>> +{
>>> + struct sg2042_mcu_data *mcu = dev_get_drvdata(dev);
>>> + long tmp;
>>
>> Why long ?
>>
>
> just use to calculate the value.
>
That is not a valid reason. There won't be any overflows, so int would
be good enough.
Guenter
More information about the linux-riscv
mailing list