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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 8 Jun 2022 13:30:23 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Mark Brown <broonie@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-spi <linux-spi@...r.kernel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH v1 2/2] spi: Use device_find_first_child() instead of
 custom approach

On Tue, Jun 7, 2022 at 10:22 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> We have already a helper to get the first child device, use it and
> drop custom approach.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

Nice cleanup.

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

> ---
>  drivers/spi/spi.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index ea09d1b42bf6..87dc8773108b 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -2613,11 +2613,6 @@ int spi_slave_abort(struct spi_device *spi)
>  }
>  EXPORT_SYMBOL_GPL(spi_slave_abort);
>
> -static int match_true(struct device *dev, void *data)
> -{
> -       return 1;
> -}
> -
>  static ssize_t slave_show(struct device *dev, struct device_attribute *attr,
>                           char *buf)
>  {
> @@ -2625,7 +2620,7 @@ static ssize_t slave_show(struct device *dev, struct device_attribute *attr,
>                                                    dev);
>         struct device *child;
>
> -       child = device_find_child(&ctlr->dev, NULL, match_true);
> +       child = device_find_first_child(&ctlr->dev);
>         return sprintf(buf, "%s\n",
>                        child ? to_spi_device(child)->modalias : NULL);
>  }
> @@ -2644,7 +2639,7 @@ static ssize_t slave_store(struct device *dev, struct device_attribute *attr,
>         if (rc != 1 || !name[0])
>                 return -EINVAL;
>
> -       child = device_find_child(&ctlr->dev, NULL, match_true);
> +       child = device_find_first_child(&ctlr->dev);
>         if (child) {
>                 /* Remove registered slave */
>                 device_unregister(child);
> --
> 2.35.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