~ubuntu-branches/ubuntu/raring/linux-ti-omap4/raring-proposed

« back to all changes in this revision

Viewing changes to sound/core/pcm_native.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Ubuntu: 3.5.0-22.34
  • Date: 2013-01-11 15:02:20 UTC
  • mfrom: (72.1.1 quantal-proposed)
  • Revision ID: package-import@ubuntu.com-20130111150220-kgmbtlwhyc4kwqhg
Tags: 3.5.0-217.25
* Release Tracking Bug
  - LP: #1097912

[ Paolo Pisati ]

* rebased on Ubuntu-3.5.0-22.34

[ Ubuntu: 3.5.0-22.34 ]

* Release Tracking Bug
  - LP: #1097343
* Revert "SAUCE: fsnotify: dont put marks on temporary list when clearing
  marks by group"
  - LP: #1096137
* Revert "SAUCE: fsnotify: introduce locked versions of
  fsnotify_add_mark() and fsnotify_remove_mark()"
  - LP: #1096137
* Revert "SAUCE: fsnotify: pass group to fsnotify_destroy_mark()"
  - LP: #1096137
* Revert "SAUCE: fsnotify: use a mutex instead of a spinlock to protect a
  groups mark list"
  - LP: #1096137
* Revert "SAUCE: fanotify: add an extra flag to mark_remove_from_mask
  that indicates wheather a mark should be destroyed"
  - LP: #1096137
* Revert "SAUCE: fsnotify: take groups mark_lock before mark lock"
  - LP: #1096137
* Revert "SAUCE: fsnotify: use reference counting for groups"
  - LP: #1096137
* Revert "SAUCE: fsnotify: introduce fsnotify_get_group()"
  - LP: #1096137
* fsnotify: introduce fsnotify_get_group()
  - LP: #1096137
* fsnotify: use reference counting for groups
  - LP: #1096137
* fsnotify: take groups mark_lock before mark lock
  - LP: #1096137
* fanotify: add an extra flag to mark_remove_from_mask that indicates
  wheather a mark should be destroyed
  - LP: #1096137
* fsnotify: use a mutex instead of a spinlock to protect a groups mark
  list
  - LP: #1096137
* fsnotify: pass group to fsnotify_destroy_mark()
  - LP: #1096137
* fsnotify: introduce locked versions of fsnotify_add_mark() and
  fsnotify_remove_mark()
  - LP: #1096137
* fsnotify: dont put marks on temporary list when clearing marks by group
  - LP: #1096137
* fsnotify: change locking order
  - LP: #1096137

Show diffs side-by-side

added added

removed removed

Lines of Context:
369
369
        return usecs;
370
370
}
371
371
 
 
372
static void snd_pcm_set_state(struct snd_pcm_substream *substream, int state)
 
373
{
 
374
        snd_pcm_stream_lock_irq(substream);
 
375
        if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED)
 
376
                substream->runtime->status->state = state;
 
377
        snd_pcm_stream_unlock_irq(substream);
 
378
}
 
379
 
372
380
static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
373
381
                             struct snd_pcm_hw_params *params)
374
382
{
452
460
                runtime->boundary *= 2;
453
461
 
454
462
        snd_pcm_timer_resolution_change(substream);
455
 
        runtime->status->state = SNDRV_PCM_STATE_SETUP;
 
463
        snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP);
456
464
 
457
465
        if (pm_qos_request_active(&substream->latency_pm_qos_req))
458
466
                pm_qos_remove_request(&substream->latency_pm_qos_req);
464
472
        /* hardware might be unusable from this time,
465
473
           so we force application to retry to set
466
474
           the correct hardware parameter settings */
467
 
        runtime->status->state = SNDRV_PCM_STATE_OPEN;
 
475
        snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
468
476
        if (substream->ops->hw_free != NULL)
469
477
                substream->ops->hw_free(substream);
470
478
        return err;
512
520
                return -EBADFD;
513
521
        if (substream->ops->hw_free)
514
522
                result = substream->ops->hw_free(substream);
515
 
        runtime->status->state = SNDRV_PCM_STATE_OPEN;
 
523
        snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
516
524
        pm_qos_remove_request(&substream->latency_pm_qos_req);
517
525
        return result;
518
526
}
1321
1329
{
1322
1330
        struct snd_pcm_runtime *runtime = substream->runtime;
1323
1331
        runtime->control->appl_ptr = runtime->status->hw_ptr;
1324
 
        runtime->status->state = SNDRV_PCM_STATE_PREPARED;
 
1332
        snd_pcm_set_state(substream, SNDRV_PCM_STATE_PREPARED);
1325
1333
}
1326
1334
 
1327
1335
static struct action_ops snd_pcm_action_prepare = {
1511
1519
                down_read(&snd_pcm_link_rwsem);
1512
1520
                snd_pcm_stream_lock_irq(substream);
1513
1521
                remove_wait_queue(&to_check->sleep, &wait);
 
1522
                if (card->shutdown) {
 
1523
                        result = -ENODEV;
 
1524
                        break;
 
1525
                }
1514
1526
                if (tout == 0) {
1515
1527
                        if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
1516
1528
                                result = -ESTRPIPE;
1634
1646
        write_unlock_irq(&snd_pcm_link_rwlock);
1635
1647
        up_write(&snd_pcm_link_rwsem);
1636
1648
 _nolock:
 
1649
        snd_card_unref(substream1->pcm->card);
1637
1650
        fput(file);
1638
1651
        if (res < 0)
1639
1652
                kfree(group);
2108
2121
                return err;
2109
2122
        pcm = snd_lookup_minor_data(iminor(inode),
2110
2123
                                    SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
2111
 
        return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);
 
2124
        err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);
 
2125
        if (pcm)
 
2126
                snd_card_unref(pcm->card);
 
2127
        return err;
2112
2128
}
2113
2129
 
2114
2130
static int snd_pcm_capture_open(struct inode *inode, struct file *file)
2119
2135
                return err;
2120
2136
        pcm = snd_lookup_minor_data(iminor(inode),
2121
2137
                                    SNDRV_DEVICE_TYPE_PCM_CAPTURE);
2122
 
        return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);
 
2138
        err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);
 
2139
        if (pcm)
 
2140
                snd_card_unref(pcm->card);
 
2141
        return err;
2123
2142
}
2124
2143
 
2125
2144
static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream)
2156
2175
                mutex_unlock(&pcm->open_mutex);
2157
2176
                schedule();
2158
2177
                mutex_lock(&pcm->open_mutex);
 
2178
                if (pcm->card->shutdown) {
 
2179
                        err = -ENODEV;
 
2180
                        break;
 
2181
                }
2159
2182
                if (signal_pending(current)) {
2160
2183
                        err = -ERESTARTSYS;
2161
2184
                        break;