Re: [PATCH v3 10/11] spi: dw: Add support for Pensando Elba SoC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 25, 2021 at 4:54 AM Brad Larson <brad@xxxxxxxxxxx> 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



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux