lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sun, 15 Jun 2014 12:47:20 +0300
From:	Antti Palosaari <crope@....fi>
To:	Manuel Schölling <manuel.schoelling@....de>
CC:	m.chehab@...sung.com, gregkh@...uxfoundation.org,
	linux-media@...r.kernel.org, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] msi3103: Use time_before_eq()

Acked-by: Antti Palosaari <crope@....fi>
Reviewed-by: Antti Palosaari <crope@....fi>

Mauro, pick that from patchwork to 3.16. I am not going to PULL request it.

regards
Antti


On 05/25/2014 03:39 PM, Manuel Schölling wrote:
> To be future-proof and for better readability the time comparisons are
> modified to use time_before_eq() instead of plain, error-prone math.
>
> Signed-off-by: Manuel Schölling <manuel.schoelling@....de>
> ---
>   drivers/staging/media/msi3101/sdr-msi3101.c |   28 +++++++++++++--------------
>   1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c
> index 65d351f..7a0a8ca 100644
> --- a/drivers/staging/media/msi3101/sdr-msi3101.c
> +++ b/drivers/staging/media/msi3101/sdr-msi3101.c
> @@ -207,10 +207,10 @@ static int msi3101_convert_stream_504(struct msi3101_state *s, u8 *dst,
>   		dst_len += 1008;
>   	}
>
> -	/* calculate samping rate and output it in 10 seconds intervals */
> -	if ((s->jiffies_next + msecs_to_jiffies(10000)) <= jiffies) {
> +	/* calculate sampling rate and output it in 10 seconds intervals */
> +	if (time_before_eq(s->jiffies_next + 10 * HZ, jiffies)) {
>   		unsigned long jiffies_now = jiffies;
> -		unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s->jiffies_next);
> +		unsigned long msecs = jiffies_to_msecs(jiffies_now - s->jiffies_next);
>   		unsigned int samples = sample_num[i_max - 1] - s->sample;
>   		s->jiffies_next = jiffies_now;
>   		s->sample = sample_num[i_max - 1];
> @@ -265,7 +265,7 @@ static int msi3101_convert_stream_504_u8(struct msi3101_state *s, u8 *dst,
>   		dst_len += 1008;
>   	}
>
> -	/* calculate samping rate and output it in 10 seconds intervals */
> +	/* calculate sampling rate and output it in 10 seconds intervals */
>   	if (unlikely(time_is_before_jiffies(s->jiffies_next))) {
>   #define MSECS 10000UL
>   		unsigned int samples = sample_num[i_max - 1] - s->sample;
> @@ -359,10 +359,10 @@ static int msi3101_convert_stream_384(struct msi3101_state *s, u8 *dst,
>   		dst_len += 984;
>   	}
>
> -	/* calculate samping rate and output it in 10 seconds intervals */
> -	if ((s->jiffies_next + msecs_to_jiffies(10000)) <= jiffies) {
> +	/* calculate sampling rate and output it in 10 seconds intervals */
> +	if (time_before_eq(s->jiffies_next + 10 * HZ, jiffies)) {
>   		unsigned long jiffies_now = jiffies;
> -		unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s->jiffies_next);
> +		unsigned long msecs = jiffies_to_msecs(jiffies_now - s->jiffies_next);
>   		unsigned int samples = sample_num[i_max - 1] - s->sample;
>   		s->jiffies_next = jiffies_now;
>   		s->sample = sample_num[i_max - 1];
> @@ -424,10 +424,10 @@ static int msi3101_convert_stream_336(struct msi3101_state *s, u8 *dst,
>   		dst_len += 1008;
>   	}
>
> -	/* calculate samping rate and output it in 10 seconds intervals */
> -	if ((s->jiffies_next + msecs_to_jiffies(10000)) <= jiffies) {
> +	/* calculate sampling rate and output it in 10 seconds intervals */
> +	if (time_before_eq(s->jiffies_next + 10 * HZ, jiffies)) {
>   		unsigned long jiffies_now = jiffies;
> -		unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s->jiffies_next);
> +		unsigned long msecs = jiffies_to_msecs(jiffies_now - s->jiffies_next);
>   		unsigned int samples = sample_num[i_max - 1] - s->sample;
>   		s->jiffies_next = jiffies_now;
>   		s->sample = sample_num[i_max - 1];
> @@ -487,10 +487,10 @@ static int msi3101_convert_stream_252(struct msi3101_state *s, u8 *dst,
>   		dst_len += 1008;
>   	}
>
> -	/* calculate samping rate and output it in 10 seconds intervals */
> -	if ((s->jiffies_next + msecs_to_jiffies(10000)) <= jiffies) {
> +	/* calculate sampling rate and output it in 10 seconds intervals */
> +	if (time_before_eq(s->jiffies_next + 10 * HZ, jiffies)) {
>   		unsigned long jiffies_now = jiffies;
> -		unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s->jiffies_next);
> +		unsigned long msecs = jiffies_to_msecs(jiffies_now - s->jiffies_next);
>   		unsigned int samples = sample_num[i_max - 1] - s->sample;
>   		s->jiffies_next = jiffies_now;
>   		s->sample = sample_num[i_max - 1];
> @@ -560,7 +560,7 @@ static int msi3101_convert_stream_252_u16(struct msi3101_state *s, u8 *dst,
>   		dst_len += 1008;
>   	}
>
> -	/* calculate samping rate and output it in 10 seconds intervals */
> +	/* calculate sampling rate and output it in 10 seconds intervals */
>   	if (unlikely(time_is_before_jiffies(s->jiffies_next))) {
>   #define MSECS 10000UL
>   		unsigned int samples = sample_num[i_max - 1] - s->sample;
>


-- 
http://palosaari.fi/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists