Skip to content

Commit

Permalink
Merge branch 'linus' of master.kernel.org:/pub/scm/linux/kernel/git/p…
Browse files Browse the repository at this point in the history
…erex/alsa

* 'linus' of master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa: (30 commits)
  [ALSA] version 1.0.14rc1
  [ALSA] ac97: Identify CMI9761 chips.
  [ALSA] ac97_codec - trivial fix for bit update functions
  [ALSA] snd-ca0106: Fix typos.
  [ALSA] snd-ca0106: Add new card variant.
  [ALSA] sound: fix PCM substream list
  [ALSA] sound: initialize rawmidi substream list
  [ALSA] snd_hda_intel 3stack mode for ASUS P5P-L2
  [ALSA] Remove IRQF_DISABLED for shared PCI irqs
  [ALSA] Fix invalid assignment of PCI revision
  [ALSA] Fix races in PCM OSS emulation
  [ALSA] hda-codec - fix typo in PCI IDs
  [ALSA] ac97 - Fix potential negative array index
  [ALSA] hda-codec - Verbose proc output for PCM parameters
  [ALSA] hda-codec - Fix detection of supported sample rates
  [ALSA] hda-codec - Fix model for ASUS V1j laptop
  [ALSA] sound/core/control.c: remove dead code
  [ALSA] hda-codec - Add model for HP q965
  [ALSA] pcm core: fix silence_start calculations
  [ALSA] hda-codec - Fix a typo
  ...
  • Loading branch information
Linus Torvalds committed Dec 21, 2006
2 parents eb2112f + 7c21699 commit e4ddc9c
Show file tree
Hide file tree
Showing 68 changed files with 270 additions and 166 deletions.
8 changes: 4 additions & 4 deletions Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@
<informalexample>
<programlisting>
<![CDATA[
struct mychip *chip = (struct mychip *)card->private_data;
struct mychip *chip = card->private_data;
]]>
</programlisting>
</informalexample>
Expand Down Expand Up @@ -1095,7 +1095,7 @@

