[PATCH v8 3/5] drm: handle HAS_IOPORT dependencies
Arnd Bergmann
arnd at arndb.de
Mon Oct 21 11:21:00 UTC 2024
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
More information about the Intel-xe
mailing list