staging/fwserial: Simplify max payload calculation
authorPeter Hurley <peter@hurleysoftware.com>
Tue, 29 Jan 2013 01:57:46 +0000 (20:57 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Jan 2013 04:26:16 +0000 (23:26 -0500)
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fwserial/fwserial.h

index e157318cb7da260379cebd06476ff06ec889efb5..953ece69c10d774355171a56b7a8140abd2cc1e9 100644 (file)
@@ -377,8 +377,8 @@ static inline void fwtty_bind_console(struct fwtty_port *port,
  */
 static inline int link_speed_to_max_payload(unsigned speed)
 {
-       speed = clamp(speed, (unsigned) SCODE_100, (unsigned) SCODE_800);
-       return 1 << (speed + 9);
+       /* Max async payload is 4096 - see IEEE 1394-2008 tables 6-4, 16-18 */
+       return min(512 << speed, 4096);
 }
 
 #endif /* _FIREWIRE_FWSERIAL_H */