Re: [PATCH 01/21] driver: Add device_detect_all() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 25, 2017 at 12:34:27AM +0100, Sam Ravnborg wrote:
> Hi Sasha.
> 
> On Fri, Nov 24, 2017 at 09:12:17AM +0100, Sascha Hauer wrote:
> > Add a device_detect_all function to detect all devices and use it
> > in the detect command. This makes the functionality reusable in other
> > code.
> > 
> > Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> > ---
> >  commands/detect.c     | 6 +-----
> >  drivers/base/driver.c | 8 ++++++++
> >  include/driver.h      | 1 +
> >  3 files changed, 10 insertions(+), 5 deletions(-)
> > 
> > diff --git a/commands/detect.c b/commands/detect.c
> > index 1586a6fb54..42e111419f 100644
> > --- a/commands/detect.c
> > +++ b/commands/detect.c
> > @@ -56,11 +56,7 @@ static int do_detect(int argc, char *argv[])
> >  	}
> >  
> >  	if (option_all) {
> > -		for_each_device(dev) {
> > -			ret = device_detect(dev);
> > -			if (ret && ret != -ENOSYS && option_error)
> > -				return ret;
> > -		}
> > +		device_detect_all();
> 
> With this change there is no longer any checks
> if device_detect() fails.
> so the option "-e" is no longer useful in combination
> with option "-a" (which uses the patched code).

Of course we could bail out of device_detect_all() when an error
occurs, I'm not sure though how useful this is. I mean when your
SATA drivers detect function returns an error because there is no
drive connected, why would you want to bail out of the detection of
other devices?

In an earlier version of this series I completely removed the -e
option. Maybe that would be better?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux