Re: [PATCH v5 08/10] iio: dac: mcp47feb02: refactor MCP47FEB02 I2C driver into two modules

From: Andy Shevchenko

Date: Thu Sep 10 2026 - 02:24:16 EST


On Wed, Sep 09, 2026 at 05:18:51PM +0300, Ariana Lazar wrote:
> Prepare the driver for the bus-specific code by refactoring into separate
> files. The renamed file will contain the common DAC functionality shared by
> the MCP47FxBy1/2/4/8 I2C and MCP48FxBy1/2/4/8 SPI drivers. The MCP47FEB02
> driver was refactored into two modules: mcp47feb02-core.c and
> mcp47feb02-i2c.c in order to prepare the support for SPI MCP48FxBy1/2/4/8
> DAC family on top of the current implementation.

...

> +static int mcp47feb02_i2c_probe(struct i2c_client *client)
> +{
> + const struct mcp47feb02_features *chip_features;
> + struct device *dev = &client->dev;
> + struct regmap *regmap;
> +
> + chip_features = i2c_get_match_data(client);
> + if (!chip_features)
> + return dev_err_probe(dev, -ENODEV, "No I2C device found\n");

Consider adding a patch that replaces ENODEV with ENODATA as we started doing
in the other drivers. This will help to distinguish the source of the error.
Also fix the error message accordingly. It's not about device.

> + if (chip_features->have_eeprom)
> + regmap = devm_regmap_init_i2c(client, &mcp47feb02_regmap_config);
> + else
> + regmap = devm_regmap_init_i2c(client, &mcp47fvb02_regmap_config);
> +
> + if (IS_ERR(regmap))
> + return dev_err_probe(dev, PTR_ERR(regmap), "Error initializing I2C regmap\n");
> +
> + return mcp47feb02_common_probe(chip_features, regmap);
> +}

...

> +#ifndef __DRIVERS_IIO_DAC_MCP47FEB02_H__
> +#define __DRIVERS_IIO_DAC_MCP47FEB02_H__
> +
> +#include <linux/pm.h>

+ regmap.h for struct regmap_config.

> +#include <linux/types.h>

> +#endif /* __DRIVERS_IIO_DAC_MCP47FEB02_H__ */

--
With Best Regards,
Andy Shevchenko