linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aleksey Makarov <aleksey.makarov@linaro.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
	Russell King <linux@arm.linux.org.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	Graeme Gregory <graeme.gregory@linaro.org>,
	Al Stone <ahs3@redhat.com>,
	Christopher Covington <cov@codeaurora.org>,
	Yury Norov <ynorov@caviumnetworks.com>,
	Peter Hurley <peter@hurleysoftware.com>,
	"Zheng, Lv" <lv.zheng@intel.com>, Len Brown <lenb@kernel.org>,
	Jiri Slaby <jslaby@suse.com>
Subject: Re: [PATCH v4 1/4] ACPI: parse SPCR and enable matching console
Date: Mon, 29 Feb 2016 16:47:37 +0300	[thread overview]
Message-ID: <56D44BF9.3030007@linaro.org> (raw)
In-Reply-To: <CAHp75VdswvD23xqRNUX=fwMt5HReR-wcSo+RYweB6FYqWPar8w@mail.gmail.com>

Hi Andy, 

Thank you for review.

On 02/29/2016 04:29 PM, Andy Shevchenko wrote:
> On Mon, Feb 29, 2016 at 2:02 PM, Aleksey Makarov
> <aleksey.makarov@linaro.org> wrote:
>> 'ARM Server Base Boot Requiremets' [1] mentions SPCR (Serial Port
>> Console Redirection Table) [2] as a mandatory ACPI table that
>> specifies the configuration of serial console.
>>
>> Parse this table and check if any registered console match the
>> description.  If it does, enable that console.
>>
>> Introduce a new function acpi_console_check().  At the uart port
>> registration, this function checks if the ACPI SPCR table specifies
>> its argument of type struct uart_port to be a console
>> and if so calls add_preferred_console().
> 
>> +       if (ACPI_FAILURE(status)) {
>> +               pr_err("could not get the table\n");
> 
> Is it worse to have on error level? Is it possible to have firmware
> without this table? I think it would be a normal case for non-arm
> world.
> I'm also not sure if this message useful even on warn level.

I will delete the message in the next version, thank you.

>> +               return -ENOENT;
>> +       }
>> +
>> +       if (table->header.revision < 2) {
>> +               err = -EINVAL;
>> +               pr_err("wrong table version\n");
> 
> And this one quite good to have, indeed.
> 
>> + * acpi_console_check - Check if uart matches the console specified by SPCR.
>> + *
>> + * @uport:     uart port to check
>> + *
> 
> Since you use sections, you may add:
> + * Description:

According to kernel-doc-nano-HOWTO.txt "Description: " is optional.

>> + * This function checks if the ACPI SPCR table specifies @uport to be a console
>> + * and if so calls add_preferred_console()
>> + *
>> + * Return: a non-error value if the console matches.
> 
>> @@ -2654,8 +2655,17 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
>>                 spin_lock_init(&uport->lock);
>>                 lockdep_set_class(&uport->lock, &port_lock_key);
>>         }
>> -       if (uport->cons && uport->dev)
>> -               of_console_check(uport->dev->of_node, uport->cons->name, uport->line);
>> +
>> +       /*
>> +        * Support both open FW and ACPI access to console definitions.
>> +        * Both of_console_check() and acpi_console_check() will call
>> +        * add_preferred_console() if a console definition is found.
>> +        */
>> +       if (uport->cons && uport->dev) {
>> +               if (!acpi_console_check(uport))
> 
> if (cond1) {
>  if (cond2) {
> ...
>  }
> }
> 
> is equivalent to
> if (cond1 && cond2) {
> ...
> }

It is, but it's a style decision.  I would prefer to leave it as is because it emphasizes that
after meeting some condition we first call acpi_console_check() and then of_console_check().

Thank you
Aleksey Makarov

> 
>> +                       of_console_check(uport->dev->of_node, uport->cons->name,
>> +                                        uport->line);
>> +       }
> 
> 
> 

  reply	other threads:[~2016-02-29 13:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 12:02 [PATCH v4 0/4] ACPI: parse the SPCR table Aleksey Makarov
2016-02-29 12:02 ` [PATCH v4 1/4] ACPI: parse SPCR and enable matching console Aleksey Makarov
2016-02-29 13:29   ` Andy Shevchenko
2016-02-29 13:47     ` Aleksey Makarov [this message]
2016-03-17 17:20   ` Timur Tabi
2016-02-29 12:02 ` [PATCH v4 2/4] ACPI: enable ACPI_SPCR_TABLE on ARM64 Aleksey Makarov
2016-03-01 15:27   ` Peter Hurley
2016-03-01 17:35     ` Aleksey Makarov
2016-03-17 17:20   ` Timur Tabi
2016-02-29 12:02 ` [PATCH v4 3/4] ACPI: add definitions of DBG2 subtypes Aleksey Makarov
2016-02-29 12:02 ` [PATCH v4 4/4] serial: pl011: use ACPI SPCR to setup 32-bit access Aleksey Makarov
2016-03-01 15:27 ` [PATCH v4 0/4] ACPI: parse the SPCR table Peter Hurley
2016-03-01 15:31 ` Peter Hurley
2016-03-03 11:59   ` Aleksey Makarov
2016-03-03 15:35     ` Peter Hurley
2016-03-04 11:53       ` Aleksey Makarov
2016-03-04 15:47         ` Peter Hurley
2016-03-11 16:25           ` Aleksey Makarov

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=56D44BF9.3030007@linaro.org \
    --to=aleksey.makarov@linaro.org \
    --cc=ahs3@redhat.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=cov@codeaurora.org \
    --cc=graeme.gregory@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=leif.lindholm@linaro.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=lv.zheng@intel.com \
    --cc=peter@hurleysoftware.com \
    --cc=rjw@rjwysocki.net \
    --cc=ynorov@caviumnetworks.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).