Commit 96d9e9c039cf94280ba80b8d64714279cb6d26dd

Authored by Takashi Iwai

Merge branch 'fix/misc' into topic/misc

Showing 9 changed files Side-by-side Diff

include/sound/ak4113.h
... ... @@ -307,7 +307,7 @@
307 307  
308 308 int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
309 309 ak4113_write_t *write,
310   - const unsigned char pgm[AK4113_WRITABLE_REGS],
  310 + const unsigned char *pgm,
311 311 void *private_data, struct ak4113 **r_ak4113);
312 312 void snd_ak4113_reg_write(struct ak4113 *ak4113, unsigned char reg,
313 313 unsigned char mask, unsigned char val);
... ... @@ -863,7 +863,6 @@
863 863 struct snd_ac97 *ac97;
864 864 int ret;
865 865  
866   - writel(0, aaci->base + AC97_POWERDOWN);
867 866 /*
868 867 * Assert AACIRESET for 2us
869 868 */
... ... @@ -1047,7 +1046,11 @@
1047 1046  
1048 1047 writel(0x1fff, aaci->base + AACI_INTCLR);
1049 1048 writel(aaci->maincr, aaci->base + AACI_MAINCR);
1050   -
  1049 + /*
  1050 + * Fix: ac97 read back fail errors by reading
  1051 + * from any arbitrary aaci register.
  1052 + */
  1053 + readl(aaci->base + AACI_CSCH1);
1051 1054 ret = aaci_probe_ac97(aaci);
1052 1055 if (ret)
1053 1056 goto out;
sound/core/pcm_lib.c
... ... @@ -148,6 +148,9 @@
148 148  
149 149 #define xrun_debug(substream, mask) \
150 150 ((substream)->pstr->xrun_debug & (mask))
  151 +#else
  152 +#define xrun_debug(substream, mask) 0
  153 +#endif
151 154  
152 155 #define dump_stack_on_xrun(substream) do { \
153 156 if (xrun_debug(substream, XRUN_DEBUG_STACK)) \
... ... @@ -169,6 +172,7 @@
169 172 }
170 173 }
171 174  
  175 +#ifdef CONFIG_SND_PCM_XRUN_DEBUG
172 176 #define hw_ptr_error(substream, fmt, args...) \
173 177 do { \
174 178 if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \
... ... @@ -255,8 +259,6 @@
255 259  
256 260 #else /* ! CONFIG_SND_PCM_XRUN_DEBUG */
257 261  
258   -#define xrun_debug(substream, mask) 0
259   -#define xrun(substream) do { } while (0)
260 262 #define hw_ptr_error(substream, fmt, args...) do { } while (0)
261 263 #define xrun_log(substream, pos) do { } while (0)
262 264 #define xrun_log_show(substream) do { } while (0)
sound/i2c/other/ak4113.c
... ... @@ -70,7 +70,7 @@
70 70 }
71 71  
72 72 int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
73   - ak4113_write_t *write, const unsigned char pgm[5],
  73 + ak4113_write_t *write, const unsigned char *pgm,
