All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] tty: serial: samsung_tty: support more than 4 uart ports
       [not found] <CGME20220629005750epcas2p418cd79922d1b3f13eda761ee3fcd3e17@epcas2p4.samsung.com>
@ 2022-06-29  0:55   ` Chanho Park
  0 siblings, 0 replies; 10+ messages in thread
From: Chanho Park @ 2022-06-29  0:55 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Greg Kroah-Hartman
  Cc: Jiri Slaby, Alim Akhtar, Hector Martin, Jaewon Kim,
	Vincent Whitchurch, linux-samsung-soc, linux-serial,
	linux-arm-kernel, Chanho Park

Regarding Exynos Auto v9 SoC, it supports uarts up to 12. However, the
maximum number of the ports has been derived from
CONFIG_SERIAL_SAMSUNG_UARTS and tightly coupled with the config for
previous Samsung SoCs such as s3c24xx and s3c64xx. To overcome this
limitation, this changes the usage of the definition to UART_NR which is
widely used from other serial drivers. This also defines the value to 12
only for ARM64 SoCs to not affect the change to previous arm32 SoCs.

Instead of enumerating all the ports as predefined arrays, this
introduces s3c24xx_serial_init_port_default that is initializing the
structure as the default value.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
---
Changes from v1:
- Remove initial value assignment of s3c24xx_serial_ports by assigning
  them dynamically as suggested by Greg and Krzysztof.

 drivers/tty/serial/samsung_tty.c | 82 ++++++++++----------------------
 1 file changed, 25 insertions(+), 57 deletions(-)

diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index 03ef4ff506fd..8971fbb49fa3 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -48,6 +48,12 @@
 #define S3C24XX_SERIAL_MAJOR	204
 #define S3C24XX_SERIAL_MINOR	64
 
+#ifdef CONFIG_ARM64
+#define UART_NR			12
+#else
+#define UART_NR			CONFIG_SERIAL_SAMSUNG_UARTS
+#endif
+
 #define S3C24XX_TX_PIO			1
 #define S3C24XX_TX_DMA			2
 #define S3C24XX_RX_PIO			1
@@ -87,7 +93,7 @@ struct s3c24xx_uart_info {
 struct s3c24xx_serial_drv_data {
 	const struct s3c24xx_uart_info	info;
 	const struct s3c2410_uartcfg	def_cfg;
-	const unsigned int		fifosize[CONFIG_SERIAL_SAMSUNG_UARTS];
+	const unsigned int		fifosize[UART_NR];
 };
 
 struct s3c24xx_uart_dma {
@@ -1810,67 +1816,27 @@ static const struct uart_ops apple_s5l_serial_ops = {
 static struct uart_driver s3c24xx_uart_drv = {
 	.owner		= THIS_MODULE,
 	.driver_name	= "s3c2410_serial",
-	.nr		= CONFIG_SERIAL_SAMSUNG_UARTS,
+	.nr		= UART_NR,
 	.cons		= S3C24XX_SERIAL_CONSOLE,
 	.dev_name	= S3C24XX_SERIAL_NAME,
 	.major		= S3C24XX_SERIAL_MAJOR,
 	.minor		= S3C24XX_SERIAL_MINOR,
 };
 
-#define __PORT_LOCK_UNLOCKED(i) \
-	__SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[i].port.lock)
-static struct s3c24xx_uart_port
-s3c24xx_serial_ports[CONFIG_SERIAL_SAMSUNG_UARTS] = {
-	[0] = {
-		.port = {
-			.lock		= __PORT_LOCK_UNLOCKED(0),
-			.iotype		= UPIO_MEM,
-			.uartclk	= 0,
-			.fifosize	= 16,
-			.ops		= &s3c24xx_serial_ops,
-			.flags		= UPF_BOOT_AUTOCONF,
-			.line		= 0,
-		}
-	},
-	[1] = {
-		.port = {
-			.lock		= __PORT_LOCK_UNLOCKED(1),
-			.iotype		= UPIO_MEM,
-			.uartclk	= 0,
-			.fifosize	= 16,
-			.ops		= &s3c24xx_serial_ops,
-			.flags		= UPF_BOOT_AUTOCONF,
-			.line		= 1,
-		}
-	},
-#if CONFIG_SERIAL_SAMSUNG_UARTS > 2
-	[2] = {
-		.port = {
-			.lock		= __PORT_LOCK_UNLOCKED(2),
-			.iotype		= UPIO_MEM,
-			.uartclk	= 0,
-			.fifosize	= 16,
-			.ops		= &s3c24xx_serial_ops,
-			.flags		= UPF_BOOT_AUTOCONF,
-			.line		= 2,
-		}
-	},
-#endif
-#if CONFIG_SERIAL_SAMSUNG_UARTS > 3
-	[3] = {
-		.port = {
-			.lock		= __PORT_LOCK_UNLOCKED(3),
-			.iotype		= UPIO_MEM,
-			.uartclk	= 0,
-			.fifosize	= 16,
-			.ops		= &s3c24xx_serial_ops,
-			.flags		= UPF_BOOT_AUTOCONF,
-			.line		= 3,
-		}
-	}
-#endif
-};
-#undef __PORT_LOCK_UNLOCKED
+static struct s3c24xx_uart_port s3c24xx_serial_ports[UART_NR];
+
+static void s3c24xx_serial_init_port_default(int index) {
+	struct uart_port *port = &s3c24xx_serial_ports[index].port;
+
+	spin_lock_init(&port->lock);
+
+	port->iotype = UPIO_MEM;
+	port->uartclk = 0;
+	port->fifosize = 16;
+	port->ops = &s3c24xx_serial_ops;
+	port->flags = UPF_BOOT_AUTOCONF;
+	port->line = index;
+}
 
 /* s3c24xx_serial_resetport
  *
@@ -2186,6 +2152,8 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
 	}
 	ourport = &s3c24xx_serial_ports[index];
 
+	s3c24xx_serial_init_port_default(index);
+
 	ourport->drv_data = s3c24xx_get_driver_data(pdev);
 	if (!ourport->drv_data) {
 		dev_err(&pdev->dev, "could not find driver data\n");
@@ -2584,7 +2552,7 @@ s3c24xx_serial_console_setup(struct console *co, char *options)
 
 	/* is this a valid port */
 
-	if (co->index == -1 || co->index >= CONFIG_SERIAL_SAMSUNG_UARTS)
+	if (co->index == -1 || co->index >= UART_NR)
 		co->index = 0;
 
 	port = &s3c24xx_serial_ports[co->index].port;
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2] tty: serial: samsung_tty: support more than 4 uart ports
@ 2022-06-29  0:55   ` Chanho Park
  0 siblings, 0 replies; 10+ messages in thread
