linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Linux Netdev List <netdev@vger.kernel.org>,
	Linux CAN List <linux-can@vger.kernel.org>
Subject: Re: [RFC PATCH net-next] can-gw: add a variable limit for CAN frame routings
Date: Tue, 08 Jan 2013 11:26:27 +0100	[thread overview]
Message-ID: <50EBF453.7020408@volkswagen.de> (raw)
In-Reply-To: <50EBDB94.3000705@pengutronix.de>

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


  reply	other threads:[~2013-01-08 10:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07 21:51 [RFC PATCH net-next] can-gw: add a variable limit for CAN frame routings Oliver Hartkopp
2013-01-08  8:40 ` Marc Kleine-Budde
2013-01-08 10:26   ` Oliver Hartkopp [this message]
2013-01-08 11:56     ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50EBF453.7020408@volkswagen.de \
    --to=oliver.hartkopp@volkswagen.de \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).