Subject: Re: Splitting struct device and softc
To: None <tech-kern@netbsd.org>
From: Jachym Holecek <freza@NetBSD.org>
List: tech-kern
Date: 09/24/2007 13:34:00
Hello,

# Joerg Sonnenberger 2007-09-23:
> I'd like to commit the attached patch to allow converting drivers on a
> case-by-case base to not depend on struct device being the first field.
> if_bge is included as sample. CFATTACH_DECL*_NEW is meant as a temporary
> interface until all drivers are converted and should be removed after
> that. This is a first and critical step to completely remove the public
> definition of struct device (and make it an abstract interface thereby).

Yay!

> Index: dev/pci/if_bgereg.h
> ===================================================================
> RCS file: /home/joerg/repo/netbsd/src/sys/dev/pci/if_bgereg.h,v
> retrieving revision 1.43
> diff -u -r1.43 if_bgereg.h
> --- dev/pci/if_bgereg.h	6 Aug 2007 12:23:08 -0000	1.43
> +++ dev/pci/if_bgereg.h	22 Sep 2007 22:34:58 -0000
> @@ -2380,7 +2380,7 @@
>  #define BGE_JUMBO_RXRING_VALID	0x0004
>  
>  struct bge_softc {
> -	struct device		bge_dev;
> +	device_t		bge_dev;
>  	struct ethercom		ethercom;		/* interface info */
>  	bus_space_handle_t	bge_bhandle;
>  	bus_space_tag_t		bge_btag;

I don't really like the backlinking, I guess I'd prefer to modify the
driver so that it passes device_t around where it previously passed
the softc... that might be an aesthetical detail.

	-- Jachym