On Fri, Jan 31, 2020 at 4:34 AM Chris Packham <chris.packham@xxxxxxxxxxxxxxxxxxx> wrote: > > Add a SPI device driver that sits in-band and provides a SPI controller > which supports chip selects via a mux-control. This enables extra SPI > devices to be connected with limited native chip selects. Thanks for an update, my comments below. ... > # > # Add new SPI master controllers in alphabetical order above this line > # > +# Redundant line. ... > +/* > + * General Purpose SPI multiplexer > + */ I think Mark wants to have this in one line with C++ style of comments. ... > +#include <linux/kernel.h> > +#include <linux/module.h> > +#include <linux/err.h> > +#include <linux/slab.h> > +#include <linux/spi/spi.h> > +#include <linux/mux/consumer.h> Perhaps sorted? ... > + /* do the transfer */ > + ret = spi_async(priv->spi, m); > + return ret; return spi_async(...); ... > + priv->mux = devm_mux_control_get(&spi->dev, NULL); > + ret = PTR_ERR_OR_ZERO(priv->mux); This is a bit complicated. > + if (ret) { Why not simple do if (IS_ERR(priv->mux)) { ret = PTR_ERR(...); ... } ? > + if (ret != -EPROBE_DEFER) > + dev_err(&spi->dev, "failed to get control-mux\n"); > + goto err_put_ctlr; > + } > + ctlr->dev.of_node = spi->dev.of_node; I'm wondering why SPI core can't handle this by default (like GPIO subsystem does). > + ret = devm_spi_register_controller(&spi->dev, ctlr); > + if (ret) > + goto err_put_ctlr; > + > + return ret; return 0; ... > +static const struct of_device_id spi_mux_of_match[] = { > + { .compatible = "spi-mux" }, > + { }, Comma is not needed in terminator line. > +}; -- With Best Regards, Andy Shevchenko