Messages in this thread | | | Subject | Re: [PATCH 6/6] Staging: iio: resolver: Prefer using the BIT macro | From | Joe Perches <> | Date | Wed, 09 Sep 2015 21:24:41 -0700 |
| |
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);
| |