Re: [PATCH 2/2] hwmon: max31827: add MAX31827 driver

From: Krzysztof Kozlowski
Date: Thu Apr 06 2023 - 15:21:01 EST


On 06/04/2023 18:43, Daniel Matyas wrote:
> MAX31827 is a low-power temperature switch with I2C interface.
>

(...)

> +
> +static const struct hwmon_ops max31827_hwmon_ops = {
> + .is_visible = max31827_is_visible,
> + .read = max31827_read,
> + .write = max31827_write,
> +};
> +
> +static const struct hwmon_chip_info max31827_chip_info = {
> + .ops = &max31827_hwmon_ops,
> + .info = max31827_info,
> +};
> +
> +static int max31827_probe(struct i2c_client *client)
> +{
> + struct device *dev = &client->dev;
> + struct device *hwmon_dev;
> + struct max31827_state *st;
> + int ret;
> +
> + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
> + return -EOPNOTSUPP;
> +
> + st = devm_kzalloc(dev, sizeof(struct max31827_state), GFP_KERNEL);

sizeof(*...)

> + if (!st)
> + return -ENOMEM;
> +


Best regards,
Krzysztof