Re: [PATCH] codel: cast the output of MS2TIME to codel_time_t

2016-02-22 Thread Emmanuel Grumbach
On Mon, Feb 22, 2016 at 9:53 PM, David Miller  wrote:
> From: Emmanuel Grumbach 
> 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 
>
> 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 majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] codel: cast the output of MS2TIME to codel_time_t

2016-02-22 Thread David Miller
From: Emmanuel Grumbach 
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 

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.



[PATCH] codel: cast the output of MS2TIME to codel_time_t

2016-02-22 Thread Emmanuel Grumbach
This will allow to pass the typecheck in the comparators:
codel_time_{after,before}

Signed-off-by: Emmanuel Grumbach 
---
 include/net/codel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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)
 {
-- 
2.5.0