All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	vz@mleia.com, linux-arm-kernel@lists.infradead.org,
	devicetree@vger.kernel.org,
	linux-serial <linux-serial@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	lukas@wunner.de, p.rosenberger@kunbus.com,
	Lino Sanfilippo <l.sanfilippo@kunbus.com>
Subject: Re: [PATCH 7/8] serial: ar933x: Remove redundant assignment in rs485_config
Date: Thu, 30 Jun 2022 02:33:23 +0200	[thread overview]
Message-ID: <16841959-42c9-cbd7-e767-39050134b070@gmx.de> (raw)
In-Reply-To: <033c8d2-3f2e-afe6-2e98-14a61c872b4b@linux.intel.com>



On 27.06.22 10:14, Ilpo Järvinen wrote:
> On Sun, 26 Jun 2022, Lino Sanfilippo wrote:
>
>> On 25.06.22 at 12:14, Ilpo Järvinen wrote:
>>> On Wed, 22 Jun 2022, Lino Sanfilippo wrote:
>>>
>>>> From: Lino Sanfilippo <l.sanfilippo@kunbus.com>
>>>>
>>>> In uart_set_rs485_config() the serial core already assigns the passed
>>>> serial_rs485 struct to the uart port.
>>>>
>>>> So remove the assignment in the drivers rs485_config() function to avoid
>>>> redundancy.
>>>>
>>>> Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
>>>> ---
>>>>  drivers/tty/serial/ar933x_uart.c | 1 -
>>>>  1 file changed, 1 deletion(-)
>>>>
>>>> diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c
>>>> index ab2c5b2a1ce8..857e010d01dc 100644
>>>> --- a/drivers/tty/serial/ar933x_uart.c
>>>> +++ b/drivers/tty/serial/ar933x_uart.c
>>>> @@ -591,7 +591,6 @@ static int ar933x_config_rs485(struct uart_port *port,
>>>>  		dev_err(port->dev, "RS485 needs rts-gpio\n");
>>>>  		return 1;
>>>>  	}
>>>> -	port->rs485 = *rs485conf;
>>>>  	return 0;
>>>>  }
>>>
>>> Hmm, I realize that for some reason I missed cleaning up this particular
>>> driver after introducing the serial_rs485 sanitization. It shouldn't need
>>> that preceeding if block either because ar933x_no_rs485 gets applied if
>>> there's no rts_gpiod so the core clears SER_RS485_ENABLED.
>>
>> I think we still need that "if" in case that RS485 was not enabled at driver
>> startup (no rs485-enabled-at-boot-time) and no RTS GPIO was defined but then
>> RS485 is enabled via TIOCSRS485.
>>
>> Maybe in ar933x_uart_probe()
>>
>> 	if ((port->rs485.flags & SER_RS485_ENABLED) &&
>> 	    !up->rts_gpiod) {
>> 		dev_err(&pdev->dev, "lacking rts-gpio, disabling RS485\n");
>> 		port->rs485.flags &= ~SER_RS485_ENABLED;
>> 		port->rs485_supported = &ar933x_no_rs485;
>> 	}
>>
>> should rather be
>
> I think it would be better (and what I should have done while moving the
> check there in the first place but I missed it). In addition, however, it
> would be useful to not print unnecessarily:
>
>> 	if (!up->rts_gpiod) {
>
> if (port->rs485.flags & SER_RS485_ENABLED) {
>
>> 		dev_err(&pdev->dev, "lacking rts-gpio, disabling RS485\n");
>> 		port->rs485.flags &= ~SER_RS485_ENABLED;
>
> }


Right. I will send a fix for this with the new version of my series.

Regards,
Lino



WARNING: multiple messages have this Message-ID (diff)
From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	vz@mleia.com, linux-arm-kernel@lists.infradead.org,
	devicetree@vger.kernel.org,
	linux-serial <linux-serial@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	lukas@wunner.de, p.rosenberger@kunbus.com,
	Lino Sanfilippo <l.sanfilippo@kunbus.com>
Subject: Re: [PATCH 7/8] serial: ar933x: Remove redundant assignment in rs485_config
Date: Thu, 30 Jun 2022 02:33:23 +0200	[thread overview]
Message-ID: <16841959-42c9-cbd7-e767-39050134b070@gmx.de> (raw)
In-Reply-To: <033c8d2-3f2e-afe6-2e98-14a61c872b4b@linux.intel.com>



On 27.06.22 10:14, Ilpo Järvinen wrote:
> On Sun, 26 Jun 2022, Lino Sanfilippo wrote:
>
>> On 25.06.22 at 12:14, Ilpo Järvinen wrote:
>>> On Wed, 22 Jun 2022, Lino Sanfilippo wrote:
>>>
>>>> From: Lino Sanfilippo <l.sanfilippo@kunbus.com>
>>>>
>>>> In uart_set_rs485_config() the serial core already assigns the passed
>>>> serial_rs485 struct to the uart port.
>>>>
>>>> So remove the assignment in the drivers rs485_config() function to avoid
>>>> redundancy.
>>>>
>>>> Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
>>>> ---
>>>>  drivers/tty/serial/ar933x_uart.c | 1 -
>>>>  1 file changed, 1 deletion(-)
>>>>
>>>> diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c
>>>> index ab2c5b2a1ce8..857e010d01dc 100644
>>>> --- a/drivers/tty/serial/ar933x_uart.c
>>>> +++ b/drivers/tty/serial/ar933x_uart.c
>>>> @@ -591,7 +591,6 @@ static int ar933x_config_rs485(struct uart_port *port,
>>>>  		dev_err(port->dev, "RS485 needs rts-gpio\n");
>>>>  		return 1;
>>>>  	}
>>>> -	port->rs485 = *rs485conf;
>>>>  	return 0;
>>>>  }
>>>
>>> Hmm, I realize that for some reason I missed cleaning up this particular
>>> driver after introducing the serial_rs485 sanitization. It shouldn't need
>>> that preceeding if block either because ar933x_no_rs485 gets applied if
>>> there's no rts_gpiod so the core clears SER_RS485_ENABLED.
>>
>> I think we still need that "if" in case that RS485 was not enabled at driver
>> startup (no rs485-enabled-at-boot-time) and no RTS GPIO was defined but then
>> RS485 is enabled via TIOCSRS485.
>>
>> Maybe in ar933x_uart_probe()
>>
>> 	if ((port->rs485.flags & SER_RS485_ENABLED) &&
>> 	    !up->rts_gpiod) {
>> 		dev_err(&pdev->dev, "lacking rts-gpio, disabling RS485\n");
>> 		port->rs485.flags &= ~SER_RS485_ENABLED;
>> 		port->rs485_supported = &ar933x_no_rs485;
>> 	}
>>
>> should rather be
>
> I think it would be better (and what I should have done while moving the
> check there in the first place but I missed it). In addition, however, it
> would be useful to not print unnecessarily:
>
>> 	if (!up->rts_gpiod) {
>
> if (port->rs485.flags & SER_RS485_ENABLED) {
>
>> 		dev_err(&pdev->dev, "lacking rts-gpio, disabling RS485\n");
>> 		port->rs485.flags &= ~SER_RS485_ENABLED;
>
> }


Right. I will send a fix for this with the new version of my series.

Regards,
Lino



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

  reply	other threads:[~2022-06-30  0:33 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22 15:46 [PATCH 0/8] Fixes and cleanup for RS485 Lino Sanfilippo
2022-06-22 15:46 ` Lino Sanfilippo
2022-06-22 15:46 ` [PATCH 1/8] serial: core: only get RS485 termination gpio if supported Lino Sanfilippo
2022-06-22 15:46   ` Lino Sanfilippo
2022-06-22 17:04   ` Andy Shevchenko
2022-06-22 17:04     ` Andy Shevchenko
2022-06-23  1:59     ` Lino Sanfilippo
2022-06-23  1:59       ` Lino Sanfilippo
2022-06-23  9:45       ` Andy Shevchenko
2022-06-23  9:45         ` Andy Shevchenko
2022-06-23 16:08         ` Lino Sanfilippo
2022-06-23 16:08           ` Lino Sanfilippo
2022-06-23 16:32           ` Andy Shevchenko
2022-06-23 16:32             ` Andy Shevchenko
2022-06-23 20:19             ` Lino Sanfilippo
2022-06-23 20:19               ` Lino Sanfilippo
2022-06-25 19:49   ` Lukas Wunner
2022-06-27  9:05     ` Ilpo Järvinen
2022-06-27  9:05       ` Ilpo Järvinen
2022-07-02 16:50       ` Lino Sanfilippo
2022-07-02 16:50         ` Lino Sanfilippo
2022-06-22 15:46 ` [PATCH 2/8] serial: core, 8250: set RS485 termination gpio in serial core Lino Sanfilippo
2022-06-22 15:46   ` Lino Sanfilippo
2022-06-22 17:06   ` Andy Shevchenko
2022-06-22 17:06     ` Andy Shevchenko
2022-06-23  2:03     ` Lino Sanfilippo
2022-06-23  2:03       ` Lino Sanfilippo
2022-06-25 10:40   ` Ilpo Järvinen
2022-06-25 10:40     ` Ilpo Järvinen
2022-06-26 15:41     ` Lino Sanfilippo
2022-06-26 15:41       ` Lino Sanfilippo
2022-06-25 19:58   ` Lukas Wunner
2022-06-26 13:36     ` Lino Sanfilippo
2022-06-26 13:36       ` Lino Sanfilippo
2022-06-28  8:31       ` Ilpo Järvinen
2022-06-28  8:31         ` Ilpo Järvinen
2022-06-22 15:46 ` [PATCH 3/8] serial: core: move sanitizing of RS485 delays into own function Lino Sanfilippo
2022-06-22 15:46   ` Lino Sanfilippo
2022-06-23 16:25   ` Andy Shevchenko
2022-06-23 16:25     ` Andy Shevchenko
2022-06-23 20:17     ` Lino Sanfilippo
2022-06-23 20:17       ` Lino Sanfilippo
2022-06-25  9:37   ` Ilpo Järvinen
2022-06-25  9:37     ` Ilpo Järvinen
2022-06-22 15:46 ` [PATCH 4/8] serial: core: sanitize RS485 delays read from device tree Lino Sanfilippo
2022-06-22 15:46   ` Lino Sanfilippo
2022-06-25 10:05   ` Ilpo Järvinen
2022-06-25 10:05     ` Ilpo Järvinen
2022-06-26 14:25     ` Lino Sanfilippo
2022-06-26 14:25       ` Lino Sanfilippo
2022-06-22 15:46 ` [PATCH 5/8] dt_bindings: rs485: Correct delay values Lino Sanfilippo
2022-06-22 15:46   ` Lino Sanfilippo
2022-06-23 16:29   ` Andy Shevchenko
2022-06-23 16:29     ` Andy Shevchenko
2022-06-23 20:17     ` Lino Sanfilippo
2022-06-23 20:17       ` Lino Sanfilippo
2022-06-25  9:54       ` Ilpo Järvinen
2022-06-25  9:54         ` Ilpo Järvinen
2022-06-27  9:23         ` Ilpo Järvinen
2022-06-27  9:23           ` Ilpo Järvinen
2022-06-28 10:03       ` Andy Shevchenko
2022-06-28 10:03         ` Andy Shevchenko
2022-06-29 23:50         ` Lino Sanfilippo
2022-06-29 23:50           ` Lino Sanfilippo
2022-06-22 15:46 ` [PATCH 6/8] serial: 8250_dwlib: remove redundant sanity check for RS485 flags Lino Sanfilippo
2022-06-22 15:46   ` Lino Sanfilippo
2022-06-25 10:21   ` Ilpo Järvinen
2022-06-25 10:21     ` Ilpo Järvinen
2022-06-22 15:46 ` [PATCH 7/8] serial: ar933x: Remove redundant assignment in rs485_config Lino Sanfilippo
2022-06-22 15:46   ` Lino Sanfilippo
2022-06-25 10:14   ` Ilpo Järvinen
2022-06-25 10:14     ` Ilpo Järvinen
2022-06-26 14:09     ` Lino Sanfilippo
2022-06-26 14:09       ` Lino Sanfilippo
2022-06-27  8:14       ` Ilpo Järvinen
2022-06-27  8:14         ` Ilpo Järvinen
2022-06-30  0:33         ` Lino Sanfilippo [this message]
2022-06-30  0:33           ` Lino Sanfilippo
2022-06-22 15:46 ` [PATCH 8/8] serial: 8250: lpc18xx: Remove redundant sanity check for RS485 flags Lino Sanfilippo
2022-06-22 15:46   ` Lino Sanfilippo
2022-06-25 10:18   ` Ilpo Järvinen
2022-06-25 10:18     ` Ilpo Järvinen

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=16841959-42c9-cbd7-e767-39050134b070@gmx.de \
    --to=linosanfilippo@gmx.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=l.sanfilippo@kunbus.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=p.rosenberger@kunbus.com \
    --cc=robh+dt@kernel.org \
    --cc=vz@mleia.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 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.