ChangeSet 1.2220, 2005/03/30 15:41:44-08:00, [EMAIL PROTECTED]

        Sound/USB merge



 core/pcm_native.c     |   31 +++++++++++++++++++++----------
 pci/ac97/ac97_codec.c |   38 +++++++++++++++++++-------------------
 usb/usbaudio.c        |   38 +++++++++++++++++++++++---------------
 3 files changed, 63 insertions(+), 44 deletions(-)


diff -Nru a/sound/core/pcm_native.c b/sound/core/pcm_native.c
--- a/sound/core/pcm_native.c   2005-03-30 16:24:26 -08:00
+++ b/sound/core/pcm_native.c   2005-03-30 16:24:26 -08:00
@@ -113,10 +113,18 @@
 
 int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user * 
_info)
 {
-       snd_pcm_info_t info;
-       int err = snd_pcm_info(substream, &info);
-       if (copy_to_user(_info, &info, sizeof(info)))
-               return -EFAULT;
+       snd_pcm_info_t *info;
+       int err;
+
+       info = kmalloc(sizeof(*info), GFP_KERNEL);
+       if (! info)
+               return -ENOMEM;
+       err = snd_pcm_info(substream, info);
+       if (err >= 0) {
+               if (copy_to_user(_info, info, sizeof(*info)))
+                       err = -EFAULT;
+       }
+       kfree(info);
        return err;
 }
 
@@ -1038,7 +1046,13 @@
  */
 int snd_pcm_suspend(snd_pcm_substream_t *substream)
 {
-       return snd_pcm_action(&snd_pcm_action_suspend, substream, 0);
+       int err;
+       unsigned long flags;
+
+       snd_pcm_stream_lock_irqsave(substream, flags);
+       err = snd_pcm_action(&snd_pcm_action_suspend, substream, 0);
+       snd_pcm_stream_unlock_irqrestore(substream, flags);
+       return err;
 }
 
 /**
@@ -1057,11 +1071,8 @@
                        /* FIXME: the open/close code should lock this as well 
*/
                        if (substream->runtime == NULL)
                                continue;
-                       snd_pcm_stream_lock(substream);
-                       if (substream->runtime->status->state != 
SNDRV_PCM_STATE_SUSPENDED)
-                               err = snd_pcm_suspend(substream);
-                       snd_pcm_stream_unlock(substream);
-                       if (err < 0)
+                       err = snd_pcm_suspend(substream);
+                       if (err < 0 && err != -EBUSY)
                                return err;
                }
        }
diff -Nru a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
--- a/sound/pci/ac97/ac97_codec.c       2005-03-30 16:24:26 -08:00
+++ b/sound/pci/ac97/ac97_codec.c       2005-03-30 16:24:26 -08:00
@@ -105,8 +105,8 @@
 { 0x41445374, 0xffffffff, "AD1981B",           patch_ad1981b,  NULL },
 { 0x41445375, 0xffffffff, "AD1985",            patch_ad1985,   NULL },
 { 0x41445378, 0xffffffff, "AD1986",            patch_ad1985,   NULL },
-{ 0x414c4300, 0xffffff00, "ALC100/100P",       NULL,           NULL },
-{ 0x414c4710, 0xfffffff0, "ALC200/200P",       NULL,           NULL },
+{ 0x414c4300, 0xffffff00, "ALC100,100P",       NULL,           NULL },
+{ 0x414c4710, 0xfffffff0, "ALC200,200P",       NULL,           NULL },
 { 0x414c4721, 0xffffffff, "ALC650D",           NULL,   NULL }, /* already 
patched */
 { 0x414c4722, 0xffffffff, "ALC650E",           NULL,   NULL }, /* already 
patched */
 { 0x414c4723, 0xffffffff, "ALC650F",           NULL,   NULL }, /* already 
patched */
@@ -145,11 +145,11 @@
 { 0x49434552, 0xffffffff, "VT1616i",           patch_vt1616,   NULL }, // 
VT1616 compatible (chipset integrated)
 { 0x49544520, 0xffffffff, "IT2226E",           NULL,           NULL },
 { 0x49544561, 0xffffffff, "IT2646E",           patch_it2646,   NULL },
-{ 0x4e534300, 0xffffffff, "LM4540/43/45/46/48",        NULL,           NULL }, 
// only guess --jk
+{ 0x4e534300, 0xffffffff, "LM4540,43,45,46,48",        NULL,           NULL }, 
// only guess --jk
 { 0x4e534331, 0xffffffff, "LM4549",            NULL,           NULL },
 { 0x4e534350, 0xffffffff, "LM4550",            NULL,           NULL },
 { 0x50534304, 0xffffffff, "UCB1400",           NULL,           NULL },
