Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7acd72eb authored by Stefani Seibold's avatar Stefani Seibold Committed by Linus Torvalds
Browse files

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: default avatarStefani Seibold <stefani@seibold.net>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Acked-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: default avatarAndi Kleen <ak@linux.intel.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e64c026d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -798,7 +798,7 @@ static int send_data(enum port_type index, struct nozomi *dc)
	struct tty_struct *tty = tty_port_tty_get(&port->port);

	/* Get data from tty and place in buf for now */
	size = kfifo_get(&port->fifo_ul, dc->send_buf,
	size = kfifo_out(&port->fifo_ul, dc->send_buf,
			   ul_size < SEND_BUF_MAX ? ul_size : SEND_BUF_MAX);

	if (size == 0) {
@@ -1672,7 +1672,7 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,
		goto exit;
	}

	rval = kfifo_put(&port->fifo_ul, (unsigned char *)buffer, count);
	rval = kfifo_in(&port->fifo_ul, (unsigned char *)buffer, count);

	/* notify card */
	if (unlikely(dc == NULL)) {
+4 −4
Original line number Diff line number Diff line
@@ -777,7 +777,7 @@ static void input_keyrelease(struct work_struct *work)
{
	struct sonypi_keypress kp;

	while (kfifo_get_locked(&sonypi_device.input_fifo, (unsigned char *)&kp,
	while (kfifo_out_locked(&sonypi_device.input_fifo, (unsigned char *)&kp,
			 sizeof(kp), &sonypi_device.input_fifo_lock)
			== sizeof(kp)) {
		msleep(10);
@@ -828,7 +828,7 @@ static void sonypi_report_input_event(u8 event)
	if (kp.dev) {
		input_report_key(kp.dev, kp.key, 1);
		input_sync(kp.dev);
		kfifo_put_locked(&sonypi_device.input_fifo,
		kfifo_in_locked(&sonypi_device.input_fifo,
			(unsigned char *)&kp, sizeof(kp),
			&sonypi_device.input_fifo_lock);
		schedule_work(&sonypi_device.input_work);
@@ -882,7 +882,7 @@ found:
		acpi_bus_generate_proc_event(sonypi_acpi_device, 1, event);
#endif

	kfifo_put_locked(&sonypi_device.fifo, (unsigned char *)&event,
	kfifo_in_locked(&sonypi_device.fifo, (unsigned char *)&event,
			sizeof(event), &sonypi_device.fifo_lock);
	kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN);
	wake_up_interruptible(&sonypi_device.fifo_proc_list);
@@ -932,7 +932,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
		return ret;

	while (ret < count &&
	       (kfifo_get_locked(&sonypi_device.fifo, &c, sizeof(c),
	       (kfifo_out_locked(&sonypi_device.fifo, &c, sizeof(c),
				 &sonypi_device.fifo_lock) == sizeof(c))) {
		if (put_user(c, buf++))
			return -EFAULT;
+8 −8
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ static int __cxio_init_resource_fifo(struct kfifo *fifo,
		return -ENOMEM;

	for (i = 0; i < skip_low + skip_high; i++)
		kfifo_put(fifo, (unsigned char *) &entry, sizeof(u32));
		kfifo_in(fifo, (unsigned char *) &entry, sizeof(u32));
	if (random) {
		j = 0;
		random_bytes = random32();
@@ -71,22 +71,22 @@ static int __cxio_init_resource_fifo(struct kfifo *fifo,
				random_bytes = random32();
			}
			idx = (random_bytes >> (j * 2)) & 0xF;
			kfifo_put(fifo,
			kfifo_in(fifo,
				(unsigned char *) &rarray[idx],
				sizeof(u32));
			rarray[idx] = i;
			j++;
		}
		for (i = 0; i < RANDOM_SIZE; i++)
			kfifo_put(fifo,
			kfifo_in(fifo,
				(unsigned char *) &rarray[i],
				sizeof(u32));
	} else
		for (i = skip_low; i < nr - skip_high; i++)
			kfifo_put(fifo, (unsigned char *) &i, sizeof(u32));
			kfifo_in(fifo, (unsigned char *) &i, sizeof(u32));

	for (i = 0; i < skip_low + skip_high; i++)
		kfifo_get_locked(fifo, (unsigned char *) &entry,
		kfifo_out_locked(fifo, (unsigned char *) &entry,
				sizeof(u32), fifo_lock);
	return 0;
}
@@ -119,7 +119,7 @@ static int cxio_init_qpid_fifo(struct cxio_rdev *rdev_p)

	for (i = 16; i < T3_MAX_NUM_QP; i++)
		if (!(i & rdev_p->qpmask))
			kfifo_put(&rdev_p->rscp->qpid_fifo,
			kfifo_in(&rdev_p->rscp->qpid_fifo,
				    (unsigned char *) &i, sizeof(u32));
	return 0;
}
@@ -180,7 +180,7 @@ tpt_err:
static u32 cxio_hal_get_resource(struct kfifo *fifo, spinlock_t * lock)
{
	u32 entry;
	if (kfifo_get_locked(fifo, (unsigned char *) &entry, sizeof(u32), lock))
	if (kfifo_out_locked(fifo, (unsigned char *) &entry, sizeof(u32), lock))
		return entry;
	else
		return 0;	/* fifo emptry */
@@ -190,7 +190,7 @@ static void cxio_hal_put_resource(struct kfifo *fifo, spinlock_t * lock,
		u32 entry)
{
	BUG_ON(
	kfifo_put_locked(fifo, (unsigned char *) &entry, sizeof(u32), lock)
	kfifo_in_locked(fifo, (unsigned char *) &entry, sizeof(u32), lock)
	== 0);
}

+8 −8
Original line number Diff line number Diff line
@@ -800,7 +800,7 @@ again:
		return IRQ_HANDLED;

	if (meye.mchip_mode == MCHIP_HIC_MODE_CONT_OUT) {
		if (kfifo_get_locked(&meye.grabq, (unsigned char *)&reqnr,
		if (kfifo_out_locked(&meye.grabq, (unsigned char *)&reqnr,
			      sizeof(int), &meye.grabq_lock) != sizeof(int)) {
			mchip_free_frame();
			return IRQ_HANDLED;
@@ -811,7 +811,7 @@ again:
		meye.grab_buffer[reqnr].state = MEYE_BUF_DONE;
		do_gettimeofday(&meye.grab_buffer[reqnr].timestamp);
		meye.grab_buffer[reqnr].sequence = sequence++;
		kfifo_put_locked(&meye.doneq, (unsigned char *)&reqnr,
		kfifo_in_locked(&meye.doneq, (unsigned char *)&reqnr,
				sizeof(int), &meye.doneq_lock);
		wake_up_interruptible(&meye.proc_list);
	} else {
@@ -821,7 +821,7 @@ again:
			mchip_free_frame();
			goto again;
		}
		if (kfifo_get_locked(&meye.grabq, (unsigned char *)&reqnr,
		if (kfifo_out_locked(&meye.grabq, (unsigned char *)&reqnr,
			      sizeof(int), &meye.grabq_lock) != sizeof(int)) {
			mchip_free_frame();
			goto again;
@@ -832,7 +832,7 @@ again:
		meye.grab_buffer[reqnr].state = MEYE_BUF_DONE;
		do_gettimeofday(&meye.grab_buffer[reqnr].timestamp);
		meye.grab_buffer[reqnr].sequence = sequence++;
		kfifo_put_locked(&meye.doneq, (unsigned char *)&reqnr,
		kfifo_in_locked(&meye.doneq, (unsigned char *)&reqnr,
				sizeof(int), &meye.doneq_lock);
		wake_up_interruptible(&meye.proc_list);
	}
@@ -935,7 +935,7 @@ static int meyeioc_qbuf_capt(int *nb)
		mchip_cont_compression_start();

	meye.grab_buffer[*nb].state = MEYE_BUF_USING;
	kfifo_put_locked(&meye.grabq, (unsigned char *)nb, sizeof(int),
	kfifo_in_locked(&meye.grabq, (unsigned char *)nb, sizeof(int),
			 &meye.grabq_lock);
	mutex_unlock(&meye.lock);

@@ -968,7 +968,7 @@ static int meyeioc_sync(struct file *file, void *fh, int *i)
		/* fall through */
	case MEYE_BUF_DONE:
		meye.grab_buffer[*i].state = MEYE_BUF_UNUSED;
		kfifo_get_locked(&meye.doneq, (unsigned char *)&unused,
		kfifo_out_locked(&meye.doneq, (unsigned char *)&unused,
				sizeof(int), &meye.doneq_lock);
	}
	*i = meye.grab_buffer[*i].size;
@@ -1456,7 +1456,7 @@ static int vidioc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
	buf->flags |= V4L2_BUF_FLAG_QUEUED;
	buf->flags &= ~V4L2_BUF_FLAG_DONE;
	meye.grab_buffer[buf->index].state = MEYE_BUF_USING;
	kfifo_put_locked(&meye.grabq, (unsigned char *)&buf->index,
	kfifo_in_locked(&meye.grabq, (unsigned char *)&buf->index,
			sizeof(int), &meye.grabq_lock);
	mutex_unlock(&meye.lock);

@@ -1483,7 +1483,7 @@ static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
		return -EINTR;
	}

	if (!kfifo_get_locked(&meye.doneq, (unsigned char *)&reqnr,
	if (!kfifo_out_locked(&meye.doneq, (unsigned char *)&reqnr,
		       sizeof(int), &meye.doneq_lock)) {
		mutex_unlock(&meye.lock);
		return -EBUSY;
+3 −2
Original line number Diff line number Diff line
@@ -513,7 +513,8 @@ static int lbs_thread(void *data)
		spin_lock_irq(&priv->driver_lock);
		while (kfifo_len(&priv->event_fifo)) {
			u32 event;
			kfifo_get(&priv->event_fifo, (unsigned char *) &event,

			kfifo_out(&priv->event_fifo, (unsigned char *) &event,
				sizeof(event));
			spin_unlock_irq(&priv->driver_lock);
			lbs_process_event(priv, event);
@@ -1175,7 +1176,7 @@ void lbs_queue_event(struct lbs_private *priv, u32 event)
	if (priv->psstate == PS_STATE_SLEEP)
		priv->psstate = PS_STATE_AWAKE;

	kfifo_put(&priv->event_fifo, (unsigned char *) &event, sizeof(u32));
	kfifo_in(&priv->event_fifo, (unsigned char *) &event, sizeof(u32));

	wake_up_interruptible(&priv->waitq);

Loading