[PATCH 6/7] serial: max310x: add macro for max number of ports

Hugo Villeneuve posted 7 patches 2 years ago
[PATCH 6/7] serial: max310x: add macro for max number of ports
Posted by Hugo Villeneuve 2 years ago
From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

Add macro to hold the maximum number of UART ports per IC/device.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
 drivers/tty/serial/max310x.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index f3a99daebdaa..58dd5cc62014 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -30,6 +30,7 @@
 #define MAX310X_MAJOR			204
 #define MAX310X_MINOR			209
 #define MAX310X_UART_NRMAX		16
+#define MAX310X_MAX_PORTS		4 /* Maximum number of UART ports per IC. */
 
 /* MAX310X register definitions */
 #define MAX310X_RHR_REG			(0x00) /* RX FIFO */
@@ -1502,7 +1503,7 @@ static const struct max310x_if_cfg __maybe_unused max310x_spi_if_cfg = {
 static int max310x_spi_probe(struct spi_device *spi)
 {
 	const struct max310x_devtype *devtype;
-	struct regmap *regmaps[4];
+	struct regmap *regmaps[MAX310X_MAX_PORTS];
 	unsigned int i;
 	int ret;
 
@@ -1605,7 +1606,7 @@ static int max310x_i2c_probe(struct i2c_client *client)
 	const struct max310x_devtype *devtype =
 			device_get_match_data(&client->dev);
 	struct i2c_client *port_client;
-	struct regmap *regmaps[4];
+	struct regmap *regmaps[MAX310X_MAX_PORTS];
 	unsigned int i;
 	u8 port_addr;
 
-- 
2.39.2
Re: [PATCH 6/7] serial: max310x: add macro for max number of ports
Posted by Jan Kundrát 2 years ago
On čtvrtek 30. listopadu 2023 20:10:48 CET, Hugo Villeneuve wrote:
> From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
>
> Add macro to hold the maximum number of UART ports per IC/device.
>
> Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>

Reviewed-by: Jan Kundrát <jan.kundrat@cesnet.cz>
Tested-by: Jan Kundrát <jan.kundrat@cesnet.cz>

> ---
>  drivers/tty/serial/max310x.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
> index f3a99daebdaa..58dd5cc62014 100644
> --- a/drivers/tty/serial/max310x.c
> +++ b/drivers/tty/serial/max310x.c
> @@ -30,6 +30,7 @@
>  #define MAX310X_MAJOR			204
>  #define MAX310X_MINOR			209
>  #define MAX310X_UART_NRMAX		16
> +#define MAX310X_MAX_PORTS		4 /* Maximum number of UART ports per IC. */
>  
>  /* MAX310X register definitions */
>  #define MAX310X_RHR_REG			(0x00) /* RX FIFO */
> @@ -1502,7 +1503,7 @@ static const struct max310x_if_cfg 
> __maybe_unused max310x_spi_if_cfg = {
>  static int max310x_spi_probe(struct spi_device *spi)
>  {
>  	const struct max310x_devtype *devtype;
> -	struct regmap *regmaps[4];
> +	struct regmap *regmaps[MAX310X_MAX_PORTS];
>  	unsigned int i;
>  	int ret;
>  
> @@ -1605,7 +1606,7 @@ static int max310x_i2c_probe(struct 
> i2c_client *client)
>  	const struct max310x_devtype *devtype =
>  			device_get_match_data(&client->dev);
>  	struct i2c_client *port_client;
> -	struct regmap *regmaps[4];
> +	struct regmap *regmaps[MAX310X_MAX_PORTS];
>  	unsigned int i;
>  	u8 port_addr;
>