Message ID | 20220304080348.218581-2-krzysztof.kozlowski@canonical.com |
---|---|
State | Superseded |
Headers | show |
Series | [1/7] tty: serial: samsung: embed s3c24xx_uart_info in parent structure | expand |
On 04. 03. 22, 9:03, Krzysztof Kozlowski wrote: > Embed "struct s3c2410_uartcfg" directly as a member of "struct > s3c24xx_serial_drv_data" instead of keeping it as a pointer. This makes > the code clearer (obvious ownership of "s3c2410_uartcfg > s3c24xx_serial_drv_data") and saves one pointer. > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> > --- > drivers/tty/serial/samsung_tty.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c > index aa5678d03704..a9a75b5b9705 100644 > --- a/drivers/tty/serial/samsung_tty.c > +++ b/drivers/tty/serial/samsung_tty.c > @@ -86,7 +86,7 @@ struct s3c24xx_uart_info { > > struct s3c24xx_serial_drv_data { > struct s3c24xx_uart_info info; > - struct s3c2410_uartcfg *def_cfg; > + struct s3c2410_uartcfg def_cfg; > unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS]; > }; > > @@ -2200,7 +2200,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) > ourport->info = &ourport->drv_data->info; > ourport->cfg = (dev_get_platdata(&pdev->dev)) ? > dev_get_platdata(&pdev->dev) : > - ourport->drv_data->def_cfg; > + &ourport->drv_data->def_cfg; > > switch (ourport->info->type) { > case TYPE_S3C24XX: > @@ -2632,7 +2632,7 @@ static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { > .clksel_mask = S3C2410_UCON_CLKMASK, > .clksel_shift = S3C2410_UCON_CLKSHIFT, > }, > - .def_cfg = &(struct s3c2410_uartcfg) { > + .def_cfg = { > .ucon = S3C2410_UCON_DEFAULT, > .ufcon = S3C2410_UFCON_DEFAULT, > }, > @@ -2661,7 +2661,7 @@ static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { > .clksel_mask = S3C2412_UCON_CLKMASK, > .clksel_shift = S3C2412_UCON_CLKSHIFT, > }, > - .def_cfg = &(struct s3c2410_uartcfg) { > + .def_cfg = { > .ucon = S3C2410_UCON_DEFAULT, > .ufcon = S3C2410_UFCON_DEFAULT, > }, > @@ -2692,7 +2692,7 @@ static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { > .clksel_shift = S3C2412_UCON_CLKSHIFT, > .ucon_mask = S3C2440_UCON0_DIVMASK, > }, > - .def_cfg = &(struct s3c2410_uartcfg) { > + .def_cfg = { > .ucon = S3C2410_UCON_DEFAULT, > .ufcon = S3C2410_UFCON_DEFAULT, > }, > @@ -2721,7 +2721,7 @@ static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { > .clksel_mask = S3C6400_UCON_CLKMASK, > .clksel_shift = S3C6400_UCON_CLKSHIFT, > }, > - .def_cfg = &(struct s3c2410_uartcfg) { > + .def_cfg = { > .ucon = S3C2410_UCON_DEFAULT, > .ufcon = S3C2410_UFCON_DEFAULT, > }, > @@ -2749,7 +2749,7 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { > .clksel_mask = S5PV210_UCON_CLKMASK, > .clksel_shift = S5PV210_UCON_CLKSHIFT, > }, > - .def_cfg = &(struct s3c2410_uartcfg) { > + .def_cfg = { > .ucon = S5PV210_UCON_DEFAULT, > .ufcon = S5PV210_UFCON_DEFAULT, > }, > @@ -2778,7 +2778,7 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { > .clksel_mask = 0, \ > .clksel_shift = 0, \ > }, \ > - .def_cfg = &(struct s3c2410_uartcfg) { \ > + .def_cfg = { \ > .ucon = S5PV210_UCON_DEFAULT, \ > .ufcon = S5PV210_UFCON_DEFAULT, \ > .has_fracval = 1, \ > @@ -2827,7 +2827,7 @@ static struct s3c24xx_serial_drv_data s5l_serial_drv_data = { > .clksel_mask = 0, > .clksel_shift = 0, > }, > - .def_cfg = &(struct s3c2410_uartcfg) { > + .def_cfg = { > .ucon = APPLE_S5L_UCON_DEFAULT, > .ufcon = S3C2410_UFCON_DEFAULT, > },
diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index aa5678d03704..a9a75b5b9705 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -86,7 +86,7 @@ struct s3c24xx_uart_info { struct s3c24xx_serial_drv_data { struct s3c24xx_uart_info info; - struct s3c2410_uartcfg *def_cfg; + struct s3c2410_uartcfg def_cfg; unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS]; }; @@ -2200,7 +2200,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) ourport->info = &ourport->drv_data->info; ourport->cfg = (dev_get_platdata(&pdev->dev)) ? dev_get_platdata(&pdev->dev) : - ourport->drv_data->def_cfg; + &ourport->drv_data->def_cfg; switch (ourport->info->type) { case TYPE_S3C24XX: @@ -2632,7 +2632,7 @@ static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { .clksel_mask = S3C2410_UCON_CLKMASK, .clksel_shift = S3C2410_UCON_CLKSHIFT, }, - .def_cfg = &(struct s3c2410_uartcfg) { + .def_cfg = { .ucon = S3C2410_UCON_DEFAULT, .ufcon = S3C2410_UFCON_DEFAULT, }, @@ -2661,7 +2661,7 @@ static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { .clksel_mask = S3C2412_UCON_CLKMASK, .clksel_shift = S3C2412_UCON_CLKSHIFT, }, - .def_cfg = &(struct s3c2410_uartcfg) { + .def_cfg = { .ucon = S3C2410_UCON_DEFAULT, .ufcon = S3C2410_UFCON_DEFAULT, }, @@ -2692,7 +2692,7 @@ static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { .clksel_shift = S3C2412_UCON_CLKSHIFT, .ucon_mask = S3C2440_UCON0_DIVMASK, }, - .def_cfg = &(struct s3c2410_uartcfg) { + .def_cfg = { .ucon = S3C2410_UCON_DEFAULT, .ufcon = S3C2410_UFCON_DEFAULT, }, @@ -2721,7 +2721,7 @@ static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { .clksel_mask = S3C6400_UCON_CLKMASK, .clksel_shift = S3C6400_UCON_CLKSHIFT, }, - .def_cfg = &(struct s3c2410_uartcfg) { + .def_cfg = { .ucon = S3C2410_UCON_DEFAULT, .ufcon = S3C2410_UFCON_DEFAULT, }, @@ -2749,7 +2749,7 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { .clksel_mask = S5PV210_UCON_CLKMASK, .clksel_shift = S5PV210_UCON_CLKSHIFT, }, - .def_cfg = &(struct s3c2410_uartcfg) { + .def_cfg = { .ucon = S5PV210_UCON_DEFAULT, .ufcon = S5PV210_UFCON_DEFAULT, }, @@ -2778,7 +2778,7 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { .clksel_mask = 0, \ .clksel_shift = 0, \ }, \ - .def_cfg = &(struct s3c2410_uartcfg) { \ + .def_cfg = { \ .ucon = S5PV210_UCON_DEFAULT, \ .ufcon = S5PV210_UFCON_DEFAULT, \ .has_fracval = 1, \ @@ -2827,7 +2827,7 @@ static struct s3c24xx_serial_drv_data s5l_serial_drv_data = { .clksel_mask = 0, .clksel_shift = 0, }, - .def_cfg = &(struct s3c2410_uartcfg) { + .def_cfg = { .ucon = APPLE_S5L_UCON_DEFAULT, .ufcon = S3C2410_UFCON_DEFAULT, },
Embed "struct s3c2410_uartcfg" directly as a member of "struct s3c24xx_serial_drv_data" instead of keeping it as a pointer. This makes the code clearer (obvious ownership of "s3c2410_uartcfg s3c24xx_serial_drv_data") and saves one pointer. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> --- drivers/tty/serial/samsung_tty.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)