mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: move eeprom utility routines in mt76x02_eeprom.h
Move shared eeprom utility routines in mt76x02_eeprom.h and remove duplicated code Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
4451f99549
commit
c9100cb925
@@ -121,4 +121,19 @@ enum mt76x02_eeprom_field {
|
||||
#define MT_EFUSE_USAGE_MAP_SIZE (MT_EE_USAGE_MAP_END - \
|
||||
MT_EE_USAGE_MAP_START + 1)
|
||||
|
||||
static inline bool mt76x02_field_valid(u8 val)
|
||||
{
|
||||
return val != 0 && val != 0xff;
|
||||
}
|
||||
|
||||
static inline int
|
||||
mt76x02_sign_extend(u32 val, unsigned int size)
|
||||
{
|
||||
bool sign = val & BIT(size - 1);
|
||||
|
||||
val &= BIT(size - 1) - 1;
|
||||
|
||||
return sign ? val : -val;
|
||||
}
|
||||
|
||||
#endif /* __MT76x02_EEPROM_H */
|
||||
|
||||
Reference in New Issue
Block a user