2016-03-10 13:15:09

by Sudip Mukherjee

[permalink] [raw]
Subject: [PATCH] serial-uartlite: fix build warning

We were getting build warnings about:
drivers/tty/serial/uartlite.c: In function ‘ulite_request_port’:
drivers/tty/serial/uartlite.c:348:21: warning: assignment discards
'const' qualifier from pointer target type
port->private_data = &uartlite_be;
^
drivers/tty/serial/uartlite.c:354:22: warning: assignment discards
'const' qualifier from pointer target type
port->private_data = &uartlite_le;
^

Fixes: 2905697a82ea ("serial-uartlite: Constify uartlite_be/uartlite_le")
Signed-off-by: Sudip Mukherjee <[email protected]>
---

next-20160310 build log at:
https://travis-ci.org/sudipm-mukherjee/parport/jobs/114988022

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

diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index c9fdfc8..1474c57 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -72,7 +72,7 @@ static void uartlite_outbe32(u32 val, void __iomem *addr)
iowrite32be(val, addr);
}

-static const struct uartlite_reg_ops uartlite_be = {
+static struct uartlite_reg_ops uartlite_be = {
.in = uartlite_inbe32,
.out = uartlite_outbe32,
};
@@ -87,7 +87,7 @@ static void uartlite_outle32(u32 val, void __iomem *addr)
iowrite32(val, addr);
}

-static const struct uartlite_reg_ops uartlite_le = {
+static struct uartlite_reg_ops uartlite_le = {
.in = uartlite_inle32,
.out = uartlite_outle32,
};
--
1.9.1


2016-03-10 15:21:01

by Maarten Brock

[permalink] [raw]
Subject: Re: [PATCH] serial-uartlite: fix build warning

I've created a version 2 of this patch immediately which fixes the warning,
but somehow this stays ignored.

Please apply my second patch!
Maarten

> We were getting build warnings about:
> drivers/tty/serial/uartlite.c: In function ‘ulite_request_port’:
> drivers/tty/serial/uartlite.c:348:21: warning: assignment discards
> 'const' qualifier from pointer target type
> port->private_data = &uartlite_be;
> ^
> drivers/tty/serial/uartlite.c:354:22: warning: assignment discards
> 'const' qualifier from pointer target type
> port->private_data = &uartlite_le;
> ^
>
> Fixes: 2905697a82ea ("serial-uartlite: Constify uartlite_be/uartlite_le")
> Signed-off-by: Sudip Mukherjee <[email protected]>
> ---
>
> next-20160310 build log at:
> https://travis-ci.org/sudipm-mukherjee/parport/jobs/114988022
>
> drivers/tty/serial/uartlite.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
> index c9fdfc8..1474c57 100644
> --- a/drivers/tty/serial/uartlite.c
> +++ b/drivers/tty/serial/uartlite.c
> @@ -72,7 +72,7 @@ static void uartlite_outbe32(u32 val, void __iomem *addr)
> iowrite32be(val, addr);
> }
>
> -static const struct uartlite_reg_ops uartlite_be = {
> +static struct uartlite_reg_ops uartlite_be = {
> .in = uartlite_inbe32,
> .out = uartlite_outbe32,
> };
> @@ -87,7 +87,7 @@ static void uartlite_outle32(u32 val, void __iomem *addr)
> iowrite32(val, addr);
> }
>
> -static const struct uartlite_reg_ops uartlite_le = {
> +static struct uartlite_reg_ops uartlite_le = {
> .in = uartlite_inle32,
> .out = uartlite_outle32,
> };
> --
> 1.9.1

2016-03-18 12:48:10

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] serial-uartlite: fix build warning

On Thu, Mar 10, 2016 at 2:14 PM, Sudip Mukherjee
<[email protected]> wrote:
> We were getting build warnings about:
> drivers/tty/serial/uartlite.c: In function ‘ulite_request_port’:
> drivers/tty/serial/uartlite.c:348:21: warning: assignment discards
> 'const' qualifier from pointer target type
> port->private_data = &uartlite_be;
> ^
> drivers/tty/serial/uartlite.c:354:22: warning: assignment discards
> 'const' qualifier from pointer target type
> port->private_data = &uartlite_le;
> ^
>
> Fixes: 2905697a82ea ("serial-uartlite: Constify uartlite_be/uartlite_le")
> Signed-off-by: Sudip Mukherjee <[email protected]>

Acked-by: Geert Uytterhoeven <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2016-03-18 17:49:10

by Maarten Brock

[permalink] [raw]
Subject: Re: [PATCH] serial-uartlite: fix build warning

----- Original Message -----
From: Geert Uytterhoeven [mailto:[email protected]]
To: Sudip Mukherjee [mailto:[email protected]]
Cc: Peter Korsgaard [mailto:[email protected]], Greg Kroah-Hartman [mailto:[email protected]], Jiri Slaby [mailto:[email protected]], [email protected] [mailto:[email protected]], [email protected] [mailto:[email protected]]
Sent: Fri, 18 Mar 2016 13:48:06 +0100
Subject: Re: [PATCH] serial-uartlite: fix build warning


> On Thu, Mar 10, 2016 at 2:14 PM, Sudip Mukherjee
> <[email protected]> wrote:
> > We were getting build warnings about:
> > drivers/tty/serial/uartlite.c: In function ‘ulite_request_port’:
> > drivers/tty/serial/uartlite.c:348:21: warning: assignment discards
> > 'const' qualifier from pointer target type
> > port->private_data = &uartlite_be;
> > ^
> > drivers/tty/serial/uartlite.c:354:22: warning: assignment discards
> > 'const' qualifier from pointer target type
> > port->private_data = &uartlite_le;
> > ^
> >
> > Fixes: 2905697a82ea ("serial-uartlite: Constify uartlite_be/uartlite_le")
> > Signed-off-by: Sudip Mukherjee <[email protected]>
>
> Acked-by: Geert Uytterhoeven <[email protected]>
>
> Gr{oetje,eeting}s,
>
> Geert

Reverting is not the same as fixing.

Rant:
It is a stupid warning IMHO, but being a compiler writer myself (SDCC) I
understand how it can arise. If you assign some const pointer to a void
pointer without an explicit cast gcc does not complain about the complete
loss of type, but it does warn about losing constness. In general I'd say:
make up your mind; either warn about both or don't warn about either.

Maarten

2016-03-18 19:19:47

by Peter Hurley

[permalink] [raw]
Subject: Re: [PATCH] serial-uartlite: fix build warning

On 03/18/2016 10:48 AM, Maarten Brock wrote:
> ----- Original Message -----
> From: Geert Uytterhoeven [mailto:[email protected]]
> To: Sudip Mukherjee [mailto:[email protected]]
> Cc: Peter Korsgaard [mailto:[email protected]], Greg Kroah-Hartman [mailto:[email protected]], Jiri Slaby [mailto:[email protected]], [email protected] [mailto:[email protected]], [email protected] [mailto:[email protected]]
> Sent: Fri, 18 Mar 2016 13:48:06 +0100
> Subject: Re: [PATCH] serial-uartlite: fix build warning
>
>
>> On Thu, Mar 10, 2016 at 2:14 PM, Sudip Mukherjee
>> <[email protected]> wrote:
>>> We were getting build warnings about:
>>> drivers/tty/serial/uartlite.c: In function ‘ulite_request_port’:
>>> drivers/tty/serial/uartlite.c:348:21: warning: assignment discards
>>> 'const' qualifier from pointer target type
>>> port->private_data = &uartlite_be;
>>> ^
>>> drivers/tty/serial/uartlite.c:354:22: warning: assignment discards
>>> 'const' qualifier from pointer target type
>>> port->private_data = &uartlite_le;
>>> ^
>>>
>>> Fixes: 2905697a82ea ("serial-uartlite: Constify uartlite_be/uartlite_le")
>>> Signed-off-by: Sudip Mukherjee <[email protected]>
>>
>> Acked-by: Geert Uytterhoeven <[email protected]>
>>
>> Gr{oetje,eeting}s,
>>
>> Geert
>
> Reverting is not the same as fixing.

I agree; better to revert commit 2905697a82ea and let Maarten re-submit
a patch that doesn't generate build warnings.


> Rant:
> It is a stupid warning IMHO, but being a compiler writer myself (SDCC) I
> understand how it can arise. If you assign some const pointer to a void
> pointer without an explicit cast gcc does not complain about the complete
> loss of type, but it does warn about losing constness. In general I'd say:
> make up your mind; either warn about both or don't warn about either.

