ALSA: emu10k1: Reduce GFP_ATOMIC allocation
The emu10k1 fx8010 code allocates each irq resource dynamically and links to the list at PCM trigger callback. Due to the nature of trigger callback, the allocation is done with GFP_ATOMIC, hence it may fail more often. Moreover, the irq resource isn't big at all, and using the kmalloc for this won't save many bytes, either. This patch removes the dynamic allocation and embeds the irq resource into struct snd_emu10k1_fx8010_pcm.irq field instead of keeping a pointer. As a result, it simplifies the code and removes the unnecessary GFP_ATOMIC usage. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -421,14 +421,10 @@ int snd_emu10k1_fx8010_register_irq_handler(struct snd_emu10k1 *emu,
|
||||
snd_fx8010_irq_handler_t *handler,
|
||||
unsigned char gpr_running,
|
||||
void *private_data,
|
||||
struct snd_emu10k1_fx8010_irq **r_irq)
|
||||
struct snd_emu10k1_fx8010_irq *irq)
|
||||
{
|
||||
struct snd_emu10k1_fx8010_irq *irq;
|
||||
unsigned long flags;
|
||||
|
||||
irq = kmalloc(sizeof(*irq), GFP_ATOMIC);
|
||||
if (irq == NULL)
|
||||
return -ENOMEM;
|
||||
irq->handler = handler;
|
||||
irq->gpr_running = gpr_running;
|
||||
irq->private_data = private_data;
|
||||
@@ -443,8 +439,6 @@ int snd_emu10k1_fx8010_register_irq_handler(struct snd_emu10k1 *emu,
|
||||
emu->fx8010.irq_handlers = irq;
|
||||
}
|
||||
spin_unlock_irqrestore(&emu->fx8010.irq_lock, flags);
|
||||
if (r_irq)
|
||||
*r_irq = irq;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -468,7 +462,6 @@ int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu,
|
||||
tmp->next = tmp->next->next;
|
||||
}
|
||||
spin_unlock_irqrestore(&emu->fx8010.irq_lock, flags);
|
||||
kfree(irq);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user