From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id D3D871C0BE0 for ; Tue, 22 Dec 2015 09:54:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id D028A94CE6 for ; Tue, 22 Dec 2015 09:54:18 +0000 (UTC) Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1d2IwXhK6b8c for ; Tue, 22 Dec 2015 09:54:17 +0000 (UTC) Received: from email.microchip.com (exsmtp03.microchip.com [198.175.253.49]) by hemlock.osuosl.org (Postfix) with ESMTPS id 726B394D28 for ; Tue, 22 Dec 2015 09:54:17 +0000 (UTC) From: Christian Gromm Subject: [PATCH 01/28] staging: most: remove unnecessary keep_mbo variable Date: Tue, 22 Dec 2015 10:52:42 +0100 Message-ID: <1450777989-5551-2-git-send-email-christian.gromm@microchip.com> In-Reply-To: <1450777989-5551-1-git-send-email-christian.gromm@microchip.com> References: <1450777989-5551-1-git-send-email-christian.gromm@microchip.com> MIME-Version: 1.0 List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" To: gregkh@linuxfoundation.org Cc: Christian Gromm , driverdev-devel@linuxdriverproject.org The MBO pointer stacked_mbo and the boolean variable keep_mbo are always changed together and therefore provide the same information. This patch removes keep_mbo and uses stacked_mbo instead. Signed-off-by: Christian Gromm --- This patch has been resent on behalf of Greg Kroah-Hartman drivers/staging/most/aim-cdev/cdev.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c index dc3fb25..6f70ed7 100644 --- a/drivers/staging/most/aim-cdev/cdev.c +++ b/drivers/staging/most/aim-cdev/cdev.c @@ -39,7 +39,6 @@ struct aim_channel { struct most_channel_config *cfg; unsigned int channel_id; dev_t devno; - bool keep_mbo; unsigned int mbo_offs; struct mbo *stacked_mbo; DECLARE_KFIFO_PTR(fifo, typeof(struct mbo *)); @@ -136,7 +135,7 @@ static int aim_close(struct inode *inode, struct file *filp) while (kfifo_out((struct kfifo *)&channel->fifo, &mbo, 1)) most_put_mbo(mbo); - if (channel->keep_mbo) + if (channel->stacked_mbo) most_put_mbo(channel->stacked_mbo); ret = most_stop_channel(channel->iface, channel->channel_id, &cdev_aim); atomic_dec(&channel->access_ref); @@ -227,9 +226,8 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset) struct mbo *mbo; struct aim_channel *channel = filp->private_data; - if (channel->keep_mbo) { + if (channel->stacked_mbo) { mbo = channel->stacked_mbo; - channel->keep_mbo = false; goto start_copy; } while ((!kfifo_out(&channel->fifo, &mbo, 1)) && (channel->dev)) { @@ -249,9 +247,6 @@ start_copy: return -EIO; } - if (count < mbo->processed_length) - channel->keep_mbo = true; - proc_len = min((int)count, (int)(mbo->processed_length - channel->mbo_offs)); @@ -261,12 +256,13 @@ start_copy: retval = not_copied ? proc_len - not_copied : proc_len; - if (channel->keep_mbo) { + if (count < mbo->processed_length) { channel->mbo_offs = retval; channel->stacked_mbo = mbo; } else { most_put_mbo(mbo); channel->mbo_offs = 0; + channel->stacked_mbo = NULL; } mutex_unlock(&channel->io_mutex); return retval; -- 1.7.9.5 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel