diff options
Diffstat (limited to 'sound/ppc/beep.c')
-rw-r--r-- | sound/ppc/beep.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c index c23f601a37f9..31ea7a4c069f 100644 --- a/sound/ppc/beep.c +++ b/sound/ppc/beep.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/input.h> | 26 | #include <linux/input.h> |
27 | #include <linux/pci.h> | ||
28 | #include <linux/dma-mapping.h> | ||
27 | #include <sound/core.h> | 29 | #include <sound/core.h> |
28 | #include <sound/control.h> | 30 | #include <sound/control.h> |
29 | #include "pmac.h" | 31 | #include "pmac.h" |
@@ -35,7 +37,7 @@ struct snd_pmac_beep { | |||
35 | int hz; | 37 | int hz; |
36 | int nsamples; | 38 | int nsamples; |
37 | short *buf; /* allocated wave buffer */ | 39 | short *buf; /* allocated wave buffer */ |
38 | unsigned long addr; /* physical address of buffer */ | 40 | dma_addr_t addr; /* physical address of buffer */ |
39 | struct input_dev dev; | 41 | struct input_dev dev; |
40 | }; | 42 | }; |
41 | 43 | ||
@@ -217,12 +219,8 @@ int __init snd_pmac_attach_beep(pmac_t *chip) | |||
217 | return -ENOMEM; | 219 | return -ENOMEM; |
218 | 220 | ||
219 | memset(beep, 0, sizeof(*beep)); | 221 | memset(beep, 0, sizeof(*beep)); |
220 | beep->buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); | 222 | beep->buf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, |
221 | if (! beep->buf) { | 223 | &beep->addr, GFP_KERNEL); |
222 | kfree(beep); | ||
223 | return -ENOMEM; | ||
224 | } | ||
225 | beep->addr = virt_to_bus(beep->buf); | ||
226 | 224 | ||
227 | beep->dev.evbit[0] = BIT(EV_SND); | 225 | beep->dev.evbit[0] = BIT(EV_SND); |
228 | beep->dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); | 226 | beep->dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); |
@@ -255,7 +253,8 @@ void snd_pmac_detach_beep(pmac_t *chip) | |||
255 | { | 253 | { |
256 | if (chip->beep) { | 254 | if (chip->beep) { |
257 | input_unregister_device(&chip->beep->dev); | 255 | input_unregister_device(&chip->beep->dev); |
258 | kfree(chip->beep->buf); | 256 | dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, |
257 | chip->beep->buf, chip->beep->addr); | ||
259 | kfree(chip->beep); | 258 | kfree(chip->beep); |
260 | chip->beep = NULL; | 259 | chip->beep = NULL; |
261 | } | 260 | } |