-{ 0x53494c20, 0xffffffe0, "Si3036/8",          NULL,           mpatch_si3036 },
+{ 0x53494c20, 0xffffffe0, "Si3036,8",          NULL,           mpatch_si3036 },
 { 0x54524102, 0xffffffff, "TR28022",           NULL,           NULL },
 { 0x54524106, 0xffffffff, "TR28026",           NULL,           NULL },
 { 0x54524108, 0xffffffff, "TR28028",           patch_tritech_tr28028,  NULL }, 
// added by xin jin [07/09/99]
@@ -158,26 +158,26 @@
 { 0x56494161, 0xffffffff, "VIA1612A",          NULL,           NULL }, // 
modified ICE1232 with S/PDIF
 { 0x57454301, 0xffffffff, "W83971D",           NULL,           NULL },
 { 0x574d4c00, 0xffffffff, "WM9701A",           NULL,           NULL },
-{ 0x574d4C03, 0xffffffff, "WM9703/WM9707/WM9708/WM9717", patch_wolfson03, 
NULL},
-{ 0x574d4C04, 0xffffffff, "WM9704M/WM9704Q",   patch_wolfson04, NULL},
-{ 0x574d4C05, 0xffffffff, "WM9705/WM9710",     patch_wolfson05, NULL},
+{ 0x574d4C03, 0xffffffff, "WM9703,WM9707,WM9708,WM9717", patch_wolfson03, 
NULL},
+{ 0x574d4C04, 0xffffffff, "WM9704M,WM9704Q",   patch_wolfson04, NULL},
+{ 0x574d4C05, 0xffffffff, "WM9705,WM9710",     patch_wolfson05, NULL},
 { 0x574d4C09, 0xffffffff, "WM9709",            NULL,           NULL},
-{ 0x574d4C12, 0xffffffff, "WM9711/WM9712",     patch_wolfson11, NULL},
-{ 0x574d4c13, 0xffffffff, "WM9713/WM9714",     patch_wolfson13, NULL, 
AC97_DEFAULT_POWER_OFF},
+{ 0x574d4C12, 0xffffffff, "WM9711,WM9712",     patch_wolfson11, NULL},
+{ 0x574d4c13, 0xffffffff, "WM9713,WM9714",     patch_wolfson13, NULL, 
AC97_DEFAULT_POWER_OFF},
 { 0x594d4800, 0xffffffff, "YMF743",            NULL,           NULL },
 { 0x594d4802, 0xffffffff, "YMF752",            NULL,           NULL },
 { 0x594d4803, 0xffffffff, "YMF753",            patch_yamaha_ymf753,    NULL },
-{ 0x83847600, 0xffffffff, "STAC9700/83/84",    patch_sigmatel_stac9700,        
NULL },
-{ 0x83847604, 0xffffffff, "STAC9701/3/4/5",    NULL,           NULL },
+{ 0x83847600, 0xffffffff, "STAC9700,83,84",    patch_sigmatel_stac9700,        
NULL },
+{ 0x83847604, 0xffffffff, "STAC9701,3,4,5",    NULL,           NULL },
 { 0x83847605, 0xffffffff, "STAC9704",          NULL,           NULL },
-{ 0x83847608, 0xffffffff, "STAC9708/11",       patch_sigmatel_stac9708,        
NULL },
-{ 0x83847609, 0xffffffff, "STAC9721/23",       patch_sigmatel_stac9721,        
NULL },
+{ 0x83847608, 0xffffffff, "STAC9708,11",       patch_sigmatel_stac9708,        
NULL },
+{ 0x83847609, 0xffffffff, "STAC9721,23",       patch_sigmatel_stac9721,        
NULL },
 { 0x83847644, 0xffffffff, "STAC9744",          patch_sigmatel_stac9744,        
NULL },
-{ 0x83847650, 0xffffffff, "STAC9750/51",       NULL,           NULL }, // 
patch?
-{ 0x83847652, 0xffffffff, "STAC9752/53",       NULL,           NULL }, // 
patch?
-{ 0x83847656, 0xffffffff, "STAC9756/57",       patch_sigmatel_stac9756,        
NULL },
-{ 0x83847658, 0xffffffff, "STAC9758/59",       patch_sigmatel_stac9758,        
NULL },
-{ 0x83847666, 0xffffffff, "STAC9766/67",       NULL,           NULL }, // 
patch?
+{ 0x83847650, 0xffffffff, "STAC9750,51",       NULL,           NULL }, // 
patch?
+{ 0x83847652, 0xffffffff, "STAC9752,53",       NULL,           NULL }, // 
patch?
+{ 0x83847656, 0xffffffff, "STAC9756,57",       patch_sigmatel_stac9756,        
NULL },
+{ 0x83847658, 0xffffffff, "STAC9758,59",       patch_sigmatel_stac9758,        
NULL },
+{ 0x83847666, 0xffffffff, "STAC9766,67",       NULL,           NULL }, // 
patch?
 { 0,         0,          NULL,                 NULL,           NULL }
 };
 
