aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-08-10 06:47:25 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-09-13 16:42:09 -0400
commit4fad5c474f9078dd133996cabaffdb5df8a1e28e (patch)
treea41eb2d3470ee04d4031a12a7333c6d434ed81e8 /drivers/media/radio
parentfc488517cc0d50bcc9e4ffa90fee5755f9c914fc (diff)
[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>
Diffstat (limited to 'drivers/media/radio')
-rw-r--r--drivers/media/radio/radio-tea5777.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/media/radio/radio-tea5777.c b/drivers/media/radio/radio-tea5777.c
index 5bc9fa62720b..8cfa364b8190 100644
--- a/drivers/media/radio/radio-tea5777.c
+++ b/drivers/media/radio/radio-tea5777.c
@@ -33,7 +33,6 @@
33#include <media/v4l2-fh.h> 33#include <media/v4l2-fh.h>
34#include <media/v4l2-ioctl.h> 34#include <media/v4l2-ioctl.h>
35#include <media/v4l2-event.h> 35#include <media/v4l2-event.h>
36#include <asm/div64.h>
37#include "radio-tea5777.h" 36#include "radio-tea5777.h"
38 37
39MODULE_AUTHOR("Hans de Goede <perex@perex.cz>"); 38MODULE_AUTHOR("Hans de Goede <perex@perex.cz>");
@@ -155,18 +154,17 @@ static u32 tea5777_freq_to_v4l2_freq(struct radio_tea5777 *tea, u32 freq)
155 154
156static int radio_tea5777_set_freq(struct radio_tea5777 *tea) 155static int radio_tea5777_set_freq(struct radio_tea5777 *tea)
157{ 156{
158 u64 freq; 157 u32 freq;
159 int res; 158 int res;
160 159
161 freq = clamp_t(u32, tea->freq, 160 freq = clamp_t(u32, tea->freq,
162 TEA5777_FM_RANGELOW, TEA5777_FM_RANGEHIGH) + 8; 161 TEA5777_FM_RANGELOW, TEA5777_FM_RANGEHIGH);
163 do_div(freq, 16); /* to kHz */ 162 freq = (freq + 8) / 16; /* to kHz */
164 163
165 freq -= TEA5777_FM_IF; 164 freq = (freq - TEA5777_FM_IF) / TEA5777_FM_FREQ_STEP;
166 do_div(freq, TEA5777_FM_FREQ_STEP);
167 165
168 tea->write_reg &= ~(TEA5777_W_FM_PLL_MASK | TEA5777_W_FM_FREF_MASK); 166 tea->write_reg &= ~(TEA5777_W_FM_PLL_MASK | TEA5777_W_FM_FREF_MASK);
169 tea->write_reg |= freq << TEA5777_W_FM_PLL_SHIFT; 167 tea->write_reg |= (u64)freq << TEA5777_W_FM_PLL_SHIFT;
170 tea->write_reg |= TEA5777_W_FM_FREF_VALUE << TEA5777_W_FM_FREF_SHIFT; 168 tea->write_reg |= TEA5777_W_FM_FREF_VALUE << TEA5777_W_FM_FREF_SHIFT;
171 169
172 res = tea->ops->write_reg(tea, tea->write_reg); 170 res = tea->ops->write_reg(tea, tea->write_reg);