[Intel-gfx] [PATCH i-g-t 1/4 v6] lib/{igt_sysfs, igt_aux}: Make available to other users kick_fbcon() (unbind_fbcon()), and added helpers to lib/igt_aux, lib/igt_kmod.
Chris Wilson
chris at chris-wilson.co.uk
Wed Nov 23 13:53:26 UTC 2016
On Wed, Nov 23, 2016 at 02:35:09PM +0200, Marius Vlad wrote:
> +static void
> +igt_show_stat(proc_t *info, const char *fn)
> +{
> + static int display = 0;
> +
> + if (!display) {
> + igt_info("%20.20s%11.11s%21.21s%11.11s%10.10s%22.22s%31.31s\n",
> + "COMM", "PID", "Type", "UID", "GID", "Size", "Filename");
> + display++;
> + }
This is called by an exported igt_lsof(). Only showing the header for
the first caller is a nuisance.
> +
> + __igt_show_stat(&(struct pinfo) {.pid = info->tid,
> + .comm = info->cmd, fn });
> +}
> +
> +int
> +igt_i915_driver_unload(void)
> +{
> + /* unbind vt */
> + kick_fbcon(false);
> +
> + if (igt_kmod_is_loaded("snd_hda_intel")) {
> + igt_pkill(SIGTERM, "alsactl");
> +
> + /* unbind snd_hda_intel */
> + kick_snd_hda_intel();
> +
> + if (igt_kmod_unload("snd_hda_intel", 0)) {
> + igt_info("Could not unload snd_hda_intel\n");
> + igt_kmod_list_loaded();
> + igt_lsof("/dev/snd");
> + return IGT_EXIT_FAILURE;
> + }
> + }
> +
> + /* gen5 */
> + if (igt_kmod_is_loaded("intel_ips")) {
> + igt_kmod_unload("intel_ips", 0);
> + }
> +
> + if (igt_kmod_is_loaded("i915")) {
> + if (igt_kmod_unload("i915", 0)) {
> + igt_info("Could not unload i915\n");
> + igt_kmod_list_loaded();
> + return IGT_EXIT_SKIP;
> + } else {
> + igt_info("i915.ko has been unloaded!\n");
> + }
> + }
> +
> + if (igt_kmod_is_loaded("intel-gtt")) {
> + igt_kmod_unload("intel-gtt", 0);
> + }
> +
> + igt_kmod_unload("drm_kms_helper", 0);
> + igt_kmod_unload("drm", 0);
> +
> + if (igt_kmod_is_loaded("i915")) {
> + igt_info("WARNING: i915.ko still loaded!\n");
igt_warn() perchance?
> + return IGT_EXIT_FAILURE;
> + } else {
> + igt_info("module successfully unloaded\n");
> + }
> +
> +
> + return IGT_EXIT_SUCCESS;
> +}
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list