lkml.org 
[lkml]   [2021]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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

\
 
 \ /
  Last update: 2021-10-31 14:21    [W:0.234 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site