summaryrefslogtreecommitdiff
path: root/lib/igt_sysfs.c
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2020-05-07 22:09:38 +0300
committerJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>2020-05-08 15:21:50 +0300
commitbdb5a61d24511850953b24ed122890fdaec7ea03 (patch)
treec1363f8bbc394e4595210fb4bf404598d44a90fc /lib/igt_sysfs.c
parent4f6c17f0dbbdf2c7b4e647bb909e6d31dfce9827 (diff)
lib/params: add igt_params.c for module parameter access
We have generic helpers for sysfs access in igt_sysfs.c, but we also have a number of module parameter access specific helpers scattered here and there. Start gathering the latter into a file of its own. For i915, the long-term goal is to migrate from module parameters to device specific debugfs parameters. With all igt module param access centralized in one place, we can make the transition much easier. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib/igt_sysfs.c')
-rw-r--r--lib/igt_sysfs.c68
1 files changed, 0 insertions, 68 deletions
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 7528c3bd..6aafe534 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -136,74 +136,6 @@ int igt_sysfs_open(int device)
}
/**
- * igt_sysfs_set_parameters:
- * @device: fd of the device
- * @parameter: the name of the parameter to set
- * @fmt: printf-esque format string
- *
- * Returns true on success
- */
-bool igt_sysfs_set_parameter(int device,
- const char *parameter,
- const char *fmt, ...)
-{
- va_list ap;
- int dir;
- int ret;
-
- dir = igt_sysfs_open_parameters(device);
- if (dir < 0)
- return false;
-
- va_start(ap, fmt);
- ret = igt_sysfs_vprintf(dir, parameter, fmt, ap);
- va_end(ap);
-
- close(dir);
-
- return ret > 0;
-}
-
-/**
- * igt_sysfs_open_parameters:
- * @device: fd of the device
- *
- * This opens the module parameters directory (under sysfs) corresponding
- * to the device for use with igt_sysfs_set() and igt_sysfs_get().
- *
- * Returns:
- * The directory fd, or -1 on failure.
- */
-int igt_sysfs_open_parameters(int device)
-{
- int dir, params = -1;
-
- dir = igt_sysfs_open(device);
- if (dir >= 0) {
- params = openat(dir,
- "device/driver/module/parameters",
- O_RDONLY);
- close(dir);
- }
-
- if (params < 0) { /* builtin? */
- drm_version_t version;
- char name[32] = "";
- char path[PATH_MAX];
-
- 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;
-}
-
-/**
* igt_sysfs_write:
* @dir: directory for the device from igt_sysfs_open()
* @attr: name of the sysfs node to open