[OpenWrt-Devel] [PATCH] ath79: speed up ath9k-eeprom extraction

Petr Štetiar ynezz at true.cz
Fri Feb 22 07:52:57 EST 2019


Dmitry Tunin <hanipouspilot at gmail.com> [2019-02-22 15:30:39]:

Hi,

> Signed-off-by: Dmitry Tunin <hanipouspilot at gmail.com>
> ---
>  target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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 8b217d1..84e4d07 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
> @@ -20,7 +20,7 @@ ath9k_eeprom_extract() {
>  	[ -n "$mtd" ] || \
>  		ath9k_eeprom_die "no mtd device found for partition $part"
>  
> -	dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
> +	dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
>  		ath9k_eeprom_die "failed to extract from $mtd"
>  }

I'm wondering if this isn't a good opportunity to simply generalize this copy&paste galore:

apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom:        dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom:  dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata:        dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom:   dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata: dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
brcm63xx/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom:       dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count || \
ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata:       dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata:       dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom: dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \

as a bonus all the platforms using the common code base couldn't benefit from this speed up.

-- ynezz

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list