Subject: kern/7295: if_we frontend and backend double declare flags constants
To: None <gnats-bugs@gnats.netbsd.org>
From: Martin Husemann <martin@rumolt.teuto.de>
List: netbsd-bugs
Date: 03/30/1999 20:51:35
>Number:         7295
>Category:       kern
>Synopsis:       if_we frontend and dp8390 backend double declare flags constants
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 30 11:05:00 1999
>Last-Modified:
>Originator:     Martin Husemann
>Organization:
	
>Release:        current as of Tue Mar 30 20:44:51 1999
>Environment:
	
System: NetBSD rumolt.teuto.de 1.3K NetBSD 1.3K (RUMOLT) #10: Tue Mar 23 06:41:45 MET 1999 root@rumolt.teuto.de:/a/usr/src/sys-i4b/arch/i386/compile/RUMOLT i386


>Description:
While looking for possible flags values for the sys/dev/isa/if_we.c driver,
I found the following:

in sys/dev/ic/dp8390var.h:
#define DP8390_DISABLE_TRANCEIVER	0x0001
#define DP8390_FORCE_8BIT_MODE		0x0002
#define DP8390_FORCE_16BIT_MODE		0x0004
#define DP8390_NO_MULTI_BUFFERING	0x0008
#define DP8390_FORCE_PIO		0x0010

in sys/dev/isa/if_wereg.h:
#define WE_FLAGS_DISABLE_TRANCEIVER	0x0001
#define WE_FLAGS_FORCE_8BIT_MODE	0x0002
#define WE_FLAGS_FORCE_16BIT_MODE	0x0004
#define WE_FLAGS_NO_MULTI_BUFFERING	0x0008

Code inspection shows that DP8390_DISABLE_TRANCEIVER and DP8390_FORCE_PIO are
not used in the driver at all; the NO_MULTI_BUFFERING is only used in the
backend as DP8390_NO_MULTI_BUFFERING, the FORCE_8/16 codes are only used in
the frontend as WE_FLAGS_FORCE_8/16BIT_MODE.

Wouldn't it be better to remove the unused constants and only define them
once (or separate them into frontend/backend values - but don't duplicate
them)?

>How-To-Repeat:
Code inspection.

>Fix:
GC and unify the duplicate defines.
>Audit-Trail:
>Unformatted: