xfree86: Make driver matching consistent

Most of the driver enumeration functions take an array and a maximum
number of entries that they are allowed to fill in. Upon success, they
return the number of entries filled in. This allows them to be easily
used to consecutively.

One exception is the xf86MatchDriverFromFiles() function, which doesn't
return a value, so callers have to manually search the array for the
first empty entry.

This commit modifies the xf86MatchDriverFromFiles() to behave the same
way as others, which makes it easier to deal with.

Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Tested-By: Aaron Plattner <aplattner@nvidia.com>
Tested-by: Rob Clark <robdclark@gmail.com>  (on arm / platform device)
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Thierry Reding 2014-02-14 15:45:33 +01:00 • committed by Keith Packard
commit 5a4e15c3f6
4 changed files with 16 additions and 22 deletions

View file

@ -265,7 +265,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
#endif
#ifdef XSERVER_LIBPCIACCESS
if (i < (nmatches - 1))
i = xf86PciMatchDriver(matches, nmatches);
i += xf86PciMatchDriver(&matches[i], nmatches - i);
#endif
#if defined(__linux__)