aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-02-01 13:00:28 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-01 13:00:28 -0500
commit47fcc0360cfb3fe82e4daddacad3c1cd80b0b75d (patch)
tree6a72f705c4e16643e08152ce7828a23c68c623ae /tools
parent5d8515bc232172963a4cef007e97b08c5e4d0533 (diff)
parentc505cbd45f6e9c539d57dd171d95ec7e5e9f9cd0 (diff)
Merge tag 'driver-core-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg KH: "Here is the set of "big" driver core patches for 4.16-rc1. The majority of the work here is in the firmware subsystem, with reworks to try to attempt to make the code easier to handle in the long run, but no functional change. There's also some tree-wide sysfs attribute fixups with lots of acks from the various subsystem maintainers, as well as a handful of other normal fixes and changes. And finally, some license cleanups for the driver core and sysfs code. All have been in linux-next for a while with no reported issues" * tag 'driver-core-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (48 commits) device property: Define type of PROPERTY_ENRTY_*() macros device property: Reuse property_entry_free_data() device property: Move property_entry_free_data() upper firmware: Fix up docs referring to FIRMWARE_IN_KERNEL firmware: Drop FIRMWARE_IN_KERNEL Kconfig option USB: serial: keyspan: Drop firmware Kconfig options sysfs: remove DEBUG defines sysfs: use SPDX identifiers drivers: base: add coredump driver ops sysfs: add attribute specification for /sysfs/devices/.../coredump test_firmware: fix missing unlock on error in config_num_requests_store() test_firmware: make local symbol test_fw_config static sysfs: turn WARN() into pr_warn() firmware: Fix a typo in fallback-mechanisms.rst treewide: Use DEVICE_ATTR_WO treewide: Use DEVICE_ATTR_RO treewide: Use DEVICE_ATTR_RW sysfs.h: Use octal permissions component: add debugfs support bus: simple-pm-bus: convert bool SIMPLE_PM_BUS to tristate ...
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/firmware/fw_fallback.sh172
-rwxr-xr-xtools/testing/selftests/firmware/fw_filesystem.sh5
2 files changed, 101 insertions, 76 deletions
diff --git a/tools/testing/selftests/firmware/fw_fallback.sh b/tools/testing/selftests/firmware/fw_fallback.sh
index 34a42c68ebfb..722cad91df74 100755
--- a/tools/testing/selftests/firmware/fw_fallback.sh
+++ b/tools/testing/selftests/firmware/fw_fallback.sh
@@ -175,96 +175,118 @@ trap "test_finish" EXIT
175echo "ABCD0123" >"$FW" 175echo "ABCD0123" >"$FW"
176NAME=$(basename "$FW") 176NAME=$(basename "$FW")
177 177
178DEVPATH="$DIR"/"nope-$NAME"/loading 178test_syfs_timeout()
179 179{
180# Test failure when doing nothing (timeout works). 180 DEVPATH="$DIR"/"nope-$NAME"/loading
181echo -n 2 >/sys/class/firmware/timeout 181
182echo -n "nope-$NAME" >"$DIR"/trigger_request 2>/dev/null & 182 # Test failure when doing nothing (timeout works).
183 183 echo -n 2 >/sys/class/firmware/timeout
184# Give the kernel some time to load the loading file, must be less 184 echo -n "nope-$NAME" >"$DIR"/trigger_request 2>/dev/null &
185# than the timeout above. 185
186sleep 1 186 # Give the kernel some time to load the loading file, must be less
187if [ ! -f $DEVPATH ]; then 187 # than the timeout above.
188 echo "$0: fallback mechanism immediately cancelled" 188 sleep 1
189 echo "" 189 if [ ! -f $DEVPATH ]; then
190 echo "The file never appeared: $DEVPATH" 190 echo "$0: fallback mechanism immediately cancelled"
191 echo "" 191 echo ""
192 echo "This might be a distribution udev rule setup by your distribution" 192 echo "The file never appeared: $DEVPATH"
193 echo "to immediately cancel all fallback requests, this must be" 193 echo ""
194 echo "removed before running these tests. To confirm look for" 194 echo "This might be a distribution udev rule setup by your distribution"
195 echo "a firmware rule like /lib/udev/rules.d/50-firmware.rules" 195 echo "to immediately cancel all fallback requests, this must be"
196 echo "and see if you have something like this:" 196 echo "removed before running these tests. To confirm look for"
197 echo "" 197 echo "a firmware rule like /lib/udev/rules.d/50-firmware.rules"
198 echo "SUBSYSTEM==\"firmware\", ACTION==\"add\", ATTR{loading}=\"-1\"" 198 echo "and see if you have something like this:"
199 echo "" 199 echo ""
200 echo "If you do remove this file or comment out this line before" 200 echo "SUBSYSTEM==\"firmware\", ACTION==\"add\", ATTR{loading}=\"-1\""
201 echo "proceeding with these tests." 201 echo ""
202 exit 1 202 echo "If you do remove this file or comment out this line before"
203fi 203 echo "proceeding with these tests."
204 204 exit 1
205if diff -q "$FW" /dev/test_firmware >/dev/null ; then 205 fi
206 echo "$0: firmware was not expected to match" >&2
207 exit 1
208else
209 echo "$0: timeout works"
210fi
211
212# Put timeout high enough for us to do work but not so long that failures
213# slow down this test too much.
214echo 4 >/sys/class/firmware/timeout
215 206
216# Load this script instead of the desired firmware. 207 if diff -q "$FW" /dev/test_firmware >/dev/null ; then
217load_fw "$NAME" "$0" 208 echo "$0: firmware was not expected to match" >&2
218if diff -q "$FW" /dev/test_firmware >/dev/null ; then 209 exit 1
219 echo "$0: firmware was not expected to match" >&2 210 else
220 exit 1 211 echo "$0: timeout works"
221else 212 fi
222 echo "$0: firmware comparison works" 213}
223fi
224 214
225# Do a proper load, which should work correctly. 215run_sysfs_main_tests()
226load_fw "$NAME" "$FW" 216{
227if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then 217 test_syfs_timeout
228 echo "$0: firmware was not loaded" >&2 218 # Put timeout high enough for us to do work but not so long that failures
229 exit 1 219 # slow down this test too much.
230else 220 echo 4 >/sys/class/firmware/timeout
231 echo "$0: fallback mechanism works"
232fi
233 221
234load_fw_cancel "nope-$NAME" "$FW" 222 # Load this script instead of the desired firmware.
235if diff -q "$FW" /dev/test_firmware >/dev/null ; then 223 load_fw "$NAME" "$0"
236 echo "$0: firmware was expected to be cancelled" >&2 224 if diff -q "$FW" /dev/test_firmware >/dev/null ; then
237 exit 1 225 echo "$0: firmware was not expected to match" >&2
238else 226 exit 1
239 echo "$0: cancelling fallback mechanism works" 227 else
240fi 228 echo "$0: firmware comparison works"
229 fi
241 230
242if load_fw_custom "$NAME" "$FW" ; then 231 # Do a proper load, which should work correctly.
232 load_fw "$NAME" "$FW"
243 if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then 233 if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
244 echo "$0: firmware was not loaded" >&2 234 echo "$0: firmware was not loaded" >&2
245 exit 1 235 exit 1
246 else 236 else
247 echo "$0: custom fallback loading mechanism works" 237 echo "$0: fallback mechanism works"
248 fi 238 fi
249fi
250 239
251if load_fw_custom_cancel "nope-$NAME" "$FW" ; then 240 load_fw_cancel "nope-$NAME" "$FW"
252 if diff -q "$FW" /dev/test_firmware >/dev/null ; then 241 if diff -q "$FW" /dev/test_firmware >/dev/null ; then
253 echo "$0: firmware was expected to be cancelled" >&2 242 echo "$0: firmware was expected to be cancelled" >&2
254 exit 1 243 exit 1
255 else 244 else
256 echo "$0: cancelling custom fallback mechanism works" 245 echo "$0: cancelling fallback mechanism works"
257 fi 246 fi
258fi
259 247
260set +e 248 set +e
261load_fw_fallback_with_child "nope-signal-$NAME" "$FW" 249 load_fw_fallback_with_child "nope-signal-$NAME" "$FW"
262if [ "$?" -eq 0 ]; then 250 if [ "$?" -eq 0 ]; then
263 echo "$0: SIGCHLD on sync ignored as expected" >&2 251 echo "$0: SIGCHLD on sync ignored as expected" >&2
264else 252 else
265 echo "$0: error - sync firmware request cancelled due to SIGCHLD" >&2 253 echo "$0: error - sync firmware request cancelled due to SIGCHLD" >&2
266 exit 1 254 exit 1
267fi 255 fi
268set -e 256 set -e
257}
258
259run_sysfs_custom_load_tests()
260{
261 if load_fw_custom "$NAME" "$FW" ; then
262 if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
263 echo "$0: firmware was not loaded" >&2
264 exit 1
265 else
266 echo "$0: custom fallback loading mechanism works"
267 fi
268 fi
269
270 if load_fw_custom "$NAME" "$FW" ; then
271 if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
272 echo "$0: firmware was not loaded" >&2
273 exit 1
274 else
275 echo "$0: custom fallback loading mechanism works"
276 fi
277 fi
278
279 if load_fw_custom_cancel "nope-$NAME" "$FW" ; then
280 if diff -q "$FW" /dev/test_firmware >/dev/null ; then
281 echo "$0: firmware was expected to be cancelled" >&2
282 exit 1
283 else
284 echo "$0: cancelling custom fallback mechanism works"
285 fi
286 fi
287}
288
289run_sysfs_main_tests
290run_sysfs_custom_load_tests
269 291
270exit 0 292exit 0
diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh
index b1f20fef36c7..f9508e1a4058 100755
--- a/tools/testing/selftests/firmware/fw_filesystem.sh
+++ b/tools/testing/selftests/firmware/fw_filesystem.sh
@@ -45,7 +45,10 @@ test_finish()
45 if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then 45 if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then
46 echo "$OLD_TIMEOUT" >/sys/class/firmware/timeout 46 echo "$OLD_TIMEOUT" >/sys/class/firmware/timeout
47 fi 47 fi
48 echo -n "$OLD_PATH" >/sys/module/firmware_class/parameters/path 48 if [ "$OLD_FWPATH" = "" ]; then
49 OLD_FWPATH=" "
50 fi
51 echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path
49 rm -f "$FW" 52 rm -f "$FW"
50 rmdir "$FWPATH" 53 rmdir "$FWPATH"
51} 54}