diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-06-05 11:40:04 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-06-05 11:45:17 -0400 |
commit | 3f7440a6b771169e1f11fa582e53a4259b682809 (patch) | |
tree | 4d91c07abf4269de4f681b821b594f5ad3d4f79a /sound/pci/rme9652 | |
parent | 3218911f839b6c85acbf872ad264ea69aa4d89ad (diff) |
ALSA: Clean up 64bit division functions
Replace the house-made div64_32() with the standard div_u64*() functions.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/rme9652')
-rw-r--r-- | sound/pci/rme9652/hdsp.c | 7 | ||||
-rw-r--r-- | sound/pci/rme9652/hdspm.c | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 314e73531bd1..bcfdbb5ebc40 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/pci.h> | 28 | #include <linux/pci.h> |
29 | #include <linux/firmware.h> | 29 | #include <linux/firmware.h> |
30 | #include <linux/moduleparam.h> | 30 | #include <linux/moduleparam.h> |
31 | #include <linux/math64.h> | ||
31 | 32 | ||
32 | #include <sound/core.h> | 33 | #include <sound/core.h> |
33 | #include <sound/control.h> | 34 | #include <sound/control.h> |
@@ -1047,7 +1048,6 @@ static int hdsp_set_interrupt_interval(struct hdsp *s, unsigned int frames) | |||
1047 | static void hdsp_set_dds_value(struct hdsp *hdsp, int rate) | 1048 | static void hdsp_set_dds_value(struct hdsp *hdsp, int rate) |
1048 | { | 1049 | { |
1049 | u64 n; | 1050 | u64 n; |
1050 | u32 r; | ||
1051 | 1051 | ||
1052 | if (rate >= 112000) | 1052 | if (rate >= 112000) |
1053 | rate /= 4; | 1053 | rate /= 4; |
@@ -1055,7 +1055,7 @@ static void hdsp_set_dds_value(struct hdsp *hdsp, int rate) | |||
1055 | rate /= 2; | 1055 | rate /= 2; |
1056 | 1056 | ||
1057 | n = DDS_NUMERATOR; | 1057 | n = DDS_NUMERATOR; |
1058 | div64_32(&n, rate, &r); | 1058 | n = div_u64(n, rate); |
1059 | /* n should be less than 2^32 for being written to FREQ register */ | 1059 | /* n should be less than 2^32 for being written to FREQ register */ |
1060 | snd_BUG_ON(n >> 32); | 1060 | snd_BUG_ON(n >> 32); |
1061 | /* HDSP_freqReg and HDSP_resetPointer are the same, so keep the DDS | 1061 | /* HDSP_freqReg and HDSP_resetPointer are the same, so keep the DDS |
@@ -3097,7 +3097,6 @@ static int snd_hdsp_get_adat_sync_check(struct snd_kcontrol *kcontrol, struct sn | |||
3097 | static int hdsp_dds_offset(struct hdsp *hdsp) | 3097 | static int hdsp_dds_offset(struct hdsp *hdsp) |
3098 | { | 3098 | { |
3099 | u64 n; | 3099 | u64 n; |
3100 | u32 r; | ||
3101 | unsigned int dds_value = hdsp->dds_value; | 3100 | unsigned int dds_value = hdsp->dds_value; |
3102 | int system_sample_rate = hdsp->system_sample_rate; | 3101 | int system_sample_rate = hdsp->system_sample_rate; |
3103 | 3102 | ||
@@ -3109,7 +3108,7 @@ static int hdsp_dds_offset(struct hdsp *hdsp) | |||
3109 | * dds_value = n / rate | 3108 | * dds_value = n / rate |
3110 | * rate = n / dds_value | 3109 | * rate = n / dds_value |
3111 | */ | 3110 | */ |
3112 | div64_32(&n, dds_value, &r); | 3111 | n = div_u64(n, dds_value); |
3113 | if (system_sample_rate >= 112000) | 3112 | if (system_sample_rate >= 112000) |
3114 | n *= 4; | 3113 | n *= 4; |
3115 | else if (system_sample_rate >= 56000) | 3114 | else if (system_sample_rate >= 56000) |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index bac2dc0c5d85..0dce331a2a3b 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
32 | #include <linux/math64.h> | ||
32 | #include <asm/io.h> | 33 | #include <asm/io.h> |
33 | 34 | ||
34 | #include <sound/core.h> | 35 | #include <sound/core.h> |
@@ -831,7 +832,6 @@ static int hdspm_set_interrupt_interval(struct hdspm * s, unsigned int frames) | |||
831 | static void hdspm_set_dds_value(struct hdspm *hdspm, int rate) | 832 | static void hdspm_set_dds_value(struct hdspm *hdspm, int rate) |
832 | { | 833 | { |
833 | u64 n; | 834 | u64 n; |
834 | u32 r; | ||
835 | 835 | ||
836 | if (rate >= 112000) | 836 | if (rate >= 112000) |
837 | rate /= 4; | 837 | rate /= 4; |
@@ -844,7 +844,7 @@ static void hdspm_set_dds_value(struct hdspm *hdspm, int rate) | |||
844 | */ | 844 | */ |
845 | /* n = 104857600000000ULL; */ /* = 2^20 * 10^8 */ | 845 | /* n = 104857600000000ULL; */ /* = 2^20 * 10^8 */ |
846 | n = 110100480000000ULL; /* Value checked for AES32 and MADI */ | 846 | n = 110100480000000ULL; /* Value checked for AES32 and MADI */ |
847 | div64_32(&n, rate, &r); | 847 | n = div_u64(n, rate); |
848 | /* n should be less than 2^32 for being written to FREQ register */ | 848 | /* n should be less than 2^32 for being written to FREQ register */ |
849 | snd_BUG_ON(n >> 32); | 849 | snd_BUG_ON(n >> 32); |
850 | hdspm_write(hdspm, HDSPM_freqReg, (u32)n); | 850 | hdspm_write(hdspm, HDSPM_freqReg, (u32)n); |