All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style
@ 2024-04-19 14:17 Parker Newman
  2024-04-19 14:17 ` [PATCH v2 1/4] serial: exar: add missing kernel doc function parameters Parker Newman
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Parker Newman @ 2024-04-19 14:17 UTC (permalink / raw
  To: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-serial
  Cc: Ilpo Järvinen, Parker Newman

From: Parker Newman <pnewman@connecttech.com>

This is a series of small patches fixing kbuilds error and code style
issues based on feedback during review of main patches.

Original patches thread:
Link: https://lore.kernel.org/linux-serial/cover.1713382717.git.pnewman@connecttech.com/

Parker Newman (4):
  serial: exar: add missing kernel doc function parameters
  serial: exar: use return dev_err_probe instead of returning error code
  serial: exar: return bool from exar_ee_read_bit()
  serial: exar: remove ternaries from
    cti_get_port_type_xr17c15x_xr17v25x()

 drivers/tty/serial/8250/8250_exar.c | 36 ++++++++++++++---------------
 1 file changed, 18 insertions(+), 18 deletions(-)


base-commit: c6795fbffc4547b40933ec368200bd4926a41b44
--
2.43.2


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

* [PATCH v2 1/4] serial: exar: add missing kernel doc function parameters
  2024-04-19 14:17 [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style Parker Newman
@ 2024-04-19 14:17 ` Parker Newman
  2024-04-19 14:17 ` [PATCH v2 2/4] serial: exar: use return dev_err_probe instead of returning error code Parker Newman
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Parker Newman @ 2024-04-19 14:17 UTC (permalink / raw
  To: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-serial
  Cc: Ilpo Järvinen, Parker Newman, kernel test robot

From: Parker Newman <pnewman@connecttech.com>

Adds missing kernel doc function parameters to 3 functions.

Reported-by: kernel test robot <lkp@intel.com>
Closes:
https://lore.kernel.org/oe-kbuild-all/202404181353.1VIC4cz9-lkp@intel.com/

Signed-off-by: Parker Newman <pnewman@connecttech.com>
---
 drivers/tty/serial/8250/8250_exar.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
index 5e42558cbb01..a180741da634 100644
--- a/drivers/tty/serial/8250/8250_exar.c
+++ b/drivers/tty/serial/8250/8250_exar.c
@@ -715,6 +715,7 @@ static int cti_read_osc_freq(struct exar8250 *priv, u8 eeprom_offset)
 /**
  * cti_get_port_type_xr17c15x_xr17v25x() - Get port type of xr17c15x/xr17v25x
  * @priv: Device's private structure
+ * @pcidev: PCI device pointer
  * @port_num: Port to get type of
  *
  * CTI xr17c15x and xr17v25x based cards port types are based on PCI IDs.
@@ -807,6 +808,7 @@ static enum cti_port_type cti_get_port_type_xr17c15x_xr17v25x(struct exar8250 *p
 /**
  * cti_get_port_type_fpga() - Get the port type of a CTI FPGA card
  * @priv: Device's private structure
+ * @pcidev: PCI device pointer
  * @port_num: Port to get type of
  *
  * FPGA based cards port types are based on PCI IDs.
@@ -836,6 +838,7 @@ static enum cti_port_type cti_get_port_type_fpga(struct exar8250 *priv,
 /**
  * cti_get_port_type_xr17v35x() - Read port type from the EEPROM
  * @priv: Device's private structure
+ * @pcidev: PCI device pointer
  * @port_num: port offset
  *
  * CTI XR17V35X based cards have the port types stored in the EEPROM.
--
2.43.2


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

* [PATCH v2 2/4] serial: exar: use return dev_err_probe instead of returning error code
  2024-04-19 14:17 [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style Parker Newman
  2024-04-19 14:17 ` [PATCH v2 1/4] serial: exar: add missing kernel doc function parameters Parker Newman
