]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - sound/core/oss/pcm_oss.c
[ALSA] Fix compilation on 32bit arch
[linux-2.6.git] / sound / core / oss / pcm_oss.c
index b9deef9179a07127857d413e709fca8a123208f7..468fca8894d9d0ab4fb442fb0fe835fb70ed7301 100644 (file)
@@ -125,17 +125,26 @@ int snd_pcm_plugin_append(snd_pcm_plugin_t *plugin)
 static long snd_pcm_oss_bytes(snd_pcm_substream_t *substream, long frames)
 {
        snd_pcm_runtime_t *runtime = substream->runtime;
-       snd_pcm_uframes_t buffer_size = snd_pcm_lib_buffer_bytes(substream);
+       long buffer_size = snd_pcm_lib_buffer_bytes(substream);
        long bytes = frames_to_bytes(runtime, frames);
        if (buffer_size == runtime->oss.buffer_bytes)
                return bytes;
-       return (long)(((int64_t)runtime->oss.buffer_bytes * (int64_t)bytes) / (int64_t)buffer_size);
+#if BITS_PER_LONG >= 64
+       return runtime->oss.buffer_bytes * bytes / buffer_size;
+#else
+       {
+               u64 bsize = (u64)runtime->oss.buffer_bytes * (u64)bytes;
+               u32 rem;
+               div64_32(&bsize, buffer_size, &rem);
+               return (long)bsize;
+       }
+#endif
 }
 
 static long snd_pcm_alsa_frames(snd_pcm_substream_t *substream, long bytes)
 {
        snd_pcm_runtime_t *runtime = substream->runtime;
-       snd_pcm_uframes_t buffer_size = snd_pcm_lib_buffer_bytes(substream);
+       long buffer_size = snd_pcm_lib_buffer_bytes(substream);
        if (buffer_size == runtime->oss.buffer_bytes)
                return bytes_to_frames(runtime, bytes);
        return bytes_to_frames(runtime, (buffer_size * bytes) / runtime->oss.buffer_bytes);