Re: [PATCH 3/3] iio: dac: add support for Microchip MCP48FEB02
Joshua Crofts <[email protected]>
| Newsgroups | org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260723230209.05c9f482@systembl0wer> |
On Thu, 23 Jul 2026 16:43:12 +0300 Ariana Lazar <[email protected]> wrote: > This is the iio driver for Microchip MCP48FxBy1/2/4/8 series of > buffered voltage output Digital-to-Analog Converters with nonvolatile or > volatile memory and an SPI Interface. > > The families support up to 8 output channels. > > The devices can be 8-bit, 10-bit and 12-bit. > > Signed-off-by: Ariana Lazar <[email protected]> > --- ... > +#include <linux/device.h> No need to include device.h, as struct device * is an opaque pointer. Instead, add dev_printk.h as you're using dev_err_probe(). > +#include <linux/err.h> > +#include <linux/export.h> > +#include <linux/module.h> > +#include <linux/mod_devicetable.h> Don't include mod_devicetable.h, this header has recently been added to spi.h, thanks to the effort of Uwe Kleine-Konig. > +#include <linux/pm.h> > +#include <linux/regmap.h> > +#include <linux/spi/spi.h> > + > +#include "mcp47feb02.h" > + ... > + > +static int mcp47feb02_spi_probe(struct spi_device *spi) > +{ > + const struct mcp47feb02_features *chip_features; > + struct device *dev = &spi->dev; > + struct regmap *regmap; > + > + chip_features = spi_get_device_match_data(spi); > + if (!chip_features) > + return -EINVAL; What about returning dev_err_probe() and -ENODEV instead of -EINVAL? It's about 50-50 in the kernel but -ENODEV seems more suitable as an error code if spi_get_device_match_data() fails. -- Kind regards, Joshua Crofts