[PATCH v3 07/38] drm: handle HAS_IOPORT dependencies

Niklas Schnelle schnelle at linux.ibm.com
Thu Mar 23 15:05:51 UTC 2023


On Wed, 2023-03-15 at 13:54 +0200, Jani Nikula wrote:
> On Tue, 14 Mar 2023, Niklas Schnelle <schnelle at linux.ibm.com> wrote:
> > In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> > not being declared. We thus need to add HAS_IOPORT as dependency for
> > those drivers using them. In the bochs driver there is optional MMIO
> > support detected at runtime, warn if this isn't taken when
> > HAS_IOPORT is not defined.
> 
> Not that I care a whole lot, but there should really only be one warning
> or even failure to probe at bochs_hw_init() for !bochs->mmio &&
> !IS_ENABLED(CONFIG_HAS_IOPORT), not warnings all over the place.
> 
> Moreover, the config macro is CONFIG_HAS_IOPORT instead of HAS_IOPORT
> that you check for below.
> 
> BR,
> Jani.
> 

Good Find! Yes the #ifdefs need CONFIG_HAS_IOPORT I even had it
correctly for cirrus in the same patch. For v4 I remove the separate
warnings and instead went with the below:

@@ -229,6 +242,10 @@ static int bochs_hw_init(struct drm_device *dev)
                        return -ENOMEM;
                }
        } else {
+               if (!IS_ENABLED(CONFIG_HAS_IOPORT)) {
+                       DRM_ERROR("I/O ports are not supported\n");
+                       return -EIO;
+               }
                ioaddr = VBE_DISPI_IOPORT_INDEX;
                iosize = 2;
                if (!request_region(ioaddr, iosize, "bochs-drm")) {


Thanks,
Niklas



More information about the dri-devel mailing list