From: Peter Maydell <peter.maydell@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "QEMU Developers" <qemu-devel@nongnu.org>,
"patches@linaro.org" <patches@linaro.org>,
"Michael S . Tsirkin" <mst@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 07/13] Change references to serial_hds[] to serial_hd()
Date: Wed, 25 Apr 2018 16:44:57 +0100 [thread overview]
Message-ID: <CAFEAcA8M6s-PjFbnuOkPHRSSb+dW2LH9D26p4VfogsdPenPAEw@mail.gmail.com> (raw)
In-Reply-To: <609a3ccf-88d7-bad3-c37a-eec6bcab0235@amsat.org>
On 25 April 2018 at 15:54, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Hi Peter,
>
> On 04/20/2018 11:52 AM, Peter Maydell wrote:
>> Change all the uses of serial_hds[] to go via the new
>> serial_hd() function. Code change produced with:
>> find hw -name '*.[ch]' | xargs sed -i -e 's/serial_hds\[\([^]]*\)\]/serial_hd(\1)/g'
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> --- a/hw/arm/mps2-tz.c
>> +++ b/hw/arm/mps2-tz.c
>> @@ -172,7 +172,7 @@ static MemoryRegion *make_uart(MPS2TZMachineState *mms, void *opaque,
>> {
>> CMSDKAPBUART *uart = opaque;
>> int i = uart - &mms->uart[0];
>> - Chardev *uartchr = i < MAX_SERIAL_PORTS ? serial_hds[i] : NULL;
>> + Chardev *uartchr = i < MAX_SERIAL_PORTS ? serial_hd(i) : NULL;
>
> You can remove uartchr and directly use serial_hd(i).
These kinds of cleanup are in later patches in the series --
this one is kept strictly to the purely-mechanical sed change,
as otherwise it would be a bit awkward to review I thought.
>> diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c
>> index f68df56b97..75c44adf7d 100644
>> --- a/hw/arm/msf2-soc.c
>> +++ b/hw/arm/msf2-soc.c
>> @@ -138,10 +138,10 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)
>> system_clock_scale = NANOSECONDS_PER_SECOND / s->m3clk;
>>
>> for (i = 0; i < MSF2_NUM_UARTS; i++) {
>> - if (serial_hds[i]) {
>> + if (serial_hd(i)) {
>
> We can now remove this check, but maybe another series...
>
>> serial_mm_init(get_system_memory(), uart_addr[i], 2,
>> qdev_get_gpio_in(armv7m, uart_irq[i]),
>> - 115200, serial_hds[i], DEVICE_NATIVE_ENDIAN);
>> + 115200, serial_hd(i), DEVICE_NATIVE_ENDIAN);
>> }
I agree that's probably a good change to make, but it's also
a behavioural change (we would go from only creating serial
devices where -serial args are given, to always creating
them). I wanted to generally avoid having any behavioural
changes in this series.
>> @@ -3963,21 +3963,21 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
>> omap_findclk(s, "uart1_ck"),
>> s->drq[OMAP_DMA_UART1_TX], s->drq[OMAP_DMA_UART1_RX],
>> "uart1",
>> - serial_hds[0]);
>> + serial_hd(0));
>> s->uart[1] = omap_uart_init(0xfffb0800,
>> qdev_get_gpio_in(s->ih[1], OMAP_INT_UART2),
>> omap_findclk(s, "uart2_ck"),
>> omap_findclk(s, "uart2_ck"),
>> s->drq[OMAP_DMA_UART2_TX], s->drq[OMAP_DMA_UART2_RX],
>> "uart2",
>> - serial_hds[0] ? serial_hds[1] : NULL);
>> + serial_hd(0) ? serial_hd(1) : NULL);
>
> This will need cleanup later...
It's a bit weird, but I don't think it's specifically wrong.
>> --- a/hw/mips/mips_mipssim.c
>> +++ b/hw/mips/mips_mipssim.c
>> @@ -213,8 +213,8 @@ mips_mipssim_init(MachineState *machine)
>>
>> /* A single 16450 sits at offset 0x3f8. It is attached to
>> MIPS CPU INT2, which is interrupt 4. */
>> - if (serial_hds[0])
>> - serial_init(0x3f8, env->irq[4], 115200, serial_hds[0],
>> + if (serial_hd(0))
>
> We will drop this if () later... This now misses brackets :/
Hazard of pure-mechanical-change cleanup is that it
doesn't include coding-style fixes, but it's no
worse than it was before.
thanks
-- PMM
next prev parent reply other threads:[~2018-04-25 15:45 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-20 14:52 [Qemu-devel] [PATCH 00/13] Drop compile time limit on number of serial ports Peter Maydell
2018-04-20 14:52 ` [Qemu-devel] [PATCH 01/13] hw/char/serial: Allow disconnected chardevs Peter Maydell
2018-04-20 16:28 ` Philippe Mathieu-Daudé
2018-04-25 14:37 ` Thomas Huth
2018-04-20 14:52 ` [Qemu-devel] [PATCH 02/13] hw/arm/fsl-imx*: Don't create "null" chardevs for serial devices Peter Maydell
2018-04-20 16:48 ` Philippe Mathieu-Daudé
2018-04-25 14:34 ` Thomas Huth
2018-04-25 14:36 ` Thomas Huth
2018-04-26 12:53 ` Peter Maydell
2018-04-20 14:52 ` [Qemu-devel] [PATCH 03/13] hw/mips/boston.c: " Peter Maydell
2018-04-21 2:50 ` Philippe Mathieu-Daudé
2018-04-25 14:36 ` Thomas Huth
2018-04-20 14:52 ` [Qemu-devel] [PATCH 04/13] hw/mips/mips_malta: " Peter Maydell
2018-04-20 16:30 ` Philippe Mathieu-Daudé
2018-04-25 14:38 ` Thomas Huth
2018-04-20 14:52 ` [Qemu-devel] [PATCH 05/13] hw/xtensa/xtfpga.c: " Peter Maydell
2018-04-21 22:26 ` Philippe Mathieu-Daudé
2018-04-25 14:39 ` Thomas Huth
2018-04-20 14:52 ` [Qemu-devel] [PATCH 06/13] vl.c: Provide accessor function serial_hd() for serial_hds[] array Peter Maydell
2018-04-25 14:39 ` Philippe Mathieu-Daudé
2018-04-25 14:43 ` Thomas Huth
2018-04-20 14:52 ` [Qemu-devel] [PATCH 07/13] Change references to serial_hds[] to serial_hd() Peter Maydell
2018-04-25 14:52 ` Thomas Huth
2018-04-25 14:54 ` Philippe Mathieu-Daudé
2018-04-25 15:44 ` Peter Maydell [this message]
2018-04-20 14:52 ` [Qemu-devel] [PATCH 08/13] Remove checks on MAX_SERIAL_PORTS that are just bounds checks Peter Maydell
2018-04-25 14:56 ` Thomas Huth
2018-04-25 14:59 ` Philippe Mathieu-Daudé
2018-04-20 14:52 ` [Qemu-devel] [PATCH 09/13] hw/char/exynos4210_uart.c: Remove unneeded handling of NULL chardev Peter Maydell
2018-04-25 14:59 ` Philippe Mathieu-Daudé
2018-04-25 15:05 ` Thomas Huth
2018-04-25 15:23 ` Philippe Mathieu-Daudé
2018-04-20 14:52 ` [Qemu-devel] [PATCH 10/13] serial-isa: Use MAX_ISA_SERIAL_PORTS instead of MAX_SERIAL_PORTS Peter Maydell
2018-04-20 16:57 ` Philippe Mathieu-Daudé
2018-04-25 15:09 ` Thomas Huth
2018-04-20 14:52 ` [Qemu-devel] [PATCH 11/13] superio: Don't use MAX_SERIAL_PORTS for serial port limit Peter Maydell
2018-04-20 17:58 ` Philippe Mathieu-Daudé
2018-04-20 14:52 ` [Qemu-devel] [PATCH 12/13] vl.c: Remove compile time limit on number of serial ports Peter Maydell
2018-04-20 16:58 ` Paolo Bonzini
2018-04-20 17:06 ` Peter Maydell
2018-04-20 17:55 ` Paolo Bonzini
2018-04-20 17:01 ` Philippe Mathieu-Daudé
2018-04-25 15:16 ` Thomas Huth
2018-04-20 14:52 ` [Qemu-devel] [PATCH 13/13] vl.c: new function max_serial_hds() Peter Maydell
2018-04-20 17:50 ` Philippe Mathieu-Daudé
2018-04-26 13:00 ` Peter Maydell
2018-04-25 15:19 ` Thomas Huth
2018-04-20 15:10 ` [Qemu-devel] [PATCH 00/13] Drop compile time limit on number of serial ports no-reply
2018-04-20 15:12 ` Peter Maydell
2018-04-26 13:56 ` Peter Maydell
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=CAFEAcA8M6s-PjFbnuOkPHRSSb+dW2LH9D26p4VfogsdPenPAEw@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=f4bug@amsat.org \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=patches@linaro.org \
--cc=pbonzini@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).