74 74 void *private_data, struct ak4113 **r_ak4113)
75 75 {
76 76 struct ak4113 *chip;
sound/pci/ac97/ac97_patch.c
... ... @@ -1852,12 +1852,14 @@
1852 1852 0x10140523, /* Thinkpad R40 */
1853 1853 0x10140534, /* Thinkpad X31 */
1854 1854 0x10140537, /* Thinkpad T41p */
  1855 + 0x1014053e, /* Thinkpad R40e */
1855 1856 0x10140554, /* Thinkpad T42p/R50p */
1856 1857 0x10140567, /* Thinkpad T43p 2668-G7U */
1857 1858 0x10140581, /* Thinkpad X41-2527 */
1858 1859 0x10280160, /* Dell Dimension 2400 */
1859 1860 0x104380b0, /* Asus A7V8X-MX */
1860 1861 0x11790241, /* Toshiba Satellite A-15 S127 */
  1862 + 0x1179ff10, /* Toshiba P500 */
1861 1863 0x144dc01a, /* Samsung NP-X20C004/SEG */
1862 1864 0 /* end */
1863 1865 };
... ... @@ -941,13 +941,21 @@
941 941 struct snd_pcm_substream *substream)
942 942 {
943 943 size_t ptr;
944   - unsigned int reg;
  944 + unsigned int reg, rem, tries;
  945 +
945 946 if (!rec->running)
946 947 return 0;
947 948 #if 1 // this seems better..
948 949 reg = rec->ch ? CM_REG_CH1_FRAME2 : CM_REG_CH0_FRAME2;
949   - ptr = rec->dma_size - (snd_cmipci_read_w(cm, reg) + 1);
950   - ptr >>= rec->shift;
  950 + for (tries = 0; tries < 3; tries++) {
  951 + rem = snd_cmipci_read_w(cm, reg);
  952 + if (rem < rec->dma_size)
  953 + goto ok;
  954 + }
  955 + printk(KERN_ERR "cmipci: invalid PCM pointer: %#x\n", rem);
  956 + return SNDRV_PCM_POS_XRUN;
  957 +ok:
  958 + ptr = (rec->dma_size - (rem + 1)) >> rec->shift;
951 959 #else
952 960 reg = rec->ch ? CM_REG_CH1_FRAME1 : CM_REG_CH0_FRAME1;
953 961 ptr = snd_cmipci_read(cm, reg) - rec->offset;
sound/pci/echoaudio/echoaudio.c
... ... @@ -2184,10 +2184,9 @@
2184 2184 goto ctl_error;
2185 2185 #endif
2186 2186  
2187   - if ((err = snd_card_register(card)) < 0) {
2188   - snd_card_free(card);
  2187 + err = snd_card_register(card);
  2188 + if (err < 0)
2189 2189 goto ctl_error;
2190   - }
2191 2190 snd_printk(KERN_INFO "Card registered: %s\n", card->longname);
2192 2191  
2193 2192 pci_set_drvdata(pci, chip);
sound/pci/mixart/mixart.c
... ... @@ -1161,13 +1161,15 @@
1161 1161 unsigned long count, unsigned long pos)
1162 1162 {
1163 1163 struct mixart_mgr *mgr = entry->private_data;
  1164 + unsigned long maxsize;
1164 1165  
1165   - count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
1166   - if(count <= 0)
  1166 + if (pos >= MIXART_BA0_SIZE)
1167 1167 return 0;
1168   - if(pos + count > MIXART_BA0_SIZE)
1169   - count = (long)(MIXART_BA0_SIZE - pos);
1170   - if(copy_to_user_fromio(buf, MIXART_MEM( mgr, pos ), count))
  1168 + maxsize = MIXART_BA0_SIZE - pos;
  1169 + if (count > maxsize)
  1170 + count = maxsize;
  1171 + count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
  1172 + if (copy_to_user_fromio(buf, MIXART_MEM(mgr, pos), count))
1171 1173 return -EFAULT;
1172 1174 return count;
1173 1175 }
1174 1176  
1175 1177  
... ... @@ -1180,13 +1182,15 @@
1180 1182 unsigned long count, unsigned long pos)
1181 1183 {
1182 1184 struct mixart_mgr *mgr = entry->private_data;
  1185 + unsigned long maxsize;
1183 1186  
1184   - count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
1185   - if(count <= 0)
  1187 + if (pos > MIXART_BA1_SIZE)
1186 1188 return 0;
1187   - if(pos + count > MIXART_BA1_SIZE)
1188   - count = (long)(MIXART_BA1_SIZE - pos);
1189   - if(copy_to_user_fromio(buf, MIXART_REG( mgr, pos ), count))
  1189 + maxsize = MIXART_BA1_SIZE - pos;
  1190 + if (count > maxsize)
  1191 + count = maxsize;
  1192 + count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
  1193 + if (copy_to_user_fromio(buf, MIXART_REG(mgr, pos), count))
1190 1194 return -EFAULT;
1191 1195 return count;
1192 1196 }
... ... @@ -986,6 +986,8 @@
986 986 DEFINE_WAIT(wait);
987 987 long timeout = msecs_to_jiffies(50);
988 988  
  989 + if (ep->umidi->disconnected)
  990 + return;
989 991 /*
990 992 * The substream buffer is empty, but some data might still be in the
991 993 * currently active URBs, so we have to wait for those to complete.
992 994  
993 995  
... ... @@ -1123,14 +1125,21 @@
1123 1125 * Frees an output endpoint.
1124 1126 * May be called when ep hasn't been initialized completely.
1125 1127 */
1126   -static void snd_usbmidi_out_endpoint_delete(struct snd_usb_midi_out_endpoint* ep)
  1128 +static void snd_usbmidi_out_endpoint_clear(struct snd_usb_midi_out_endpoint *ep)
1127 1129 {
1128 1130 unsigned int i;
1129 1131  
1130 1132 for (i = 0; i < OUTPUT_URBS; ++i)
1131   - if (ep->urbs[i].urb)
  1133 + if (ep->urbs[i].urb) {
1132 1134 free_urb_and_buffer(ep->umidi, ep->urbs[i].urb,
1133 1135 ep->max_transfer);
  1136 + ep->urbs[i].urb = NULL;
  1137 + }
  1138 +}
  1139 +
  1140 +static void snd_usbmidi_out_endpoint_delete(struct snd_usb_midi_out_endpoint *ep)
  1141 +{
  1142 + snd_usbmidi_out_endpoint_clear(ep);
1134 1143 kfree(ep);
1135 1144 }
1136 1145  
1137 1146  
... ... @@ -1262,15 +1271,18 @@
1262 1271 usb_kill_urb(ep->out->urbs[j].urb);
1263 1272 if (umidi->usb_protocol_ops->finish_out_endpoint)
1264 1273 umidi->usb_protocol_ops->finish_out_endpoint(ep->out);
  1274 + ep->out->active_urbs = 0;
  1275 + if (ep->out->drain_urbs) {
  1276 + ep->out->drain_urbs = 0;
  1277 + wake_up(&ep->out->drain_wait);
  1278 + }
1265 1279 }
1266 1280 if (ep->in)
1267 1281 for (j = 0; j < INPUT_URBS; ++j)
1268 1282 usb_kill_urb(ep->in->urbs[j]);
1269 1283 /* free endpoints here; later call can result in Oops */
1270   - if (ep->out) {
1271   - snd_usbmidi_out_endpoint_delete(ep->out);
1272   - ep->out = NULL;
1273   - }
  1284 + if (ep->out)
  1285 + snd_usbmidi_out_endpoint_clear(ep->out);
1274 1286 if (ep->in) {
1275 1287 snd_usbmidi_in_endpoint_delete(ep->in);
1276 1288 ep->in = NULL;