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

\
 
 \ /
  Last update: 2022-03-07 21:27    [W:0.140 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site