Messages in this thread |  | | From | Andy Shevchenko <> | Date | Sun, 31 Oct 2021 15:19:48 +0200 | Subject | Re: [PATCH v3 10/11] spi: dw: Add support for Pensando Elba SoC |
| |
On Mon, Oct 25, 2021 at 4:54 AM Brad Larson <brad@pensando.io> wrote: > > The Pensando Elba SoC includes a DW apb_ssi v4 controller > with device specific chip-select control. The Elba SoC > provides four chip-selects where the native DW IP supports > two chip-selects.
...
> +static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable) > +{ > + struct dw_spi *dws = spi_master_get_devdata(spi->master); > + struct dw_spi_mmio *dwsmmio = container_of(dws, struct dw_spi_mmio, dws); > + struct dw_spi_elba *dwselba = dwsmmio->priv;
> + u8 cs = spi->chip_select;
Much easier to maintain and follow the code (in the future) if this assignment is broken to two parts, i.e...
> +
...like this
cs = spi->chip_select; if (cs < 2) { ...
> + if (cs < 2) { > + /* overridden native chip-select */ > + elba_spics_set_cs(dwselba, spi->chip_select, enable); > + }
...
> + regmap = syscon_node_to_regmap(args.np); > + if (IS_ERR(regmap)) { > + dev_err(&pdev->dev, "could not map pensando,spics\n"); > + return PTR_ERR(regmap); > + }
Why not return dev_err_probe()?
-- With Best Regards, Andy Shevchenko
|  |