Skip to contentSkip to conversation

staging: gpib: Fix secondary address restriction

PATCH New Dave Penkler 1 participant 1 message May 20, 2025 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: gpib: Fix secondary address restriction

GPIB secondary addresses have valid values between 0 and 31 inclusive. The Make Secondary Address function MSA, used to form the protocol byte, was using the gpib_address_restrict function erroneously restricting the address range to 0 through 30.

Remove the call to gpib_address_restrict and simply trim the address to 5 bits.

Fixes 2da03e7e31aa ("staging: gpib: Add user api include files")
---
 drivers/staging/gpib/uapi/gpib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/gpib/uapi/gpib.h +1 -1
index 4ca3cc9e0cd7..deb7ffcb7902 100644
@@ -136,7 +136,7 @@ static inline __u8 MTA(unsigned int addr)
 
 static inline __u8 MSA(unsigned int addr)
 {
-	return gpib_address_restrict(addr) | SAD;
+	return (addr & 0x1f) | SAD;
 }
 
 static inline __u8 PPE_byte(unsigned int dio_line, int sense)
Signature · 1 line
2.49.0