Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] radio-tea5777.c: Get rid of do_div usage

freq fits easily into 32 bits until it gets shifted, so make it 32 bits,
and cast it to 64 bits before shifting.

[mchehab@redhat.com: also remove asm/div64.h header, as this is not
needed anymore]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Hans de Goede and committed by
Mauro Carvalho Chehab
4fad5c47 fc488517

+5 -7
+5 -7
drivers/media/radio/radio-tea5777.c
··· 33 33 #include <media/v4l2-fh.h> 34 34 #include <media/v4l2-ioctl.h> 35 35 #include <media/v4l2-event.h> 36 - #include <asm/div64.h> 37 36 #include "radio-tea5777.h" 38 37 39 38 MODULE_AUTHOR("Hans de Goede <perex@perex.cz>"); ··· 154 155 155 156 static int radio_tea5777_set_freq(struct radio_tea5777 *tea) 156 157 { 157 - u64 freq; 158 + u32 freq; 158 159 int res; 159 160 160 161 freq = clamp_t(u32, tea->freq, 161 - TEA5777_FM_RANGELOW, TEA5777_FM_RANGEHIGH) + 8; 162 - do_div(freq, 16); /* to kHz */ 162 + TEA5777_FM_RANGELOW, TEA5777_FM_RANGEHIGH); 163 + freq = (freq + 8) / 16; /* to kHz */ 163 164 164 - freq -= TEA5777_FM_IF; 165 - do_div(freq, TEA5777_FM_FREQ_STEP); 165 + freq = (freq - TEA5777_FM_IF) / TEA5777_FM_FREQ_STEP; 166 166 167 167 tea->write_reg &= ~(TEA5777_W_FM_PLL_MASK | TEA5777_W_FM_FREF_MASK); 168 - tea->write_reg |= freq << TEA5777_W_FM_PLL_SHIFT; 168 + tea->write_reg |= (u64)freq << TEA5777_W_FM_PLL_SHIFT; 169 169 tea->write_reg |= TEA5777_W_FM_FREF_VALUE << TEA5777_W_FM_FREF_SHIFT; 170 170 171 171 res = tea->ops->write_reg(tea, tea->write_reg);