Subject: Re: FYI: Unused function ehci_dump()
To: Krister Walfridsson <cato@df.lth.se>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: tech-kern
Date: 11/15/2005 16:27:05
--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Nov 04, 2005 at 08:38:29PM +0100, Krister Walfridsson wrote:
> 
> On Thu, 3 Nov 2005, Patrick Welche wrote:
> 
> >The following seems to do the trick - I just still haven't tested the
> >kernel yet - should be safe to apply nevertheless (I can't)
> 
> You should use __attribute__((__used__)) instead, which tells gcc that
> the function is used in a way that gcc does not know about (and implies
> that the function must not be eliminated).  Or even better, use the __used
> definition from sys/cdefs.h...

Indeed that seem like the right solution - I didn't even know it existed!

Cheers,

Patrick
(please apply..)

--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=ehcipat

Index: ehci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ehci.c,v
retrieving revision 1.105
diff -u -r1.105 ehci.c
--- ehci.c	18 Jul 2005 11:08:00 -0000	1.105
+++ ehci.c	15 Nov 2005 16:26:09 -0000
@@ -219,7 +219,7 @@
 
 #ifdef EHCI_DEBUG
 Static void		ehci_dump_regs(ehci_softc_t *);
-Static void		ehci_dump(void);
+Static void		ehci_dump(void) __used;
 Static ehci_softc_t 	*theehci;
 Static void		ehci_dump_link(ehci_link_t, int);
 Static void		ehci_dump_sqtds(ehci_soft_qtd_t *);

--HcAYCG3uE/tztfnV--