From: Peter Maydell <peter.maydell@linaro.org>
To: Andrew Jones <drjones@redhat.com>
Cc: David Edmondson <david.edmondson@oracle.com>,
Ying Fang <fangying1@huawei.com>,
salil.mehta@huawei.com, qemu-arm <qemu-arm@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH] hw/arm/virt: Remove virt machine state 'smp_cpus'
Date: Thu, 7 Jan 2021 12:16:58 +0000 [thread overview]
Message-ID: <CAFEAcA8MQoThWcmcoC30oEGGQ8POtz=ixBd7HUjZT+8YnJfvqA@mail.gmail.com> (raw)
In-Reply-To: <20201216064353.2n4evhicybkkuf7z@kamzik.brq.redhat.com>
On Wed, 16 Dec 2020 at 06:44, Andrew Jones <drjones@redhat.com> wrote:
>
> On Tue, Dec 15, 2020 at 06:20:48PM +0000, David Edmondson wrote:
> > On Tuesday, 2020-12-15 at 18:48:15 +01, Andrew Jones wrote:
> >
> > > virt machine's 'smp_cpus' and machine->smp.cpus must always have the
> > > same value. And, anywhere we have virt machine state we have machine
> > > state. So let's remove the redundancy. Also, to make it easier to see
> > > that machine->smp is the true source for "smp_cpus" and "max_cpus",
> > > avoid passing them in function parameters, preferring instead to get
> > > them from the state.
> > > static void fdt_add_cpu_nodes(const VirtMachineState *vms)
> > > {
> > > - int cpu;
> > > - int addr_cells = 1;
> > > const MachineState *ms = MACHINE(vms);
> > > + int smp_cpus = ms->smp.cpus, cpu;
> >
> > Is it house-style to have initialised and un-initialised local variables
> > declared on the same line?
> >
>
> checkpatch.pl doesn't complain and a grep of qemu shows hundreds of other
> examples. That said, I only see one other example in hw/arm/virt.c, so if
> we'd rather avoid it, I'll repost.
I think this is one of those things where the style guide doesn't
say anything, so it comes down to individual developer preference.
Personally I find declaring an uninitialized local on the same
line and after an initialized local is a bit confusing to read
so I've tweaked the patch, but it's not a big deal either way.
Applied to target-arm.next, thanks.
-- PMM
next prev parent reply other threads:[~2021-01-07 12:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-15 17:48 [PATCH] hw/arm/virt: Remove virt machine state 'smp_cpus' Andrew Jones
2020-12-15 18:20 ` David Edmondson
2020-12-16 6:43 ` Andrew Jones
2020-12-16 8:38 ` David Edmondson
2021-01-07 12:16 ` Peter Maydell [this message]
2020-12-16 9:01 ` Ying Fang
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='CAFEAcA8MQoThWcmcoC30oEGGQ8POtz=ixBd7HUjZT+8YnJfvqA@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=david.edmondson@oracle.com \
--cc=drjones@redhat.com \
--cc=fangying1@huawei.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=salil.mehta@huawei.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).