[PATCH] Driver core: Fix up the driver and device iterators to be quieter
Also stops looping over the lists when a match is found. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de
This commit is contained in:
		
					parent
					
						
							
								d0e2b4a0a9
							
						
					
				
			
			
				commit
				
					
						b86c1df1f9
					
				
			
		
					 1 changed files with 19 additions and 13 deletions
				
			
		| 
						 | 
					@ -88,20 +88,23 @@ static int __device_attach(struct device_driver * drv, void * data)
 | 
				
			||||||
	int error;
 | 
						int error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	error = driver_probe_device(drv, dev);
 | 
						error = driver_probe_device(drv, dev);
 | 
				
			||||||
 | 
						if (error) {
 | 
				
			||||||
	if (error == -ENODEV && error == -ENXIO) {
 | 
							if ((error == -ENODEV) || (error == -ENXIO)) {
 | 
				
			||||||
		/* Driver matched, but didn't support device
 | 
								/* Driver matched, but didn't support device
 | 
				
			||||||
		 * or device not found.
 | 
								 * or device not found.
 | 
				
			||||||
		 * Not an error; keep going.
 | 
								 * Not an error; keep going.
 | 
				
			||||||
		 */
 | 
								 */
 | 
				
			||||||
		error = 0;
 | 
								error = 0;
 | 
				
			||||||
	} else {
 | 
							} else {
 | 
				
			||||||
		/* driver matched but the probe failed */
 | 
								/* driver matched but the probe failed */
 | 
				
			||||||
		printk(KERN_WARNING
 | 
								printk(KERN_WARNING
 | 
				
			||||||
		       "%s: probe of %s failed with error %d\n",
 | 
								       "%s: probe of %s failed with error %d\n",
 | 
				
			||||||
		       drv->name, dev->bus_id, error);
 | 
								       drv->name, dev->bus_id, error);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return error;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						/* stop looking, this device is attached */
 | 
				
			||||||
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -137,7 +140,10 @@ static int __driver_attach(struct device * dev, void * data)
 | 
				
			||||||
				       drv->name, dev->bus_id, error);
 | 
									       drv->name, dev->bus_id, error);
 | 
				
			||||||
			} else
 | 
								} else
 | 
				
			||||||
				error = 0;
 | 
									error = 0;
 | 
				
			||||||
 | 
								return error;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							/* stop looking, this driver is attached */
 | 
				
			||||||
 | 
							return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue