[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50EBF453.7020408@volkswagen.de>
Date: Tue, 08 Jan 2013 11:26:27 +0100
From: Oliver Hartkopp <oliver.hartkopp@...kswagen.de>
To: Marc Kleine-Budde <mkl@...gutronix.de>
CC: Linux Netdev List <netdev@...r.kernel.org>,
Linux CAN List <linux-can@...r.kernel.org>
Subject: Re: [RFC PATCH net-next] can-gw: add a variable limit for CAN frame
routings
Am 08.01.2013 09:40, schrieb Marc Kleine-Budde:
> On 01/07/2013 10:51 PM, Oliver Hartkopp wrote:
>>
>> static __init int cgw_module_init(void)
>> {
>> - printk(banner);
>> + /* sanitize given module parameter */
>> + if (max_hops < 1)
>> + max_hops = 1;
>> +
>> + if (max_hops > CAN_GW_MAX_HOPS)
>> + max_hops = CAN_GW_MAX_HOPS;
>
> You can make use of clamp(val, min, max) here.
>
ok.
I added
#include <linux/kernel.h>
where clamp is defined and reduced the code above to
clamp_t(unsigned int, max_hops, CAN_GW_MIN_HOPS, CAN_GW_MAX_HOPS);
Unfortunately clamp(max_hops, CAN_GW_MIN_HOPS, CAN_GW_MAX_HOPS) did not work.
=> (warning: comparison of distinct pointer types lacks a cast)
Will send the v2 when there're no other remarks tommorrow.
Tnx,
Oliver
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists