Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 Mar 2009 23:14:02 +0000 (16:14 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 Mar 2009 23:14:02 +0000 (16:14 -0700)
* 'bkl-removal' of git://git.lwn.net/linux-2.6:
  Rationalize fasync return values
  Move FASYNC bit handling to f_op->fasync()
  Use f_lock to protect f_flags
  Rename struct file->f_ep_lock

1  2 
drivers/hid/usbhid/hiddev.c
drivers/net/wan/cosa.c
drivers/usb/gadget/file_storage.c
fs/file_table.c
include/linux/fs.h
net/socket.c
sound/core/oss/pcm_oss.c
sound/core/pcm_native.c

@@@ -227,12 -227,9 +227,9 @@@ void hiddev_report_event(struct hid_dev
   */
  static int hiddev_fasync(int fd, struct file *file, int on)
  {
-       int retval;
        struct hiddev_list *list = file->private_data;
  
-       retval = fasync_helper(fd, file, on, &list->fasync);
-       return retval < 0 ? retval : 0;
+       return fasync_helper(fd, file, on, &list->fasync);
  }
  
  
@@@ -306,7 -303,7 +303,7 @@@ static int hiddev_open(struct inode *in
        return 0;
  bail:
        file->private_data = NULL;
 -      kfree(list->hiddev);
 +      kfree(list);
        return res;
  }
  
@@@ -323,7 -320,7 +320,7 @@@ static ssize_t hiddev_write(struct fil
   */
  static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t count, loff_t *ppos)
  {
 -      DECLARE_WAITQUEUE(wait, current);
 +      DEFINE_WAIT(wait);
        struct hiddev_list *list = file->private_data;
        int event_size;
        int retval;
diff --combined drivers/net/wan/cosa.c
@@@ -427,15 -427,6 +427,15 @@@ static void __exit cosa_exit(void
  }
  module_exit(cosa_exit);
  
 +static const struct net_device_ops cosa_ops = {
 +      .ndo_open       = cosa_net_open,
 +      .ndo_stop       = cosa_net_close,
 +      .ndo_change_mtu = hdlc_change_mtu,
 +      .ndo_start_xmit = hdlc_start_xmit,
 +      .ndo_do_ioctl   = cosa_net_ioctl,
 +      .ndo_tx_timeout = cosa_net_timeout,
 +};
 +
  static int cosa_probe(int base, int irq, int dma)
  {
        struct cosa_data *cosa = cosa_cards+nr_cards;
                }
                dev_to_hdlc(chan->netdev)->attach = cosa_net_attach;
                dev_to_hdlc(chan->netdev)->xmit = cosa_net_tx;
 -              chan->netdev->open = cosa_net_open;
 -              chan->netdev->stop = cosa_net_close;
 -              chan->netdev->do_ioctl = cosa_net_ioctl;
 -              chan->netdev->tx_timeout = cosa_net_timeout;
 +              chan->netdev->netdev_ops = &cosa_ops;
                chan->netdev->watchdog_timeo = TX_TIMEOUT;
                chan->netdev->base_addr = chan->cosa->datareg;
                chan->netdev->irq = chan->cosa->irq;
@@@ -731,7 -725,8 +731,7 @@@ static char *cosa_net_setup_rx(struct c
         * We can safely fall back to non-dma-able memory, because we have
         * the cosa->bouncebuf pre-allocated.
         */
 -      if (chan->rx_skb)
 -              kfree_skb(chan->rx_skb);
 +      kfree_skb(chan->rx_skb);
        chan->rx_skb = dev_alloc_skb(size);
        if (chan->rx_skb == NULL) {
                printk(KERN_NOTICE "%s: Memory squeeze, dropping packet\n",
@@@ -998,8 -993,8 +998,8 @@@ static struct fasync_struct *fasync[256
  static int cosa_fasync(struct inode *inode, struct file *file, int on)
  {
          int port = iminor(inode);
-         int rv = fasync_helper(inode, file, on, &fasync[port]);
-         return rv < 0 ? rv : 0;
+       return fasync_helper(inode, file, on, &fasync[port]);
  }
  #endif
  
@@@ -847,13 -847,13 +847,13 @@@ device_desc = 
        .bLength =              sizeof device_desc,
        .bDescriptorType =      USB_DT_DEVICE,
  
 -      .bcdUSB =               __constant_cpu_to_le16(0x0200),
 +      .bcdUSB =               cpu_to_le16(0x0200),
        .bDeviceClass =         USB_CLASS_PER_INTERFACE,
  
        /* The next three values can be overridden by module parameters */
 -      .idVendor =             __constant_cpu_to_le16(DRIVER_VENDOR_ID),
 -      .idProduct =            __constant_cpu_to_le16(DRIVER_PRODUCT_ID),
 -      .bcdDevice =            __constant_cpu_to_le16(0xffff),
 +      .idVendor =             cpu_to_le16(DRIVER_VENDOR_ID),
 +      .idProduct =            cpu_to_le16(DRIVER_PRODUCT_ID),
 +      .bcdDevice =            cpu_to_le16(0xffff),
  
        .iManufacturer =        STRING_MANUFACTURER,
        .iProduct =             STRING_PRODUCT,
@@@ -926,7 -926,7 +926,7 @@@ fs_intr_in_desc = 
  
        .bEndpointAddress =     USB_DIR_IN,
        .bmAttributes =         USB_ENDPOINT_XFER_INT,
 -      .wMaxPacketSize =       __constant_cpu_to_le16(2),
 +      .wMaxPacketSize =       cpu_to_le16(2),
        .bInterval =            32,     // frames -> 32 ms
  };
  
@@@ -954,7 -954,7 +954,7 @@@ dev_qualifier = 
        .bLength =              sizeof dev_qualifier,
        .bDescriptorType =      USB_DT_DEVICE_QUALIFIER,
  
 -      .bcdUSB =               __constant_cpu_to_le16(0x0200),
 +      .bcdUSB =               cpu_to_le16(0x0200),
        .bDeviceClass =         USB_CLASS_PER_INTERFACE,
  
        .bNumConfigurations =   1,
@@@ -967,7 -967,7 +967,7 @@@ hs_bulk_in_desc = 
  
        /* bEndpointAddress copied from fs_bulk_in_desc during fsg_bind() */
        .bmAttributes =         USB_ENDPOINT_XFER_BULK,
 -      .wMaxPacketSize =       __constant_cpu_to_le16(512),
 +      .wMaxPacketSize =       cpu_to_le16(512),
  };
  
  static struct usb_endpoint_descriptor
@@@ -977,7 -977,7 +977,7 @@@ hs_bulk_out_desc = 
  
        /* bEndpointAddress copied from fs_bulk_out_desc during fsg_bind() */
        .bmAttributes =         USB_ENDPOINT_XFER_BULK,
 -      .wMaxPacketSize =       __constant_cpu_to_le16(512),
 +      .wMaxPacketSize =       cpu_to_le16(512),
        .bInterval =            1,      // NAK every 1 uframe
  };
  
@@@ -988,7 -988,7 +988,7 @@@ hs_intr_in_desc = 
  
        /* bEndpointAddress copied from fs_intr_in_desc during fsg_bind() */
        .bmAttributes =         USB_ENDPOINT_XFER_INT,
 -      .wMaxPacketSize =       __constant_cpu_to_le16(2),
 +      .wMaxPacketSize =       cpu_to_le16(2),
        .bInterval =            9,      // 2**(9-1) = 256 uframes -> 32 ms
  };
  
@@@ -1711,7 -1711,9 +1711,9 @@@ static int do_write(struct fsg_dev *fsg
                curlun->sense_data = SS_WRITE_PROTECTED;
                return -EINVAL;
        }
+       spin_lock(&curlun->filp->f_lock);
        curlun->filp->f_flags &= ~O_SYNC;       // Default is not to wait
+       spin_unlock(&curlun->filp->f_lock);
  
        /* Get the starting Logical Block Address and check that it's
         * not too big */
                        curlun->sense_data = SS_INVALID_FIELD_IN_CDB;
                        return -EINVAL;
                }
-               if (fsg->cmnd[1] & 0x08)        // FUA
+               if (fsg->cmnd[1] & 0x08) {      // FUA
+                       spin_lock(&curlun->filp->f_lock);
                        curlun->filp->f_flags |= O_SYNC;
+                       spin_unlock(&curlun->filp->f_lock);
+               }
        }
        if (lba >= curlun->num_sectors) {
                curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
@@@ -2646,7 -2651,7 +2651,7 @@@ static int send_status(struct fsg_dev *
                struct bulk_cs_wrap     *csw = bh->buf;
  
                /* Store and send the Bulk-only CSW */
 -              csw->Signature = __constant_cpu_to_le32(USB_BULK_CS_SIG);
 +              csw->Signature = cpu_to_le32(USB_BULK_CS_SIG);
                csw->Tag = fsg->tag;
                csw->Residue = cpu_to_le32(fsg->residue);
                csw->Status = status;
@@@ -3089,7 -3094,7 +3094,7 @@@ static int received_cbw(struct fsg_dev 
  
        /* Is the CBW valid? */
        if (req->actual != USB_BULK_CB_WRAP_LEN ||
 -                      cbw->Signature != __constant_cpu_to_le32(
 +                      cbw->Signature != cpu_to_le32(
                                USB_BULK_CB_SIG)) {
                DBG(fsg, "invalid CBW: len %u sig 0x%x\n",
                                req->actual,
diff --combined fs/file_table.c
@@@ -13,7 -13,6 +13,7 @@@
  #include <linux/module.h>
  #include <linux/fs.h>
  #include <linux/security.h>
 +#include <linux/ima.h>
  #include <linux/eventpoll.h>
  #include <linux/rcupdate.h>
  #include <linux/mount.h>
@@@ -128,6 -127,7 +128,7 @@@ struct file *get_empty_filp(void
        atomic_long_set(&f->f_count, 1);
        rwlock_init(&f->f_owner.lock);
        f->f_cred = get_cred(cred);
+       spin_lock_init(&f->f_lock);
        eventpoll_init_file(f);
        /* f->f_version: 0 */
        return f;
@@@ -280,7 -280,6 +281,7 @@@ void __fput(struct file *file
        if (file->f_op && file->f_op->release)
                file->f_op->release(inode, file);
        security_file_free(file);
 +      ima_file_free(file);
        if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL))
                cdev_put(inode->i_cdev);
        fops_put(file->f_op);
diff --combined include/linux/fs.h
@@@ -141,7 -141,6 +141,7 @@@ struct inodes_stat_t 
  #define MS_RELATIME   (1<<21) /* Update atime relative to mtime/ctime. */
  #define MS_KERNMOUNT  (1<<22) /* this is a kern_mount call */
  #define MS_I_VERSION  (1<<23) /* Update inode I_version field */
 +#define MS_STRICTATIME        (1<<24) /* Always perform atime updates */
  #define MS_ACTIVE     (1<<30)
  #define MS_NOUSER     (1<<31)
  
@@@ -849,6 -848,7 +849,7 @@@ struct file 
  #define f_dentry      f_path.dentry
  #define f_vfsmnt      f_path.mnt
        const struct file_operations    *f_op;
+       spinlock_t              f_lock;  /* f_ep_links, f_flags */
        atomic_long_t           f_count;
        unsigned int            f_flags;
        fmode_t                 f_mode;
  #ifdef CONFIG_EPOLL
        /* Used by fs/eventpoll.c to link all the hooks to this file */
        struct list_head        f_ep_links;
-       spinlock_t              f_ep_lock;
  #endif /* #ifdef CONFIG_EPOLL */
        struct address_space    *f_mapping;
  #ifdef CONFIG_DEBUG_WRITECOUNT
diff --combined net/socket.c
@@@ -545,18 -545,6 +545,18 @@@ void sock_release(struct socket *sock
        sock->file = NULL;
  }
  
 +int sock_tx_timestamp(struct msghdr *msg, struct sock *sk,
 +                    union skb_shared_tx *shtx)
 +{
 +      shtx->flags = 0;
 +      if (sock_flag(sk, SOCK_TIMESTAMPING_TX_HARDWARE))
 +              shtx->hardware = 1;
 +      if (sock_flag(sk, SOCK_TIMESTAMPING_TX_SOFTWARE))
 +              shtx->software = 1;
 +      return 0;
 +}
 +EXPORT_SYMBOL(sock_tx_timestamp);
 +
  static inline int __sock_sendmsg(struct kiocb *iocb, struct socket *sock,
                                 struct msghdr *msg, size_t size)
  {
@@@ -607,65 -595,33 +607,65 @@@ int kernel_sendmsg(struct socket *sock
        return result;
  }
  
 +static int ktime2ts(ktime_t kt, struct timespec *ts)
 +{
 +      if (kt.tv64) {
 +              *ts = ktime_to_timespec(kt);
 +              return 1;
 +      } else {
 +              return 0;
 +      }
 +}
 +
  /*
   * called from sock_recv_timestamp() if sock_flag(sk, SOCK_RCVTSTAMP)
   */
  void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
        struct sk_buff *skb)
  {
 -      ktime_t kt = skb->tstamp;
 -
 -      if (!sock_flag(sk, SOCK_RCVTSTAMPNS)) {
 -              struct timeval tv;
 -              /* Race occurred between timestamp enabling and packet
 -                 receiving.  Fill in the current time for now. */
 -              if (kt.tv64 == 0)
 -                      kt = ktime_get_real();
 -              skb->tstamp = kt;
 -              tv = ktime_to_timeval(kt);
 -              put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMP, sizeof(tv), &tv);
 -      } else {
 -              struct timespec ts;
 -              /* Race occurred between timestamp enabling and packet
 -                 receiving.  Fill in the current time for now. */
 -              if (kt.tv64 == 0)
 -                      kt = ktime_get_real();
 -              skb->tstamp = kt;
 -              ts = ktime_to_timespec(kt);
 -              put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMPNS, sizeof(ts), &ts);
 +      int need_software_tstamp = sock_flag(sk, SOCK_RCVTSTAMP);
 +      struct timespec ts[3];
 +      int empty = 1;
 +      struct skb_shared_hwtstamps *shhwtstamps =
 +              skb_hwtstamps(skb);
 +
 +      /* Race occurred between timestamp enabling and packet
 +         receiving.  Fill in the current time for now. */
 +      if (need_software_tstamp && skb->tstamp.tv64 == 0)
 +              __net_timestamp(skb);
 +
 +      if (need_software_tstamp) {
 +              if (!sock_flag(sk, SOCK_RCVTSTAMPNS)) {
 +                      struct timeval tv;
 +                      skb_get_timestamp(skb, &tv);
 +                      put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMP,
 +                               sizeof(tv), &tv);
 +              } else {
 +                      struct timespec ts;
 +                      skb_get_timestampns(skb, &ts);
 +                      put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMPNS,
 +                               sizeof(ts), &ts);
 +              }
 +      }
 +
 +
 +      memset(ts, 0, sizeof(ts));
 +      if (skb->tstamp.tv64 &&
 +          sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE)) {
 +              skb_get_timestampns(skb, ts + 0);
 +              empty = 0;
 +      }
 +      if (shhwtstamps) {
 +              if (sock_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE) &&
 +                  ktime2ts(shhwtstamps->syststamp, ts + 1))
 +                      empty = 0;
 +              if (sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE) &&
 +                  ktime2ts(shhwtstamps->hwtstamp, ts + 2))
 +                      empty = 0;
        }
 +      if (!empty)
 +              put_cmsg(msg, SOL_SOCKET,
 +                       SCM_TIMESTAMPING, sizeof(ts), &ts);
  }
  
  EXPORT_SYMBOL_GPL(__sock_recv_timestamp);
@@@ -1074,6 -1030,13 +1074,13 @@@ static int sock_fasync(int fd, struct f
  
        lock_sock(sk);
  
+       spin_lock(&filp->f_lock);
+       if (on)
+               filp->f_flags |= FASYNC;
+       else
+               filp->f_flags &= ~FASYNC;
+       spin_unlock(&filp->f_lock);
        prev = &(sock->fasync_list);
  
        for (fa = *prev; fa != NULL; prev = &fa->fa_next, fa = *prev)
diff --combined sound/core/oss/pcm_oss.c
@@@ -1160,11 -1160,9 +1160,11 @@@ snd_pcm_sframes_t snd_pcm_oss_write3(st
                    runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
  #ifdef OSS_DEBUG
                        if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
 -                              printk("pcm_oss: write: recovering from XRUN\n");
 +                              printk(KERN_DEBUG "pcm_oss: write: "
 +                                     "recovering from XRUN\n");
                        else
 -                              printk("pcm_oss: write: recovering from SUSPEND\n");
 +                              printk(KERN_DEBUG "pcm_oss: write: "
 +                                     "recovering from SUSPEND\n");
  #endif
                        ret = snd_pcm_oss_prepare(substream);
                        if (ret < 0)
@@@ -1198,11 -1196,9 +1198,11 @@@ snd_pcm_sframes_t snd_pcm_oss_read3(str
                    runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
  #ifdef OSS_DEBUG
                        if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
 -                              printk("pcm_oss: read: recovering from XRUN\n");
 +                              printk(KERN_DEBUG "pcm_oss: read: "
 +                                     "recovering from XRUN\n");
                        else
 -                              printk("pcm_oss: read: recovering from SUSPEND\n");
 +                              printk(KERN_DEBUG "pcm_oss: read: "
 +                                     "recovering from SUSPEND\n");
  #endif
                        ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
                        if (ret < 0)
@@@ -1246,11 -1242,9 +1246,11 @@@ snd_pcm_sframes_t snd_pcm_oss_writev3(s
                    runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
  #ifdef OSS_DEBUG
                        if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
 -                              printk("pcm_oss: writev: recovering from XRUN\n");
 +                              printk(KERN_DEBUG "pcm_oss: writev: "
 +                                     "recovering from XRUN\n");
                        else
 -                              printk("pcm_oss: writev: recovering from SUSPEND\n");
 +                              printk(KERN_DEBUG "pcm_oss: writev: "
 +                                     "recovering from SUSPEND\n");
  #endif
                        ret = snd_pcm_oss_prepare(substream);
                        if (ret < 0)
@@@ -1284,11 -1278,9 +1284,11 @@@ snd_pcm_sframes_t snd_pcm_oss_readv3(st
                    runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
  #ifdef OSS_DEBUG
                        if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
 -                              printk("pcm_oss: readv: recovering from XRUN\n");
 +                              printk(KERN_DEBUG "pcm_oss: readv: "
 +                                     "recovering from XRUN\n");
                        else
 -                              printk("pcm_oss: readv: recovering from SUSPEND\n");
 +                              printk(KERN_DEBUG "pcm_oss: readv: "
 +                                     "recovering from SUSPEND\n");
  #endif
                        ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
                        if (ret < 0)
@@@ -1541,7 -1533,7 +1541,7 @@@ static int snd_pcm_oss_sync1(struct snd
        init_waitqueue_entry(&wait, current);
        add_wait_queue(&runtime->sleep, &wait);
  #ifdef OSS_DEBUG
 -      printk("sync1: size = %li\n", size);
 +      printk(KERN_DEBUG "sync1: size = %li\n", size);
  #endif
        while (1) {
                result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1);
@@@ -1598,7 -1590,7 +1598,7 @@@ static int snd_pcm_oss_sync(struct snd_
                mutex_lock(&runtime->oss.params_lock);
                if (runtime->oss.buffer_used > 0) {
  #ifdef OSS_DEBUG
 -                      printk("sync: buffer_used\n");
 +                      printk(KERN_DEBUG "sync: buffer_used\n");
  #endif
                        size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width;
                        snd_pcm_format_set_silence(format,
                        }
                } else if (runtime->oss.period_ptr > 0) {
  #ifdef OSS_DEBUG
 -                      printk("sync: period_ptr\n");
 +                      printk(KERN_DEBUG "sync: period_ptr\n");
  #endif
                        size = runtime->oss.period_bytes - runtime->oss.period_ptr;
                        snd_pcm_format_set_silence(format,
@@@ -1903,7 -1895,9 +1903,9 @@@ static int snd_pcm_oss_set_fragment(str
  
  static int snd_pcm_oss_nonblock(struct file * file)
  {
+       spin_lock(&file->f_lock);
        file->f_flags |= O_NONBLOCK;
+       spin_unlock(&file->f_lock);
        return 0;
  }
  
@@@ -1960,7 -1954,7 +1962,7 @@@ static int snd_pcm_oss_set_trigger(stru
        int err, cmd;
  
  #ifdef OSS_DEBUG
 -      printk("pcm_oss: trigger = 0x%x\n", trigger);
 +      printk(KERN_DEBUG "pcm_oss: trigger = 0x%x\n", trigger);
  #endif
        
        psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
@@@ -2178,9 -2172,7 +2180,9 @@@ static int snd_pcm_oss_get_space(struc
        }
  
  #ifdef OSS_DEBUG
 -      printk("pcm_oss: space: bytes = %i, fragments = %i, fragstotal = %i, fragsize = %i\n", info.bytes, info.fragments, info.fragstotal, info.fragsize);
 +      printk(KERN_DEBUG "pcm_oss: space: bytes = %i, fragments = %i, "
 +             "fragstotal = %i, fragsize = %i\n",
 +             info.bytes, info.fragments, info.fragstotal, info.fragsize);
  #endif
        if (copy_to_user(_info, &info, sizeof(info)))
                return -EFAULT;
@@@ -2483,7 -2475,7 +2485,7 @@@ static long snd_pcm_oss_ioctl(struct fi
        if (((cmd >> 8) & 0xff) != 'P')
                return -EINVAL;
  #ifdef OSS_DEBUG
 -      printk("pcm_oss: ioctl = 0x%x\n", cmd);
 +      printk(KERN_DEBUG "pcm_oss: ioctl = 0x%x\n", cmd);
  #endif
        switch (cmd) {
        case SNDCTL_DSP_RESET:
@@@ -2637,8 -2629,7 +2639,8 @@@ static ssize_t snd_pcm_oss_read(struct 
  #else
        {
                ssize_t res = snd_pcm_oss_read1(substream, buf, count);
 -              printk("pcm_oss: read %li bytes (returned %li bytes)\n", (long)count, (long)res);
 +              printk(KERN_DEBUG "pcm_oss: read %li bytes "
 +                     "(returned %li bytes)\n", (long)count, (long)res);
                return res;
        }
  #endif
@@@ -2657,8 -2648,7 +2659,8 @@@ static ssize_t snd_pcm_oss_write(struc
        substream->f_flags = file->f_flags & O_NONBLOCK;
        result = snd_pcm_oss_write1(substream, buf, count);
  #ifdef OSS_DEBUG
 -      printk("pcm_oss: write %li bytes (wrote %li bytes)\n", (long)count, (long)result);
 +      printk(KERN_DEBUG "pcm_oss: write %li bytes (wrote %li bytes)\n",
 +             (long)count, (long)result);
  #endif
        return result;
  }
@@@ -2732,7 -2722,7 +2734,7 @@@ static int snd_pcm_oss_mmap(struct fil
        int err;
  
  #ifdef OSS_DEBUG
 -      printk("pcm_oss: mmap begin\n");
 +      printk(KERN_DEBUG "pcm_oss: mmap begin\n");
  #endif
        pcm_oss_file = file->private_data;
        switch ((area->vm_flags & (VM_READ | VM_WRITE))) {
        runtime->silence_threshold = 0;
        runtime->silence_size = 0;
  #ifdef OSS_DEBUG
 -      printk("pcm_oss: mmap ok, bytes = 0x%x\n", runtime->oss.mmap_bytes);
 +      printk(KERN_DEBUG "pcm_oss: mmap ok, bytes = 0x%x\n",
 +             runtime->oss.mmap_bytes);
  #endif
        /* In mmap mode we never stop */
        runtime->stop_threshold = runtime->boundary;
@@@ -2885,7 -2874,7 +2887,7 @@@ static void snd_pcm_oss_proc_write(stru
                        setup = kmalloc(sizeof(*setup), GFP_KERNEL);
                        if (! setup) {
                                buffer->error = -ENOMEM;
 -                              mutex_lock(&pstr->oss.setup_mutex);
 +                              mutex_unlock(&pstr->oss.setup_mutex);
                                return;
                        }
                        if (pstr->oss.setup_list == NULL)
                        if (! template.task_name) {
                                kfree(setup);
                                buffer->error = -ENOMEM;
 -                              mutex_lock(&pstr->oss.setup_mutex);
 +                              mutex_unlock(&pstr->oss.setup_mutex);
                                return;
                        }
                }
diff --combined sound/core/pcm_native.c
@@@ -186,7 -186,7 +186,7 @@@ int snd_pcm_hw_refine(struct snd_pcm_su
                if (!(params->rmask & (1 << k)))
                        continue;
  #ifdef RULES_DEBUG
 -              printk("%s = ", snd_pcm_hw_param_names[k]);
 +              printk(KERN_DEBUG "%s = ", snd_pcm_hw_param_names[k]);
                printk("%04x%04x%04x%04x -> ", m->bits[3], m->bits[2], m->bits[1], m->bits[0]);
  #endif
                changed = snd_mask_refine(m, constrs_mask(constrs, k));
                if (!(params->rmask & (1 << k)))
                        continue;
  #ifdef RULES_DEBUG
 -              printk("%s = ", snd_pcm_hw_param_names[k]);
 +              printk(KERN_DEBUG "%s = ", snd_pcm_hw_param_names[k]);
                if (i->empty)
                        printk("empty");
                else
                        if (!doit)
                                continue;
  #ifdef RULES_DEBUG
 -                      printk("Rule %d [%p]: ", k, r->func);
 +                      printk(KERN_DEBUG "Rule %d [%p]: ", k, r->func);
                        if (r->var >= 0) {
                                printk("%s = ", snd_pcm_hw_param_names[r->var]);
                                if (hw_is_mask(r->var)) {
@@@ -3246,9 -3246,7 +3246,7 @@@ static int snd_pcm_fasync(int fd, struc
        err = fasync_helper(fd, file, on, &runtime->fasync);
  out:
        unlock_kernel();
-       if (err < 0)
-               return err;
-       return 0;
+       return err;
  }
  
  /*