As explained in my recent ix(4) diff, using a define when an arch
doesn't support a given function makes the compiler complain that
the arguments are unused:

  /sys/dev/pci/if_ix.c:1789:21: error: unused variable 'dummy'
        [-Werror,-Wunused-variable]
          pci_intr_handle_t        dummy;
                                   ^
  /sys/dev/pci/if_ix.c:1788:26: error: unused variable 'pa'
        [-Werror,-Wunused-variable]
          struct pci_attach_args  *pa = &os->os_pa;

So the diff below uses a stub instead, as discussed with kettenis@.
This is enough to not break any build with the above mentioned ix(4)
diff.

That said alpha, hppa, landisk, macppc and the various mips64 could
benefit from the same treatment to prevent future bad surprises.

ok?

Index: arch/i386/pci/pci_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/pci/pci_machdep.c,v
retrieving revision 1.85
diff -u -p -r1.85 pci_machdep.c
--- arch/i386/pci/pci_machdep.c 7 Jan 2019 23:44:11 -0000       1.85
+++ arch/i386/pci/pci_machdep.c 20 Mar 2020 10:41:20 -0000
@@ -631,6 +631,12 @@ pci_intr_map_msi(struct pci_attach_args 
 }
 
 int
+pci_intr_map_msix(struct pci_attach_args *pa, int vec, pci_intr_handle_t *ihp)
+{
+       return -1;
+}
+
+int
 pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
 {
        int pin = pa->pa_rawintrpin;
Index: arch/i386/pci/pci_machdep.h
===================================================================
RCS file: /cvs/src/sys/arch/i386/pci/pci_machdep.h,v
retrieving revision 1.30
diff -u -p -r1.30 pci_machdep.h
--- arch/i386/pci/pci_machdep.h 19 Aug 2018 08:23:47 -0000      1.30
+++ arch/i386/pci/pci_machdep.h 20 Mar 2020 10:42:45 -0000
@@ -96,7 +96,8 @@ void          pci_conf_write(pci_chipset_tag_t, 
 struct pci_attach_args;
 int            pci_intr_map_msi(struct pci_attach_args *, pci_intr_handle_t *);
 int            pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
-#define                pci_intr_map_msix(p, vec, ihp)  (-1)
+int            pci_intr_map_msix(struct pci_attach_args *,
+                   int, pci_intr_handle_t *);
 #define                pci_intr_line(c, ih)    ((ih).line)
 const char     *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
 void           *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,

Reply via email to