/* release the irq */
if (chip->irq >= 0)
free_irq(chip->irq, (void *)chip);
free_irq(chip->irq, chip);
/* release the i/o ports & memory */
pci_release_regions(chip->pci);
/* disable the PCI entry */
Expand Down Expand Up @@ -1148,7 +1148,7 @@
}
chip->port = pci_resource_start(pci, 0);
if (request_irq(pci->irq, snd_mychip_interrupt,
IRQF_DISABLED|IRQF_SHARED, "My Chip", chip)) {
IRQF_SHARED, "My Chip", chip)) {
printk(KERN_ERR "cannot grab irq %d\n", pci->irq);
snd_mychip_free(chip);
return -EBUSY;
Expand Down Expand Up @@ -1387,7 +1387,7 @@
<programlisting>
<![CDATA[
if (chip->irq >= 0)
free_irq(chip->irq, (void *)chip);
free_irq(chip->irq, chip);
]]>
</programlisting>
</informalexample>
Expand Down
1 change: 1 addition & 0 deletions include/sound/pcm_oss.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ struct snd_pcm_oss_runtime {
size_t mmap_bytes;
char *buffer; /* vmallocated period */
size_t buffer_used; /* used length from period buffer */
struct mutex params_lock;
#ifdef CONFIG_SND_PCM_OSS_PLUGINS
struct snd_pcm_plugin *plugin_first;
struct snd_pcm_plugin *plugin_last;
Expand Down
4 changes: 2 additions & 2 deletions include/sound/version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* include/version.h. Generated by alsa/ksync script. */
#define CONFIG_SND_VERSION "1.0.13"
#define CONFIG_SND_DATE " (Tue Nov 28 14:07:24 2006 UTC)"
#define CONFIG_SND_VERSION "1.0.14rc1"
#define CONFIG_SND_DATE " (Wed Dec 20 08:11:48 2006 UTC)"
5 changes: 2 additions & 3 deletions include/sound/ymfpci.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ struct snd_ymfpci {
int irq;

unsigned int device_id; /* PCI device ID */
unsigned int rev; /* PCI revision */
unsigned char rev; /* PCI revision */
unsigned long reg_area_phys;
void __iomem *reg_area_virt;
struct resource *res_reg_area;
Expand Down Expand Up @@ -345,7 +345,6 @@ struct snd_ymfpci {
struct snd_kcontrol *spdif_pcm_ctl;
int mode_dup4ch;
int rear_opened;
int rear_swap;
int spdif_opened;
struct {
u16 left;
Expand Down Expand Up @@ -378,7 +377,7 @@ int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch, int rear_swap);
int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch);
int snd_ymfpci_timer(struct snd_ymfpci *chip, int device);

#endif /* __SOUND_YMFPCI_H */
1 change: 0 additions & 1 deletion sound/aoa/codecs/snd-aoa-codec-onyx.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#define __SND_AOA_CODEC_ONYX_H
#include <stddef.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <asm/pmac_low_i2c.h>
#include <asm/prom.h>

Expand Down
1 change: 0 additions & 1 deletion sound/aoa/codecs/snd-aoa-codec-tas.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
*/
#include <stddef.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <asm/pmac_low_i2c.h>
#include <asm/prom.h>
#include <linux/delay.h>
Expand Down
2 changes: 1 addition & 1 deletion sound/core/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer,
schedule();
remove_wait_queue(&ctl->change_sleep, &wait);
if (signal_pending(current))
return result > 0 ? result : -ERESTARTSYS;
return -ERESTARTSYS;
spin_lock_irq(&ctl->read_lock);
}
kev = snd_kctl_event(ctl->events.next);
Expand Down
52 changes: 40 additions & 12 deletions sound/core/oss/pcm_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,8 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
struct snd_mask sformat_mask;
struct snd_mask mask;

if (mutex_lock_interruptible(&runtime->oss.params_lock))
return -EINTR;
sw_params = kmalloc(sizeof(*sw_params), GFP_KERNEL);
params = kmalloc(sizeof(*params), GFP_KERNEL);
sparams = kmalloc(sizeof(*sparams), GFP_KERNEL);
Expand Down Expand Up @@ -1020,6 +1022,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
kfree(sw_params);
kfree(params);
kfree(sparams);
mutex_unlock(&runtime->oss.params_lock);
return err;
}

Expand Down Expand Up @@ -1307,14 +1310,17 @@ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const cha

if ((tmp = snd_pcm_oss_make_ready(substream)) < 0)
return tmp;
mutex_lock(&runtime->oss.params_lock);
while (bytes > 0) {
if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) {
tmp = bytes;
if (tmp + runtime->oss.buffer_used > runtime->oss.period_bytes)
tmp = runtime->oss.period_bytes - runtime->oss.buffer_used;
if (tmp > 0) {
if (copy_from_user(runtime->oss.buffer + runtime->oss.buffer_used, buf, tmp))
return xfer > 0 ? (snd_pcm_sframes_t)xfer : -EFAULT;
if (copy_from_user(runtime->oss.buffer + runtime->oss.buffer_used, buf, tmp)) {
tmp = -EFAULT;
goto err;
}
}
runtime->oss.buffer_used += tmp;
buf += tmp;
Expand All @@ -1325,22 +1331,24 @@ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const cha
tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr,
runtime->oss.buffer_used - runtime->oss.period_ptr, 1);
if (tmp <= 0)
return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
goto err;
runtime->oss.bytes += tmp;
runtime->oss.period_ptr += tmp;
runtime->oss.period_ptr %= runtime->oss.period_bytes;
if (runtime->oss.period_ptr == 0 ||
runtime->oss.period_ptr == runtime->oss.buffer_used)
runtime->oss.buffer_used = 0;
else if ((substream->f_flags & O_NONBLOCK) != 0)
return xfer > 0 ? xfer : -EAGAIN;
else if ((substream->f_flags & O_NONBLOCK) != 0) {
tmp = -EAGAIN;
goto err;
}
}
} else {
tmp = snd_pcm_oss_write2(substream,
(const char __force *)buf,
runtime->oss.period_bytes, 0);
if (tmp <= 0)
return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
goto err;
runtime->oss.bytes += tmp;
buf += tmp;
bytes -= tmp;
Expand All @@ -1350,7 +1358,12 @@ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const cha
break;
}
}
mutex_unlock(&runtime->oss.params_lock);
return xfer;

