From: ynorov@caviumnetworks.com (Yury Norov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 3/6] ACPI: parse SPCR and enable matching console
Date: Tue, 22 Mar 2016 19:51:22 +0300 [thread overview]
Message-ID: <20160322165122.GB10616@yury-N73SV> (raw)
In-Reply-To: <56F15D40.9020401@hurleysoftware.com>
On Tue, Mar 22, 2016 at 07:57:04AM -0700, Peter Hurley wrote:
[...]
> >> +static bool init_earlycon;
> >> +
> >> +void __init init_spcr_earlycon(void)
> >> +{
> >> + init_earlycon = true;
> >> +}
> >> +
> >
> > 1. I see you keep in mind multiple access.
>
> Concurrent access is not a concern here: only the boot cpu is running
> and intrs are off.
>
> The "init_earlycon" flag is used because parsing the "earlycon" early param
> is earlier than parsing ACPI tables.
>
OK got it. My concern is that it's generic code, and parse_spcr() is public
function. I think corresponding comment is needed at least. The other option is
to make it race-safe and forget. I prefer second one, moreover it's 2 simple
changes.
>
> Then you'd worry about race
> > conditions as well. In this case, I'd consider atomic access to
> > variable.
> > 2. It seems you need is_init() helper too.
> >
> >> +int __init parse_spcr(void)
> >> +{
> >> + static char opts[64];
> >> + struct acpi_table_spcr *table;
> >> + acpi_size table_size;
> >> + acpi_status status;
> >> + char *uart;
> >> + char *iotype;
> >> + int baud_rate;
> >> + int err = 0;
> >
> > You can do not initialize 'err'.
>
> Why?
>
Because there's no path here that doesn't init err with some value.
So this initialization is useless waste of cycles.
[...]
next prev parent reply other threads:[~2016-03-22 16:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 10:46 [PATCH v5 0/6] ACPI: parse the SPCR table Aleksey Makarov
2016-03-22 10:46 ` [PATCH v5 1/6] of/serial: move earlycon early_param handling to serial Aleksey Makarov
2016-03-22 11:15 ` Rob Herring
2016-03-22 16:55 ` Aleksey Makarov
2016-03-22 12:28 ` kbuild test robot
2016-03-22 10:46 ` [PATCH v5 2/6] ACPI: add definitions of DBG2 subtypes Aleksey Makarov
2016-03-22 10:46 ` [PATCH v5 3/6] ACPI: parse SPCR and enable matching console Aleksey Makarov
2016-03-22 11:09 ` Andy Shevchenko
2016-03-22 16:07 ` Peter Hurley
2016-03-22 17:04 ` Aleksey Makarov
2016-03-22 17:21 ` Peter Hurley
2016-03-22 12:26 ` Yury Norov
2016-03-22 14:57 ` Peter Hurley
2016-03-22 16:51 ` Yury Norov [this message]
2016-03-22 17:08 ` Aleksey Makarov
2016-03-22 17:32 ` Peter Hurley
2016-03-22 10:46 ` [PATCH v5 4/6] ACPI: enable ACPI_SPCR_TABLE on ARM64 Aleksey Makarov
2016-03-22 10:46 ` [PATCH v5 5/6] serial: pl011: add console matching function Aleksey Makarov
2016-03-22 10:46 ` [PATCH v5 6/6] serial: pl011: add EARLYCON_DECLARE Aleksey Makarov
2016-03-22 16:15 ` Peter Hurley
2016-03-22 17:09 ` Aleksey Makarov
2016-03-22 17:41 ` Peter Hurley
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=20160322165122.GB10616@yury-N73SV \
--to=ynorov@caviumnetworks.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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