[PATCH 2/2] xfree86: Support autoloading of non-PCI drivers
Hans de Goede
hdegoede at redhat.com
Wed Feb 12 08:28:56 PST 2014
Hi,
On 02/12/2014 05:11 PM, Thierry Reding wrote:
> Drivers for non-PCI devices cannot be autoloaded because there is no
> mechanism in place to correlate the device to the driver name.
>
> This patch adds a simple table that maps the name of the Linux kernel
> driver name to a list of DDX module names. Matching modules will be
> added to the list of drivers that X tries to load for a given device.
>
> Signed-off-by: Thierry Reding <treding at nvidia.com>
> ---
> hw/xfree86/common/xf86platformBus.c | 41 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 41 insertions(+)
>
> diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
> index 5875a91363cc..16c9bb6c1dbc 100644
> --- a/hw/xfree86/common/xf86platformBus.c
> +++ b/hw/xfree86/common/xf86platformBus.c
> @@ -176,6 +176,41 @@ xf86_check_platform_slot(const struct xf86_platform_device *pd)
> return TRUE;
> }
>
> +#ifdef __linux__
I'm not a big fan of this, why not put most of this in:
hw/xfree86/os-support/linux/lnx_platform.c
And make xf86platformBus.c simple call a helper for this
from hw/xfree86/os-support/linux/lnx_platform.c ?
Regards,
Hans
> +static const struct xf86platformDriver {
> + const char *name;
> + const char **modules;
> +} xf86platformDrivers[] = {
> + {
> + .name = "tegra",
> + .modules = (const char *[]) {
> + "opentegra",
> + NULL
> + },
> + },
> + { },
> +};
> +
> +static int xf86platformDriverList(char *name, char *matches[], int nmatches)
> +{
> + const struct xf86platformDriver *driver = xf86platformDrivers;
> + int i = 0;
> +
> + while (driver->name) {
> + if (strcmp(driver->name, name) == 0) {
> + for (i = 0; driver->modules[i] && (i < nmatches); i++)
> + matches[i] = xstrdup(driver->modules[i]);
> +
> + break;
> + }
> +
> + driver++;
> + }
> +
> + return i;
> +}
> +#endif
> +
> /**
> * @return The numbers of found devices that match with the current system
> * drivers.
> @@ -208,6 +243,12 @@ xf86PlatformMatchDriver(char *matches[], int nmatches)
> if ((info != NULL) && (j < nmatches)) {
> j += xf86VideoPtrToDriverList(info, &(matches[j]), nmatches - j);
> }
> +#ifdef __linux__
> + else if (j < nmatches) {
> + char *name = xf86_get_platform_attrib(i, ODEV_ATTRIB_DRIVER);
> + j += xf86platformDriverList(name, &matches[j], nmatches - j);
> + }
> +#endif
> }
> }
> return j;
>
More information about the xorg-devel
mailing list