From: Thomas Huth <thuth@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: Aurelien Jarno <aurelien@aurel32.net>,
"Michael S. Tsirkin" <mst@redhat.com>,
Aleksandar Markovic <amarkovic@wavecomp.com>,
Aleksandar Rikalo <arikalo@wavecomp.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-4.1 1/4] hw/isa/superio: Rename a variable
Date: Fri, 5 Apr 2019 06:14:26 +0200 [thread overview]
Message-ID: <ef95f30c-38e0-d7bd-533f-d8b9831bc62a@redhat.com> (raw)
In-Reply-To: <20190404221238.12468-2-philmd@redhat.com>
On 05/04/2019 00.12, Philippe Mathieu-Daudé wrote:
> This patch is purely cosmetic. No functional change.
> This will ease the next patch where we re-indent an if() statement.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/isa/isa-superio.c | 69 ++++++++++++++++++++++----------------------
> 1 file changed, 34 insertions(+), 35 deletions(-)
>
> diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
> index d54463bf035..c6845eaf578 100644
> --- a/hw/isa/isa-superio.c
> +++ b/hw/isa/isa-superio.c
> @@ -22,8 +22,8 @@
>
> static void isa_superio_realize(DeviceState *dev, Error **errp)
> {
> - ISASuperIODevice *sio = ISA_SUPERIO(dev);
> - ISASuperIOClass *k = ISA_SUPERIO_GET_CLASS(sio);
> + ISASuperIODevice *s = ISA_SUPERIO(dev);
> + ISASuperIOClass *k = ISA_SUPERIO_GET_CLASS(s);
Sorry, but I have to say that I normally really don't like single-letter
variable names. They are much harder to search for, and way less
self-describing.
If you get problems with the line length in a later patch, what about
refactoring the related code into a separate function? So that you'd
only have something like this in the realize function:
for (i = 0, j = 0; i < bus_count; i++, j += MAX_IDE_DEVS) {
if (!k->ide.is_enabled || k->ide.is_enabled(s, j)) {
isa_superio_init_ide(...);
}
}
Thomas
WARNING: multiple messages have this Message-ID (diff)
From: Thomas Huth <thuth@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: Aleksandar Rikalo <arikalo@wavecomp.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Aleksandar Markovic <amarkovic@wavecomp.com>,
Aurelien Jarno <aurelien@aurel32.net>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-4.1 1/4] hw/isa/superio: Rename a variable
Date: Fri, 5 Apr 2019 06:14:26 +0200 [thread overview]
Message-ID: <ef95f30c-38e0-d7bd-533f-d8b9831bc62a@redhat.com> (raw)
Message-ID: <20190405041426.PPjwxonZjXwC9rDQD1ZddgHpXnNCgBRco3mX7-etxR8@z> (raw)
In-Reply-To: <20190404221238.12468-2-philmd@redhat.com>
On 05/04/2019 00.12, Philippe Mathieu-Daudé wrote:
> This patch is purely cosmetic. No functional change.
> This will ease the next patch where we re-indent an if() statement.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/isa/isa-superio.c | 69 ++++++++++++++++++++++----------------------
> 1 file changed, 34 insertions(+), 35 deletions(-)
>
> diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
> index d54463bf035..c6845eaf578 100644
> --- a/hw/isa/isa-superio.c
> +++ b/hw/isa/isa-superio.c
> @@ -22,8 +22,8 @@
>
> static void isa_superio_realize(DeviceState *dev, Error **errp)
> {
> - ISASuperIODevice *sio = ISA_SUPERIO(dev);
> - ISASuperIOClass *k = ISA_SUPERIO_GET_CLASS(sio);
> + ISASuperIODevice *s = ISA_SUPERIO(dev);
> + ISASuperIOClass *k = ISA_SUPERIO_GET_CLASS(s);
Sorry, but I have to say that I normally really don't like single-letter
variable names. They are much harder to search for, and way less
self-describing.
If you get problems with the line length in a later patch, what about
refactoring the related code into a separate function? So that you'd
only have something like this in the realize function:
for (i = 0, j = 0; i < bus_count; i++, j += MAX_IDE_DEVS) {
if (!k->ide.is_enabled || k->ide.is_enabled(s, j)) {
isa_superio_init_ide(...);
}
}
Thomas
next prev parent reply other threads:[~2019-04-05 4:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-04 22:12 [Qemu-devel] [PATCH for-4.1 0/4] hw/mips/r4k: Refactor the Super I/O chipset Philippe Mathieu-Daudé
2019-04-04 22:12 ` [Qemu-devel] [PATCH for-4.1 1/4] hw/isa/superio: Rename a variable Philippe Mathieu-Daudé
2019-04-05 4:14 ` Thomas Huth [this message]
2019-04-05 4:14 ` Thomas Huth
2019-04-05 9:32 ` Philippe Mathieu-Daudé
2019-04-05 9:32 ` Philippe Mathieu-Daudé
2019-04-04 22:12 ` [Qemu-devel] [PATCH for-4.1 2/4] hw/isa/superio: Support more than one IDE bus Philippe Mathieu-Daudé
2019-04-04 22:12 ` [Qemu-devel] [PATCH for-4.1 3/4] hw/isa/superio: Support chipsets with no Floppy Disk controller Philippe Mathieu-Daudé
2019-04-05 4:24 ` Thomas Huth
2019-04-05 4:24 ` Thomas Huth
2019-04-04 22:12 ` [Qemu-devel] [PATCH for-4.1 4/4] hw/mips/r4k: Refactor the Super I/O chipset Philippe Mathieu-Daudé
2019-04-05 4:51 ` Thomas Huth
2019-04-05 4:51 ` Thomas Huth
2019-04-05 9:49 ` Philippe Mathieu-Daudé
2019-04-05 9:49 ` Philippe Mathieu-Daudé
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=ef95f30c-38e0-d7bd-533f-d8b9831bc62a@redhat.com \
--to=thuth@redhat.com \
--cc=amarkovic@wavecomp.com \
--cc=arikalo@wavecomp.com \
--cc=aurelien@aurel32.net \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).