On Tue, Feb 21, 2023 at 01:39:10PM +0300, Okan Sahin wrote: > Regulator driver for both MAX77541 and MAX77540. > The MAX77541 is a high-efficiency step-down converter > with two 3A switching phases for single-cell Li+ battery > and 5VDC systems. > > The MAX77540 is a high-efficiency step-down converter > with two 3A switching phases. ... > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright (c) 2022 Analog Devices, Inc. > + * ADI Regulator driver for the MAX77540 and MAX77541 > + */ Dunno if Mark requires // comments for regulator new code. ... > +#include <linux/i2c.h> Is there any user of this? ... > +static int max77541_regulator_probe(struct platform_device *pdev) > +{ > + struct regulator_config config = {}; > + const struct regulator_desc *desc; > + struct device *dev = &pdev->dev; > + struct regulator_dev *rdev; > + struct max77541 *max77541; > + int i; unsigned ? > + max77541 = dev_get_drvdata(dev->parent); Can be done in definition block (but it's up to you): struct regulator_config config = {}; const struct regulator_desc *desc; struct device *dev = &pdev->dev; struct max77541 *max77541 = dev_get_drvdata(dev->parent); struct regulator_dev *rdev; unsigned int i; > + config.dev = dev->parent; > + > + switch (max77541->chip->id) { > + case MAX77540: > + desc = max77540_regulators_desc; > + break; > + case MAX77541: > + desc = max77541_regulators_desc; > + break; > + default: > + return -EINVAL; > + } > + > + for (i = 0; i < MAX77541_MAX_REGULATORS; i++) { > + rdev = devm_regulator_register(dev, &desc[i], &config); > + if (IS_ERR(rdev)) > + return dev_err_probe(dev, PTR_ERR(rdev), > + "Failed to register regulator\n"); > + } > + > + return 0; > +} -- With Best Regards, Andy Shevchenko