codel: cast the output of MS2TIME to codel_time_t
diff mbox

Message ID 1456141787-18143-1-git-send-email-emmanuel.grumbach@intel.com
State Not Applicable
Delegated to: Kalle Valo
Headers show

Commit Message

Emmanuel Grumbach Feb. 22, 2016, 11:49 a.m. UTC
This will allow to pass the typecheck in the comparators:
codel_time_{after,before}

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 include/net/codel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Feb. 22, 2016, 7:53 p.m. UTC | #1
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Date: Mon, 22 Feb 2016 13:49:47 +0200

> This will allow to pass the typecheck in the comparators:
> codel_time_{after,before}
> 
> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

I do not see any existing code where this would matter.  Maybe it was
not meant to be fed directly?  And if you need to you should add the
explicit casts yourself.

I'm not applying this, sorry.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Emmanuel Grumbach Feb. 22, 2016, 9:04 p.m. UTC | #2
On Mon, Feb 22, 2016 at 9:53 PM, David Miller <davem@davemloft.net> wrote:
> From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> Date: Mon, 22 Feb 2016 13:49:47 +0200
>
>> This will allow to pass the typecheck in the comparators:
>> codel_time_{after,before}
>>
>> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
>
> I do not see any existing code where this would matter.  Maybe it was
> not meant to be fed directly?  And if you need to you should add the
> explicit casts yourself.

Well.. This header file is kinda special. As Eric pointed out, I
shouldn't include it since it contains huge inline functions. I only
really need small parts of it for iwlwifi and I copied those into the
driver. In iwlwifi I do need to feed MS2TIME output into the
comparators so I guess I'll do that there. I just thought it'd be nice
to feed this change back in the original implementation of the code.
If another user of the small helpers in this file comes up, it may
make sense to split this file into two header files: one that can be
included, and another one which can't. If that were to happen, I'd be
glad to have this patch in. We're not there yet.

Bottom line, I am perfectly fine if you don't apply this.

>
> I'm not applying this, sorry.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/include/net/codel.h b/include/net/codel.h
index 267e702..0d92e39 100644
--- a/include/net/codel.h
+++ b/include/net/codel.h
@@ -62,7 +62,7 @@ 
 typedef u32 codel_time_t;
 typedef s32 codel_tdiff_t;
 #define CODEL_SHIFT 10
-#define MS2TIME(a) ((a * NSEC_PER_MSEC) >> CODEL_SHIFT)
+#define MS2TIME(a) ((codel_time_t)((a * NSEC_PER_MSEC) >> CODEL_SHIFT))
 
 static inline codel_time_t codel_get_time(void)
 {