diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-01-04 03:22:20 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 11:29:44 -0500 |
commit | 740eb8358f2bf337fd4ec62abb5b8cca7c652e5a (patch) | |
tree | fa3d6d2deedf7f58ca2436b5d4a2129f7cdf5d59 /sound | |
parent | 93521d274b7fb4e6da5772768683e4984783d9e7 (diff) |
[ALSA] oxygen: use uintptr_t in pointer casts
When we store the DMA channel number in the substream's private_data
pointer, use uintptr_t as an intermediate step when casting from/to
unsigned int to prevent the compiler from whining when the pointer size
is different.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/oxygen/oxygen_pcm.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c index 941399bcab8a..ff46ba5f2774 100644 --- a/sound/pci/oxygen/oxygen_pcm.c +++ b/sound/pci/oxygen/oxygen_pcm.c | |||
@@ -168,6 +168,12 @@ static struct snd_pcm_hardware oxygen_hardware[PCM_COUNT] = { | |||
168 | }, | 168 | }, |
169 | }; | 169 | }; |
170 | 170 | ||
171 | static inline unsigned int | ||
172 | oxygen_substream_channel(struct snd_pcm_substream *substream) | ||
173 | { | ||
174 | return (unsigned int)(uintptr_t)substream->runtime->private_data; | ||
175 | } | ||
176 | |||
171 | static int oxygen_open(struct snd_pcm_substream *substream, | 177 | static int oxygen_open(struct snd_pcm_substream *substream, |
172 | unsigned int channel) | 178 | unsigned int channel) |
173 | { | 179 | { |
@@ -175,7 +181,7 @@ static int oxygen_open(struct snd_pcm_substream *substream, | |||
175 | struct snd_pcm_runtime *runtime = substream->runtime; | 181 | struct snd_pcm_runtime *runtime = substream->runtime; |
176 | int err; | 182 | int err; |
177 | 183 | ||
178 | runtime->private_data = (void *)channel; | 184 | runtime->private_data = (void *)(uintptr_t)channel; |
179 | runtime->hw = oxygen_hardware[channel]; | 185 | runtime->hw = oxygen_hardware[channel]; |
180 | err = snd_pcm_hw_constraint_step(runtime, 0, | 186 | err = snd_pcm_hw_constraint_step(runtime, 0, |
181 | SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 32); | 187 | SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 32); |
@@ -248,7 +254,7 @@ static int oxygen_ac97_open(struct snd_pcm_substream *substream) | |||
248 | static int oxygen_close(struct snd_pcm_substream *substream) | 254 | static int oxygen_close(struct snd_pcm_substream *substream) |
249 | { | 255 | { |
250 | struct oxygen *chip = snd_pcm_substream_chip(substream); | 256 | struct oxygen *chip = snd_pcm_substream_chip(substream); |
251 | unsigned int channel = (unsigned int)substream->runtime->private_data; | 257 | unsigned int channel = oxygen_substream_channel(substream); |
252 | 258 | ||
253 | mutex_lock(&chip->mutex); | 259 | mutex_lock(&chip->mutex); |
254 | chip->pcm_active &= ~(1 << channel); | 260 | chip->pcm_active &= ~(1 << channel); |
@@ -337,7 +343,7 @@ static int oxygen_hw_params(struct snd_pcm_substream *substream, | |||
337 | struct snd_pcm_hw_params *hw_params) | 343 | struct snd_pcm_hw_params *hw_params) |
338 | { | 344 | { |
339 | struct oxygen *chip = snd_pcm_substream_chip(substream); | 345 | struct oxygen *chip = snd_pcm_substream_chip(substream); |
340 | unsigned int channel = (unsigned int)substream->runtime->private_data; | 346 | unsigned int channel = oxygen_substream_channel(substream); |
341 | int err; | 347 | int err; |
342 | 348 | ||
343 | err = snd_pcm_lib_malloc_pages(substream, | 349 | err = snd_pcm_lib_malloc_pages(substream, |
@@ -516,7 +522,7 @@ static int oxygen_ac97_hw_params(struct snd_pcm_substream *substream, | |||
516 | static int oxygen_hw_free(struct snd_pcm_substream *substream) | 522 | static int oxygen_hw_free(struct snd_pcm_substream *substream) |
517 | { | 523 | { |
518 | struct oxygen *chip = snd_pcm_substream_chip(substream); | 524 | struct oxygen *chip = snd_pcm_substream_chip(substream); |
519 | unsigned int channel = (unsigned int)substream->runtime->private_data; | 525 | unsigned int channel = oxygen_substream_channel(substream); |
520 | 526 | ||
521 | spin_lock_irq(&chip->reg_lock); | 527 | spin_lock_irq(&chip->reg_lock); |
522 | chip->interrupt_mask &= ~(1 << channel); | 528 | chip->interrupt_mask &= ~(1 << channel); |
@@ -540,7 +546,7 @@ static int oxygen_spdif_hw_free(struct snd_pcm_substream *substream) | |||
540 | static int oxygen_prepare(struct snd_pcm_substream *substream) | 546 | static int oxygen_prepare(struct snd_pcm_substream *substream) |
541 | { | 547 | { |
542 | struct oxygen *chip = snd_pcm_substream_chip(substream); | 548 | struct oxygen *chip = snd_pcm_substream_chip(substream); |
543 | unsigned int channel = (unsigned int)substream->runtime->private_data; | 549 | unsigned int channel = oxygen_substream_channel(substream); |
544 | unsigned int channel_mask = 1 << channel; | 550 | unsigned int channel_mask = 1 << channel; |
545 | 551 | ||
546 | spin_lock_irq(&chip->reg_lock); | 552 | spin_lock_irq(&chip->reg_lock); |
@@ -575,7 +581,7 @@ static int oxygen_trigger(struct snd_pcm_substream *substream, int cmd) | |||
575 | 581 | ||
576 | snd_pcm_group_for_each_entry(s, substream) { | 582 | snd_pcm_group_for_each_entry(s, substream) { |
577 | if (snd_pcm_substream_chip(s) == chip) { | 583 | if (snd_pcm_substream_chip(s) == chip) { |
578 | mask |= 1 << (unsigned int)s->runtime->private_data; | 584 | mask |= 1 << oxygen_substream_channel(s); |
579 | snd_pcm_trigger_done(s, substream); | 585 | snd_pcm_trigger_done(s, substream); |
580 | } | 586 | } |
581 | } | 587 | } |
@@ -594,7 +600,7 @@ static snd_pcm_uframes_t oxygen_pointer(struct snd_pcm_substream *substream) | |||
594 | { | 600 | { |
595 | struct oxygen *chip = snd_pcm_substream_chip(substream); | 601 | struct oxygen *chip = snd_pcm_substream_chip(substream); |
596 | struct snd_pcm_runtime *runtime = substream->runtime; | 602 | struct snd_pcm_runtime *runtime = substream->runtime; |
597 | unsigned int channel = (unsigned int)runtime->private_data; | 603 | unsigned int channel = oxygen_substream_channel(substream); |
598 | u32 curr_addr; | 604 | u32 curr_addr; |
599 | 605 | ||
600 | /* no spinlock, this read should be atomic */ | 606 | /* no spinlock, this read should be atomic */ |