[PATCH] Driver core: Fix up the driver and device iterators to be quieter

From: Greg KH (gregkh_at_suse.de)
Date: 06/21/05

  • Next message: Greg KH: "[PATCH] I2C: drivers/i2c/chips/adm1026.c: use dynamic sysfs callbacks"
    Date:	Mon, 20 Jun 2005 15:59:27 -0700
    To: linux-kernel@vger.kernel.org
    
    

    [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

    ---
    commit b86c1df1f98d16c999423a3907eb40a9423f481e
    tree 02cf0b54f3c1d9b987268f2d4737af1a67dd4056
    parent d0e2b4a0a9dd3eed71b56c47268bf4e40cff6d0f
    author gregkh@suse.de <gregkh@suse.de> Thu, 31 Mar 2005 12:53:00 -0800
    committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 20 Jun 2005 15:15:27 -0700
     drivers/base/dd.c |   32 +++++++++++++++++++-------------
     1 files changed, 19 insertions(+), 13 deletions(-)
    diff --git a/drivers/base/dd.c b/drivers/base/dd.c
    --- a/drivers/base/dd.c
    +++ b/drivers/base/dd.c
    @@ -88,20 +88,23 @@ static int __device_attach(struct device
     	int error;
     
     	error = driver_probe_device(drv, dev);
    -
    -	if (error == -ENODEV && error == -ENXIO) {
    -		/* Driver matched, but didn't support device
    -		 * or device not found.
    -		 * Not an error; keep going.
    -		 */
    -		error = 0;
    -	} else {
    -		/* driver matched but the probe failed */
    -		printk(KERN_WARNING
    -		       "%s: probe of %s failed with error %d\n",
    -		       drv->name, dev->bus_id, error);
    +	if (error) {
    +		if ((error == -ENODEV) || (error == -ENXIO)) {
    +			/* Driver matched, but didn't support device
    +			 * or device not found.
    +			 * Not an error; keep going.
    +			 */
    +			error = 0;
    +		} else {
    +			/* driver matched but the probe failed */
    +			printk(KERN_WARNING
    +			       "%s: probe of %s failed with error %d\n",
    +			       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
     				       drv->name, dev->bus_id, error);
     			} else
     				error = 0;
    +			return error;
     		}
    +		/* stop looking, this driver is attached */
    +		return 1;
     	}
     	return 0;
     }
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Greg KH: "[PATCH] I2C: drivers/i2c/chips/adm1026.c: use dynamic sysfs callbacks"

    Relevant Pages

    • Re: New SCM and commit list
      ... > commit message (which isn't the case with most other projects CVS commit ... > lists, ... GIT isn't quite at the point where I can start using it yet, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: New SCM and commit list
      ... especially with the actual patch included in the ... > commit message (which isn't the case with most other projects CVS commit ... The commits lists currently only accept posts from dwmw2@hera, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Linux v2.6.12-rc6
      ... I think it should stop at the first empty line ... > in the commit, not just take the first one). ... Also if the lists of commits could be shown in chronological order (like ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • New SCM and commit list
      ... commit message (which isn't the case with most other projects CVS commit ... lists, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Oops on APM wakeup on 2.4.22/23-pre, works with 2.6.0-test
      ... use 2.6.0 due to other problems such as unstable PCMCIA ... right now (have to solder null-modem cable first etc), ... the followups to me, I don't read the lists ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)