mbox series

[0/2] tty: serial: samsung_tty: simple cleanups

Message ID 20240806-samsung-tty-cleanup-v1-0-a68d3abf31fe@linaro.org
Headers show
Series tty: serial: samsung_tty: simple cleanups | expand

Message

André Draszik Aug. 6, 2024, 3:29 p.m. UTC
While looking through the samsung tty driver, I've spotted a few things that
can be simplified by removing unused function arguments and by avoiding some
duplicated variables and casting.

There are no functional changes here.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
André Draszik (2):
      tty: serial: samsung_tty: drop unused argument to irq handlers
      tty: serial: samsung_tty: cast the interrupt's void *id just once

 drivers/tty/serial/samsung_tty.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)
---
base-commit: 1e391b34f6aa043c7afa40a2103163a0ef06d179
change-id: 20240806-samsung-tty-cleanup-ffae1515a284

Best regards,

Comments

Greg Kroah-Hartman Aug. 7, 2024, 11:09 a.m. UTC | #1
On Tue, Aug 06, 2024 at 04:29:44PM +0100, André Draszik wrote:
> While looking through the samsung tty driver, I've spotted a few things that
> can be simplified by removing unused function arguments and by avoiding some
> duplicated variables and casting.
> 
> There are no functional changes here.
> 
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---
> André Draszik (2):
>       tty: serial: samsung_tty: drop unused argument to irq handlers
>       tty: serial: samsung_tty: cast the interrupt's void *id just once

This series blows up the build for me, are you sure you tested it?

drivers/tty/serial/samsung_tty.c: In function ‘s3c64xx_serial_handle_irq’:
drivers/tty/serial/samsung_tty.c:948:45: error: passing argument 1 of ‘s3c24xx_serial_rx_irq’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  948 |                 ret = s3c24xx_serial_rx_irq(ourport);
      |                                             ^~~~~~~
drivers/tty/serial/samsung_tty.c:856:68: note: expected ‘struct s3c24xx_uart_port *’ but argument is of type ‘const struct s3c24xx_uart_port *’

And so on...
André Draszik Aug. 7, 2024, 11:17 a.m. UTC | #2
On Wed, 2024-08-07 at 13:09 +0200, Greg Kroah-Hartman wrote:
> On Tue, Aug 06, 2024 at 04:29:44PM +0100, André Draszik wrote:
> > While looking through the samsung tty driver, I've spotted a few things that
> > can be simplified by removing unused function arguments and by avoiding some
> > duplicated variables and casting.
> > 
> > There are no functional changes here.
> > 
> > Signed-off-by: André Draszik <andre.draszik@linaro.org>
> > ---
> > André Draszik (2):
> >       tty: serial: samsung_tty: drop unused argument to irq handlers
> >       tty: serial: samsung_tty: cast the interrupt's void *id just once
> 
> This series blows up the build for me, are you sure you tested it?
> 
> drivers/tty/serial/samsung_tty.c: In function ‘s3c64xx_serial_handle_irq’:
> drivers/tty/serial/samsung_tty.c:948:45: error: passing argument 1 of ‘s3c24xx_serial_rx_irq’ discards ‘const’ qualifier from pointer
> target type [-Werror=discarded-qualifiers]
>   948 |                 ret = s3c24xx_serial_rx_irq(ourport);
>       |                                             ^~~~~~~
> drivers/tty/serial/samsung_tty.c:856:68: note: expected ‘struct s3c24xx_uart_port *’ but argument is of type ‘const struct
> s3c24xx_uart_port *’
> 
> And so on...

Odd, I did test this, yes. Not sure why I don't get these, let me check.

Cheers,
Andre'
André Draszik Aug. 7, 2024, noon UTC | #3
On Wed, 2024-08-07 at 13:09 +0200, Greg Kroah-Hartman wrote:
> On Tue, Aug 06, 2024 at 04:29:44PM +0100, André Draszik wrote:
> > While looking through the samsung tty driver, I've spotted a few things that
> > can be simplified by removing unused function arguments and by avoiding some
> > duplicated variables and casting.
> > 
> > There are no functional changes here.
> > 
> > Signed-off-by: André Draszik <andre.draszik@linaro.org>
> > ---
> > André Draszik (2):
> >       tty: serial: samsung_tty: drop unused argument to irq handlers
> >       tty: serial: samsung_tty: cast the interrupt's void *id just once
> 
> This series blows up the build for me, are you sure you tested it?
> 
> drivers/tty/serial/samsung_tty.c: In function ‘s3c64xx_serial_handle_irq’:
> drivers/tty/serial/samsung_tty.c:948:45: error: passing argument 1 of ‘s3c24xx_serial_rx_irq’ discards ‘const’ qualifier from pointer
> target type [-Werror=discarded-qualifiers]
>   948 |                 ret = s3c24xx_serial_rx_irq(ourport);
>       |                                             ^~~~~~~
> drivers/tty/serial/samsung_tty.c:856:68: note: expected ‘struct s3c24xx_uart_port *’ but argument is of type ‘const struct
> s3c24xx_uart_port *’
> 
> And so on...

Looks like I had Werror disabled and therefore just missed them. Sorry for that.

Cheers,
Andre'
Tudor Ambarus Aug. 7, 2024, 1:53 p.m. UTC | #4
On 8/7/24 1:00 PM, André Draszik wrote:
> On Wed, 2024-08-07 at 13:09 +0200, Greg Kroah-Hartman wrote:
>> On Tue, Aug 06, 2024 at 04:29:44PM +0100, André Draszik wrote:
>>> While looking through the samsung tty driver, I've spotted a few things that
>>> can be simplified by removing unused function arguments and by avoiding some
>>> duplicated variables and casting.
>>>
>>> There are no functional changes here.
>>>
>>> Signed-off-by: André Draszik <andre.draszik@linaro.org>
>>> ---
>>> André Draszik (2):
>>>       tty: serial: samsung_tty: drop unused argument to irq handlers
>>>       tty: serial: samsung_tty: cast the interrupt's void *id just once
>>
>> This series blows up the build for me, are you sure you tested it?
>>
>> drivers/tty/serial/samsung_tty.c: In function ‘s3c64xx_serial_handle_irq’:
>> drivers/tty/serial/samsung_tty.c:948:45: error: passing argument 1 of ‘s3c24xx_serial_rx_irq’ discards ‘const’ qualifier from pointer
>> target type [-Werror=discarded-qualifiers]
>>   948 |                 ret = s3c24xx_serial_rx_irq(ourport);
>>       |                                             ^~~~~~~
>> drivers/tty/serial/samsung_tty.c:856:68: note: expected ‘struct s3c24xx_uart_port *’ but argument is of type ‘const struct
>> s3c24xx_uart_port *’
>>
>> And so on...
> 
> Looks like I had Werror disabled and therefore just missed them. Sorry for that.
> 

Same on my side. Any idea why CONFIG_WERROR is not enabled by more
archs? I see just the two:
arch/x86/configs/i386_defconfig:CONFIG_WERROR=y
arch/x86/configs/x86_64_defconfig:CONFIG_WERROR=y
André Draszik Aug. 7, 2024, 1:58 p.m. UTC | #5
On Wed, 2024-08-07 at 14:53 +0100, Tudor Ambarus wrote:
> Same on my side. Any idea why CONFIG_WERROR is not enabled by more
> archs? I see just the two:
> arch/x86/configs/i386_defconfig:CONFIG_WERROR=y
> arch/x86/configs/x86_64_defconfig:CONFIG_WERROR=y

I can't answer that, but it's an opt-in these days, see
b339ec9c229a ("kbuild: Only default to -Werror if COMPILE_TEST").
Surely if the concern at the time was runtime testing, then that
runtime testing CI infra could have disabled CONFIG_WERROR instead of
globally disabling it for everybody.

Anyway, I've updated our Pixel build env now.

Cheers,
Andre'
Krzysztof Kozlowski Aug. 8, 2024, 7:23 a.m. UTC | #6
On 07/08/2024 15:58, André Draszik wrote:
> On Wed, 2024-08-07 at 14:53 +0100, Tudor Ambarus wrote:
>> Same on my side. Any idea why CONFIG_WERROR is not enabled by more
>> archs? I see just the two:
>> arch/x86/configs/i386_defconfig:CONFIG_WERROR=y
>> arch/x86/configs/x86_64_defconfig:CONFIG_WERROR=y
> 
> I can't answer that, but it's an opt-in these days, see
> b339ec9c229a ("kbuild: Only default to -Werror if COMPILE_TEST").
> Surely if the concern at the time was runtime testing, then that
> runtime testing CI infra could have disabled CONFIG_WERROR instead of
> globally disabling it for everybody.

You are supposed to look for warnings not rely on errors. The same for
building with W=1...

Best regards,
Krzysztof