lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfT=KNM6J1bP5cPsLw7Z776opcB9Kf6qhNCZukY-7g=pQ@mail.gmail.com>
Date:   Mon, 3 Feb 2020 11:50:42 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Chris Packham <chris.packham@...iedtelesis.co.nz>
Cc:     Mark Brown <broonie@...nel.org>, Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        linux-spi <linux-spi@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 2/2] spi: Add generic SPI multiplexer

On Fri, Jan 31, 2020 at 4:34 AM Chris Packham
<chris.packham@...iedtelesis.co.nz> 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