[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <c7592bd4-a9f9-43b0-a243-0fb2ef6bb83d@app.fastmail.com>
Date: Mon, 21 Oct 2024 11:21:00 +0000
From: "Arnd Bergmann" <arnd@...db.de>
To: "Thomas Zimmermann" <tzimmermann@...e.de>,
"Niklas Schnelle" <schnelle@...ux.ibm.com>, "Brian Cain" <bcain@...cinc.com>,
"Marcel Holtmann" <marcel@...tmann.org>,
"Luiz Augusto von Dentz" <luiz.dentz@...il.com>,
"Patrik Jakobsson" <patrik.r.jakobsson@...il.com>,
"Maarten Lankhorst" <maarten.lankhorst@...ux.intel.com>,
"Maxime Ripard" <mripard@...nel.org>, "Dave Airlie" <airlied@...il.com>,
"Simona Vetter" <simona@...ll.ch>, "Dave Airlie" <airlied@...hat.com>,
"Gerd Hoffmann" <kraxel@...hat.com>,
"Lucas De Marchi" <lucas.demarchi@...el.com>,
Thomas Hellström <thomas.hellstrom@...ux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@...el.com>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
"Jiri Slaby" <jirislaby@...nel.org>, "Maciej W. Rozycki" <macro@...am.me.uk>,
"Heiko Carstens" <hca@...ux.ibm.com>
Cc: linux-kernel@...r.kernel.org, linux-hexagon@...r.kernel.org,
linux-bluetooth@...r.kernel.org, dri-devel@...ts.freedesktop.org,
virtualization@...ts.linux.dev, spice-devel@...ts.freedesktop.org,
intel-xe@...ts.freedesktop.org, linux-serial@...r.kernel.org,
Linux-Arch <linux-arch@...r.kernel.org>, "Arnd Bergmann" <arnd@...nel.org>
Subject: Re: [PATCH v8 3/5] drm: handle HAS_IOPORT dependencies
On Mon, Oct 21, 2024, at 10:58, Thomas Zimmermann wrote:
> Am 21.10.24 um 12:08 schrieb Arnd Bergmann:
>> On Mon, Oct 21, 2024, at 07:52, Thomas Zimmermann wrote:
>> --- a/drivers/gpu/drm/tiny/bochs.c
>> +++ b/drivers/gpu/drm/tiny/bochs.c
>> @@ -112,14 +112,12 @@ static void bochs_vga_writeb(struct bochs_device *bochs, u16 ioport, u8 val)
>> if (WARN_ON(ioport < 0x3c0 || ioport > 0x3df))
>> return;
>>
>> - if (bochs->mmio) {
>> + if (!IS_DEFINED(CONFIG_HAS_IOPORT) || bochs->mmio) {
I meant IS_ENABLED() of course.
> For all functions with such a pattern, could we use:
>
> bool bochs_uses_mmio(bochs)
> {
> return !IS_DEFINED(CONFIG_HAS_IOPORT) || bochs->mmio
> }
>
> void writeb_func()
> {
> if (bochs_uses_mmio()) {
> writeb()
> #if CONFIG_HAS_IOPORT
> } else {
> outb()
> #endif
> }
Yes, that helper function look fine, but it should then
be either __always_inline or a macro. With that, the
#ifdef is not needed since gcc only warns if there is
a path that leads to outb() actually getting called.
Arnd
Powered by blists - more mailing lists