2017-03-01 12:40:02

by Aleksey Makarov

[permalink] [raw]
Subject: [PATCH] Revert "tty: serial: pl011: add ttyAMA for matching pl011 console"

The original patch makes condition always true, so it is wrong.

This reverts commit aea9a80ba98a0c9b4de88850260e9fbdcc98360b.
---
drivers/tty/serial/amba-pl011.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 8789ea423ccf..56f92d7348bf 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2373,7 +2373,7 @@ static int __init pl011_console_match(struct console *co, char *name, int idx,
if (strcmp(name, "qdf2400_e44") == 0) {
pr_info_once("UART: Working around QDF2400 SoC erratum 44");
qdf2400_e44_present = true;
- } else if (strcmp(name, "pl011") != 0 || strcmp(name, "ttyAMA") != 0) {
+ } else if (strcmp(name, "pl011") != 0) {
return -ENODEV;
}

--
2.11.1


2017-03-01 13:05:47

by Aleksey Makarov

[permalink] [raw]
Subject: Re: [PATCH] Revert "tty: serial: pl011: add ttyAMA for matching pl011 console"



On 03/01/2017 03:59 PM, Robin Murphy wrote:
> On 01/03/17 12:26, Aleksey Makarov wrote:
>> The original patch makes condition always true, so it is wrong.
>>
>> This reverts commit aea9a80ba98a0c9b4de88850260e9fbdcc98360b.
>
> It seems fairly clear that the intent of the code merely warrants
> s/||/&&/ - wouldn't it be more straightforward to just fix that?

No, I don't think so. The description of the patch says that it fixes a problem
of double printing the logs with SPCR and both console=ttyAMA and earlycon are specified
on the command string. That wrong patch does "fix" it, but introduces
a regression with the regular case.

With s/||/&&/ it would not even 'fix' the described problem.

Thank you
Aleksey Makarov

> Robin.
>
>> ---
>> drivers/tty/serial/amba-pl011.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
>> index 8789ea423ccf..56f92d7348bf 100644
>> --- a/drivers/tty/serial/amba-pl011.c
>> +++ b/drivers/tty/serial/amba-pl011.c
>> @@ -2373,7 +2373,7 @@ static int __init pl011_console_match(struct console *co, char *name, int idx,
>> if (strcmp(name, "qdf2400_e44") == 0) {
>> pr_info_once("UART: Working around QDF2400 SoC erratum 44");
>> qdf2400_e44_present = true;
>> - } else if (strcmp(name, "pl011") != 0 || strcmp(name, "ttyAMA") != 0) {
>> + } else if (strcmp(name, "pl011") != 0) {
>> return -ENODEV;
>> }
>>
>>
>

--
All the best
Alekséy Makárov

2017-03-01 13:09:16

by Robin Murphy

[permalink] [raw]
Subject: Re: [PATCH] Revert "tty: serial: pl011: add ttyAMA for matching pl011 console"

On 01/03/17 12:26, Aleksey Makarov wrote:
> The original patch makes condition always true, so it is wrong.
>
> This reverts commit aea9a80ba98a0c9b4de88850260e9fbdcc98360b.

It seems fairly clear that the intent of the code merely warrants
s/||/&&/ - wouldn't it be more straightforward to just fix that?

Robin.

> ---
> drivers/tty/serial/amba-pl011.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 8789ea423ccf..56f92d7348bf 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -2373,7 +2373,7 @@ static int __init pl011_console_match(struct console *co, char *name, int idx,
> if (strcmp(name, "qdf2400_e44") == 0) {
> pr_info_once("UART: Working around QDF2400 SoC erratum 44");
> qdf2400_e44_present = true;
> - } else if (strcmp(name, "pl011") != 0 || strcmp(name, "ttyAMA") != 0) {
> + } else if (strcmp(name, "pl011") != 0) {
> return -ENODEV;
> }
>
>

2017-03-01 13:55:27

by Robin Murphy

[permalink] [raw]
Subject: Re: [PATCH] Revert "tty: serial: pl011: add ttyAMA for matching pl011 console"

On 01/03/17 13:01, Aleksey Makarov wrote:
>
>
> On 03/01/2017 03:59 PM, Robin Murphy wrote:
>> On 01/03/17 12:26, Aleksey Makarov wrote:
>>> The original patch makes condition always true, so it is wrong.
>>>
>>> This reverts commit aea9a80ba98a0c9b4de88850260e9fbdcc98360b.
>>
>> It seems fairly clear that the intent of the code merely warrants
>> s/||/&&/ - wouldn't it be more straightforward to just fix that?
>
> No, I don't think so. The description of the patch says that it fixes a problem
> of double printing the logs with SPCR and both console=ttyAMA and earlycon are specified
> on the command string. That wrong patch does "fix" it, but introduces
> a regression with the regular case.
>
> With s/||/&&/ it would not even 'fix' the described problem.

Ah, I see, so it's that this fundamental approach itself was flawed, but
the bug causing it to match nothing happened to hide the underlying
problem. It might be useful to call that out explicitly in the commit
log. FWIW the "enabling the main console reprints earlycon contents"
problem has also been present for a while in the non-ACPI case when
relying on stdout-path for both main console and earlycon in DT, i.e.
with just "earlycon" on the command line (it seems to be OK if you
specify "earlycon=pl011,..." or explicitly add "console=ttyAMA0").

Thanks,
Robin.

>
> Thank you
> Aleksey Makarov
>
>> Robin.
>>
>>> ---
>>> drivers/tty/serial/amba-pl011.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
>>> index 8789ea423ccf..56f92d7348bf 100644
>>> --- a/drivers/tty/serial/amba-pl011.c
>>> +++ b/drivers/tty/serial/amba-pl011.c
>>> @@ -2373,7 +2373,7 @@ static int __init pl011_console_match(struct console *co, char *name, int idx,
>>> if (strcmp(name, "qdf2400_e44") == 0) {
>>> pr_info_once("UART: Working around QDF2400 SoC erratum 44");
>>> qdf2400_e44_present = true;
>>> - } else if (strcmp(name, "pl011") != 0 || strcmp(name, "ttyAMA") != 0) {
>>> + } else if (strcmp(name, "pl011") != 0) {
>>> return -ENODEV;
>>> }
>>>
>>>
>>
>

2017-03-01 15:26:37

by Aleksey Makarov

[permalink] [raw]
Subject: [PATCH v3] Revert "tty: serial: pl011: add ttyAMA for matching pl011 console"

The original patch makes the condition always true, so it is wrong.

It masks (but not fixes) the bug described in the commit message
but introduces a regression (no console is selected by SPCR)
in regular (no 'console=ttyAMA') case.

s/||/&&/ would not fix the problem as the root cause was identified
incorrectly.

This reverts commit aea9a80ba98a0c9b4de88850260e9fbdcc98360b.

Signed-off-by: Aleksey Makarov <[email protected]>
---

v3: fix commit message (Robin Murphy)
v2: add Signed-off-by:

drivers/tty/serial/amba-pl011.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 8789ea423ccf..56f92d7348bf 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2373,7 +2373,7 @@ static int __init pl011_console_match(struct console *co, char *name, int idx,
if (strcmp(name, "qdf2400_e44") == 0) {
pr_info_once("UART: Working around QDF2400 SoC erratum 44");
qdf2400_e44_present = true;
- } else if (strcmp(name, "pl011") != 0 || strcmp(name, "ttyAMA") != 0) {
+ } else if (strcmp(name, "pl011") != 0) {
return -ENODEV;
}

--
2.11.1

2017-03-01 15:55:32

by Aleksey Makarov

[permalink] [raw]
Subject: [PATCH v2] Revert "tty: serial: pl011: add ttyAMA for matching pl011 console"

The original patch makes condition always true, so it is wrong.

This reverts commit aea9a80ba98a0c9b4de88850260e9fbdcc98360b.

Signed-off-by: Aleksey Makarov <[email protected]>
---
v2: add Signed-off-by:

drivers/tty/serial/amba-pl011.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 8789ea423ccf..56f92d7348bf 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2373,7 +2373,7 @@ static int __init pl011_console_match(struct console *co, char *name, int idx,
if (strcmp(name, "qdf2400_e44") == 0) {
pr_info_once("UART: Working around QDF2400 SoC erratum 44");
qdf2400_e44_present = true;
- } else if (strcmp(name, "pl011") != 0 || strcmp(name, "ttyAMA") != 0) {
+ } else if (strcmp(name, "pl011") != 0) {
return -ENODEV;
}

--
2.11.1

2017-03-14 16:14:34

by Sudeep Holla

[permalink] [raw]
Subject: Re: [PATCH v3] Revert "tty: serial: pl011: add ttyAMA for matching pl011 console"



On 01/03/17 15:23, Aleksey Makarov wrote:
> The original patch makes the condition always true, so it is wrong.
>
> It masks (but not fixes) the bug described in the commit message
> but introduces a regression (no console is selected by SPCR)
> in regular (no 'console=ttyAMA') case.
>
> s/||/&&/ would not fix the problem as the root cause was identified
> incorrectly.
>
> This reverts commit aea9a80ba98a0c9b4de88850260e9fbdcc98360b.
>

Sorry for that, I will test your patches and respond to that. For this
patch:

Acked-by: Sudeep Holla <[email protected]>

--
Regards,
Sudeep

2017-03-16 07:11:22

by Jayachandran C.

[permalink] [raw]
Subject: Re: [PATCH v3] Revert "tty: serial: pl011: add ttyAMA for matching pl011 console"

Hi Greg,

On Tue, Mar 14, 2017 at 9:44 PM, Sudeep Holla <[email protected]> wrote:
>
>
> On 01/03/17 15:23, Aleksey Makarov wrote:
>> The original patch makes the condition always true, so it is wrong.
>>
>> It masks (but not fixes) the bug described in the commit message
>> but introduces a regression (no console is selected by SPCR)
>> in regular (no 'console=ttyAMA') case.
>>
>> s/||/&&/ would not fix the problem as the root cause was identified
>> incorrectly.
>>
>> This reverts commit aea9a80ba98a0c9b4de88850260e9fbdcc98360b.
>>
>
> Sorry for that, I will test your patches and respond to that. For this
> patch:
>
> Acked-by: Sudeep Holla <[email protected]>
>

This fixes a regression I see in v4.11-rc2

Tested-by: Jayachandran C <[email protected]>

I don't see it in the tty/serial tree yet

JC.

2017-03-16 09:36:18

by Aleksey Makarov

[permalink] [raw]
Subject: Re: [PATCH v3] Revert "tty: serial: pl011: add ttyAMA for matching pl011 console"



On 03/16/2017 10:11 AM, Jayachandran C. wrote:
> Hi Greg,
>
> On Tue, Mar 14, 2017 at 9:44 PM, Sudeep Holla <[email protected]> wrote:
>>
>>
>> On 01/03/17 15:23, Aleksey Makarov wrote:
>>> The original patch makes the condition always true, so it is wrong.
>>>
>>> It masks (but not fixes) the bug described in the commit message
>>> but introduces a regression (no console is selected by SPCR)
>>> in regular (no 'console=ttyAMA') case.
>>>
>>> s/||/&&/ would not fix the problem as the root cause was identified
>>> incorrectly.
>>>
>>> This reverts commit aea9a80ba98a0c9b4de88850260e9fbdcc98360b.
>>>
>>
>> Sorry for that, I will test your patches and respond to that. For this
>> patch:
>>
>> Acked-by: Sudeep Holla <[email protected]>
>>
>
> This fixes a regression I see in v4.11-rc2
>
> Tested-by: Jayachandran C <[email protected]>
>
> I don't see it in the tty/serial tree yet

It's commit 713b93f1b849 from tty-next branch of
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git

So it looks like it is scheduled for 4.12

Greg, this is a fix for regression. Can it be applied to 4.11-rcX?

Thank you
Aleksey Makarov

>
> JC.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-serial" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2017-03-17 05:04:45

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v3] Revert "tty: serial: pl011: add ttyAMA for matching pl011 console"

On Thu, Mar 16, 2017 at 12:31:53PM +0300, Aleksey Makarov wrote:
>
>
> On 03/16/2017 10:11 AM, Jayachandran C. wrote:
> > Hi Greg,
> >
> > On Tue, Mar 14, 2017 at 9:44 PM, Sudeep Holla <[email protected]> wrote:
> >>
> >>
> >> On 01/03/17 15:23, Aleksey Makarov wrote:
> >>> The original patch makes the condition always true, so it is wrong.
> >>>
> >>> It masks (but not fixes) the bug described in the commit message
> >>> but introduces a regression (no console is selected by SPCR)
> >>> in regular (no 'console=ttyAMA') case.
> >>>
> >>> s/||/&&/ would not fix the problem as the root cause was identified
> >>> incorrectly.
> >>>
> >>> This reverts commit aea9a80ba98a0c9b4de88850260e9fbdcc98360b.
> >>>
> >>
> >> Sorry for that, I will test your patches and respond to that. For this
> >> patch:
> >>
> >> Acked-by: Sudeep Holla <[email protected]>
> >>
> >
> > This fixes a regression I see in v4.11-rc2
> >
> > Tested-by: Jayachandran C <[email protected]>
> >
> > I don't see it in the tty/serial tree yet
>
> It's commit 713b93f1b849 from tty-next branch of
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
>
> So it looks like it is scheduled for 4.12
>
> Greg, this is a fix for regression. Can it be applied to 4.11-rcX?

Yes, will do that now, thanks.

greg k-h