From: Chanho Park @ 2022-06-29  0:55 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Greg Kroah-Hartman
  Cc: Jiri Slaby, Alim Akhtar, Hector Martin, Jaewon Kim,
	Vincent Whitchurch, linux-samsung-soc, linux-serial,
	linux-arm-kernel, Chanho Park

Regarding Exynos Auto v9 SoC, it supports uarts up to 12. However, the
maximum number of the ports has been derived from
CONFIG_SERIAL_SAMSUNG_UARTS and tightly coupled with the config for
previous Samsung SoCs such as s3c24xx and s3c64xx. To overcome this
limitation, this changes the usage of the definition to UART_NR which is
widely used from other serial drivers. This also defines the value to 12
only for ARM64 SoCs to not affect the change to previous arm32 SoCs.

Instead of enumerating all the ports as predefined arrays, this
introduces s3c24xx_serial_init_port_default that is initializing the
structure as the default value.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
---
Changes from v1:
- Remove initial value assignment of s3c24xx_serial_ports by assigning
  them dynamically as suggested by Greg and Krzysztof.

 drivers/tty/serial/samsung_tty.c | 82 ++++++++++----------------------
 1 file changed, 25 insertions(+), 57 deletions(-)

diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index 03ef4ff506fd..8971fbb49fa3 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -48,6 +48,12 @@
 #define S3C24XX_SERIAL_MAJOR	204
 #define S3C24XX_SERIAL_MINOR	64
 
