Coverage Report

Created: 2026-10-17 06:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/barebox/commands/drvinfo.c
Line
Count
Source
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
// SPDX-FileCopyrightText: © 2013 Sascha Hauer, Pengutronix
3
// SPDX-FileCopyrightText: © 2014 Holger Schurig
4
5
#include <common.h>
6
#include <command.h>
7
#include <driver.h>
8
#include <complete.h>
9
#include <fnmatch.h>
10
11
static int do_drvinfo(int argc, char *argv[])
12
0
{
13
0
  char *pattern = argv[1];
14
0
  struct driver *drv;
15
0
  struct device *dev;
16
17
0
  printf("Driver\tDevice(s)\n");
18
0
  printf("--------------------\n");
19
0
  for_each_driver(drv) {
20
0
    if (pattern && fnmatch(pattern, drv->name, 0))
21
0
      continue;
22
23
0
    printf("%s\n",drv->name);
24
0
    for_each_device(dev) {
25
0
      if (dev->driver == drv)
26
0
        printf("\t%s\n", dev_name(dev));
27
0
    }
28
0
  }
29
30
0
  if (IS_ENABLED(CONFIG_CMD_DEVINFO))
31
0
    printf("\nUse 'devinfo DEVICE' for more information\n");
32
33
0
  return 0;
34
0
}
35
36
37
BAREBOX_CMD_START(drvinfo)
38
  .cmd    = do_drvinfo,
39
  BAREBOX_CMD_DESC("list compiled-in device drivers")
40
  BAREBOX_CMD_OPTS("[DRIVER]")
41
  BAREBOX_CMD_GROUP(CMD_GRP_INFO)
42
  BAREBOX_CMD_COMPLETE(driver_complete)
43
BAREBOX_CMD_END