Le 25/02/2025 à 20:11, Dzmitry Sankouski a écrit :
Add support for max77705 hwmon. Includes charger input, system bus, and vbyp measurements. Signed-off-by: Dzmitry Sankouski <dsankouski@xxxxxxxxx>
...
+static int max77705_hwmon_probe(struct platform_device *pdev) +{ + struct i2c_client *i2c; + struct device *hwmon_dev; + struct max77705_hwmon *drv_data; + + drv_data = devm_kzalloc(&pdev->dev, sizeof(struct max77705_hwmon), + GFP_KERNEL); + if (!drv_data) + return -ENOMEM; + + i2c = to_i2c_client(pdev->dev.parent); + drv_data->regmap = devm_regmap_init_i2c(i2c, &max77705_hwmon_regmap_config); + if (IS_ERR(drv_data->regmap)) + return dev_err_probe(&pdev->dev, PTR_ERR(drv_data->regmap), + "Failed to register max77705 hwmon regmap\n"); + + hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev, "max77705", drv_data, + &max77705_chip_info, NULL); + if (IS_ERR(hwmon_dev)) { + return dev_err_probe(&i2c->dev, PTR_ERR(hwmon_dev),
No strong opinion, but why &i2c->dev and not &pdev->dev?
+ "Unable to register hwmon device\n"); + }
Extra { } can be removed, as done a few lines above
+ + return 0; +}; +
... CJ