+#ifdef CONFIG_ARM64
+#define UART_NR			12
+#else
+#define UART_NR			CONFIG_SERIAL_SAMSUNG_UARTS
+#endif
+
 #define S3C24XX_TX_PIO			1
 #define S3C24XX_TX_DMA			2
 #define S3C24XX_RX_PIO			1
@@ -87,7 +93,7 @@ struct s3c24xx_uart_info {
 struct s3c24xx_serial_drv_data {
 	const struct s3c24xx_uart_info	info;
 	const struct s3c2410_uartcfg	def_cfg;
-	const unsigned int		fifosize[CONFIG_SERIAL_SAMSUNG_UARTS];
+	const unsigned int		fifosize[UART_NR];
 };
 
 struct s3c24xx_uart_dma {
@@ -1810,67 +1816,27 @@ static const struct uart_ops apple_s5l_serial_ops = {
 static struct uart_driver s3c24xx_uart_drv = {
 	.owner		= THIS_MODULE,
 	.driver_name	= "s3c2410_serial",
-	.nr		= CONFIG_SERIAL_SAMSUNG_UARTS,
+	.nr		= UART_NR,
 	.cons		= S3C24XX_SERIAL_CONSOLE,
 	.dev_name	= S3C24XX_SERIAL_NAME,
 	.major		= S3C24XX_SERIAL_MAJOR,
 	.minor		= S3C24XX_SERIAL_MINOR,
 };
 
-#define __PORT_LOCK_UNLOCKED(i) \
-	__SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[i].port.lock)
-static struct s3c24xx_uart_port
-s3c24xx_serial_ports[CONFIG_SERIAL_SAMSUNG_UARTS] = {
-	[0] = {
-		.port = {
-			.lock		= __PORT_LOCK_UNLOCKED(0),
-			.iotype		= UPIO_MEM,
-			.uartclk	= 0,
-			.fifosize	= 16,
-			.ops		= &s3c24xx_serial_ops,
-			.flags		= UPF_BOOT_AUTOCONF,
-			.line		= 0,
-		}
-	},
-	[1] = {
-		.port = {
-			.lock		= __PORT_LOCK_UNLOCKED(1),
-			.iotype		= UPIO_MEM,
-			.uartclk	= 0,
-			.fifosize	= 16,
-			.ops		= &s3c24xx_serial_ops,
-			.flags		= UPF_BOOT_AUTOCONF,
-			.line		= 1,
-		}
-	},
-#if CONFIG_SERIAL_SAMSUNG_UARTS > 2
-	[2] = {
-		.port = {
-			.lock		= __PORT_LOCK_UNLOCKED(2),
-			.iotype		= UPIO_MEM,
-			.uartclk	= 0,
-			.fifosize	= 16,
-			.ops		= &s3c24xx_serial_ops,
-			.flags		= UPF_BOOT_AUTOCONF,
-			.line		= 2,
-		}
-	},
-#endif
-#if CONFIG_SERIAL_SAMSUNG_UARTS > 3
-	[3] = {
-		.port = {
-			.lock		= __PORT_LOCK_UNLOCKED(3),
-			.iotype		= UPIO_MEM,
-			.uartclk	= 0,
-			.fifosize	= 16,
-			.ops		= &s3c24xx_serial_ops,
-			.flags		= UPF_BOOT_AUTOCONF,
-			.line		= 3,
-		}
-	}
-#endif
-};
-#undef __PORT_LOCK_UNLOCKED
+static struct s3c24xx_uart_port s3c24xx_serial_ports[UART_NR];
+
+static void s3c24xx_serial_init_port_default(int index) {
+	struct uart_port *port = &s3c24xx_serial_ports[index].port;
+
+	spin_lock_init(&port->lock);
+
+	port->iotype = UPIO_MEM;
+	port->uartclk = 0;
+	port->fifosize = 16;
+	port->ops = &s3c24xx_serial_ops;
+	port->flags = UPF_BOOT_AUTOCONF;
+	port->line = index;
+}
 
 /* s3c24xx_serial_resetport
  *
@@ -2186,6 +2152,8 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
 	}
 	ourport = &s3c24xx_serial_ports[index];
 
+	s3c24xx_serial_init_port_default(index);
+
 	ourport->drv_data = s3c24xx_get_driver_data(pdev);
 	if (!ourport->drv_data) {
 		dev_err(&pdev->dev, "could not find driver data\n");
@@ -2584,7 +2552,7 @@ s3c24xx_serial_console_setup(struct console *co, char *options)
 
 	/* is this a valid port */
 
-	if (co->index == -1 || co->index >= CONFIG_SERIAL_SAMSUNG_UARTS)
+	if (co->index == -1 || co->index >= UART_NR)
 		co->index = 0;
 
 	port = &s3c24xx_serial_ports[co->index].port;
-- 
2.36.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] tty: serial: samsung_tty: support more than 4 uart ports
  2022-06-29  0:55   ` Chanho Park
@ 2022-06-29  7:30     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-29  7:30 UTC (permalink / raw)
  To: Chanho Park, Greg Kroah-Hartman
  Cc: Jiri Slaby, Alim Akhtar, Hector Martin, Jaewon Kim,
	Vincent Whitchurch, linux-samsung-soc, linux-serial,
	linux-arm-kernel

On 29/06/2022 02:55, Chanho Park wrote:
> Regarding Exynos Auto v9 SoC, it supports uarts up to 12. However, the
> maximum number of the ports has been derived from
> CONFIG_SERIAL_SAMSUNG_UARTS and tightly coupled with the config for
> previous Samsung SoCs such as s3c24xx and s3c64xx. To overcome this
> limitation, this changes the usage of the definition to UART_NR which is
> widely used from other serial drivers. This also defines the value to 12
> only for ARM64 SoCs to not affect the change to previous arm32 SoCs.
> 
> Instead of enumerating all the ports as predefined arrays, this
> introduces s3c24xx_serial_init_port_default that is initializing the
> structure as the default value.
> 
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>
> ---


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] tty: serial: samsung_tty: support more than 4 uart ports
@ 2022-06-29  7:30     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-29  7:30 UTC (permalink / raw)
  To: Chanho Park, Greg Kroah-Hartman
  Cc: Jiri Slaby, Alim Akhtar, Hector Martin, Jaewon Kim,
	Vincent Whitchurch, linux-samsung-soc, linux-serial,
	linux-arm-kernel

On 29/06/2022 02:55, Chanho Park wrote:
> Regarding Exynos Auto v9 SoC, it supports uarts up to 12. However, the
> maximum number of the ports has been derived from
> CONFIG_SERIAL_SAMSUNG_UARTS and tightly coupled with the config for
> previous Samsung SoCs such as s3c24xx and s3c64xx. To overcome this
> limitation, this changes the usage of the definition to UART_NR which is
> widely used from other serial drivers. This also defines the value to 12
> only for ARM64 SoCs to not affect the change to previous arm32 SoCs.
> 
> Instead of enumerating all the ports as predefined arrays, this
> introduces s3c24xx_serial_init_port_default that is initializing the
> structure as the default value.
> 
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>
> ---


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] tty: serial: samsung_tty: support more than 4 uart ports
  2022-06-29  0:55   ` Chanho Park
@ 2022-06-29 11:13     ` Hector Martin
  -1 siblings, 0 replies; 10+ messages in thread
From: Hector Martin @ 2022-06-29 11:13 UTC (permalink / raw)
  To: Chanho Park, Krzysztof Kozlowski, Greg Kroah-Hartman
  Cc: Jiri Slaby, Alim Akhtar, Jaewon Kim, Vincent Whitchurch,
	linux-samsung-soc, linux-serial, linux-arm-kernel

On 29/06/2022 09.55, Chanho Park wrote:
> Regarding Exynos Auto v9 SoC, it supports uarts up to 12. However, the
> maximum number of the ports has been derived from
> CONFIG_SERIAL_SAMSUNG_UARTS and tightly coupled with the config for
> previous Samsung SoCs such as s3c24xx and s3c64xx. To overcome this
> limitation, this changes the usage of the definition to UART_NR which is
> widely used from other serial drivers. This also defines the value to 12
> only for ARM64 SoCs to not affect the change to previous arm32 SoCs.
> 
> Instead of enumerating all the ports as predefined arrays, this
> introduces s3c24xx_serial_init_port_default that is initializing the
> structure as the default value.
> 
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>

Reviewed-by: Hector Martin <marcan@marcan.st>

-- 
Hector Martin (marcan@marcan.st)
Public Key: https://mrcn.st/pub

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] tty: serial: samsung_tty: support more than 4 uart ports
@ 2022-06-29 11:13     ` Hector Martin
  0 siblings, 0 replies; 10+ messages in thread
From: Hector Martin @ 2022-06-29 11:13 UTC (permalink / raw)
  To: Chanho Park, Krzysztof Kozlowski, Greg Kroah-Hartman
  Cc: Jiri Slaby, Alim Akhtar, Jaewon Kim, Vincent Whitchurch,
	linux-samsung-soc, linux-serial, linux-arm-kernel

On 29/06/2022 09.55, Chanho Park wrote:
> Regarding Exynos Auto v9 SoC, it supports uarts up to 12. However, the
> maximum number of the ports has been derived from
> CONFIG_SERIAL_SAMSUNG_UARTS and tightly coupled with the config for
> previous Samsung SoCs such as s3c24xx and s3c64xx. To overcome this
> limitation, this changes the usage of the definition to UART_NR which is
> widely used from other serial drivers. This also defines the value to 12
> only for ARM64 SoCs to not affect the change to previous arm32 SoCs.
> 
> Instead of enumerating all the ports as predefined arrays, this
> introduces s3c24xx_serial_init_port_default that is initializing the
> structure as the default value.
> 
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>

Reviewed-by: Hector Martin <marcan@marcan.st>

-- 
Hector Martin (marcan@marcan.st)
Public Key: https://mrcn.st/pub

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] tty: serial: samsung_tty: support more than 4 uart ports
  2022-06-29  0:55   ` Chanho Park
@ 2022-07-04  7:40     ` Jiri Slaby
  -1 siblings, 0 replies; 10+ messages in thread
