diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-10-14 18:32:51 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-10-14 18:49:37 +0100 |
commit | acd5d3d3657b04a47418a95d9301835e6d64c86c (patch) | |
tree | f0bc8daaeacdc590be20d62251b3a37dd96ae998 | |
parent | 7dcf7bf0be339c3e6cfd5b403e624654653b5c63 (diff) |
lib/sysfs: Use a fallback for builtin modules
A builtin modules does not have a sysfs/device/module symlink, so be
creative.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | lib/igt_sysfs.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c index 4dc57365..612de751 100644 --- a/lib/igt_sysfs.c +++ b/lib/igt_sysfs.c @@ -151,6 +151,20 @@ int igt_sysfs_open_parameters(int device) params = openat(dir, "device/driver/module/parameters", O_RDONLY); close(dir); + if (params < 0) { /* builtin? */ + drm_version_t version; + char name[32] = ""; + char path[128]; + + memset(&version, 0, sizeof(version)); + version.name_len = sizeof(name); + version.name = name; + ioctl(device, DRM_IOCTL_VERSION, &version); + + sprintf(path, "/sys/module/%s/parameters", name); + params = open(path, O_RDONLY); + } + return params; } /** |