From: Peter Maydell <peter.maydell@linaro.org>
To: Peter Delevoryas <pdel@fb.com>
Cc: "zev@bewilderbeest.net" <zev@bewilderbeest.net>,
"Andrew Jeffery" <andrew@aj.id.au>,
"Iris Chen" <irischenlj@fb.com>,
"OpenBMC List" <openbmc@lists.ozlabs.org>,
"Cameron Esfahani via" <qemu-devel@nongnu.org>,
qemu-arm <qemu-arm@nongnu.org>, "Joel Stanley" <joel@jms.id.au>,
"Cédric Le Goater" <clg@kaod.org>
Subject: Re: [PATCH 2/2] hw: aspeed: Init all UART's with serial devices
Date: Mon, 16 May 2022 15:56:58 +0100 [thread overview]
Message-ID: <CAFEAcA_dadj4cuE55K4ng-twgGO98FOcLX7Y=1_Y9Z929NUZLw@mail.gmail.com> (raw)
In-Reply-To: <05F5C72F-8424-476C-82B7-7D30BA48CDEB@fb.com>
On Fri, 13 May 2022 at 22:09, Peter Delevoryas <pdel@fb.com> wrote
> I was actually intentionally skipping that. If serial_hd(i)
> doesn’t exist, the function will return NULL.
>
> Chardev *serial_hd(int i)
> {
> assert(i >= 0);
> if (i < num_serial_hds) {
> return serial_hds[i];
> }
> return NULL;
> }
>
> So then, the serial device’s CharBackend’s “Chardev *chr”
> will be initialized as NULL. Looking at all of the
> usage of this attribute in “hw/char/serial.c”, I think
> that’s ok, the read/write functions will just be no-ops.
> They all have guards for “chr == NULL”.
Yes, this is deliberate. We added these in commit 12051d82f0040
because otherwise lots of board/SoC code would have to create
NullChardev dummy backends (or forget to and then crash depending
on the user's commandline).
thanks
-- PMM
WARNING: multiple messages have this Message-ID (diff)
From: Peter Maydell <peter.maydell@linaro.org>
To: Peter Delevoryas <pdel@fb.com>
Cc: "Iris Chen" <irischenlj@fb.com>,
"patrick@stwcx.xyz" <patrick@stwcx.xyz>,
qemu-arm <qemu-arm@nongnu.org>,
"Cameron Esfahani via" <qemu-devel@nongnu.org>,
"zev@bewilderbeest.net" <zev@bewilderbeest.net>,
"OpenBMC List" <openbmc@lists.ozlabs.org>,
"Andrew Jeffery" <andrew@aj.id.au>,
"Joel Stanley" <joel@jms.id.au>,
"Cédric Le Goater" <clg@kaod.org>
Subject: Re: [PATCH 2/2] hw: aspeed: Init all UART's with serial devices
Date: Mon, 16 May 2022 15:56:58 +0100 [thread overview]
Message-ID: <CAFEAcA_dadj4cuE55K4ng-twgGO98FOcLX7Y=1_Y9Z929NUZLw@mail.gmail.com> (raw)
In-Reply-To: <05F5C72F-8424-476C-82B7-7D30BA48CDEB@fb.com>
On Fri, 13 May 2022 at 22:09, Peter Delevoryas <pdel@fb.com> wrote
> I was actually intentionally skipping that. If serial_hd(i)
> doesn’t exist, the function will return NULL.
>
> Chardev *serial_hd(int i)
> {
> assert(i >= 0);
> if (i < num_serial_hds) {
> return serial_hds[i];
> }
> return NULL;
> }
>
> So then, the serial device’s CharBackend’s “Chardev *chr”
> will be initialized as NULL. Looking at all of the
> usage of this attribute in “hw/char/serial.c”, I think
> that’s ok, the read/write functions will just be no-ops.
> They all have guards for “chr == NULL”.
Yes, this is deliberate. We added these in commit 12051d82f0040
because otherwise lots of board/SoC code would have to create
NullChardev dummy backends (or forget to and then crash depending
on the user's commandline).
thanks
-- PMM
next prev parent reply other threads:[~2022-05-16 14:58 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 4:02 [PATCH 0/2] hw: aspeed: Init all UART's with serial devices Peter Delevoryas
2022-05-13 4:02 ` Peter Delevoryas
2022-05-13 4:02 ` [PATCH 1/2] hw: aspeed: Add missing UART's Peter Delevoryas
2022-05-13 4:02 ` Peter Delevoryas
2022-05-13 5:21 ` Cédric Le Goater
2022-05-13 5:21 ` Cédric Le Goater
2022-05-13 4:02 ` [PATCH 2/2] hw: aspeed: Init all UART's with serial devices Peter Delevoryas
2022-05-13 4:02 ` Peter Delevoryas
2022-05-13 5:31 ` Cédric Le Goater
2022-05-13 5:31 ` Cédric Le Goater
2022-05-13 21:08 ` Peter Delevoryas
2022-05-13 21:08 ` Peter Delevoryas
2022-05-14 7:30 ` Cédric Le Goater
2022-05-14 7:30 ` Cédric Le Goater
2022-05-14 7:39 ` Peter Delevoryas
2022-05-14 7:39 ` Peter Delevoryas
2022-05-15 21:19 ` Cédric Le Goater
2022-05-15 21:19 ` Cédric Le Goater
2022-05-15 22:55 ` Peter Delevoryas
2022-05-15 22:55 ` Peter Delevoryas
2022-05-16 14:56 ` Peter Maydell [this message]
2022-05-16 14:56 ` Peter Maydell
2022-05-13 21:39 ` [PATCH 0/2] " Zev Weiss
2022-05-13 21:39 ` Zev Weiss
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='CAFEAcA_dadj4cuE55K4ng-twgGO98FOcLX7Y=1_Y9Z929NUZLw@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=irischenlj@fb.com \
--cc=joel@jms.id.au \
--cc=openbmc@lists.ozlabs.org \
--cc=pdel@fb.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=zev@bewilderbeest.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.