@ 2024-04-19 14:17 ` Parker Newman
  2024-04-19 14:17 ` [PATCH v2 3/4] serial: exar: return bool from exar_ee_read_bit() Parker Newman
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Parker Newman @ 2024-04-19 14:17 UTC (permalink / raw
  To: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-serial
  Cc: Ilpo Järvinen, Parker Newman

From: Parker Newman <pnewman@connecttech.com>

Change to returning dev_err_probe() instead of returning the error code
after calling dev_err_probe().

Signed-off-by: Parker Newman <pnewman@connecttech.com>
---
 drivers/tty/serial/8250/8250_exar.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
index a180741da634..01748ddbf729 100644
--- a/drivers/tty/serial/8250/8250_exar.c
+++ b/drivers/tty/serial/8250/8250_exar.c
@@ -1551,9 +1551,8 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)

 	nr_ports = exar_get_nr_ports(board, pcidev);
 	if (nr_ports == 0) {
-		dev_err_probe(&pcidev->dev, -ENODEV,
+		return dev_err_probe(&pcidev->dev, -ENODEV,
 				"failed to get number of ports\n");
-		return -ENODEV;
 	}

 	priv = devm_kzalloc(&pcidev->dev, struct_size(priv, line, nr_ports), GFP_KERNEL);
@@ -1587,9 +1586,8 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
 	if (board->board_init) {
 		rc = board->board_init(priv, pcidev);
 		if (rc) {
-			dev_err_probe(&pcidev->dev, rc,
+			return dev_err_probe(&pcidev->dev, rc,
 					"failed to init serial board\n");
-			return rc;
 		}
 	}

--
2.43.2


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

* [PATCH v2 3/4] serial: exar: return bool from exar_ee_read_bit()
  2024-04-19 14:17 [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style Parker Newman
  2024-04-19 14:17 ` [PATCH v2 1/4] serial: exar: add missing kernel doc function parameters Parker Newman
  2024-04-19 14:17 ` [PATCH v2 2/4] serial: exar: use return dev_err_probe instead of returning error code Parker Newman
@ 2024-04-19 14:17 ` Parker Newman
  2024-04-19 14:17 ` [PATCH v2 4/4] serial: exar: remove ternaries from cti_get_port_type_xr17c15x_xr17v25x() Parker Newman
  2024-05-02 16:18 ` [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style Parker Newman
  4 siblings, 0 replies; 8+ messages in thread
From: Parker Newman @ 2024-04-19 14:17 UTC (permalink / raw
  To: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-serial
  Cc: Ilpo Järvinen, Parker Newman

From: Parker Newman <pnewman@connecttech.com>

Change exar_ee_read_bit() to return a bool instead of u8. Removed need
for ternary or if/else for return value.

Signed-off-by: Parker Newman <pnewman@connecttech.com>
---
Changes in v2:
- Change exar_ee_read_bit() to return a bool

 drivers/tty/serial/8250/8250_exar.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
index 01748ddbf729..8665d3b7b673 100644
--- a/drivers/tty/serial/8250/8250_exar.c
+++ b/drivers/tty/serial/8250/8250_exar.c
@@ -300,7 +300,7 @@ static inline void exar_ee_write_bit(struct exar8250 *priv, int bit)
 	udelay(2);
 }

-static inline u8 exar_ee_read_bit(struct exar8250 *priv)
+static inline bool exar_ee_read_bit(struct exar8250 *priv)
 {
 	u8 regb;
 	u8 value = UART_EXAR_REGB_EECS;
@@ -317,7 +317,7 @@ static inline u8 exar_ee_read_bit(struct exar8250 *priv)

 	regb = exar_read_reg(priv, UART_EXAR_REGB);

-	return (regb & UART_EXAR_REGB_EEDO ? 1 : 0);
+	return regb & UART_EXAR_REGB_EEDO;
 }

 /**
--
2.43.2


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

* [PATCH v2 4/4] serial: exar: remove ternaries from cti_get_port_type_xr17c15x_xr17v25x()
  2024-04-19 14:17 [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style Parker Newman
                   ` (2 preceding siblings ...)
  2024-04-19 14:17 ` [PATCH v2 3/4] serial: exar: return bool from exar_ee_read_bit() Parker Newman
@ 2024-04-19 14:17 ` Parker Newman
  2024-04-22  6:34   ` Jiri Slaby
  2024-05-02 16:18 ` [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style Parker Newman
  4 siblings, 1 reply; 8+ messages in thread
From: Parker Newman @ 2024-04-19 14:17 UTC (permalink / raw
  To: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-serial
  Cc: Ilpo Järvinen, Parker Newman

From: Parker Newman <pnewman@connecttech.com>

Remove ternary operators from cti_get_port_type_xr17c15x_xr17v25x() for
better readability.

Signed-off-by: Parker Newman <pnewman@connecttech.com>
---
Changes in v2:
- Removed ternary operators completely

 drivers/tty/serial/8250/8250_exar.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
index 8665d3b7b673..521d2acf4004 100644
--- a/drivers/tty/serial/8250/8250_exar.c
+++ b/drivers/tty/serial/8250/8250_exar.c
@@ -726,7 +726,7 @@ static enum cti_port_type cti_get_port_type_xr17c15x_xr17v25x(struct exar8250 *p
 							struct pci_dev *pcidev,
 							unsigned int port_num)
 {
-	enum cti_port_type port_type;
+	enum cti_port_type port_type = CTI_PORT_TYPE_RS232;

 	switch (pcidev->subsystem_device) {
 	// RS232 only cards
@@ -737,23 +737,22 @@ static enum cti_port_type cti_get_port_type_xr17c15x_xr17v25x(struct exar8250 *p
 	case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_SP_232_NS:
 	case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_XPRS_LP_232:
 	case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_XPRS_LP_232_NS:
-		port_type = CTI_PORT_TYPE_RS232;
 		break;
 	// 1x RS232, 1x RS422/RS485
 	case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1:
-		port_type = (port_num == 0) ?
-			CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485;
+		if (port_num)
+			port_type = CTI_PORT_TYPE_RS422_485;
 		break;
 	// 2x RS232, 2x RS422/RS485
 	case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2:
-		port_type = (port_num < 2) ?
-			CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485;
+		if (port_num > 1)
+			port_type = CTI_PORT_TYPE_RS422_485;
 		break;
 	// 4x RS232, 4x RS422/RS485
 	case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4:
 	case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4_SP:
-		port_type = (port_num < 4) ?
-			CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485;
+		if (port_num > 3)
+			port_type = CTI_PORT_TYPE_RS422_485;
 		break;
 	// RS232/RS422/RS485 HW (jumper) selectable
 	case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2:
@@ -789,13 +788,13 @@ static enum cti_port_type cti_get_port_type_xr17c15x_xr17v25x(struct exar8250 *p
 		break;
 	// 6x RS232, 2x RS422/RS485
 	case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_6_2_SP:
-		port_type = (port_num < 6) ?
-			CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485;
+		if (port_num > 5)
+			port_type = CTI_PORT_TYPE_RS422_485;
 		break;
 	// 2x RS232, 6x RS422/RS485
 	case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_6_SP:
-		port_type = (port_num < 2) ?
-			CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485;
+		if (port_num > 1)
+			port_type = CTI_PORT_TYPE_RS422_485;
 		break;
 	default:
 		dev_err(&pcidev->dev, "unknown/unsupported device\n");
--
2.43.2


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

* Re: [PATCH v2 4/4] serial: exar: remove ternaries from cti_get_port_type_xr17c15x_xr17v25x()
  2024-04-19 14:17 ` [PATCH v2 4/4] serial: exar: remove ternaries from cti_get_port_type_xr17c15x_xr17v25x() Parker Newman
@ 2024-04-22  6:34   ` Jiri Slaby
  0 siblings, 0 replies; 8+ messages in thread
From: Jiri Slaby @ 2024-04-22  6:34 UTC (permalink / raw
  To: Parker Newman, Greg Kroah-Hartman, linux-kernel, linux-serial
  Cc: Ilpo Järvinen, Parker Newman

On 19. 04. 24, 16:17, Parker Newman wrote:
> From: Parker Newman <pnewman@connecttech.com>
> 
> Remove ternary operators from cti_get_port_type_xr17c15x_xr17v25x() for
> better readability.
> 
> Signed-off-by: Parker Newman <pnewman@connecttech.com>

Much better.

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

> --- a/drivers/tty/serial/8250/8250_exar.c
> +++ b/drivers/tty/serial/8250/8250_exar.c
> @@ -726,7 +726,7 @@ static enum cti_port_type cti_get_port_type_xr17c15x_xr17v25x(struct exar8250 *p
>   							struct pci_dev *pcidev,
>   							unsigned int port_num)
>   {
> -	enum cti_port_type port_type;
> +	enum cti_port_type port_type = CTI_PORT_TYPE_RS232;
> 
>   	switch (pcidev->subsystem_device) {
>   	// RS232 only cards

Unrelated to this one, but // comments are discouraged in the kernel, IMO?

thanks,
-- 
js
suse labs


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

* Re: [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style
  2024-04-19 14:17 [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style Parker Newman
                   ` (3 preceding siblings ...)
  2024-04-19 14:17 ` [PATCH v2 4/4] serial: exar: remove ternaries from cti_get_port_type_xr17c15x_xr17v25x() Parker Newman
@ 2024-05-02 16:18 ` Parker Newman
  2024-05-04 16:01   ` Greg Kroah-Hartman
  4 siblings, 1 reply; 8+ messages in thread
From: Parker Newman @ 2024-05-02 16:18 UTC (permalink / raw
  To: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-serial
  Cc: Ilpo Järvinen, Parker Newman

On Fri, 19 Apr 2024 10:17:00 -0400
Parker Newman <parker@finest.io> wrote:

> From: Parker Newman <pnewman@connecttech.com>
>
> This is a series of small patches fixing kbuilds error and code style
> issues based on feedback during review of main patches.
>
> Original patches thread:
> Link: https://lore.kernel.org/linux-serial/cover.1713382717.git.pnewman@connecttech.com/
>

These patches should not be required anymore. Andy Shevchenko has
submitted a more comprehensive clean up patch set that makes this
set unneeded.

Link: https://lore.kernel.org/linux-serial/20240502144626.2716994-1-andriy.shevchenko@linux.intel.com/

Thanks,
Parker

> Parker Newman (4):
>   serial: exar: add missing kernel doc function parameters
>   serial: exar: use return dev_err_probe instead of returning error code
>   serial: exar: return bool from exar_ee_read_bit()
>   serial: exar: remove ternaries from
>     cti_get_port_type_xr17c15x_xr17v25x()
>
>  drivers/tty/serial/8250/8250_exar.c | 36 ++++++++++++++---------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
>
>
> base-commit: c6795fbffc4547b40933ec368200bd4926a41b44
> --
> 2.43.2
>


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

* Re: [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style
  2024-05-02 16:18 ` [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style Parker Newman
@ 2024-05-04 16:01   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2024-05-04 16:01 UTC (permalink / raw
  To: Parker Newman
  Cc: Jiri Slaby, linux-kernel, linux-serial, Ilpo Järvinen,
	Parker Newman

On Thu, May 02, 2024 at 12:18:09PM -0400, Parker Newman wrote:
> On Fri, 19 Apr 2024 10:17:00 -0400
> Parker Newman <parker@finest.io> wrote:
> 
> > From: Parker Newman <pnewman@connecttech.com>
> >
> > This is a series of small patches fixing kbuilds error and code style
> > issues based on feedback during review of main patches.
> >
> > Original patches thread:
> > Link: https://lore.kernel.org/linux-serial/cover.1713382717.git.pnewman@connecttech.com/
> >
> 
> These patches should not be required anymore. Andy Shevchenko has
> submitted a more comprehensive clean up patch set that makes this
> set unneeded.
> 
> Link: https://lore.kernel.org/linux-serial/20240502144626.2716994-1-andriy.shevchenko@linux.intel.com/

Thanks for letting me know, now dropped.

greg k-h

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

end of thread, other threads:[~2024-05-04 16:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-19 14:17 [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style Parker Newman
2024-04-19 14:17 ` [PATCH v2 1/4] serial: exar: add missing kernel doc function parameters Parker Newman
2024-04-19 14:17 ` [PATCH v2 2/4] serial: exar: use return dev_err_probe instead of returning error code Parker Newman
2024-04-19 14:17 ` [PATCH v2 3/4] serial: exar: return bool from exar_ee_read_bit() Parker Newman
2024-04-19 14:17 ` [PATCH v2 4/4] serial: exar: remove ternaries from cti_get_port_type_xr17c15x_xr17v25x() Parker Newman
2024-04-22  6:34   ` Jiri Slaby
2024-05-02 16:18 ` [PATCH v2 0/4] serial: exar: fix kbuild warnings and code style Parker Newman
2024-05-04 16:01   ` Greg Kroah-Hartman

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.