From c1388a2deb00b65ee4a06c0a1d4c461f2194ef38 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sat, 28 Sep 2019 15:12:55 +0200 Subject: base-files: move xor() from caldata extraction to functions.sh The xor() function is defined in each of the caldata extraction scripts for several targets. Move it to functions.sh to reduce duplicate code. Signed-off-by: Adrian Schmutzler --- .../base-files/etc/hotplug.d/firmware/10-ath9k-eeprom | 15 --------------- .../etc/hotplug.d/firmware/11-ath10k-caldata | 18 +----------------- 2 files changed, 1 insertion(+), 32 deletions(-) (limited to 'target/linux/ath79/base-files') diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 7911d0aa1e..0cdd783315 100644 --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -42,21 +42,6 @@ ath9k_eeprom_extract_reverse() { printf "%b" "$caldata" > /lib/firmware/$FIRMWARE } -xor() { - local val - local ret="0x$1" - local retlen=${#1} - - shift - while [ -n "$1" ]; do - val="0x$1" - ret=$((ret ^ val)) - shift - done - - printf "%0${retlen}x" "$ret" -} - ath9k_patch_fw_mac() { local mac=$1 local mac_offset=$(($2)) diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 0aa8f3d918..3844481f5a 100644 --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -1,23 +1,8 @@ #!/bin/sh +. /lib/functions.sh . /lib/functions/k2t.sh -# xor multiple hex values of the same length -xor() { - local val - local ret="0x$1" - local retlen=${#1} - - shift - while [ -n "$1" ]; do - val="0x$1" - ret=$((ret ^ val)) - shift - done - - printf "%0${retlen}x" "$ret" -} - ath10kcal_die() { echo "ath10cal: " "$*" exit 1 @@ -79,7 +64,6 @@ ath10kcal_patch_mac_crc() { [ -e /lib/firmware/$FIRMWARE ] && exit 0 -. /lib/functions.sh . /lib/functions/system.sh board=$(board_name) -- cgit v1.2.3