Subject: Problems with autoconf matching
To: None <>
From: Julio M. Merino Vidal <>
List: tech-kern
Date: 09/01/2007 17:25:17

[ Please CC me ]

I am adding a new 'genfb' driver to mac68k, aimed at replacing  
intvid, macvid and the macfb that attaches to these two.

The relevant part of the current configuration file looks like this  
(I'm discarding macvid for simplicity):

intvid0	at obio?			# Internal video hardware
macfb*	at intvid?

genfb*		at obio?		# Internal video hardware

wsdisplay*	at genfb? console ?
wsdisplay*	at macfb? console ?

So we have this chain of devices:

1) The old one: wsdisplay -> macfb -> intvid -> obio
2) The new one: wsdisplay -> genfb -> obio

intvid and genfb have the exact same autoconf matching functions  
because they can handle the same set of devices (yes, the plan is to  
kill intvid later on).  However, I have changed genfb to return 5 on  
match, instead of the 1 that intvid returns, so that the kernel gives  
priority to genfb.  Unfortunately this doesn't seem to work as expected.

For simplicity I have reduced the above configuration into the  

intvid0	at obio?			# Internal video hardware
genfb*		at obio?		# Internal video hardware
wsdisplay*	at genfb? console ?

So basically we now only have intvid and genfb competing to handle  
the same video device, and we don't have macfb into the mix (which  
messes other code due to conditional compilation and it could cause  
other nasty problems).

Based on this simplified configuration, if I compile both intvid and  
genfb into the kernel, it seems that the system is picking up the  
intvid driver.  I say "seems" because I cannot see what happens later  
because the machine hangs.  (Adding macfb does not help either.)

If I disable intvid, the machine boots.  If I disable genfb and add  
macfb on top of intvid, it also works.

If I change intvid's match routine to return 0 in all cases, the  
kernel properly picks up genfb and boots correctly.

AIUI, as genfb returns 5 during match and intvid returns 1, autoconf  
should simply discard intvid and use genfb, isn't it?  It should  
behave as if intvid's match returned 0, as the last test I did.  But  
for some reason there seems to be a problem in this.  Or is my  
reasoning wrong?


Julio M. Merino Vidal <>