memcpy

Regards,
Peter Hurley


2016-03-18 19:20:06

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] serial-uartlite: fix build warning

On Fri, Mar 18, 2016 at 6:48 PM, Maarten Brock <[email protected]> wrote:
> ----- Original Message -----
> From: Geert Uytterhoeven [mailto:[email protected]]
> To: Sudip Mukherjee [mailto:[email protected]]
> Cc: Peter Korsgaard [mailto:[email protected]], Greg Kroah-Hartman [mailto:[email protected]], Jiri Slaby [mailto:[email protected]], [email protected] [mailto:[email protected]], [email protected] [mailto:[email protected]]
> Sent: Fri, 18 Mar 2016 13:48:06 +0100
> Subject: Re: [PATCH] serial-uartlite: fix build warning
>
>> On Thu, Mar 10, 2016 at 2:14 PM, Sudip Mukherjee
>> <[email protected]> wrote:
>> > We were getting build warnings about:
>> > drivers/tty/serial/uartlite.c: In function ‘ulite_request_port’:
>> > drivers/tty/serial/uartlite.c:348:21: warning: assignment discards
>> > 'const' qualifier from pointer target type
>> > port->private_data = &uartlite_be;
>> > ^
>> > drivers/tty/serial/uartlite.c:354:22: warning: assignment discards
>> > 'const' qualifier from pointer target type
>> > port->private_data = &uartlite_le;
>> > ^
>> >
>> > Fixes: 2905697a82ea ("serial-uartlite: Constify uartlite_be/uartlite_le")
>> > Signed-off-by: Sudip Mukherjee <[email protected]>
>>
>> Acked-by: Geert Uytterhoeven <[email protected]>
>
> Reverting is not the same as fixing.
>
> Rant:
> It is a stupid warning IMHO, but being a compiler writer myself (SDCC) I
> understand how it can arise. If you assign some const pointer to a void
> pointer without an explicit cast gcc does not complain about the complete
> loss of type, but it does warn about losing constness. In general I'd say:
> make up your mind; either warn about both or don't warn about either.

You're right, I was a bit too hasty adding my Acked-by.

Hereby I would like to withdraw my Acked-by.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2016-03-18 20:32:39

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] serial-uartlite: fix build warning

On Fri, Mar 18, 2016 at 12:19:40PM -0700, Peter Hurley wrote:
> On 03/18/2016 10:48 AM, Maarten Brock wrote:
> > ----- Original Message -----
> > From: Geert Uytterhoeven [mailto:[email protected]]
> > To: Sudip Mukherjee [mailto:[email protected]]
> > Cc: Peter Korsgaard [mailto:[email protected]], Greg Kroah-Hartman [mailto:[email protected]], Jiri Slaby [mailto:[email protected]], [email protected] [mailto:[email protected]], [email protected] [mailto:[email protected]]
> > Sent: Fri, 18 Mar 2016 13:48:06 +0100
> > Subject: Re: [PATCH] serial-uartlite: fix build warning
> >
> >
> >> On Thu, Mar 10, 2016 at 2:14 PM, Sudip Mukherjee
> >> <[email protected]> wrote:
> >>> We were getting build warnings about:
> >>> drivers/tty/serial/uartlite.c: In function ‘ulite_request_port’:
> >>> drivers/tty/serial/uartlite.c:348:21: warning: assignment discards
> >>> 'const' qualifier from pointer target type
> >>> port->private_data = &uartlite_be;
> >>> ^
> >>> drivers/tty/serial/uartlite.c:354:22: warning: assignment discards
> >>> 'const' qualifier from pointer target type
> >>> port->private_data = &uartlite_le;
> >>> ^
> >>>
> >>> Fixes: 2905697a82ea ("serial-uartlite: Constify uartlite_be/uartlite_le")
> >>> Signed-off-by: Sudip Mukherjee <[email protected]>
> >>
> >> Acked-by: Geert Uytterhoeven <[email protected]>
> >>
> >> Gr{oetje,eeting}s,
> >>
> >> Geert
> >
> > Reverting is not the same as fixing.
>
> I agree; better to revert commit 2905697a82ea and let Maarten re-submit
> a patch that doesn't generate build warnings.

I'll fix this up after 4.6-rc1 is out, thanks.

greg k-h