err:
mutex_unlock(&runtime->oss.params_lock);
return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
}

static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, size_t bytes, int in_kernel)
Expand Down Expand Up @@ -1397,21 +1410,24 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use

if ((tmp = snd_pcm_oss_make_ready(substream)) < 0)
return tmp;
mutex_lock(&runtime->oss.params_lock);
while (bytes > 0) {
if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) {
if (runtime->oss.buffer_used == 0) {
tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);
if (tmp <= 0)
return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
goto err;
runtime->oss.bytes += tmp;
runtime->oss.period_ptr = tmp;
runtime->oss.buffer_used = tmp;
}
tmp = bytes;
if ((size_t) tmp > runtime->oss.buffer_used)
tmp = runtime->oss.buffer_used;
if (copy_to_user(buf, runtime->oss.buffer + (runtime->oss.period_ptr - runtime->oss.buffer_used), tmp))
return xfer > 0 ? (snd_pcm_sframes_t)xfer : -EFAULT;
if (copy_to_user(buf, runtime->oss.buffer + (runtime->oss.period_ptr - runtime->oss.buffer_used), tmp)) {
tmp = -EFAULT;
goto err;
}
buf += tmp;
bytes -= tmp;
xfer += tmp;
Expand All @@ -1420,14 +1436,19 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use
tmp = snd_pcm_oss_read2(substream, (char __force *)buf,
runtime->oss.period_bytes, 0);
if (tmp <= 0)
return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
goto err;
runtime->oss.bytes += tmp;
buf += tmp;
bytes -= tmp;
xfer += tmp;
}
}
mutex_unlock(&runtime->oss.params_lock);
return xfer;

err:
mutex_unlock(&runtime->oss.params_lock);
return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
}

static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file)
Expand Down Expand Up @@ -1528,6 +1549,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
return err;
format = snd_pcm_oss_format_from(runtime->oss.format);
width = snd_pcm_format_physical_width(format);
mutex_lock(&runtime->oss.params_lock);
if (runtime->oss.buffer_used > 0) {
#ifdef OSS_DEBUG
printk("sync: buffer_used\n");
Expand All @@ -1537,8 +1559,10 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
runtime->oss.buffer + runtime->oss.buffer_used,
size);
err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes);
if (err < 0)
if (err < 0) {
mutex_unlock(&runtime->oss.params_lock);
return err;
}
} else if (runtime->oss.period_ptr > 0) {
#ifdef OSS_DEBUG
printk("sync: period_ptr\n");
Expand All @@ -1548,8 +1572,10 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
runtime->oss.buffer,
size * 8 / width);
err = snd_pcm_oss_sync1(substream, size);
if (err < 0)
if (err < 0) {
mutex_unlock(&runtime->oss.params_lock);
return err;
}
}
/*
* The ALSA's period might be a bit large than OSS one.
Expand Down Expand Up @@ -1579,6 +1605,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
snd_pcm_lib_writev(substream, buffers, size);
}
}
mutex_unlock(&runtime->oss.params_lock);
/*
* finish sync: drain the buffer
*/
Expand Down Expand Up @@ -2172,6 +2199,7 @@ static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream,
runtime->oss.params = 1;
runtime->oss.trigger = 1;
runtime->oss.rate = 8000;
mutex_init(&runtime->oss.params_lock);
switch (SNDRV_MINOR_OSS_DEVICE(minor)) {
case SNDRV_MINOR_OSS_PCM_8:
runtime->oss.format = AFMT_U8;
Expand Down
4 changes: 4 additions & 0 deletions sound/core/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,10 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
err = snd_pcm_substream_proc_init(substream);
if (err < 0) {
snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n");
if (prev == NULL)
pstr->substream = NULL;
else
prev->next = NULL;
kfree(substream);
return err;
}
Expand Down
8 changes: 3 additions & 5 deletions sound/core/pcm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,17 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram
runtime->silence_filled -= frames;
if ((snd_pcm_sframes_t)runtime->silence_filled < 0) {
runtime->silence_filled = 0;
runtime->silence_start = (ofs + frames) - runtime->buffer_size;
runtime->silence_start = new_hw_ptr;
} else {
runtime->silence_start = ofs - runtime->silence_filled;
runtime->silence_start = ofs;
}
if ((snd_pcm_sframes_t)runtime->silence_start < 0)
runtime->silence_start += runtime->boundary;
}
frames = runtime->buffer_size - runtime->silence_filled;
}
snd_assert(frames <= runtime->buffer_size, return);
if (frames == 0)
return;
ofs = (runtime->silence_start + runtime->silence_filled) % runtime->buffer_size;
ofs = runtime->silence_start % runtime->buffer_size;
while (frames > 0) {
transfer = ofs + frames > runtime->buffer_size ? runtime->buffer_size - ofs : frames;
if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED ||
Expand Down
4 changes: 3 additions & 1 deletion sound/core/rawmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,6 @@ static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi,
struct snd_rawmidi_substream *substream;
int idx;

INIT_LIST_HEAD(&stream->substreams);
for (idx = 0; idx < count; idx++) {
substream = kzalloc(sizeof(*substream), GFP_KERNEL);
if (substream == NULL) {
Expand Down Expand Up @@ -1440,6 +1439,9 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
rmidi->device = device;
mutex_init(&rmidi->open_mutex);
init_waitqueue_head(&rmidi->open_wait);
INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams);
INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams);

if (id != NULL)
strlcpy(rmidi->id, id, sizeof(rmidi->id));
if ((err = snd_rawmidi_alloc_substreams(rmidi,
Expand Down
2 changes: 1 addition & 1 deletion sound/core/seq/seq_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char
return len;
newlen = len;
if (size_aligned > 0)
newlen = ((len + size_aligned - 1) / size_aligned) * size_aligned;
newlen = roundup(len, size_aligned);
if (count < newlen)
return -EAGAIN;

Expand Down
2 changes: 1 addition & 1 deletion sound/core/sgbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

/* table entries are align to 32 */
#define SGBUF_TBL_ALIGN 32
#define sgbuf_align_table(tbl) ((((tbl) + SGBUF_TBL_ALIGN - 1) / SGBUF_TBL_ALIGN) * SGBUF_TBL_ALIGN)
#define sgbuf_align_table(tbl) ALIGN((tbl), SGBUF_TBL_ALIGN)

int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab)
{
Expand Down
7 changes: 3 additions & 4 deletions sound/isa/gus/gus_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ static int snd_gf1_mem_find(struct snd_gf1_mem * alloc,
struct snd_gf1_mem_block *pblock;
unsigned int ptr1, ptr2;

align--;
if (w_16 && align < 1)
align = 1;
if (w_16 && align < 2)
align = 2;
block->flags = w_16 ? SNDRV_GF1_MEM_BLOCK_16BIT : 0;
block->owner = SNDRV_GF1_MEM_OWNER_DRIVER;
block->share = 0;
Expand All @@ -165,7 +164,7 @@ static int snd_gf1_mem_find(struct snd_gf1_mem * alloc,
if (pblock->next->ptr < boundary)
ptr2 = pblock->next->ptr;
}
ptr1 = (pblock->ptr + pblock->size + align) & ~align;
ptr1 = ALIGN(pblock->ptr + pblock->size, align);
if (ptr1 >= ptr2)
continue;
size1 = ptr2 - ptr1;
Expand Down
2 changes: 1 addition & 1 deletion sound/isa/sb/sb_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ int snd_sbdsp_create(struct snd_card *card,
chip->port = port;

if (request_irq(irq, irq_handler, hardware == SB_HW_ALS4000 ?
IRQF_DISABLED | IRQF_SHARED : IRQF_DISABLED,
IRQF_SHARED : IRQF_DISABLED,
"SoundBlaster", (void *) chip)) {
snd_printk(KERN_ERR "sb: can't grab irq %d\n", irq);
snd_sbdsp_free(chip);
Expand Down
2 changes: 1 addition & 1 deletion sound/isa/wavefront/wavefront_synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ wavefront_send_sample (snd_wavefront_t *dev,
blocksize = max_blksize;
} else {
/* round to nearest 16-byte value */
blocksize = ((length-written+7)&~0x7);
blocksize = ALIGN(length - written, 8);
}

if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_BLOCK, NULL, NULL)) {
Expand Down
Loading

0 comments on commit e4ddc9c

Please sign in to comment.