lib/igt_sysfs: move kick_snd_hda_intel() to igt_kmod.c
PATCH 1/1 lib/igt_sysfs: move kick_snd_hda_intel() to igt_kmod.c
From: Mauro Carvalho Chehab <[email protected]>
This unbind function is now used only inside igt_kmod, and should be called only via igt_always_unload_audio_driver(), which does other required steps to unbind the audio driver.
So, move it to igt_kmod and make it static.
--- lib/igt_kmod.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_sysfs.c | 52 ------------------------------------------------- lib/igt_sysfs.h | 1 - 3 files changed, 52 insertions(+), 53 deletions(-)
lib/igt_kmod.c +52 -0
@@ -437,6 +437,58 @@ igt_intel_driver_load(const char *opts, const char *driver)return 0 ; } +/** +* kick_snd_hda_intel: +* +* This function unbinds the snd_hda_intel driver so the module cand be +* unloaded. +* +*/ +static void kick_snd_hda_intel (void ) +{ +DIR *dir; +struct dirent *snd_hda; +int fd;size_t len; + +const char *dpath ="/sys/bus/pci/drivers/snd_hda_intel" ; +const char *path ="/sys/bus/pci/drivers/snd_hda_intel/unbind" ; +const char *devid ="0000:" ; + + fd =open (path,O_WRONLY ); +if (fd <0 ) { +return ; + } + + dir =opendir (dpath); +if (!dir) + goto out; + + len =strlen (devid); +while ((snd_hda =readdir (dir))) { +struct stat st; +char fpath[PATH_MAX ]; + +if (*snd_hda->d_name =='.' ) +continue ; + +snprintf (fpath,sizeof (fpath),"%s/%s" , dpath, snd_hda->d_name); +if (lstat (fpath, &st)) +continue ; + +if (!S_ISLNK (st.st_mode)) +continue ; + +if (!strncmp (devid, snd_hda->d_name, len)) { +igt_ignore_warn (write (fd, snd_hda->d_name, +strlen (snd_hda->d_name))); + } + } + +closedir (dir); +out: +close (fd); +} +static int igt_always_unload_audio_driver (char **who) {int ret;
lib/igt_sysfs.c +0 -52
58 lines not on this page · raw message
lib/igt_sysfs.h +0 -1
@@ -135,7 +135,6 @@ bool __igt_sysfs_set_boolean(int dir, const char *attr, bool value);void igt_sysfs_set_boolean (int dir,const char *attr,bool value);void bind_fbcon (bool enable); -void kick_snd_hda_intel (void );void fbcon_blink_enable (bool enable);/**
Signature · 1 line
2.41.0
Patchwork
CI[igt-dev] ✗ Fi.CI.BUILD: failure for lib/igt_sysfs: move kick_snd_hda_intel() to igt_kmod.c
== Series Details ==
== Series Details ==
Series: lib/igt_sysfs: move kick_snd_hda_intel() to igt_kmod.c
URL : https://patchwork.freedesktop.org/series/125553/
State : failure
== Summary ==
IGT patchset build failed on latest successful build cdc8d1fcd23c0480145f83af79a222fd9ca2eeb6 tests/device_reset: fix logic to unbind when snd_hda_intel is loaded
Tail of build.log:
[270/1645] Compiling C object 'lib/76b5a35@@igt-rendercopy_i915_c@sta/rendercopy_i915.c.o'. [271/1645] Compiling C object 'lib/76b5a35@@igt-rendercopy_i830_c@sta/rendercopy_i830.c.o'. [272/1645] Compiling C object 'lib/76b5a35@@igt-igt_msm_c@sta/igt_msm.c.o'.
[273/1645] Compiling C object 'lib/76b5a35@@igt-xe_xe_gt_c@sta/xe_xe_gt.c.o'.
[274/1645] Compiling C object 'lib/76b5a35@@igt-intel_aux_pgtable_c@sta/intel_aux_pgtable.c.o'. [275/1645] Compiling C object 'lib/76b5a35@@igt-intel_allocator_simple_c@sta/intel_allocator_simple.c.o'. [276/1645] Compiling C object 'lib/76b5a35@@igt-igt_vc4_c@sta/igt_vc4.c.o'.
[277/1645] Compiling C object 'tests/59830eb@@kms_atomic_transition@exe/kms_atomic_transition.c.o'. [278/1645] Compiling C object 'lib/76b5a35@@igt-intel_compute_c@sta/intel_compute.c.o'. [279/1645] Compiling C object 'lib/76b5a35@@igt-veboxcopy_gen12_c@sta/veboxcopy_gen12.c.o'. [280/1645] Compiling C object 'lib/76b5a35@@igt-igt_draw_c@sta/igt_draw.c.o'.
[281/1645] Compiling C object 'tests/59830eb@@kms_lease@exe/kms_lease.c.o'.
[282/1645] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen4_c@sta/rendercopy_gen4.c.o'. [283/1645] Compiling C object 'tests/59830eb@@kms_flip@exe/kms_flip.c.o'.
[284/1645] Compiling C object 'lib/76b5a35@@igt-igt_edid_c@sta/igt_edid.c.o'.
[285/1645] Compiling C object 'lib/76b5a35@@igt-xe_xe_spin_c@sta/xe_xe_spin.c.o'. [286/1645] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen7_c@sta/rendercopy_gen7.c.o'. [287/1645] Compiling C object 'lib/76b5a35@@igt-xe_xe_ioctl_c@sta/xe_xe_ioctl.c.o'. [288/1645] Compiling C object 'lib/76b5a35@@igt-ioctl_wrappers_c@sta/ioctl_wrappers.c.o'. [289/1645] Compiling C object 'lib/76b5a35@@igt-igt_frame_c@sta/igt_frame.c.o'. [290/1645] Compiling C object 'lib/76b5a35@@igt-instdone_c@sta/instdone.c.o'.
[291/1645] Compiling C object 'lib/76b5a35@@igt-xe_xe_util_c@sta/xe_xe_util.c.o'. [292/1645] Compiling C object 'lib/76b5a35@@igt-igt_device_scan_c@sta/igt_device_scan.c.o'. [293/1645] Compiling C object 'lib/76b5a35@@igt-intel_allocator_c@sta/intel_allocator.c.o'. [294/1645] Compiling C object 'lib/76b5a35@@igt-xe_xe_query_c@sta/xe_xe_query.c.o'. [295/1645] Compiling C object 'lib/76b5a35@@igt-igt_dummyload_c@sta/igt_dummyload.c.o'. [296/1645] Compiling C object 'lib/76b5a35@@igt-gpu_cmds_c@sta/gpu_cmds.c.o'.
[297/1645] Compiling C object 'lib/76b5a35@@igt-igt_v3d_c@sta/igt_v3d.c.o'.
[298/1645] Compiling C object 'lib/76b5a35@@igt-igt_aux_c@sta/igt_aux.c.o'.
[299/1645] Compiling C object 'lib/76b5a35@@igt-igt_pm_c@sta/igt_pm.c.o'.
[300/1645] Compiling C object 'lib/76b5a35@@igt-intel_bufops_c@sta/intel_bufops.c.o'. [301/1645] Compiling C object 'lib/76b5a35@@igt-igt_vmwgfx_c@sta/igt_vmwgfx.c.o'. [302/1645] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen6_c@sta/rendercopy_gen6.c.o'. [303/1645] Compiling C object 'tests/59830eb@@kms_atomic@exe/kms_atomic.c.o'.
[304/1645] Compiling C object 'lib/76b5a35@@igt-intel_blt_c@sta/intel_blt.c.o'. [305/1645] Compiling C object 'lib/76b5a35@@igt-igt_amd_c@sta/igt_amd.c.o'.
[306/1645] Generating i915-perf-registers-acmgt3 with a custom command.
[307/1645] Compiling C object 'lib/76b5a35@@igt-igt_core_c@sta/igt_core.c.o'.
[308/1645] Compiling C object 'lib/76b5a35@@igt-intel_batchbuffer_c@sta/intel_batchbuffer.c.o'. [309/1645] Compiling C object 'lib/76b5a35@@igt-igt_chamelium_c@sta/igt_chamelium.c.o'. [310/1645] Generating i915-perf-metrics-acmgt3 with a custom command.
[311/1645] Compiling C object 'tests/59830eb@@kms_cursor_legacy@exe/kms_cursor_legacy.c.o'. [312/1645] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen8_c@sta/rendercopy_gen8.c.o'. [313/1645] Compiling C object 'lib/76b5a35@@igt-rendercopy_gen9_c@sta/rendercopy_gen9.c.o'. [314/1645] Compiling C object 'lib/76b5a35@@igt-i915_intel_decode_c@sta/i915_intel_decode.c.o'. [315/1645] Compiling C object 'lib/76b5a35@@igt-igt_fb_c@sta/igt_fb.c.o'.
[316/1645] Compiling C object 'lib/76b5a35@@igt-igt_kms_c@sta/igt_kms.c.o'.
[317/1645] Compiling C object 'tests/59830eb@@perf@exe/intel_perf.c.o'.
[318/1645] Generating i915-perf-equations with a custom command.
ninja: build stopped: subcommand failed.
Patchwork
CI[igt-dev] ✗ GitLab.Pipeline: warning for lib/igt_sysfs: move kick_snd_hda_intel() to igt_kmod.c
In reply to Mauro Carvalho Chehab== Series Details ==
== Series Details ==
Series: lib/igt_sysfs: move kick_snd_hda_intel() to igt_kmod.c
URL : https://patchwork.freedesktop.org/series/125553/
State : warning
== Summary ==
Pipeline status: FAILED.
see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/1018404 for the overview.
build:tests-debian-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/50736039):
if (!S_ISLNK(st.st_mode))
^~~~~~~
S_IFLNK
../lib/igt_kmod.c:478:8: warning: nested extern declaration of ‘S_ISLNK’ [-Wnested-externs]
../lib/igt_kmod.c:469:8: warning: unused variable ‘fpath’ [-Wunused-variable]
char fpath[PATH_MAX];
^~~~~
../lib/igt_kmod.c:487:2: error: implicit declaration of function ‘closedir’; did you mean ‘close’? [-Werror=implicit-function-declaration]
closedir(dir);
^~~~~~~~
close ../lib/igt_kmod.c:487:2: warning: nested extern declaration of ‘closedir’ [-Wnested-externs]
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
section_end:1698228409:step_script section_start:1698228409:cleanup_file_variables
Cleaning up project directory and file based variables section_end:1698228410:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-debian-meson-arm64 has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/50736042):
if (!S_ISLNK(st.st_mode))
^~~~~~~
S_IFLNK
../lib/igt_kmod.c:478:8: warning: nested extern declaration of ‘S_ISLNK’ [-Wnested-externs]
../lib/igt_kmod.c:469:8: warning: unused variable ‘fpath’ [-Wunused-variable]
char fpath[PATH_MAX];
^~~~~
../lib/igt_kmod.c:487:2: error: implicit declaration of function ‘closedir’; did you mean ‘close’? [-Werror=implicit-function-declaration]
closedir(dir);
^~~~~~~~
close ../lib/igt_kmod.c:487:2: warning: nested extern declaration of ‘closedir’ [-Wnested-externs]
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
section_end:1698228434:step_script section_start:1698228434:cleanup_file_variables
Cleaning up project directory and file based variables section_end:1698228435:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-debian-meson-armhf has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/50736041):
if (!S_ISLNK(st.st_mode))
^~~~~~~
S_IFLNK
../lib/igt_kmod.c:478:8: warning: nested extern declaration of ‘S_ISLNK’ [-Wnested-externs]
../lib/igt_kmod.c:469:8: warning: unused variable ‘fpath’ [-Wunused-variable]
char fpath[PATH_MAX];
^~~~~
../lib/igt_kmod.c:487:2: error: implicit declaration of function ‘closedir’; did you mean ‘close’? [-Werror=implicit-function-declaration]
closedir(dir);
^~~~~~~~
close ../lib/igt_kmod.c:487:2: warning: nested extern declaration of ‘closedir’ [-Wnested-externs]
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
section_end:1698228425:step_script section_start:1698228425:cleanup_file_variables
Cleaning up project directory and file based variables section_end:1698228426:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-debian-meson-mips has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/50736043):
if (!S_ISLNK(st.st_mode))
^~~~~~~
S_IFLNK
../lib/igt_kmod.c:478:8: warning: nested extern declaration of ‘S_ISLNK’ [-Wnested-externs]
../lib/igt_kmod.c:469:8: warning: unused variable ‘fpath’ [-Wunused-variable]
char fpath[PATH_MAX];
^~~~~
../lib/igt_kmod.c:487:2: error: implicit declaration of function ‘closedir’; did you mean ‘close’? [-Werror=implicit-function-declaration]
closedir(dir);
^~~~~~~~
close ../lib/igt_kmod.c:487:2: warning: nested extern declaration of ‘closedir’ [-Wnested-externs]
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
section_end:1698228420:step_script section_start:1698228420:cleanup_file_variables
Cleaning up project directory and file based variables section_end:1698228420:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-debian-minimal has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/50736040):
if (!S_ISLNK(st.st_mode))
^~~~~~~
S_IFLNK
../lib/igt_kmod.c:478:8: warning: nested extern declaration of ‘S_ISLNK’ [-Wnested-externs]
../lib/igt_kmod.c:469:8: warning: unused variable ‘fpath’ [-Wunused-variable]
char fpath[PATH_MAX];
^~~~~
../lib/igt_kmod.c:487:2: error: implicit declaration of function ‘closedir’; did you mean ‘close’? [-Werror=implicit-function-declaration]
closedir(dir);
^~~~~~~~
close ../lib/igt_kmod.c:487:2: warning: nested extern declaration of ‘closedir’ [-Wnested-externs]
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
section_end:1698228405:step_script section_start:1698228405:cleanup_file_variables
Cleaning up project directory and file based variables section_end:1698228406:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-fedora has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/50736034):
478 | if (!S_ISLNK(st.st_mode))
| ^~~~~~~
| S_IFLNK
../lib/igt_kmod.c:478:8: warning: nested extern declaration of ‘S_ISLNK’ [-Wnested-externs]
../lib/igt_kmod.c:469:8: warning: unused variable ‘fpath’ [-Wunused-variable]
469 | char fpath[PATH_MAX];
| ^~~~~
../lib/igt_kmod.c:487:2: error: implicit declaration of function ‘closedir’; did you mean ‘close’? [-Werror=implicit-function-declaration]
487 | closedir(dir);
| ^~~~~~~~
| close ../lib/igt_kmod.c:487:2: warning: nested extern declaration of ‘closedir’ [-Wnested-externs]
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
section_end:1698228410:step_script section_start:1698228410:cleanup_file_variables
Cleaning up project directory and file based variables section_end:1698228410:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-fedora-clang has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/50736038):
/usr/include/stdlib.h:852:14: note: 'div' declared here
extern div_t div (int __numer, int __denom)
^
../lib/igt_kmod.c:868:5: warning: declaration does not declare anything [-Wmissing-declarations]
__attribute__ ((fallthrough));
^
../lib/igt_kmod.c:1044:5: warning: declaration does not declare anything [-Wmissing-declarations]
__attribute__ ((fallthrough));
^
../lib/igt_kmod.c:1271:5: warning: declaration does not declare anything [-Wmissing-declarations]
__attribute__ ((fallthrough));
^ 4 warnings and 18 errors generated.
ninja: build stopped: subcommand failed. section_end:1698228421:step_script section_start:1698228421:cleanup_file_variables Cleaning up project directory and file based variables section_end:1698228424:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-fedora-no-libdrm-nouveau has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/50736037):
478 | if (!S_ISLNK(st.st_mode))
| ^~~~~~~
| S_IFLNK
../lib/igt_kmod.c:478:8: warning: nested extern declaration of ‘S_ISLNK’ [-Wnested-externs]
../lib/igt_kmod.c:469:8: warning: unused variable ‘fpath’ [-Wunused-variable]
469 | char fpath[PATH_MAX];
| ^~~~~
../lib/igt_kmod.c:487:2: error: implicit declaration of function ‘closedir’; did you mean ‘close’? [-Werror=implicit-function-declaration]
487 | closedir(dir);
| ^~~~~~~~
| close ../lib/igt_kmod.c:487:2: warning: nested extern declaration of ‘closedir’ [-Wnested-externs]
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
section_end:1698228405:step_script section_start:1698228405:cleanup_file_variables
Cleaning up project directory and file based variables section_end:1698228405:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-fedora-no-libunwind has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/50736035):
478 | if (!S_ISLNK(st.st_mode))
| ^~~~~~~
| S_IFLNK
../lib/igt_kmod.c:478:8: warning: nested extern declaration of ‘S_ISLNK’ [-Wnested-externs]
../lib/igt_kmod.c:469:8: warning: unused variable ‘fpath’ [-Wunused-variable]
469 | char fpath[PATH_MAX];
| ^~~~~
../lib/igt_kmod.c:487:2: error: implicit declaration of function ‘closedir’; did you mean ‘close’? [-Werror=implicit-function-declaration]
487 | closedir(dir);
| ^~~~~~~~
| close ../lib/igt_kmod.c:487:2: warning: nested extern declaration of ‘closedir’ [-Wnested-externs]
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
section_end:1698228407:step_script section_start:1698228407:cleanup_file_variables
Cleaning up project directory and file based variables section_end:1698228408:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-fedora-oldest-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/50736036):
478 | if (!S_ISLNK(st.st_mode))
| ^~~~~~~
| S_IFLNK
../lib/igt_kmod.c:478:8: warning: nested extern declaration of ‘S_ISLNK’ [-Wnested-externs]
../lib/igt_kmod.c:469:8: warning: unused variable ‘fpath’ [-Wunused-variable]
469 | char fpath[PATH_MAX];
| ^~~~~
../lib/igt_kmod.c:487:2: error: implicit declaration of function ‘closedir’; did you mean ‘close’? [-Werror=implicit-function-declaration]
487 | closedir(dir);
| ^~~~~~~~
| close ../lib/igt_kmod.c:487:2: warning: nested extern declaration of ‘closedir’ [-Wnested-externs]
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
section_end:1698228410:step_script section_start:1698228410:cleanup_file_variables
Cleaning up project directory and file based variables section_end:1698228411:cleanup_file_variables
ERROR: Job failed: exit code 1
== Logs ==
For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/1018404