aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-04-10 15:34:56 -0400
committerTakashi Iwai <tiwai@suse.de>2010-04-10 15:34:56 -0400
commit27762b2ce16d5c6f7bc8ab1aad1b9179076f997a (patch)
tree04108617a1ccc18e3cef39e780c67460da9d5a0d
parent7b7b9042263f5cafb6ce85b3764375a8de7e22da (diff)
parent29aac005ff4dc8a5f50b80f4e5c4f59b21c0fb50 (diff)
Merge branch 'fix/misc' into topic/usb
-rw-r--r--include/sound/ak4113.h2
-rw-r--r--sound/core/pcm_lib.c6
-rw-r--r--sound/i2c/other/ak4113.c2
-rw-r--r--sound/pci/ac97/ac97_patch.c2
-rw-r--r--sound/pci/cmipci.c14
-rw-r--r--sound/pci/echoaudio/echoaudio.c5
-rw-r--r--sound/pci/mixart/mixart.c24
-rw-r--r--sound/usb/midi.c24
8 files changed, 53 insertions, 26 deletions
diff --git a/include/sound/ak4113.h b/include/sound/ak4113.h
index 8988edae1609..2609048c1d44 100644
--- a/include/sound/ak4113.h
+++ b/include/sound/ak4113.h
@@ -307,7 +307,7 @@ struct ak4113 {
307 307
308int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read, 308int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
309 ak4113_write_t *write, 309 ak4113_write_t *write,
310 const unsigned char pgm[AK4113_WRITABLE_REGS], 310 const unsigned char *pgm,
311 void *private_data, struct ak4113 **r_ak4113); 311 void *private_data, struct ak4113 **r_ak4113);
312void snd_ak4113_reg_write(struct ak4113 *ak4113, unsigned char reg, 312void snd_ak4113_reg_write(struct ak4113 *ak4113, unsigned char reg,
313 unsigned char mask, unsigned char val); 313 unsigned char mask, unsigned char val);
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index b546ac2660f9..a2ff86189d2a 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -148,6 +148,9 @@ static void pcm_debug_name(struct snd_pcm_substream *substream,
148 148
149#define xrun_debug(substream, mask) \ 149#define xrun_debug(substream, mask) \
150 ((substream)->pstr->xrun_debug & (mask)) 150 ((substream)->pstr->xrun_debug & (mask))
151#else
152#define xrun_debug(substream, mask) 0
153#endif
151 154
152#define dump_stack_on_xrun(substream) do { \ 155#define dump_stack_on_xrun(substream) do { \
153 if (xrun_debug(substream, XRUN_DEBUG_STACK)) \ 156 if (xrun_debug(substream, XRUN_DEBUG_STACK)) \
@@ -169,6 +172,7 @@ static void xrun(struct snd_pcm_substream *substream)
169 } 172 }
170} 173}
171 174
175#ifdef CONFIG_SND_PCM_XRUN_DEBUG
172#define hw_ptr_error(substream, fmt, args...) \ 176#define hw_ptr_error(substream, fmt, args...) \
173 do { \ 177 do { \
174 if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \ 178 if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \
@@ -255,8 +259,6 @@ static void xrun_log_show(struct snd_pcm_substream *substream)
255 259
256#else /* ! CONFIG_SND_PCM_XRUN_DEBUG */ 260#else /* ! CONFIG_SND_PCM_XRUN_DEBUG */
257 261
258#define xrun_debug(substream, mask) 0
259#define xrun(substream) do { } while (0)
260#define hw_ptr_error(substream, fmt, args...) do { } while (0) 262#define hw_ptr_error(substream, fmt, args...) do { } while (0)
261#define xrun_log(substream, pos) do { } while (0) 263#define xrun_log(substream, pos) do { } while (0)
262#define xrun_log_show(substream) do { } while (0) 264#define xrun_log_show(substream) do { } while (0)
diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c
index fff62cc8607c..971a84a4fa77 100644
--- a/sound/i2c/other/ak4113.c
+++ b/sound/i2c/other/ak4113.c
@@ -70,7 +70,7 @@ static int snd_ak4113_dev_free(struct snd_device *device)
70} 70}
71 71
72int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read, 72int 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 void *private_data, struct ak4113 **r_ak4113) 74 void *private_data, struct ak4113 **r_ak4113)
75{ 75{
76 struct ak4113 *chip; 76 struct ak4113 *chip;
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 1caf5e3c1f6a..e68c98ef4041 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1852,12 +1852,14 @@ static unsigned int ad1981_jacks_blacklist[] = {
1852 0x10140523, /* Thinkpad R40 */ 1852 0x10140523, /* Thinkpad R40 */
1853 0x10140534, /* Thinkpad X31 */ 1853 0x10140534, /* Thinkpad X31 */
1854 0x10140537, /* Thinkpad T41p */ 1854 0x10140537, /* Thinkpad T41p */
1855 0x1014053e, /* Thinkpad R40e */
1855 0x10140554, /* Thinkpad T42p/R50p */ 1856 0x10140554, /* Thinkpad T42p/R50p */
1856 0x10140567, /* Thinkpad T43p 2668-G7U */ 1857 0x10140567, /* Thinkpad T43p 2668-G7U */
1857 0x10140581, /* Thinkpad X41-2527 */ 1858 0x10140581, /* Thinkpad X41-2527 */
1858 0x10280160, /* Dell Dimension 2400 */ 1859 0x10280160, /* Dell Dimension 2400 */
1859 0x104380b0, /* Asus A7V8X-MX */ 1860 0x104380b0, /* Asus A7V8X-MX */
1860 0x11790241, /* Toshiba Satellite A-15 S127 */ 1861 0x11790241, /* Toshiba Satellite A-15 S127 */
1862 0x1179ff10, /* Toshiba P500 */
1861 0x144dc01a, /* Samsung NP-X20C004/SEG */ 1863 0x144dc01a, /* Samsung NP-X20C004/SEG */
1862 0 /* end */ 1864 0 /* end */
1863}; 1865};
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 1ded64e05643..329968edca9b 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -941,13 +941,21 @@ static snd_pcm_uframes_t snd_cmipci_pcm_pointer(struct cmipci *cm, struct cmipci
941 struct snd_pcm_substream *substream) 941 struct snd_pcm_substream *substream)
942{ 942{
943 size_t ptr; 943 size_t ptr;
944 unsigned int reg; 944 unsigned int reg, rem, tries;
945
945 if (!rec->running) 946 if (!rec->running)
946 return 0; 947 return 0;
947#if 1 // this seems better.. 948#if 1 // this seems better..
948 reg = rec->ch ? CM_REG_CH1_FRAME2 : CM_REG_CH0_FRAME2; 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 for (tries = 0; tries < 3; tries++) {
950 ptr >>= rec->shift; 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;
957ok:
958 ptr = (rec->dma_size - (rem + 1)) >> rec->shift;
951#else 959#else
952 reg = rec->ch ? CM_REG_CH1_FRAME1 : CM_REG_CH0_FRAME1; 960 reg = rec->ch ? CM_REG_CH1_FRAME1 : CM_REG_CH0_FRAME1;
953 ptr = snd_cmipci_read(cm, reg) - rec->offset; 961 ptr = snd_cmipci_read(cm, reg) - rec->offset;
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 8dab82d7d19d..668a5ec04499 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -2184,10 +2184,9 @@ static int __devinit snd_echo_probe(struct pci_dev *pci,
2184 goto ctl_error; 2184 goto ctl_error;
2185#endif 2185#endif
2186 2186
2187 if ((err = snd_card_register(card)) < 0) { 2187 err = snd_card_register(card);
2188 snd_card_free(card); 2188 if (err < 0)
2189 goto ctl_error; 2189 goto ctl_error;
2190 }
2191 snd_printk(KERN_INFO "Card registered: %s\n", card->longname); 2190 snd_printk(KERN_INFO "Card registered: %s\n", card->longname);
2192 2191
2193 pci_set_drvdata(pci, chip); 2192 pci_set_drvdata(pci, chip);
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 7e8e7da592a9..ea4256b08a38 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -1161,13 +1161,15 @@ static long snd_mixart_BA0_read(struct snd_info_entry *entry, void *file_private
1161 unsigned long count, unsigned long pos) 1161 unsigned long count, unsigned long pos)
1162{ 1162{
1163 struct mixart_mgr *mgr = entry->private_data; 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 (pos >= MIXART_BA0_SIZE)
1166 if(count <= 0)
1167 return 0; 1167 return 0;
1168 if(pos + count > MIXART_BA0_SIZE) 1168 maxsize = MIXART_BA0_SIZE - pos;
1169 count = (long)(MIXART_BA0_SIZE - pos); 1169 if (count > maxsize)
1170 if(copy_to_user_fromio(buf, MIXART_MEM( mgr, pos ), count)) 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 return -EFAULT; 1173 return -EFAULT;
1172 return count; 1174 return count;
1173} 1175}
@@ -1180,13 +1182,15 @@ static long snd_mixart_BA1_read(struct snd_info_entry *entry, void *file_private
1180 unsigned long count, unsigned long pos) 1182 unsigned long count, unsigned long pos)
1181{ 1183{
1182 struct mixart_mgr *mgr = entry->private_data; 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 */ 1187 if (pos > MIXART_BA1_SIZE)
1185 if(count <= 0)
1186 return 0; 1188 return 0;
1187 if(pos + count > MIXART_BA1_SIZE) 1189 maxsize = MIXART_BA1_SIZE - pos;
1188 count = (long)(MIXART_BA1_SIZE - pos); 1190 if (count > maxsize)
1189 if(copy_to_user_fromio(buf, MIXART_REG( mgr, pos ), count)) 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 return -EFAULT; 1194 return -EFAULT;
1191 return count; 1195 return count;
1192} 1196}
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index c6ee4a18e513..2c1558c327bb 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -987,6 +987,8 @@ static void snd_usbmidi_output_drain(struct snd_rawmidi_substream *substream)
987 DEFINE_WAIT(wait); 987 DEFINE_WAIT(wait);
988 long timeout = msecs_to_jiffies(50); 988 long timeout = msecs_to_jiffies(50);
989 989
990 if (ep->umidi->disconnected)
991 return;
990 /* 992 /*
991 * The substream buffer is empty, but some data might still be in the 993 * The substream buffer is empty, but some data might still be in the
992 * currently active URBs, so we have to wait for those to complete. 994 * currently active URBs, so we have to wait for those to complete.
@@ -1124,14 +1126,21 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi,
1124 * Frees an output endpoint. 1126 * Frees an output endpoint.
1125 * May be called when ep hasn't been initialized completely. 1127 * May be called when ep hasn't been initialized completely.
1126 */ 1128 */
1127static void snd_usbmidi_out_endpoint_delete(struct snd_usb_midi_out_endpoint* ep) 1129static void snd_usbmidi_out_endpoint_clear(struct snd_usb_midi_out_endpoint *ep)
1128{ 1130{
1129 unsigned int i; 1131 unsigned int i;
1130 1132
1131 for (i = 0; i < OUTPUT_URBS; ++i) 1133 for (i = 0; i < OUTPUT_URBS; ++i)
1132 if (ep->urbs[i].urb) 1134 if (ep->urbs[i].urb) {
1133 free_urb_and_buffer(ep->umidi, ep->urbs[i].urb, 1135 free_urb_and_buffer(ep->umidi, ep->urbs[i].urb,
1134 ep->max_transfer); 1136 ep->max_transfer);
1137 ep->urbs[i].urb = NULL;
1138 }
1139}
1140
1141static void snd_usbmidi_out_endpoint_delete(struct snd_usb_midi_out_endpoint *ep)
1142{
1143 snd_usbmidi_out_endpoint_clear(ep);
1135 kfree(ep); 1144 kfree(ep);
1136} 1145}
1137 1146
@@ -1263,15 +1272,18 @@ void snd_usbmidi_disconnect(struct list_head* p)
1263 usb_kill_urb(ep->out->urbs[j].urb); 1272 usb_kill_urb(ep->out->urbs[j].urb);
1264 if (umidi->usb_protocol_ops->finish_out_endpoint) 1273 if (umidi->usb_protocol_ops->finish_out_endpoint)
1265 umidi->usb_protocol_ops->finish_out_endpoint(ep->out); 1274 umidi->usb_protocol_ops->finish_out_endpoint(ep->out);
1275 ep->out->active_urbs = 0;
1276 if (ep->out->drain_urbs) {
1277 ep->out->drain_urbs = 0;
1278 wake_up(&ep->out->drain_wait);
1279 }
1266 } 1280 }
1267 if (ep->in) 1281 if (ep->in)
1268 for (j = 0; j < INPUT_URBS; ++j) 1282 for (j = 0; j < INPUT_URBS; ++j)
1269 usb_kill_urb(ep->in->urbs[j]); 1283 usb_kill_urb(ep->in->urbs[j]);
1270 /* free endpoints here; later call can result in Oops */ 1284 /* free endpoints here; later call can result in Oops */
1271 if (ep->out) { 1285 if (ep->out)
1272 snd_usbmidi_out_endpoint_delete(ep->out); 1286 snd_usbmidi_out_endpoint_clear(ep->out);
1273 ep->out = NULL;
1274 }
1275 if (ep->in) { 1287 if (ep->in) {
1276 snd_usbmidi_in_endpoint_delete(ep->in); 1288 snd_usbmidi_in_endpoint_delete(ep->in);
1277 ep->in = NULL; 1289 ep->in = NULL;