Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1221904

Re: [PATCH 6/6] Staging: iio: resolver: Prefer using the BIT macro

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH 6/6] Staging: iio: resolver: Prefer using the BIT macro
Date 2015-09-10 06:30 +0200
Message-ID <q71EK-7Fd-11@gated-at.bofh.it> (permalink)
References <q71v3-7rK-3@gated-at.bofh.it> <q71v4-7rK-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 2015-09-10 at 09:43 +0530, Shraddha Barke wrote:
> This patch replaces bit shifting on 1 with the BIT(x) macro
> as it's extensively used by other function in this driver.
[]
> diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
[]
> @@ -149,7 +149,7 @@ int ad2s1210_update_frequency_control_word(struct ad2s1210_state *st)
>  	int ret;
>  	unsigned char fcw;
>  
> -	fcw = (unsigned char)(st->fexcit * (1 << 15) / st->fclkin);
> +	fcw = (unsigned char)(st->fexcit * BIT(15) / st->fclkin);

Multiplying by a bit isn't very obvious.
Maybe just shift it.

	fcw = (unsigned char)((st->fexcit << 15) / st->fclkin);


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 6/6] Staging: iio: resolver: Prefer using the BIT macro Shraddha Barke <shraddha.6596@gmail.com> - 2015-09-10 06:20 +0200
  Re: [PATCH 6/6] Staging: iio: resolver: Prefer using the BIT macro Joe Perches <joe@perches.com> - 2015-09-10 06:30 +0200
    Re: [PATCH 6/6] Staging: iio: resolver: Prefer using the BIT macro Julia Lawall <julia.lawall@lip6.fr> - 2015-09-10 10:10 +0200

csiph-web