firewire: use clamp and min3 macros

Use kernel.h's convenience macros.  Also omit a printk that should never
happen and won't matter much if it ever happened.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
This commit is contained in:
Stefan Richter
2011-09-19 00:20:48 +02:00
parent b810e4ae11
commit 4ec4a67aa1
3 changed files with 5 additions and 9 deletions

View File

@@ -502,11 +502,7 @@ static struct fwnet_peer *fwnet_peer_find_by_node_id(struct fwnet_device *dev,
static unsigned fwnet_max_payload(unsigned max_rec, unsigned speed)
{
max_rec = min(max_rec, speed + 8);
max_rec = min(max_rec, 0xbU); /* <= 4096 */
if (max_rec < 8) {
fw_notify("max_rec %x out of range\n", max_rec);
max_rec = 8;
}
max_rec = clamp(max_rec, 8U, 11U); /* 512...4096 */
return (1 << (max_rec + 1)) - RFC2374_FRAG_HDR_SIZE;
}