diff options
| author | Stefani Seibold <stefani@seibold.net> | 2009-12-21 17:37:28 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-22 17:17:56 -0500 |
| commit | 7acd72eb85f1c7a15e8b5eb554994949241737f1 (patch) | |
| tree | 76712bb9f38690d8cf9c2f91bef811e4413d1aa3 | |
| parent | e64c026dd09b73faf20707711402fc5ed55a8e70 (diff) | |
kfifo: rename kfifo_put... into kfifo_in... and kfifo_get... into kfifo_out...
rename kfifo_put... into kfifo_in... to prevent miss use of old non in
kernel-tree drivers
ditto for kfifo_get... -> kfifo_out...
Improve the prototypes of kfifo_in and kfifo_out to make the kerneldoc
annotations more readable.
Add mini "howto porting to the new API" in kfifo.h
Signed-off-by: Stefani Seibold <stefani@seibold.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | drivers/char/nozomi.c | 4 | ||||
| -rw-r--r-- | drivers/char/sonypi.c | 8 | ||||
| -rw-r--r-- | drivers/infiniband/hw/cxgb3/cxio_resource.c | 16 | ||||
| -rw-r--r-- | drivers/media/video/meye.c | 16 | ||||
| -rw-r--r-- | drivers/net/wireless/libertas/main.c | 5 | ||||
| -rw-r--r-- | drivers/platform/x86/fujitsu-laptop.c | 4 | ||||
| -rw-r--r-- | drivers/platform/x86/sony-laptop.c | 8 | ||||
| -rw-r--r-- | drivers/scsi/libiscsi.c | 14 | ||||
| -rw-r--r-- | drivers/scsi/libiscsi_tcp.c | 18 | ||||
| -rw-r--r-- | drivers/scsi/libsrp.c | 6 | ||||
| -rw-r--r-- | drivers/usb/host/fhci.h | 4 | ||||
| -rw-r--r-- | drivers/usb/serial/generic.c | 4 | ||||
| -rw-r--r-- | include/linux/kfifo.h | 39 | ||||
| -rw-r--r-- | kernel/kfifo.c | 32 | ||||
| -rw-r--r-- | net/dccp/probe.c | 4 |
15 files changed, 101 insertions, 81 deletions
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c index 61f5bfe74f38..9ef243429014 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c | |||
| @@ -798,7 +798,7 @@ static int send_data(enum port_type index, struct nozomi *dc) | |||
| 798 | struct tty_struct *tty = tty_port_tty_get(&port->port); | 798 | struct tty_struct *tty = tty_port_tty_get(&port->port); |
| 799 | 799 | ||
| 800 | /* Get data from tty and place in buf for now */ | 800 | /* Get data from tty and place in buf for now */ |
| 801 | size = kfifo_get(&port->fifo_ul, dc->send_buf, | 801 | size = kfifo_out(&port->fifo_ul, dc->send_buf, |
| 802 | ul_size < SEND_BUF_MAX ? ul_size : SEND_BUF_MAX); | 802 | ul_size < SEND_BUF_MAX ? ul_size : SEND_BUF_MAX); |
| 803 | 803 | ||
| 804 | if (size == 0) { | 804 | if (size == 0) { |
| @@ -1672,7 +1672,7 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer, | |||
| 1672 | goto exit; | 1672 | goto exit; |
| 1673 | } | 1673 | } |
| 1674 | 1674 | ||
| 1675 | rval = kfifo_put(&port->fifo_ul, (unsigned char *)buffer, count); | 1675 | rval = kfifo_in(&port->fifo_ul, (unsigned char *)buffer, count); |
| 1676 | 1676 | ||
| 1677 | /* notify card */ | 1677 | /* notify card */ |
| 1678 | if (unlikely(dc == NULL)) { | 1678 | if (unlikely(dc == NULL)) { |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index dbcb3bd192c7..0798754a607c 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
| @@ -777,7 +777,7 @@ static void input_keyrelease(struct work_struct *work) | |||
| 777 | { | 777 | { |
| 778 | struct sonypi_keypress kp; | 778 | struct sonypi_keypress kp; |
| 779 | 779 | ||
| 780 | while (kfifo_get_locked(&sonypi_device.input_fifo, (unsigned char *)&kp, | 780 | while (kfifo_out_locked(&sonypi_device.input_fifo, (unsigned char *)&kp, |
| 781 | sizeof(kp), &sonypi_device.input_fifo_lock) | 781 | sizeof(kp), &sonypi_device.input_fifo_lock) |
| 782 | == sizeof(kp)) { | 782 | == sizeof(kp)) { |
| 783 | msleep(10); | 783 | msleep(10); |
| @@ -828,7 +828,7 @@ static void sonypi_report_input_event(u8 event) | |||
| 828 | if (kp.dev) { | 828 | if (kp.dev) { |
| 829 | input_report_key(kp.dev, kp.key, 1); | 829 | input_report_key(kp.dev, kp.key, 1); |
| 830 | input_sync(kp.dev); | 830 | input_sync(kp.dev); |
| 831 | kfifo_put_locked(&sonypi_device.input_fifo, | 831 | kfifo_in_locked(&sonypi_device.input_fifo, |
| 832 | (unsigned char *)&kp, sizeof(kp), | 832 | (unsigned char *)&kp, sizeof(kp), |
| 833 | &sonypi_device.input_fifo_lock); | 833 | &sonypi_device.input_fifo_lock); |
| 834 | schedule_work(&sonypi_device.input_work); | 834 | schedule_work(&sonypi_device.input_work); |
| @@ -882,7 +882,7 @@ found: | |||
| 882 | acpi_bus_generate_proc_event(sonypi_acpi_device, 1, event); | 882 | acpi_bus_generate_proc_event(sonypi_acpi_device, 1, event); |
| 883 | #endif | 883 | #endif |
| 884 | 884 | ||
| 885 | kfifo_put_locked(&sonypi_device.fifo, (unsigned char *)&event, | 885 | kfifo_in_locked(&sonypi_device.fifo, (unsigned char *)&event, |
| 886 | sizeof(event), &sonypi_device.fifo_lock); | 886 | sizeof(event), &sonypi_device.fifo_lock); |
| 887 | kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); | 887 | kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); |
| 888 | wake_up_interruptible(&sonypi_device.fifo_proc_list); | 888 | wake_up_interruptible(&sonypi_device.fifo_proc_list); |
| @@ -932,7 +932,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf, | |||
| 932 | return ret; | 932 | return ret; |
| 933 | 933 | ||
| 934 | while (ret < count && | 934 | while (ret < count && |
| 935 | (kfifo_get_locked(&sonypi_device.fifo, &c, sizeof(c), | 935 | (kfifo_out_locked(&sonypi_device.fifo, &c, sizeof(c), |
| 936 | &sonypi_device.fifo_lock) == sizeof(c))) { | 936 | &sonypi_device.fifo_lock) == sizeof(c))) { |
| 937 | if (put_user(c, buf++)) | 937 | if (put_user(c, buf++)) |
| 938 | return -EFAULT; | 938 | return -EFAULT; |
diff --git a/drivers/infiniband/hw/cxgb3/cxio_resource.c b/drivers/infiniband/hw/cxgb3/cxio_resource.c index d7d18fb02c93..dcbf2606c438 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_resource.c +++ b/drivers/infiniband/hw/cxgb3/cxio_resource.c | |||
| @@ -59,7 +59,7 @@ static int __cxio_init_resource_fifo(struct kfifo *fifo, | |||
| 59 | return -ENOMEM; | 59 | return -ENOMEM; |
| 60 | 60 | ||
| 61 | for (i = 0; i < skip_low + skip_high; i++) | 61 | for (i = 0; i < skip_low + skip_high; i++) |
| 62 | kfifo_put(fifo, (unsigned char *) &entry, sizeof(u32)); | 62 | kfifo_in(fifo, (unsigned char *) &entry, sizeof(u32)); |
| 63 | if (random) { | 63 | if (random) { |
| 64 | j = 0; | 64 | j = 0; |
| 65 | random_bytes = random32(); | 65 | random_bytes = random32(); |
| @@ -71,22 +71,22 @@ static int __cxio_init_resource_fifo(struct kfifo *fifo, | |||
| 71 | random_bytes = random32(); | 71 | random_bytes = random32(); |
| 72 | } | 72 | } |
| 73 | idx = (random_bytes >> (j * 2)) & 0xF; | 73 | idx = (random_bytes >> (j * 2)) & 0xF; |
| 74 | kfifo_put(fifo, | 74 | kfifo_in(fifo, |
| 75 | (unsigned char *) &rarray[idx], | 75 | (unsigned char *) &rarray[idx], |
| 76 | sizeof(u32)); | 76 | sizeof(u32)); |
| 77 | rarray[idx] = i; | 77 | rarray[idx] = i; |
| 78 | j++; | 78 | j++; |
| 79 | } | 79 | } |
| 80 | for (i = 0; i < RANDOM_SIZE; i++) | 80 | for (i = 0; i < RANDOM_SIZE; i++) |
| 81 | kfifo_put(fifo, | 81 | kfifo_in(fifo, |
| 82 | (unsigned char *) &rarray[i], | 82 | (unsigned char *) &rarray[i], |
| 83 | sizeof(u32)); | 83 | sizeof(u32)); |
| 84 | } else | 84 | } else |
| 85 | for (i = skip_low; i < nr - skip_high; i++) | 85 | for (i = skip_low; i < nr - skip_high; i++) |
| 86 | kfifo_put(fifo, (unsigned char *) &i, sizeof(u32)); | 86 | kfifo_in(fifo, (unsigned char *) &i, sizeof(u32)); |
| 87 | 87 | ||
| 88 | for (i = 0; i < skip_low + skip_high; i++) | 88 | for (i = 0; i < skip_low + skip_high; i++) |
| 89 | kfifo_get_locked(fifo, (unsigned char *) &entry, | 89 | kfifo_out_locked(fifo, (unsigned char *) &entry, |
| 90 | sizeof(u32), fifo_lock); | 90 | sizeof(u32), fifo_lock); |
| 91 | return 0; | 91 | return 0; |
| 92 | } | 92 | } |
| @@ -119,7 +119,7 @@ static int cxio_init_qpid_fifo(struct cxio_rdev *rdev_p) | |||
| 119 | 119 | ||
| 120 | for (i = 16; i < T3_MAX_NUM_QP; i++) | 120 | for (i = 16; i < T3_MAX_NUM_QP; i++) |
| 121 | if (!(i & rdev_p->qpmask)) | 121 | if (!(i & rdev_p->qpmask)) |
| 122 | kfifo_put(&rdev_p->rscp->qpid_fifo, | 122 | kfifo_in(&rdev_p->rscp->qpid_fifo, |
| 123 | (unsigned char *) &i, sizeof(u32)); | 123 | (unsigned char *) &i, sizeof(u32)); |
| 124 | return 0; | 124 | return 0; |
| 125 | } | 125 | } |
| @@ -180,7 +180,7 @@ tpt_err: | |||
| 180 | static u32 cxio_hal_get_resource(struct kfifo *fifo, spinlock_t * lock) | 180 | static u32 cxio_hal_get_resource(struct kfifo *fifo, spinlock_t * lock) |
| 181 | { | 181 | { |
| 182 | u32 entry; | 182 | u32 entry; |
| 183 | if (kfifo_get_locked(fifo, (unsigned char *) &entry, sizeof(u32), lock)) | 183 | if (kfifo_out_locked(fifo, (unsigned char *) &entry, sizeof(u32), lock)) |
| 184 | return entry; | 184 | return entry; |
| 185 | else | 185 | else |
| 186 | return 0; /* fifo emptry */ | 186 | return 0; /* fifo emptry */ |
| @@ -190,7 +190,7 @@ static void cxio_hal_put_resource(struct kfifo *fifo, spinlock_t * lock, | |||
| 190 | u32 entry) | 190 | u32 entry) |
| 191 | { | 191 | { |
| 192 | BUG_ON( | 192 | BUG_ON( |
| 193 | kfifo_put_locked(fifo, (unsigned char *) &entry, sizeof(u32), lock) | 193 | kfifo_in_locked(fifo, (unsigned char *) &entry, sizeof(u32), lock) |
| 194 | == 0); | 194 | == 0); |
| 195 | } | 195 | } |
| 196 | 196 | ||
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index 38bcedfd9fec..884a569d60a2 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c | |||
| @@ -800,7 +800,7 @@ again: | |||
| 800 | return IRQ_HANDLED; | 800 | return IRQ_HANDLED; |
| 801 | 801 | ||
| 802 | if (meye.mchip_mode == MCHIP_HIC_MODE_CONT_OUT) { | 802 | if (meye.mchip_mode == MCHIP_HIC_MODE_CONT_OUT) { |
| 803 | if (kfifo_get_locked(&meye.grabq, (unsigned char *)&reqnr, | 803 | if (kfifo_out_locked(&meye.grabq, (unsigned char *)&reqnr, |
| 804 | sizeof(int), &meye.grabq_lock) != sizeof(int)) { | 804 | sizeof(int), &meye.grabq_lock) != sizeof(int)) { |
| 805 | mchip_free_frame(); | 805 | mchip_free_frame(); |
| 806 | return IRQ_HANDLED; | 806 | return IRQ_HANDLED; |
| @@ -811,7 +811,7 @@ again: | |||
| 811 | meye.grab_buffer[reqnr].state = MEYE_BUF_DONE; | 811 | meye.grab_buffer[reqnr].state = MEYE_BUF_DONE; |
| 812 | do_gettimeofday(&meye.grab_buffer[reqnr].timestamp); | 812 | do_gettimeofday(&meye.grab_buffer[reqnr].timestamp); |
| 813 | meye.grab_buffer[reqnr].sequence = sequence++; | 813 | meye.grab_buffer[reqnr].sequence = sequence++; |
| 814 | kfifo_put_locked(&meye.doneq, (unsigned char *)&reqnr, | 814 | kfifo_in_locked(&meye.doneq, (unsigned char *)&reqnr, |
| 815 | sizeof(int), &meye.doneq_lock); | 815 | sizeof(int), &meye.doneq_lock); |
| 816 | wake_up_interruptible(&meye.proc_list); | 816 | wake_up_interruptible(&meye.proc_list); |
| 817 | } else { | 817 | } else { |
| @@ -821,7 +821,7 @@ again: | |||
| 821 | mchip_free_frame(); | 821 | mchip_free_frame(); |
| 822 | goto again; | 822 | goto again; |
| 823 | } | 823 | } |
| 824 | if (kfifo_get_locked(&meye.grabq, (unsigned char *)&reqnr, | 824 | if (kfifo_out_locked(&meye.grabq, (unsigned char *)&reqnr, |
| 825 | sizeof(int), &meye.grabq_lock) != sizeof(int)) { | 825 | sizeof(int), &meye.grabq_lock) != sizeof(int)) { |
| 826 | mchip_free_frame(); | 826 | mchip_free_frame(); |
| 827 | goto again; | 827 | goto again; |
| @@ -832,7 +832,7 @@ again: | |||
| 832 | meye.grab_buffer[reqnr].state = MEYE_BUF_DONE; | 832 | meye.grab_buffer[reqnr].state = MEYE_BUF_DONE; |
| 833 | do_gettimeofday(&meye.grab_buffer[reqnr].timestamp); | 833 | do_gettimeofday(&meye.grab_buffer[reqnr].timestamp); |
| 834 | meye.grab_buffer[reqnr].sequence = sequence++; | 834 | meye.grab_buffer[reqnr].sequence = sequence++; |
| 835 | kfifo_put_locked(&meye.doneq, (unsigned char *)&reqnr, | 835 | kfifo_in_locked(&meye.doneq, (unsigned char *)&reqnr, |
| 836 | sizeof(int), &meye.doneq_lock); | 836 | sizeof(int), &meye.doneq_lock); |
| 837 | wake_up_interruptible(&meye.proc_list); | 837 | wake_up_interruptible(&meye.proc_list); |
| 838 | } | 838 | } |
| @@ -935,7 +935,7 @@ static int meyeioc_qbuf_capt(int *nb) | |||
| 935 | mchip_cont_compression_start(); | 935 | mchip_cont_compression_start(); |
| 936 | 936 | ||
| 937 | meye.grab_buffer[*nb].state = MEYE_BUF_USING; | 937 | meye.grab_buffer[*nb].state = MEYE_BUF_USING; |
| 938 | kfifo_put_locked(&meye.grabq, (unsigned char *)nb, sizeof(int), | 938 | kfifo_in_locked(&meye.grabq, (unsigned char *)nb, sizeof(int), |
| 939 | &meye.grabq_lock); | 939 | &meye.grabq_lock); |
| 940 | mutex_unlock(&meye.lock); | 940 | mutex_unlock(&meye.lock); |
| 941 | 941 | ||
| @@ -968,7 +968,7 @@ static int meyeioc_sync(struct file *file, void *fh, int *i) | |||
| 968 | /* fall through */ | 968 | /* fall through */ |
| 969 | case MEYE_BUF_DONE: | 969 | case MEYE_BUF_DONE: |
| 970 | meye.grab_buffer[*i].state = MEYE_BUF_UNUSED; | 970 | meye.grab_buffer[*i].state = MEYE_BUF_UNUSED; |
| 971 | kfifo_get_locked(&meye.doneq, (unsigned char *)&unused, | 971 | kfifo_out_locked(&meye.doneq, (unsigned char *)&unused, |
| 972 | sizeof(int), &meye.doneq_lock); | 972 | sizeof(int), &meye.doneq_lock); |
| 973 | } | 973 | } |
| 974 | *i = meye.grab_buffer[*i].size; | 974 | *i = meye.grab_buffer[*i].size; |
| @@ -1456,7 +1456,7 @@ static int vidioc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) | |||
| 1456 | buf->flags |= V4L2_BUF_FLAG_QUEUED; | 1456 | buf->flags |= V4L2_BUF_FLAG_QUEUED; |
| 1457 | buf->flags &= ~V4L2_BUF_FLAG_DONE; | 1457 | buf->flags &= ~V4L2_BUF_FLAG_DONE; |
| 1458 | meye.grab_buffer[buf->index].state = MEYE_BUF_USING; | 1458 | meye.grab_buffer[buf->index].state = MEYE_BUF_USING; |
| 1459 | kfifo_put_locked(&meye.grabq, (unsigned char *)&buf->index, | 1459 | kfifo_in_locked(&meye.grabq, (unsigned char *)&buf->index, |
| 1460 | sizeof(int), &meye.grabq_lock); | 1460 | sizeof(int), &meye.grabq_lock); |
| 1461 | mutex_unlock(&meye.lock); | 1461 | mutex_unlock(&meye.lock); |
| 1462 | 1462 | ||
| @@ -1483,7 +1483,7 @@ static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) | |||
| 1483 | return -EINTR; | 1483 | return -EINTR; |
| 1484 | } | 1484 | } |
| 1485 | 1485 | ||
| 1486 | if (!kfifo_get_locked(&meye.doneq, (unsigned char *)&reqnr, | 1486 | if (!kfifo_out_locked(&meye.doneq, (unsigned char *)&reqnr, |
| 1487 | sizeof(int), &meye.doneq_lock)) { | 1487 | sizeof(int), &meye.doneq_lock)) { |
| 1488 | mutex_unlock(&meye.lock); | 1488 | mutex_unlock(&meye.lock); |
| 1489 | return -EBUSY; | 1489 | return -EBUSY; |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 0622104f0a03..2bcfa745524a 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
| @@ -513,7 +513,8 @@ static int lbs_thread(void *data) | |||
| 513 | spin_lock_irq(&priv->driver_lock); | 513 | spin_lock_irq(&priv->driver_lock); |
| 514 | while (kfifo_len(&priv->event_fifo)) { | 514 | while (kfifo_len(&priv->event_fifo)) { |
| 515 | u32 event; | 515 | u32 event; |
| 516 | kfifo_get(&priv->event_fifo, (unsigned char *) &event, | 516 | |
| 517 | kfifo_out(&priv->event_fifo, (unsigned char *) &event, | ||
| 517 | sizeof(event)); | 518 | sizeof(event)); |
| 518 | spin_unlock_irq(&priv->driver_lock); | 519 | spin_unlock_irq(&priv->driver_lock); |
| 519 | lbs_process_event(priv, event); | 520 | lbs_process_event(priv, event); |
| @@ -1175,7 +1176,7 @@ void lbs_queue_event(struct lbs_private *priv, u32 event) | |||
| 1175 | if (priv->psstate == PS_STATE_SLEEP) | 1176 | if (priv->psstate == PS_STATE_SLEEP) |
| 1176 | priv->psstate = PS_STATE_AWAKE; | 1177 | priv->psstate = PS_STATE_AWAKE; |
| 1177 | 1178 | ||
| 1178 | kfifo_put(&priv->event_fifo, (unsigned char *) &event, sizeof(u32)); | 1179 | kfifo_in(&priv->event_fifo, (unsigned char *) &event, sizeof(u32)); |
| 1179 | 1180 | ||
| 1180 | wake_up_interruptible(&priv->waitq); | 1181 | wake_up_interruptible(&priv->waitq); |
| 1181 | 1182 | ||
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 13dc7bedcfce..b66029bd75d0 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
| @@ -1006,7 +1006,7 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) | |||
| 1006 | vdbg_printk(FUJLAPTOP_DBG_TRACE, | 1006 | vdbg_printk(FUJLAPTOP_DBG_TRACE, |
| 1007 | "Push keycode into ringbuffer [%d]\n", | 1007 | "Push keycode into ringbuffer [%d]\n", |
| 1008 | keycode); | 1008 | keycode); |
| 1009 | status = kfifo_put_locked(&fujitsu_hotkey->fifo, | 1009 | status = kfifo_in_locked(&fujitsu_hotkey->fifo, |
| 1010 | (unsigned char *)&keycode, | 1010 | (unsigned char *)&keycode, |
| 1011 | sizeof(keycode), | 1011 | sizeof(keycode), |
| 1012 | &fujitsu_hotkey->fifo_lock); | 1012 | &fujitsu_hotkey->fifo_lock); |
| @@ -1020,7 +1020,7 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) | |||
| 1020 | } | 1020 | } |
| 1021 | } else if (keycode == 0) { | 1021 | } else if (keycode == 0) { |
| 1022 | while ((status = | 1022 | while ((status = |
| 1023 | kfifo_get_locked( | 1023 | kfifo_out_locked( |
| 1024 | &fujitsu_hotkey->fifo, | 1024 | &fujitsu_hotkey->fifo, |
| 1025 | (unsigned char *) &keycode_r, | 1025 | (unsigned char *) &keycode_r, |
| 1026 | sizeof(keycode_r), | 1026 | sizeof(keycode_r), |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 36e5dc6fc953..2896ca4cd9ab 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
| @@ -300,7 +300,7 @@ static void do_sony_laptop_release_key(struct work_struct *work) | |||
| 300 | { | 300 | { |
| 301 | struct sony_laptop_keypress kp; | 301 | struct sony_laptop_keypress kp; |
| 302 | 302 | ||
| 303 | while (kfifo_get_locked(&sony_laptop_input.fifo, (unsigned char *)&kp, | 303 | while (kfifo_out_locked(&sony_laptop_input.fifo, (unsigned char *)&kp, |
| 304 | sizeof(kp), &sony_laptop_input.fifo_lock) | 304 | sizeof(kp), &sony_laptop_input.fifo_lock) |
| 305 | == sizeof(kp)) { | 305 | == sizeof(kp)) { |
| 306 | msleep(10); | 306 | msleep(10); |
| @@ -363,7 +363,7 @@ static void sony_laptop_report_input_event(u8 event) | |||
| 363 | /* we emit the scancode so we can always remap the key */ | 363 | /* we emit the scancode so we can always remap the key */ |
| 364 | input_event(kp.dev, EV_MSC, MSC_SCAN, event); | 364 | input_event(kp.dev, EV_MSC, MSC_SCAN, event); |
| 365 | input_sync(kp.dev); | 365 | input_sync(kp.dev); |
| 366 | kfifo_put_locked(&sony_laptop_input.fifo, | 366 | kfifo_in_locked(&sony_laptop_input.fifo, |
| 367 | (unsigned char *)&kp, sizeof(kp), | 367 | (unsigned char *)&kp, sizeof(kp), |
| 368 | &sony_laptop_input.fifo_lock); | 368 | &sony_laptop_input.fifo_lock); |
| 369 | 369 | ||
| @@ -2130,7 +2130,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf, | |||
| 2130 | return ret; | 2130 | return ret; |
| 2131 | 2131 | ||
| 2132 | while (ret < count && | 2132 | while (ret < count && |
| 2133 | (kfifo_get_locked(&sonypi_compat.fifo, &c, sizeof(c), | 2133 | (kfifo_out_locked(&sonypi_compat.fifo, &c, sizeof(c), |
| 2134 | &sonypi_compat.fifo_lock) == sizeof(c))) { | 2134 | &sonypi_compat.fifo_lock) == sizeof(c))) { |
| 2135 | if (put_user(c, buf++)) | 2135 | if (put_user(c, buf++)) |
| 2136 | return -EFAULT; | 2136 | return -EFAULT; |
| @@ -2310,7 +2310,7 @@ static struct miscdevice sonypi_misc_device = { | |||
| 2310 | 2310 | ||
| 2311 | static void sonypi_compat_report_event(u8 event) | 2311 | static void sonypi_compat_report_event(u8 event) |
| 2312 | { | 2312 | { |
| 2313 | kfifo_put_locked(&sonypi_compat.fifo, (unsigned char *)&event, | 2313 | kfifo_in_locked(&sonypi_compat.fifo, (unsigned char *)&event, |
| 2314 | sizeof(event), &sonypi_compat.fifo_lock); | 2314 | sizeof(event), &sonypi_compat.fifo_lock); |
| 2315 | kill_fasync(&sonypi_compat.fifo_async, SIGIO, POLL_IN); | 2315 | kill_fasync(&sonypi_compat.fifo_async, SIGIO, POLL_IN); |
| 2316 | wake_up_interruptible(&sonypi_compat.fifo_proc_list); | 2316 | wake_up_interruptible(&sonypi_compat.fifo_proc_list); |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 5f0c46f43ee1..c28a712fd4db 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
| @@ -517,7 +517,7 @@ static void iscsi_free_task(struct iscsi_task *task) | |||
| 517 | if (conn->login_task == task) | 517 | if (conn->login_task == task) |
| 518 | return; | 518 | return; |
| 519 | 519 | ||
| 520 | kfifo_put(&session->cmdpool.queue, (void*)&task, sizeof(void*)); | 520 | kfifo_in(&session->cmdpool.queue, (void*)&task, sizeof(void*)); |
| 521 | 521 | ||
| 522 | if (sc) { | 522 | if (sc) { |
| 523 | task->sc = NULL; | 523 | task->sc = NULL; |
| @@ -737,7 +737,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
| 737 | BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE); | 737 | BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE); |
| 738 | BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED); | 738 | BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED); |
| 739 | 739 | ||
| 740 | if (!kfifo_get(&session->cmdpool.queue, | 740 | if (!kfifo_out(&session->cmdpool.queue, |
| 741 | (void*)&task, sizeof(void*))) | 741 | (void*)&task, sizeof(void*))) |
| 742 | return NULL; | 742 | return NULL; |
| 743 | } | 743 | } |
| @@ -1567,7 +1567,7 @@ static inline struct iscsi_task *iscsi_alloc_task(struct iscsi_conn *conn, | |||
| 1567 | { | 1567 | { |
| 1568 | struct iscsi_task *task; | 1568 | struct iscsi_task *task; |
| 1569 | 1569 | ||
| 1570 | if (!kfifo_get(&conn->session->cmdpool.queue, | 1570 | if (!kfifo_out(&conn->session->cmdpool.queue, |
| 1571 | (void *) &task, sizeof(void *))) | 1571 | (void *) &task, sizeof(void *))) |
| 1572 | return NULL; | 1572 | return NULL; |
| 1573 | 1573 | ||
| @@ -2469,7 +2469,7 @@ iscsi_pool_init(struct iscsi_pool *q, int max, void ***items, int item_size) | |||
| 2469 | q->max = i; | 2469 | q->max = i; |
| 2470 | goto enomem; | 2470 | goto enomem; |
| 2471 | } | 2471 | } |
| 2472 | kfifo_put(&q->queue, (void*)&q->pool[i], sizeof(void*)); | 2472 | kfifo_in(&q->queue, (void*)&q->pool[i], sizeof(void*)); |
| 2473 | } | 2473 | } |
| 2474 | 2474 | ||
| 2475 | if (items) { | 2475 | if (items) { |
| @@ -2819,7 +2819,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, | |||
| 2819 | 2819 | ||
| 2820 | /* allocate login_task used for the login/text sequences */ | 2820 | /* allocate login_task used for the login/text sequences */ |
| 2821 | spin_lock_bh(&session->lock); | 2821 | spin_lock_bh(&session->lock); |
| 2822 | if (!kfifo_get(&session->cmdpool.queue, | 2822 | if (!kfifo_out(&session->cmdpool.queue, |
| 2823 | (void*)&conn->login_task, | 2823 | (void*)&conn->login_task, |
| 2824 | sizeof(void*))) { | 2824 | sizeof(void*))) { |
| 2825 | spin_unlock_bh(&session->lock); | 2825 | spin_unlock_bh(&session->lock); |
| @@ -2839,7 +2839,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, | |||
| 2839 | return cls_conn; | 2839 | return cls_conn; |
| 2840 | 2840 | ||
| 2841 | login_task_data_alloc_fail: | 2841 | login_task_data_alloc_fail: |
| 2842 | kfifo_put(&session->cmdpool.queue, (void*)&conn->login_task, | 2842 | kfifo_in(&session->cmdpool.queue, (void*)&conn->login_task, |
| 2843 | sizeof(void*)); | 2843 | sizeof(void*)); |
| 2844 | login_task_alloc_fail: | 2844 | login_task_alloc_fail: |
| 2845 | iscsi_destroy_conn(cls_conn); | 2845 | iscsi_destroy_conn(cls_conn); |
| @@ -2902,7 +2902,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) | |||
| 2902 | free_pages((unsigned long) conn->data, | 2902 | free_pages((unsigned long) conn->data, |
| 2903 | get_order(ISCSI_DEF_MAX_RECV_SEG_LEN)); | 2903 | get_order(ISCSI_DEF_MAX_RECV_SEG_LEN)); |
| 2904 | kfree(conn->persistent_address); | 2904 | kfree(conn->persistent_address); |
| 2905 | kfifo_put(&session->cmdpool.queue, (void*)&conn->login_task, | 2905 | kfifo_in(&session->cmdpool.queue, (void*)&conn->login_task, |
| 2906 | sizeof(void*)); | 2906 | sizeof(void*)); |
| 2907 | if (session->leadconn == conn) | 2907 | if (session->leadconn == conn) |
| 2908 | session->leadconn = NULL; | 2908 | session->leadconn = NULL; |
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c index c0be926637b1..d51ffeca2ec9 100644 --- a/drivers/scsi/libiscsi_tcp.c +++ b/drivers/scsi/libiscsi_tcp.c | |||
| @@ -445,15 +445,15 @@ void iscsi_tcp_cleanup_task(struct iscsi_task *task) | |||
| 445 | return; | 445 | return; |
| 446 | 446 | ||
| 447 | /* flush task's r2t queues */ | 447 | /* flush task's r2t queues */ |
| 448 | while (kfifo_get(&tcp_task->r2tqueue, (void*)&r2t, sizeof(void*))) { | 448 | while (kfifo_out(&tcp_task->r2tqueue, (void*)&r2t, sizeof(void*))) { |
| 449 | kfifo_put(&tcp_task->r2tpool.queue, (void*)&r2t, | 449 | kfifo_in(&tcp_task->r2tpool.queue, (void*)&r2t, |
| 450 | sizeof(void*)); | 450 | sizeof(void*)); |
| 451 | ISCSI_DBG_TCP(task->conn, "pending r2t dropped\n"); | 451 | ISCSI_DBG_TCP(task->conn, "pending r2t dropped\n"); |
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | r2t = tcp_task->r2t; | 454 | r2t = tcp_task->r2t; |
| 455 | if (r2t != NULL) { | 455 | if (r2t != NULL) { |
| 456 | kfifo_put(&tcp_task->r2tpool.queue, (void*)&r2t, | 456 | kfifo_in(&tcp_task->r2tpool.queue, (void*)&r2t, |
| 457 | sizeof(void*)); | 457 | sizeof(void*)); |
| 458 | tcp_task->r2t = NULL; | 458 | tcp_task->r2t = NULL; |
| 459 | } | 459 | } |
| @@ -541,7 +541,7 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) | |||
| 541 | return 0; | 541 | return 0; |
| 542 | } | 542 | } |
| 543 | 543 | ||
| 544 | rc = kfifo_get(&tcp_task->r2tpool.queue, (void*)&r2t, sizeof(void*)); | 544 | rc = kfifo_out(&tcp_task->r2tpool.queue, (void*)&r2t, sizeof(void*)); |
| 545 | if (!rc) { | 545 | if (!rc) { |
| 546 | iscsi_conn_printk(KERN_ERR, conn, "Could not allocate R2T. " | 546 | iscsi_conn_printk(KERN_ERR, conn, "Could not allocate R2T. " |
| 547 | "Target has sent more R2Ts than it " | 547 | "Target has sent more R2Ts than it " |
| @@ -554,7 +554,7 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) | |||
| 554 | if (r2t->data_length == 0) { | 554 | if (r2t->data_length == 0) { |
| 555 | iscsi_conn_printk(KERN_ERR, conn, | 555 | iscsi_conn_printk(KERN_ERR, conn, |
| 556 | "invalid R2T with zero data len\n"); | 556 | "invalid R2T with zero data len\n"); |
| 557 | kfifo_put(&tcp_task->r2tpool.queue, (void*)&r2t, | 557 | kfifo_in(&tcp_task->r2tpool.queue, (void*)&r2t, |
| 558 | sizeof(void*)); | 558 | sizeof(void*)); |
| 559 | return ISCSI_ERR_DATALEN; | 559 | return ISCSI_ERR_DATALEN; |
| 560 | } | 560 | } |
| @@ -570,7 +570,7 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) | |||
| 570 | "invalid R2T with data len %u at offset %u " | 570 | "invalid R2T with data len %u at offset %u " |
| 571 | "and total length %d\n", r2t->data_length, | 571 | "and total length %d\n", r2t->data_length, |
| 572 | r2t->data_offset, scsi_out(task->sc)->length); | 572 | r2t->data_offset, scsi_out(task->sc)->length); |
| 573 | kfifo_put(&tcp_task->r2tpool.queue, (void*)&r2t, | 573 | kfifo_in(&tcp_task->r2tpool.queue, (void*)&r2t, |
| 574 | sizeof(void*)); | 574 | sizeof(void*)); |
| 575 | return ISCSI_ERR_DATALEN; | 575 | return ISCSI_ERR_DATALEN; |
| 576 | } | 576 | } |
| @@ -580,7 +580,7 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) | |||
| 580 | r2t->sent = 0; | 580 | r2t->sent = 0; |
| 581 | 581 | ||
| 582 | tcp_task->exp_datasn = r2tsn + 1; | 582 | tcp_task->exp_datasn = r2tsn + 1; |
| 583 | kfifo_put(&tcp_task->r2tqueue, (void*)&r2t, sizeof(void*)); | 583 | kfifo_in(&tcp_task->r2tqueue, (void*)&r2t, sizeof(void*)); |
| 584 | conn->r2t_pdus_cnt++; | 584 | conn->r2t_pdus_cnt++; |
| 585 | 585 | ||
| 586 | iscsi_requeue_task(task); | 586 | iscsi_requeue_task(task); |
| @@ -982,7 +982,7 @@ static struct iscsi_r2t_info *iscsi_tcp_get_curr_r2t(struct iscsi_task *task) | |||
| 982 | if (r2t->data_length <= r2t->sent) { | 982 | if (r2t->data_length <= r2t->sent) { |
| 983 | ISCSI_DBG_TCP(task->conn, | 983 | ISCSI_DBG_TCP(task->conn, |
| 984 | " done with r2t %p\n", r2t); | 984 | " done with r2t %p\n", r2t); |
| 985 | kfifo_put(&tcp_task->r2tpool.queue, | 985 | kfifo_in(&tcp_task->r2tpool.queue, |
| 986 | (void *)&tcp_task->r2t, | 986 | (void *)&tcp_task->r2t, |
| 987 | sizeof(void *)); | 987 | sizeof(void *)); |
| 988 | tcp_task->r2t = r2t = NULL; | 988 | tcp_task->r2t = r2t = NULL; |
| @@ -990,7 +990,7 @@ static struct iscsi_r2t_info *iscsi_tcp_get_curr_r2t(struct iscsi_task *task) | |||
| 990 | } | 990 | } |
| 991 | 991 | ||
| 992 | if (r2t == NULL) { | 992 | if (r2t == NULL) { |
| 993 | kfifo_get(&tcp_task->r2tqueue, | 993 | kfifo_out(&tcp_task->r2tqueue, |
| 994 | (void *)&tcp_task->r2t, sizeof(void *)); | 994 | (void *)&tcp_task->r2t, sizeof(void *)); |
| 995 | r2t = tcp_task->r2t; | 995 | r2t = tcp_task->r2t; |
| 996 | } | 996 | } |
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c index 975e448cfcb9..8424b8606efb 100644 --- a/drivers/scsi/libsrp.c +++ b/drivers/scsi/libsrp.c | |||
| @@ -61,7 +61,7 @@ static int srp_iu_pool_alloc(struct srp_queue *q, size_t max, | |||
| 61 | kfifo_init(&q->queue, (void *) q->pool, max * sizeof(void *)); | 61 | kfifo_init(&q->queue, (void *) q->pool, max * sizeof(void *)); |
| 62 | 62 | ||
| 63 | for (i = 0, iue = q->items; i < max; i++) { | 63 | for (i = 0, iue = q->items; i < max; i++) { |
| 64 | kfifo_put(&q->queue, (void *) &iue, sizeof(void *)); | 64 | kfifo_in(&q->queue, (void *) &iue, sizeof(void *)); |
| 65 | iue->sbuf = ring[i]; | 65 | iue->sbuf = ring[i]; |
| 66 | iue++; | 66 | iue++; |
| 67 | } | 67 | } |
| @@ -163,7 +163,7 @@ struct iu_entry *srp_iu_get(struct srp_target *target) | |||
| 163 | { | 163 | { |
| 164 | struct iu_entry *iue = NULL; | 164 | struct iu_entry *iue = NULL; |
| 165 | 165 | ||
| 166 | kfifo_get_locked(&target->iu_queue.queue, (void *) &iue, | 166 | kfifo_out_locked(&target->iu_queue.queue, (void *) &iue, |
| 167 | sizeof(void *), &target->iu_queue.lock); | 167 | sizeof(void *), &target->iu_queue.lock); |
| 168 | if (!iue) | 168 | if (!iue) |
| 169 | return iue; | 169 | return iue; |
| @@ -176,7 +176,7 @@ EXPORT_SYMBOL_GPL(srp_iu_get); | |||
| 176 | 176 | ||
| 177 | void srp_iu_put(struct iu_entry *iue) | 177 | void srp_iu_put(struct iu_entry *iue) |
| 178 | { | 178 | { |
| 179 | kfifo_put_locked(&iue->target->iu_queue.queue, (void *) &iue, | 179 | kfifo_in_locked(&iue->target->iu_queue.queue, (void *) &iue, |
| 180 | sizeof(void *), &iue->target->iu_queue.lock); | 180 | sizeof(void *), &iue->target->iu_queue.lock); |
| 181 | } | 181 | } |
| 182 | EXPORT_SYMBOL_GPL(srp_iu_put); | 182 | EXPORT_SYMBOL_GPL(srp_iu_put); |
diff --git a/drivers/usb/host/fhci.h b/drivers/usb/host/fhci.h index 96aa787f208f..72dae1c5ab38 100644 --- a/drivers/usb/host/fhci.h +++ b/drivers/usb/host/fhci.h | |||
| @@ -510,14 +510,14 @@ static inline unsigned int cq_howmany(struct kfifo *kfifo) | |||
| 510 | 510 | ||
| 511 | static inline int cq_put(struct kfifo *kfifo, void *p) | 511 | static inline int cq_put(struct kfifo *kfifo, void *p) |
| 512 | { | 512 | { |
| 513 | return kfifo_put(kfifo, (void *)&p, sizeof(p)); | 513 | return kfifo_in(kfifo, (void *)&p, sizeof(p)); |
| 514 | } | 514 | } |
| 515 | 515 | ||
| 516 | static inline void *cq_get(struct kfifo *kfifo) | 516 | static inline void *cq_get(struct kfifo *kfifo) |
| 517 | { | 517 | { |
| 518 | void *p = NULL; | 518 | void *p = NULL; |
| 519 | 519 | ||
| 520 | kfifo_get(kfifo, (void *)&p, sizeof(p)); | 520 | kfifo_out(kfifo, (void *)&p, sizeof(p)); |
| 521 | return p; | 521 | return p; |
| 522 | } | 522 | } |
| 523 | 523 | ||
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index d0a2e464cacd..b0f1183755c9 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
| @@ -285,7 +285,7 @@ static int usb_serial_generic_write_start(struct usb_serial_port *port) | |||
| 285 | return 0; | 285 | return 0; |
| 286 | 286 | ||
| 287 | data = port->write_urb->transfer_buffer; | 287 | data = port->write_urb->transfer_buffer; |
| 288 | count = kfifo_get_locked(port->write_fifo, data, port->bulk_out_size, &port->lock); | 288 | count = kfifo_out_locked(port->write_fifo, data, port->bulk_out_size, &port->lock); |
| 289 | usb_serial_debug_data(debug, &port->dev, __func__, count, data); | 289 | usb_serial_debug_data(debug, &port->dev, __func__, count, data); |
| 290 | 290 | ||
| 291 | /* set up our urb */ | 291 | /* set up our urb */ |
| @@ -345,7 +345,7 @@ int usb_serial_generic_write(struct tty_struct *tty, | |||
| 345 | return usb_serial_multi_urb_write(tty, port, | 345 | return usb_serial_multi_urb_write(tty, port, |
| 346 | buf, count); | 346 | buf, count); |
| 347 | 347 | ||
| 348 | count = kfifo_put_locked(port->write_fifo, buf, count, &port->lock); | 348 | count = kfifo_in_locked(port->write_fifo, buf, count, &port->lock); |
| 349 | result = usb_serial_generic_write_start(port); | 349 | result = usb_serial_generic_write_start(port); |
| 350 | 350 | ||
| 351 | if (result >= 0) | 351 | if (result >= 0) |
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index a893acda3964..1b59c4a0e85f 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
| @@ -19,6 +19,25 @@ | |||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 | * | 20 | * |
| 21 | */ | 21 | */ |
| 22 | |||
| 23 | /* | ||
| 24 | * Howto porting drivers to the new generic fifo API: | ||
| 25 | * | ||
| 26 | * - Modify the declaration of the "struct kfifo *" object into a | ||
| 27 | * in-place "struct kfifo" object | ||
| 28 | * - Init the in-place object with kfifo_alloc() or kfifo_init() | ||
| 29 | * Note: The address of the in-place "struct kfifo" object must be | ||
| 30 | * passed as the first argument to this functions | ||
| 31 | * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get | ||
| 32 | * into kfifo_out | ||
| 33 | * - Replace the use of kfifo_put into kfifo_in_locked and kfifo_get | ||
| 34 | * into kfifo_out_locked | ||
| 35 | * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc | ||
| 36 | * must be passed now to the kfifo_in_locked and kfifo_out_locked | ||
| 37 | * as the last parameter. | ||
| 38 | * - All formerly name __kfifo_* functions has been renamed into kfifo_* | ||
| 39 | */ | ||
| 40 | |||
| 22 | #ifndef _LINUX_KFIFO_H | 41 | #ifndef _LINUX_KFIFO_H |
| 23 | #define _LINUX_KFIFO_H | 42 | #define _LINUX_KFIFO_H |
| 24 | 43 | ||
| @@ -37,10 +56,10 @@ extern void kfifo_init(struct kfifo *fifo, unsigned char *buffer, | |||
| 37 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, | 56 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, |
| 38 | gfp_t gfp_mask); | 57 | gfp_t gfp_mask); |
| 39 | extern void kfifo_free(struct kfifo *fifo); | 58 | extern void kfifo_free(struct kfifo *fifo); |
| 40 | extern unsigned int kfifo_put(struct kfifo *fifo, | 59 | extern __must_check unsigned int kfifo_in(struct kfifo *fifo, |
| 41 | const unsigned char *buffer, unsigned int len); | 60 | const unsigned char *from, unsigned int len); |
| 42 | extern unsigned int kfifo_get(struct kfifo *fifo, | 61 | extern __must_check unsigned int kfifo_out(struct kfifo *fifo, |
| 43 | unsigned char *buffer, unsigned int len); | 62 | unsigned char *to, unsigned int len); |
| 44 | 63 | ||
| 45 | /** | 64 | /** |
| 46 | * kfifo_reset - removes the entire FIFO contents | 65 | * kfifo_reset - removes the entire FIFO contents |
| @@ -65,7 +84,7 @@ static inline unsigned int kfifo_len(struct kfifo *fifo) | |||
| 65 | } | 84 | } |
| 66 | 85 | ||
| 67 | /** | 86 | /** |
| 68 | * kfifo_put_locked - puts some data into the FIFO using a spinlock for locking | 87 | * kfifo_in_locked - puts some data into the FIFO using a spinlock for locking |
| 69 | * @fifo: the fifo to be used. | 88 | * @fifo: the fifo to be used. |
| 70 | * @from: the data to be added. | 89 | * @from: the data to be added. |
| 71 | * @n: the length of the data to be added. | 90 | * @n: the length of the data to be added. |
| @@ -75,7 +94,7 @@ static inline unsigned int kfifo_len(struct kfifo *fifo) | |||
| 75 | * the FIFO depending on the free space, and returns the number of | 94 | * the FIFO depending on the free space, and returns the number of |
| 76 | * bytes copied. | 95 | * bytes copied. |
| 77 | */ | 96 | */ |
| 78 | static inline __must_check unsigned int kfifo_put_locked(struct kfifo *fifo, | 97 | static inline __must_check unsigned int kfifo_in_locked(struct kfifo *fifo, |
| 79 | const unsigned char *from, unsigned int n, spinlock_t *lock) | 98 | const unsigned char *from, unsigned int n, spinlock_t *lock) |
| 80 | { | 99 | { |
| 81 | unsigned long flags; | 100 | unsigned long flags; |
| @@ -83,7 +102,7 @@ static inline __must_check unsigned int kfifo_put_locked(struct kfifo *fifo, | |||
| 83 | 102 | ||
| 84 | spin_lock_irqsave(lock, flags); | 103 | spin_lock_irqsave(lock, flags); |
| 85 | 104 | ||
| 86 | ret = kfifo_put(fifo, from, n); | 105 | ret = kfifo_in(fifo, from, n); |
| 87 | 106 | ||
| 88 | spin_unlock_irqrestore(lock, flags); | 107 | spin_unlock_irqrestore(lock, flags); |
| 89 | 108 | ||
| @@ -91,7 +110,7 @@ static inline __must_check unsigned int kfifo_put_locked(struct kfifo *fifo, | |||
| 91 | } | 110 | } |
| 92 | 111 | ||
| 93 | /** | 112 | /** |
| 94 | * kfifo_get_locked - gets some data from the FIFO using a spinlock for locking | 113 | * kfifo_out_locked - gets some data from the FIFO using a spinlock for locking |
| 95 | * @fifo: the fifo to be used. | 114 | * @fifo: the fifo to be used. |
| 96 | * @to: where the data must be copied. | 115 | * @to: where the data must be copied. |
| 97 | * @n: the size of the destination buffer. | 116 | * @n: the size of the destination buffer. |
| @@ -100,7 +119,7 @@ static inline __must_check unsigned int kfifo_put_locked(struct kfifo *fifo, | |||
| 100 | * This function copies at most @len bytes from the FIFO into the | 119 | * This function copies at most @len bytes from the FIFO into the |
| 101 | * @to buffer and returns the number of copied bytes. | 120 | * @to buffer and returns the number of copied bytes. |
| 102 | */ | 121 | */ |
| 103 | static inline __must_check unsigned int kfifo_get_locked(struct kfifo *fifo, | 122 | static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo, |
| 104 | unsigned char *to, unsigned int n, spinlock_t *lock) | 123 | unsigned char *to, unsigned int n, spinlock_t *lock) |
| 105 | { | 124 | { |
| 106 | unsigned long flags; | 125 | unsigned long flags; |
| @@ -108,7 +127,7 @@ static inline __must_check unsigned int kfifo_get_locked(struct kfifo *fifo, | |||
| 108 | 127 | ||
| 109 | spin_lock_irqsave(lock, flags); | 128 | spin_lock_irqsave(lock, flags); |
| 110 | 129 | ||
| 111 | ret = kfifo_get(fifo, to, n); | 130 | ret = kfifo_out(fifo, to, n); |
| 112 | 131 | ||
| 113 | /* | 132 | /* |
| 114 | * optimization: if the FIFO is empty, set the indices to 0 | 133 | * optimization: if the FIFO is empty, set the indices to 0 |
diff --git a/kernel/kfifo.c b/kernel/kfifo.c index 963ffde4af1a..d659442e73f2 100644 --- a/kernel/kfifo.c +++ b/kernel/kfifo.c | |||
| @@ -100,20 +100,20 @@ void kfifo_free(struct kfifo *fifo) | |||
| 100 | EXPORT_SYMBOL(kfifo_free); | 100 | EXPORT_SYMBOL(kfifo_free); |
| 101 | 101 | ||
| 102 | /** | 102 | /** |
| 103 | * kfifo_put - puts some data into the FIFO, no locking version | 103 | * kfifo_in - puts some data into the FIFO |
| 104 | * @fifo: the fifo to be used. | 104 | * @fifo: the fifo to be used. |
| 105 | * @buffer: the data to be added. | 105 | * @from: the data to be added. |
| 106 | * @len: the length of the data to be added. | 106 | * @len: the length of the data to be added. |
| 107 | * | 107 | * |
| 108 | * This function copies at most @len bytes from the @buffer into | 108 | * This function copies at most @len bytes from the @from buffer into |
| 109 | * the FIFO depending on the free space, and returns the number of | 109 | * the FIFO depending on the free space, and returns the number of |
| 110 | * bytes copied. | 110 | * bytes copied. |
| 111 | * | 111 | * |
| 112 | * Note that with only one concurrent reader and one concurrent | 112 | * Note that with only one concurrent reader and one concurrent |
| 113 | * writer, you don't need extra locking to use these functions. | 113 | * writer, you don't need extra locking to use these functions. |
| 114 | */ | 114 | */ |
| 115 | unsigned int kfifo_put(struct kfifo *fifo, | 115 | unsigned int kfifo_in(struct kfifo *fifo, |
| 116 | const unsigned char *buffer, unsigned int len) | 116 | const unsigned char *from, unsigned int len) |
| 117 | { | 117 | { |
| 118 | unsigned int l; | 118 | unsigned int l; |
| 119 | 119 | ||
| @@ -128,10 +128,10 @@ unsigned int kfifo_put(struct kfifo *fifo, | |||
| 128 | 128 | ||
| 129 | /* first put the data starting from fifo->in to buffer end */ | 129 | /* first put the data starting from fifo->in to buffer end */ |
| 130 | l = min(len, fifo->size - (fifo->in & (fifo->size - 1))); | 130 | l = min(len, fifo->size - (fifo->in & (fifo->size - 1))); |
| 131 | memcpy(fifo->buffer + (fifo->in & (fifo->size - 1)), buffer, l); | 131 | memcpy(fifo->buffer + (fifo->in & (fifo->size - 1)), from, l); |
| 132 | 132 | ||
| 133 | /* then put the rest (if any) at the beginning of the buffer */ | 133 | /* then put the rest (if any) at the beginning of the buffer */ |
| 134 | memcpy(fifo->buffer, buffer + l, len - l); | 134 | memcpy(fifo->buffer, from + l, len - l); |
| 135 | 135 | ||
| 136 | /* | 136 | /* |
| 137 | * Ensure that we add the bytes to the kfifo -before- | 137 | * Ensure that we add the bytes to the kfifo -before- |
| @@ -144,22 +144,22 @@ unsigned int kfifo_put(struct kfifo *fifo, | |||
| 144 | 144 | ||
| 145 | return len; | 145 | return len; |
| 146 | } | 146 | } |
| 147 | EXPORT_SYMBOL(kfifo_put); | 147 | EXPORT_SYMBOL(kfifo_in); |
| 148 | 148 | ||
| 149 | /** | 149 | /** |
| 150 | * kfifo_get - gets some data from the FIFO, no locking version | 150 | * kfifo_out - gets some data from the FIFO |
| 151 | * @fifo: the fifo to be used. | 151 | * @fifo: the fifo to be used. |
| 152 | * @buffer: where the data must be copied. | 152 | * @to: where the data must be copied. |
| 153 | * @len: the size of the destination buffer. | 153 | * @len: the size of the destination buffer. |
| 154 | * | 154 | * |
| 155 | * This function copies at most @len bytes from the FIFO into the | 155 | * This function copies at most @len bytes from the FIFO into the |
| 156 | * @buffer and returns the number of copied bytes. | 156 | * @to buffer and returns the number of copied bytes. |
| 157 | * | 157 | * |
| 158 | * Note that with only one concurrent reader and one concurrent | 158 | * Note that with only one concurrent reader and one concurrent |
| 159 | * writer, you don't need extra locking to use these functions. | 159 | * writer, you don't need extra locking to use these functions. |
| 160 | */ | 160 | */ |
| 161 | unsigned int kfifo_get(struct kfifo *fifo, | 161 | unsigned int kfifo_out(struct kfifo *fifo, |
| 162 | unsigned char *buffer, unsigned int len) | 162 | unsigned char *to, unsigned int len) |
| 163 | { | 163 | { |
| 164 | unsigned int l; | 164 | unsigned int l; |
| 165 | 165 | ||
| @@ -174,10 +174,10 @@ unsigned int kfifo_get(struct kfifo *fifo, | |||
| 174 | 174 | ||
| 175 | /* first get the data from fifo->out until the end of the buffer */ | 175 | /* first get the data from fifo->out until the end of the buffer */ |
| 176 | l = min(len, fifo->size - (fifo->out & (fifo->size - 1))); | 176 | l = min(len, fifo->size - (fifo->out & (fifo->size - 1))); |
| 177 | memcpy(buffer, fifo->buffer + (fifo->out & (fifo->size - 1)), l); | 177 | memcpy(to, fifo->buffer + (fifo->out & (fifo->size - 1)), l); |
| 178 | 178 | ||
| 179 | /* then get the rest (if any) from the beginning of the buffer */ | 179 | /* then get the rest (if any) from the beginning of the buffer */ |
| 180 | memcpy(buffer + l, fifo->buffer, len - l); | 180 | memcpy(to + l, fifo->buffer, len - l); |
| 181 | 181 | ||
| 182 | /* | 182 | /* |
| 183 | * Ensure that we remove the bytes from the kfifo -before- | 183 | * Ensure that we remove the bytes from the kfifo -before- |
| @@ -190,4 +190,4 @@ unsigned int kfifo_get(struct kfifo *fifo, | |||
| 190 | 190 | ||
| 191 | return len; | 191 | return len; |
| 192 | } | 192 | } |
| 193 | EXPORT_SYMBOL(kfifo_get); | 193 | EXPORT_SYMBOL(kfifo_out); |
diff --git a/net/dccp/probe.c b/net/dccp/probe.c index 9ef36849edd7..a1362dc8abb0 100644 --- a/net/dccp/probe.c +++ b/net/dccp/probe.c | |||
| @@ -67,7 +67,7 @@ static void printl(const char *fmt, ...) | |||
| 67 | len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args); | 67 | len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args); |
| 68 | va_end(args); | 68 | va_end(args); |
| 69 | 69 | ||
| 70 | kfifo_put_locked(&dccpw.fifo, tbuf, len, &dccpw.lock); | 70 | kfifo_in_locked(&dccpw.fifo, tbuf, len, &dccpw.lock); |
| 71 | wake_up(&dccpw.wait); | 71 | wake_up(&dccpw.wait); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| @@ -135,7 +135,7 @@ static ssize_t dccpprobe_read(struct file *file, char __user *buf, | |||
| 135 | if (error) | 135 | if (error) |
| 136 | goto out_free; | 136 | goto out_free; |
| 137 | 137 | ||
| 138 | cnt = kfifo_get_locked(&dccpw.fifo, tbuf, len, &dccpw.lock); | 138 | cnt = kfifo_out_locked(&dccpw.fifo, tbuf, len, &dccpw.lock); |
| 139 | error = copy_to_user(buf, tbuf, cnt) ? -EFAULT : 0; | 139 | error = copy_to_user(buf, tbuf, cnt) ? -EFAULT : 0; |
| 140 | 140 | ||
| 141 | out_free: | 141 | out_free: |
