cvs commit: src/sys/dev/acpica acpivar.h

M. Warner Losh imp at bsdimp.com
Thu May 20 19:57:44 PDT 2004


In message: <20040520194832.I44800 at root.org>
            Nate Lawson <nate at root.org> writes:
: On Thu, 20 May 2004, M. Warner Losh wrote:
: > In message: <20040520174908.I44439 at root.org>
: >             Nate Lawson <nate at root.org> writes:
: > : Interesting, I didn't get that in my testing.  Try this patch:
: > :
: > : Index: /sys/sys/bus.h
: > : ===================================================================
: > : RCS file: /home/ncvs/src/sys/sys/bus.h,v
: > : retrieving revision 1.58
: > : diff -u -r1.58 bus.h
: > : --- /sys/sys/bus.h	17 Mar 2004 17:40:34 -0000	1.58
: > : +++ /sys/sys/bus.h	21 May 2004 00:48:23 -0000
: > : @@ -456,8 +456,9 @@
: > :  static __inline type varp ## _get_ ## var(device_t dev)			\
: > :  {									\
: > :  	uintptr_t v;							\
: > : -	BUS_READ_IVAR(device_get_parent(dev), dev,			\
: > : -	    ivarp ## _IVAR_ ## ivar, &v);				\
: > : +	if (BUS_READ_IVAR(device_get_parent(dev), dev,			\
: > : +	    ivarp ## _IVAR_ ## ivar, &v) != 0)				\
: > : +		v = (type) 0;						\

v = (type) 0; is likely wrong too :-)  Why not -1 or 12 or 0xdeadbeef?

: > :  	return ((type) v);						\
: > :  }									\
: > :  									\
: > : I don't know if this change will be acceptable though.  It's probably
: > : better to change the get function to take a pointer argument and return
: > : the value from BUS_READ_IVAR.
: >
: > No can do.  All the pci get functions are implemented in terms of this
: > macro, and changing all the drivers in the tree to behave as you
: > suggest would be extremely painful.
: 
: Augh, I assume this also applies to making it varp_get_var(device_t dev,
: uintptr_t value) ?  It's lousy that this doesn't check the return value.

I'm not sure I understand what you are saying.

Warner


More information about the cvs-src mailing list