From: Parker Newman <parker@finest.io>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
"Parker Newman" <pnewman@connecttech.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: Re: [PATCH v1 4/4] serial: exar: change port_type ternary line wrapping
Date: Fri, 19 Apr 2024 08:17:27 -0400 [thread overview]
Message-ID: <20240419081727.435437d0@SWDEV2.connecttech.local> (raw)
In-Reply-To: <379d43bd-d5eb-4877-8781-888c82821bb8@kernel.org>
On Fri, 19 Apr 2024 08:07:50 +0200
Jiri Slaby <jirislaby@kernel.org> wrote:
> On 18. 04. 24, 17:36, Parker Newman wrote:
> > From: Parker Newman <pnewman@connecttech.com>
> >
> > Change line wrapping of ternary operators in
> > cti_get_port_type_xr17c15x_xr17v25x() for better readability.
> >
> > Old example:
> >
> > port_type = port_num == 0 ?
> > CTI_PORT_TYPE_RS232 : CTI_PORT_TYPE_RS422_485;
> >
> > New:
> > port_type = port_num == 0 ? CTI_PORT_TYPE_RS232 :
> > CTI_PORT_TYPE_RS422_485;
>
> This is worse IMO. Ilpo suggested a bit different alignment. But still...
>
> > Based on feedback from:
> > Link: https://lore.kernel.org/linux-serial/f2353b8c-2079-b895-2707-f6be83161288@linux.intel.com
>
> You should have CCed the author.
>
> > Signed-off-by: Parker Newman <pnewman@connecttech.com>
> > ---
> > drivers/tty/serial/8250/8250_exar.c | 20 ++++++++++----------
> > 1 file changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
> > index 10725ad0f3ef..a76b4e5bab4e 100644
> > --- a/drivers/tty/serial/8250/8250_exar.c
> > +++ b/drivers/tty/serial/8250/8250_exar.c
> > @@ -741,19 +741,19 @@ static enum cti_port_type cti_get_port_type_xr17c15x_xr17v25x(struct exar8250 *p
> > 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;
> > + port_type = port_num == 0 ? CTI_PORT_TYPE_RS232 :
> > + CTI_PORT_TYPE_RS422_485;
>
>
> Well, could you initialize port_type = CTI_PORT_TYPE_RS232? And here do
> only:
> if (port_num > 0)
> return CTI_PORT_TYPE_RS422_485;
> ?
>
I like this idea I will move to that. Thanks.
>
> > 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;
> > + port_type = port_num < 2 ? CTI_PORT_TYPE_RS232 :
> > + CTI_PORT_TYPE_RS422_485;
>
> And so on.
>
> > 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;
> > + port_type = port_num < 4 ? CTI_PORT_TYPE_RS232 :
> > + CTI_PORT_TYPE_RS422_485;
> > break;
> > // RS232/RS422/RS485 HW (jumper) selectable
> > case PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2:
> > @@ -789,13 +789,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;
> > + port_type = port_num < 6 ? CTI_PORT_TYPE_RS232 :
> > + 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;
> > + port_type = port_num < 2 ? CTI_PORT_TYPE_RS232 :
> > + CTI_PORT_TYPE_RS422_485;
> > break;
> > default:
> > dev_err(&pcidev->dev, "unknown/unsupported device\n");
> > --
> > 2.43.2
> >
>
next prev parent reply other threads:[~2024-04-19 12:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 15:36 [PATCH v1 0/4] serial: exar: fix kbuild warnings and code style Parker Newman
2024-04-18 15:36 ` [PATCH v1 1/4] serial: exar: add missing kernel doc function parameters Parker Newman
2024-04-18 15:36 ` [PATCH v1 2/4] serial: exar: use return dev_err_probe instead of returning error code Parker Newman
2024-04-18 15:36 ` [PATCH v1 3/4] serial: exar: remove unneeded parenthesis Parker Newman
2024-04-19 6:58 ` Greg Kroah-Hartman
2024-04-19 7:01 ` Jiri Slaby
2024-04-19 12:50 ` Parker Newman
2024-04-18 15:36 ` [PATCH v1 4/4] serial: exar: change port_type ternary line wrapping Parker Newman
2024-04-19 6:07 ` Jiri Slaby
2024-04-19 12:17 ` Parker Newman [this message]
2024-04-19 6:57 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240419081727.435437d0@SWDEV2.connecttech.local \
--to=parker@finest.io \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=pnewman@connecttech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).