> Date: Fri, 20 Mar 2020 12:50:58 +0100
> From: Martin Pieuchot <m...@openbsd.org>
> 
> On 20/03/20(Fri) 12:01, Mark Kettenis wrote:
> > > Date: Fri, 20 Mar 2020 11:54:59 +0100
> > > From: Martin Pieuchot <m...@openbsd.org>
> > > 
> > > 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?
> > 
> > Does it have to be a real function?  Or can it be a static inline?
> > The latter has the benefit that the compiler can optimize away the
> > function call.
> 
> static inline works as well:

I think that is preferable then.

ok kettenis@

P.S. I can take care of hppa and macppc.


> 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 11:46:38 -0000
> @@ -96,7 +96,6 @@ 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)
>  #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,
> @@ -113,6 +112,12 @@ void             pci_set_powerstate_md(pci_chipset_
>  
>  void         pci_mcfg_init(bus_space_tag_t, bus_addr_t, int, int, int);
>  pci_chipset_tag_t pci_lookup_segment(int);
> +
> +static inline int
> +pci_intr_map_msix(struct pci_attach_args *pa,  int vec, pci_intr_handle_t 
> *ihp)
> +{
> +     return -1;
> +}
>  
>  /*
>   * Section 6.2.4, `Miscellaneous Functions' of the PIC Specification,
> 

Reply via email to