From: Jiri Slaby @ 2022-07-04  7:40 UTC (permalink / raw)
  To: Chanho Park, Krzysztof Kozlowski, Greg Kroah-Hartman
  Cc: Alim Akhtar, Hector Martin, Jaewon Kim, Vincent Whitchurch,
	linux-samsung-soc, linux-serial, linux-arm-kernel

On 29. 06. 22, 2:55, Chanho Park wrote:
> Regarding Exynos Auto v9 SoC, it supports uarts up to 12. However, the
> maximum number of the ports has been derived from
> CONFIG_SERIAL_SAMSUNG_UARTS and tightly coupled with the config for
> previous Samsung SoCs such as s3c24xx and s3c64xx. To overcome this
> limitation, this changes the usage of the definition to UART_NR which is
> widely used from other serial drivers. This also defines the value to 12
> only for ARM64 SoCs to not affect the change to previous arm32 SoCs.
> 
> Instead of enumerating all the ports as predefined arrays, this
> introduces s3c24xx_serial_init_port_default that is initializing the
> structure as the default value.
...
> --- a/drivers/tty/serial/samsung_tty.c
> +++ b/drivers/tty/serial/samsung_tty.c
...
> @@ -1810,67 +1816,27 @@ static const struct uart_ops apple_s5l_serial_ops = {
...
> +static struct s3c24xx_uart_port s3c24xx_serial_ports[UART_NR];
> +
> +static void s3c24xx_serial_init_port_default(int index) {

The opening brace should be on a separate line.

> +	struct uart_port *port = &s3c24xx_serial_ports[index].port;
> +
> +	spin_lock_init(&port->lock);
> +
> +	port->iotype = UPIO_MEM;
> +	port->uartclk = 0;
> +	port->fifosize = 16;
> +	port->ops = &s3c24xx_serial_ops;
> +	port->flags = UPF_BOOT_AUTOCONF;
> +	port->line = index;
> +}
>   
>   /* s3c24xx_serial_resetport
>    *
> @@ -2186,6 +2152,8 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
>   	}
>   	ourport = &s3c24xx_serial_ports[index];
>   
> +	s3c24xx_serial_init_port_default(index);

Perhaps pass &ourport->port to the function too -- you'd save the 
refetch there.

thanks,
-- 
js
suse labs

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] tty: serial: samsung_tty: support more than 4 uart ports
@ 2022-07-04  7:40     ` Jiri Slaby
  0 siblings, 0 replies; 10+ messages in thread
From: Jiri Slaby @ 2022-07-04  7:40 UTC (permalink / raw)
  To: Chanho Park, Krzysztof Kozlowski, Greg Kroah-Hartman
  Cc: Alim Akhtar, Hector Martin, Jaewon Kim, Vincent Whitchurch,
	linux-samsung-soc, linux-serial, linux-arm-kernel

On 29. 06. 22, 2:55, Chanho Park wrote:
> Regarding Exynos Auto v9 SoC, it supports uarts up to 12. However, the
> maximum number of the ports has been derived from
> CONFIG_SERIAL_SAMSUNG_UARTS and tightly coupled with the config for
> previous Samsung SoCs such as s3c24xx and s3c64xx. To overcome this
> limitation, this changes the usage of the definition to UART_NR which is
> widely used from other serial drivers. This also defines the value to 12
> only for ARM64 SoCs to not affect the change to previous arm32 SoCs.
> 
> Instead of enumerating all the ports as predefined arrays, this
> introduces s3c24xx_serial_init_port_default that is initializing the
> structure as the default value.
...
> --- a/drivers/tty/serial/samsung_tty.c
> +++ b/drivers/tty/serial/samsung_tty.c
...
> @@ -1810,67 +1816,27 @@ static const struct uart_ops apple_s5l_serial_ops = {
...
> +static struct s3c24xx_uart_port s3c24xx_serial_ports[UART_NR];
> +
> +static void s3c24xx_serial_init_port_default(int index) {

The opening brace should be on a separate line.

> +	struct uart_port *port = &s3c24xx_serial_ports[index].port;
> +
> +	spin_lock_init(&port->lock);
> +
> +	port->iotype = UPIO_MEM;
> +	port->uartclk = 0;
> +	port->fifosize = 16;
> +	port->ops = &s3c24xx_serial_ops;
> +	port->flags = UPF_BOOT_AUTOCONF;
> +	port->line = index;
> +}
>   
>   /* s3c24xx_serial_resetport
>    *
> @@ -2186,6 +2152,8 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
>   	}
>   	ourport = &s3c24xx_serial_ports[index];
>   
> +	s3c24xx_serial_init_port_default(index);

Perhaps pass &ourport->port to the function too -- you'd save the 
refetch there.

thanks,
-- 
js
suse labs

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v2] tty: serial: samsung_tty: support more than 4 uart ports
  2022-07-04  7:40     ` Jiri Slaby
@ 2022-07-04  8:11       ` Chanho Park
  -1 siblings, 0 replies; 10+ messages in thread
From: Chanho Park @ 2022-07-04  8:11 UTC (permalink / raw)
  To: 'Jiri Slaby', 'Krzysztof Kozlowski',
	'Greg Kroah-Hartman'
  Cc: 'Alim Akhtar', 'Hector Martin',
	'Jaewon Kim', 'Vincent Whitchurch',
	linux-samsung-soc, linux-serial, linux-arm-kernel

> > --- a/drivers/tty/serial/samsung_tty.c
> > +++ b/drivers/tty/serial/samsung_tty.c
> ...
> > @@ -1810,67 +1816,27 @@ static const struct uart_ops
> > apple_s5l_serial_ops = {
> ...
> > +static struct s3c24xx_uart_port s3c24xx_serial_ports[UART_NR];
> > +
> > +static void s3c24xx_serial_init_port_default(int index) {
> 
> The opening brace should be on a separate line.

Oh, I missed this. Thanks for your review.
I'll make a separate patch to fix this.

> 
> > +	struct uart_port *port = &s3c24xx_serial_ports[index].port;
> > +
> > +	spin_lock_init(&port->lock);
> > +
> > +	port->iotype = UPIO_MEM;
> > +	port->uartclk = 0;
> > +	port->fifosize = 16;
> > +	port->ops = &s3c24xx_serial_ops;
> > +	port->flags = UPF_BOOT_AUTOCONF;
> > +	port->line = index;
> > +}
> >
> >   /* s3c24xx_serial_resetport
> >    *
> > @@ -2186,6 +2152,8 @@ static int s3c24xx_serial_probe(struct
> platform_device *pdev)
> >   	}
> >   	ourport = &s3c24xx_serial_ports[index];
> >
> > +	s3c24xx_serial_init_port_default(index);
> 
> Perhaps pass &ourport->port to the function too -- you'd save the refetch
> there.

&ourport->port will be retrieved by index in the s3c24xx_serial_init_port_default.
Why do I need to pass it?

+	struct uart_port *port = &s3c24xx_serial_ports[index].port;

Best Regards,
Chanho Park


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v2] tty: serial: samsung_tty: support more than 4 uart ports
@ 2022-07-04  8:11       ` Chanho Park
  0 siblings, 0 replies; 10+ messages in thread
From: Chanho Park @ 2022-07-04  8:11 UTC (permalink / raw)
  To: 'Jiri Slaby', 'Krzysztof Kozlowski',
	'Greg Kroah-Hartman'
  Cc: 'Alim Akhtar', 'Hector Martin',
	'Jaewon Kim', 'Vincent Whitchurch',
	linux-samsung-soc, linux-serial, linux-arm-kernel

> > --- a/drivers/tty/serial/samsung_tty.c
> > +++ b/drivers/tty/serial/samsung_tty.c
> ...
> > @@ -1810,67 +1816,27 @@ static const struct uart_ops
> > apple_s5l_serial_ops = {
> ...
> > +static struct s3c24xx_uart_port s3c24xx_serial_ports[UART_NR];
> > +
> > +static void s3c24xx_serial_init_port_default(int index) {
> 
> The opening brace should be on a separate line.

Oh, I missed this. Thanks for your review.
I'll make a separate patch to fix this.

> 
> > +	struct uart_port *port = &s3c24xx_serial_ports[index].port;
> > +
> > +	spin_lock_init(&port->lock);
> > +
> > +	port->iotype = UPIO_MEM;
> > +	port->uartclk = 0;
> > +	port->fifosize = 16;
> > +	port->ops = &s3c24xx_serial_ops;
> > +	port->flags = UPF_BOOT_AUTOCONF;
> > +	port->line = index;
> > +}
> >
> >   /* s3c24xx_serial_resetport
> >    *
> > @@ -2186,6 +2152,8 @@ static int s3c24xx_serial_probe(struct
> platform_device *pdev)
> >   	}
> >   	ourport = &s3c24xx_serial_ports[index];
> >
> > +	s3c24xx_serial_init_port_default(index);
> 
> Perhaps pass &ourport->port to the function too -- you'd save the refetch
> there.

&ourport->port will be retrieved by index in the s3c24xx_serial_init_port_default.
Why do I need to pass it?

+	struct uart_port *port = &s3c24xx_serial_ports[index].port;

Best Regards,
Chanho Park


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-07-04  8:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20220629005750epcas2p418cd79922d1b3f13eda761ee3fcd3e17@epcas2p4.samsung.com>
2022-06-29  0:55 ` [PATCH v2] tty: serial: samsung_tty: support more than 4 uart ports Chanho Park
2022-06-29  0:55   ` Chanho Park
2022-06-29  7:30   ` Krzysztof Kozlowski
2022-06-29  7:30     ` Krzysztof Kozlowski
2022-06-29 11:13   ` Hector Martin
2022-06-29 11:13     ` Hector Martin
2022-07-04  7:40   ` Jiri Slaby
2022-07-04  7:40     ` Jiri Slaby
2022-07-04  8:11     ` Chanho Park
2022-07-04  8:11       ` Chanho Park

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.