netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Oliver Hartkopp <oliver.hartkopp@volkswagen.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 12:56:32 +0100	[thread overview]
Message-ID: <50EC0970.10806@pengutronix.de> (raw)
In-Reply-To: <50EBF453.7020408@volkswagen.de>

[-- Attachment #1: Type: text/plain, Size: 1254 bytes --]

On 01/08/2013 11:26 AM, Oliver Hartkopp wrote:
> 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)

Defines are probably unsinged longs, by default.

> Will send the v2 when there're no other remarks tommorrow.

Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]

      reply	other threads:[~2013-01-08 11:56 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
2013-01-08 11:56     ` Marc Kleine-Budde [this message]

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=50EC0970.10806@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oliver.hartkopp@volkswagen.de \
    /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).