@@ -1486,7 +1486,7 @@
        }
 
        /* build S/PDIF controls */
-       if (ac97->ext_id & AC97_EI_SPDIF) {
+       if ((ac97->ext_id & AC97_EI_SPDIF) && !(ac97->scaps & 
AC97_SCAP_NO_SPDIF)) {
                if (ac97->build_ops->build_spdif) {
                        if ((err = ac97->build_ops->build_spdif(ac97)) < 0)
                                return err;
diff -Nru a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
--- a/sound/usb/usbaudio.c      2005-03-30 16:24:26 -08:00
+++ b/sound/usb/usbaudio.c      2005-03-30 16:24:26 -08:00
@@ -1606,62 +1606,65 @@
        return changed;
 }
 
+#define MAX_MASK       64
+
 /*
  * check whether the registered audio formats need special hw-constraints
  */
 static int check_hw_params_convention(snd_usb_substream_t *subs)
 {
        int i;
-       u32 channels[64];
-       u32 rates[64];
+       u32 *channels;
+       u32 *rates;
        u32 cmaster, rmaster;
        u32 rate_min = 0, rate_max = 0;
        struct list_head *p;
+       int err = 1;
 
-       memset(channels, 0, sizeof(channels));
-       memset(rates, 0, sizeof(rates));
+       channels = kcalloc(MAX_MASK, sizeof(u32), GFP_KERNEL);
+       rates = kcalloc(MAX_MASK, sizeof(u32), GFP_KERNEL);
 
        list_for_each(p, &subs->fmt_list) {
                struct audioformat *f;
                f = list_entry(p, struct audioformat, list);
                /* unconventional channels? */
                if (f->channels > 32)
-                       return 1;
+                       goto __out;
                /* continuous rate min/max matches? */
                if (f->rates & SNDRV_PCM_RATE_CONTINUOUS) {
                        if (rate_min && f->rate_min != rate_min)
-                               return 1;
+                               goto __out;
                        if (rate_max && f->rate_max != rate_max)
-                               return 1;
+                               goto __out;
                        rate_min = f->rate_min;
                        rate_max = f->rate_max;
                }
                /* combination of continuous rates and fixed rates? */
                if (rates[f->format] & SNDRV_PCM_RATE_CONTINUOUS) {
                        if (f->rates != rates[f->format])
-                               return 1;
+                               goto __out;
                }
                if (f->rates & SNDRV_PCM_RATE_CONTINUOUS) {
                        if (rates[f->format] && rates[f->format] != f->rates)
-                               return 1;
+                               goto __out;
                }
                channels[f->format] |= (1 << f->channels);
                rates[f->format] |= f->rates;
        }
        /* check whether channels and rates match for all formats */
        cmaster = rmaster = 0;
-       for (i = 0; i < 64; i++) {
+       for (i = 0; i < MAX_MASK; i++) {
                if (cmaster != channels[i] && cmaster && channels[i])
-                       return 1;
+                       goto __out;
                if (rmaster != rates[i] && rmaster && rates[i])
-                       return 1;
+                       goto __out;
                if (channels[i])
                        cmaster = channels[i];
                if (rates[i])
                        rmaster = rates[i];
        }
        /* check whether channels match for all distinct rates */
-       memset(channels, 0, sizeof(channels));
+       memset(channels, 0, MAX_MASK * sizeof(u32));
        list_for_each(p, &subs->fmt_list) {
                struct audioformat *f;
                f = list_entry(p, struct audioformat, list);
@@ -1675,11 +1678,16 @@
        cmaster = 0;
        for (i = 0; i < 32; i++) {
                if (cmaster != channels[i] && cmaster && channels[i])
-                       return 1;
+                       goto __out;
                if (channels[i])
                        cmaster = channels[i];
        }
-       return 0;
+       err = 0;
+
+ __out:
+       kfree(channels);
+       kfree(rates);
+       return err;
 }
 
 
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to