[parisc-linux-cvs] hardware.c and drivers.c changes

Matthew Wilcox willy@debian.org
Tue, 28 Aug 2001 14:26:54 +0100


I think this change is bad.  It eliminates the possibiity of hotplugging
native devices, plus it relies on (eg) Lasi getting initialised before
the serial driver.  I know that's currently the case, but relying
on initialisation order is bad and we should attempt to minimalise
dependencies.  Can you revert this change, please?

On Tue, Aug 28, 2001 at 10:04:36AM +0200, Helge Deller wrote:
> +/**
> + * register_parisc_driver - Register this driver if it can handle a device
> + * @driver: the PA-RISC driver to try
> + */
>  int register_parisc_driver(struct parisc_driver *driver)
>  {
>  	int i;
>  
>  	if (driver->next) {
> -		BUG();
>  		printk(KERN_WARNING "BUG: Skipping previously registered driver: %s %s\n",
>  				driver->name, driver->version);
>  		return 1;
>  	}
>  
> -	/* link driver to the head of the global list.
> -	 * The list gets built in reverse order...ideally, it shouldn't
> -	 * matter but reality will eventually rear its ugly head.
> -	 */
> -	driver->next = pa_drivers;
> -	pa_drivers = driver;
> -
> +	write_lock(&pa_lock);
> +	
>  	for (i=0; i < num_devices; i++) {
>  		struct parisc_device *device = &pa_devices[i];
>  
> @@ -91,6 +96,16 @@
>  
>  		if (driver->probe(device) == 0) {
>  			device->driver = driver;
> +			
> +			/* link driver to the head of the global list.
> +			 * The list gets built in reverse order...ideally, it shouldn't
> +			 * matter but reality will eventually rear its ugly head.
> +			 */
> +			if (!driver->next) {
> +				driver->next = pa_drivers;
> +				pa_drivers = driver;
> +			}
> +			
>  		} else {
>  			printk(KERN_WARNING "Warning : device (%d, 0x%x, 0x%x, 0x%x) NOT claimed by %s\n",
>  				device->id.hw_type, device->id.hversion,