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]
Message-ID: <CAHp75VdN3MDDEjEoLAudtRW5pgHvfgP7Zt9Hv8OOhfZbHN9hpA@mail.gmail.com>
Date:   Mon, 7 Mar 2022 22:24:16 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
Cc:     Alim Akhtar <alim.akhtar@...sung.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jirislaby@...nel.org>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        Linux Samsung SOC <linux-samsung-soc@...r.kernel.org>,
        "open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 7/7] tty: serial: samsung: simplify getting OF match data

On Mon, Mar 7, 2022 at 11:20 AM Krzysztof Kozlowski
<krzysztof.kozlowski@...onical.com> wrote:
>
> Simplify the code with of_device_get_match_data().

You may get rid of ugly ifdeffery as well.

...

>  static inline const struct s3c24xx_serial_drv_data *
>  s3c24xx_get_driver_data(struct platform_device *pdev)
>  {
>  #ifdef CONFIG_OF
> -       if (pdev->dev.of_node) {
> -               const struct of_device_id *match;
> -
> -               match = of_match_node(s3c24xx_uart_dt_match, pdev->dev.of_node);
> -               return (struct s3c24xx_serial_drv_data *)match->data;
> -       }

> +       if (pdev->dev.of_node)

I believe it's never true when CONFIG_OF=n,

> +               return of_device_get_match_data(&pdev->dev);
>  #endif
> +
>         return (struct s3c24xx_serial_drv_data *)
>                         platform_get_device_id(pdev)->driver_data;
>  }

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