Message ID | 20220304080348.218581-1-krzysztof.kozlowski@canonical.com (mailing list archive) |
---|---|
State | New, archived |
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 s3c24xx_uart_info" 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 "struct 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 d002a4e48ed9..aa5678d03704 100644 > --- a/drivers/tty/serial/samsung_tty.c > +++ b/drivers/tty/serial/samsung_tty.c > @@ -85,7 +85,7 @@ struct s3c24xx_uart_info { > }; > > struct s3c24xx_serial_drv_data { > - struct s3c24xx_uart_info *info; > + struct s3c24xx_uart_info info; > struct s3c2410_uartcfg *def_cfg; > unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS]; > }; > @@ -2197,7 +2197,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) > } > > ourport->baudclk = ERR_PTR(-EINVAL); > - ourport->info = ourport->drv_data->info; > + ourport->info = &ourport->drv_data->info; > ourport->cfg = (dev_get_platdata(&pdev->dev)) ? > dev_get_platdata(&pdev->dev) : > ourport->drv_data->def_cfg; > @@ -2616,7 +2616,7 @@ static struct console s3c24xx_serial_console = { > > #ifdef CONFIG_CPU_S3C2410 > static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { > - .info = &(struct s3c24xx_uart_info) { > + .info = { > .name = "Samsung S3C2410 UART", > .type = TYPE_S3C24XX, > .port_type = PORT_S3C2410, > @@ -2644,7 +2644,7 @@ static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { > > #ifdef CONFIG_CPU_S3C2412 > static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { > - .info = &(struct s3c24xx_uart_info) { > + .info = { > .name = "Samsung S3C2412 UART", > .type = TYPE_S3C24XX, > .port_type = PORT_S3C2412, > @@ -2674,7 +2674,7 @@ static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { > #if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2416) || \ > defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2442) > static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { > - .info = &(struct s3c24xx_uart_info) { > + .info = { > .name = "Samsung S3C2440 UART", > .type = TYPE_S3C24XX, > .port_type = PORT_S3C2440, > @@ -2704,7 +2704,7 @@ static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { > > #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) > static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { > - .info = &(struct s3c24xx_uart_info) { > + .info = { > .name = "Samsung S3C6400 UART", > .type = TYPE_S3C6400, > .port_type = PORT_S3C6400, > @@ -2733,7 +2733,7 @@ static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { > > #ifdef CONFIG_CPU_S5PV210 > static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { > - .info = &(struct s3c24xx_uart_info) { > + .info = { > .name = "Samsung S5PV210 UART", > .type = TYPE_S3C6400, > .port_type = PORT_S3C6400, > @@ -2762,7 +2762,7 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { > > #if defined(CONFIG_ARCH_EXYNOS) > #define EXYNOS_COMMON_SERIAL_DRV_DATA() \ > - .info = &(struct s3c24xx_uart_info) { \ > + .info = { \ > .name = "Samsung Exynos UART", \ > .type = TYPE_S3C6400, \ > .port_type = PORT_S3C6400, \ > @@ -2811,7 +2811,7 @@ static struct s3c24xx_serial_drv_data exynos850_serial_drv_data = { > > #ifdef CONFIG_ARCH_APPLE > static struct s3c24xx_serial_drv_data s5l_serial_drv_data = { > - .info = &(struct s3c24xx_uart_info) { > + .info = { > .name = "Apple S5L UART", > .type = TYPE_APPLE_S5L, > .port_type = PORT_8250,
diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index d002a4e48ed9..aa5678d03704 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -85,7 +85,7 @@ struct s3c24xx_uart_info { }; struct s3c24xx_serial_drv_data { - struct s3c24xx_uart_info *info; + struct s3c24xx_uart_info info; struct s3c2410_uartcfg *def_cfg; unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS]; }; @@ -2197,7 +2197,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) } ourport->baudclk = ERR_PTR(-EINVAL); - ourport->info = ourport->drv_data->info; + ourport->info = &ourport->drv_data->info; ourport->cfg = (dev_get_platdata(&pdev->dev)) ? dev_get_platdata(&pdev->dev) : ourport->drv_data->def_cfg; @@ -2616,7 +2616,7 @@ static struct console s3c24xx_serial_console = { #ifdef CONFIG_CPU_S3C2410 static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { - .info = &(struct s3c24xx_uart_info) { + .info = { .name = "Samsung S3C2410 UART", .type = TYPE_S3C24XX, .port_type = PORT_S3C2410, @@ -2644,7 +2644,7 @@ static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { #ifdef CONFIG_CPU_S3C2412 static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { - .info = &(struct s3c24xx_uart_info) { + .info = { .name = "Samsung S3C2412 UART", .type = TYPE_S3C24XX, .port_type = PORT_S3C2412, @@ -2674,7 +2674,7 @@ static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { #if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2416) || \ defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2442) static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { - .info = &(struct s3c24xx_uart_info) { + .info = { .name = "Samsung S3C2440 UART", .type = TYPE_S3C24XX, .port_type = PORT_S3C2440, @@ -2704,7 +2704,7 @@ static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { - .info = &(struct s3c24xx_uart_info) { + .info = { .name = "Samsung S3C6400 UART", .type = TYPE_S3C6400, .port_type = PORT_S3C6400, @@ -2733,7 +2733,7 @@ static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { #ifdef CONFIG_CPU_S5PV210 static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { - .info = &(struct s3c24xx_uart_info) { + .info = { .name = "Samsung S5PV210 UART", .type = TYPE_S3C6400, .port_type = PORT_S3C6400, @@ -2762,7 +2762,7 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { #if defined(CONFIG_ARCH_EXYNOS) #define EXYNOS_COMMON_SERIAL_DRV_DATA() \ - .info = &(struct s3c24xx_uart_info) { \ + .info = { \ .name = "Samsung Exynos UART", \ .type = TYPE_S3C6400, \ .port_type = PORT_S3C6400, \ @@ -2811,7 +2811,7 @@ static struct s3c24xx_serial_drv_data exynos850_serial_drv_data = { #ifdef CONFIG_ARCH_APPLE static struct s3c24xx_serial_drv_data s5l_serial_drv_data = { - .info = &(struct s3c24xx_uart_info) { + .info = { .name = "Apple S5L UART", .type = TYPE_APPLE_S5L, .port_type = PORT_8250,
Embed "struct s3c24xx_uart_info" 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 "struct 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(-)