[PATCH 01/21] driver: Add device_detect_all() function
Sascha Hauer
s.hauer at pengutronix.de
Mon Nov 27 23:58:12 PST 2017
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 at pengutronix.de>
> > ---
> > 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 |
More information about the barebox
mailing list