From patchwork Tue May 1 17:56:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kelly X-Patchwork-Id: 10374269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C43360384 for ; Tue, 1 May 2018 17:57:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0C1C28CF1 for ; Tue, 1 May 2018 17:57:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E545728D21; Tue, 1 May 2018 17:57:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81F1528CF1 for ; Tue, 1 May 2018 17:57:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756364AbeEAR5J (ORCPT ); Tue, 1 May 2018 13:57:09 -0400 Received: from mail-sn1nam01on0080.outbound.protection.outlook.com ([104.47.32.80]:18380 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756359AbeEAR5I (ORCPT ); Tue, 1 May 2018 13:57:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uievolution.onmicrosoft.com; s=selector1-xevo-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=X6m3PDbsjQM2i5atqacFE85q2/eYUlnkPUugAhGWSV0=; b=ArkhoDeiMJDE3R8SfBn/230OsO9AEOdnEEt5ixkmWgEdcbU9WtWRCryUJAQRE/IIshGMXzyHOycQLvt/Ojzsj3lOFtJQS5TiS4OKBp0FR+HV4CGaVFaBiV1DDxfHrd0vRcjMwJDnfdI/3oyGiBPm68jwk3EUXxZvPgioEkyxwAA= Received: from columbia.corp.xevo.com (65.122.179.226) by MW2PR0102MB3419.prod.exchangelabs.com (2603:10b6:302:3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.18; Tue, 1 May 2018 17:57:06 +0000 From: Martin Kelly To: linux-iio@vger.kernel.org Cc: Jean-Baptiste Maneyrol , Martin Kelly Subject: [PATCH 2/2] iio: imu: inv_mpu6050: make loop a do-while Date: Tue, 1 May 2018 10:56:42 -0700 Message-Id: <20180501175642.8551-3-mkelly@xevo.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180501175642.8551-1-mkelly@xevo.com> References: <20180501175642.8551-1-mkelly@xevo.com> MIME-Version: 1.0 X-Originating-IP: [65.122.179.226] X-ClientProxiedBy: MWHPR13CA0013.namprd13.prod.outlook.com (2603:10b6:300:16::23) To MW2PR0102MB3419.prod.exchangelabs.com (2603:10b6:302:3::12) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(2017052603328)(7153060)(7193020); SRVR:MW2PR0102MB3419; X-Microsoft-Exchange-Diagnostics: 1; MW2PR0102MB3419; 3:J3Eos8XCOaDYl1gViKRM3UGmt6md98ayc3seOWGTodpG8AmLJf6K488ChG31Ukfk4VAaOAgcQEGY8drub38HDKjcZJR5m5YNGk82f4pdGly7iwiPDuANS7acRxbk9oK2peBrQRlE16gdD74/ltDbQnAje4YPCQTJo4ERXdvxxtZYYq+XjZkRkatYNWGhbwM6SFsujJlGpyhC8iqZJDsVtUhucA0TR+/YSIdiOX96pPGlzpzdB/tk8GO/M8w23oup; 25:fwhcrVdtNv7XA2UvygKP6M59v/ZJc/dV7vDrT1jy/30TLZ5ZaLD+DP6nX2DBHC/4B5r+qaBSozqdcCSkJtmulVU3frgZ1InKJulMB71musQl0NFLwaAbYUW8YJw122YbPYqjIFHV1lG/brTVSDVzo2fwGOjxgwtCbs659a1+eMbm5pNEN10kgdc8vraEh7Aza5rlJdfkw9wEfORpYvX2KAtm1yq667XHCnMcKfWjFxx9TgeYRm17iQ1qbDiRs0URHSFx4qDUYPxnZ9bqz8hm9APZU8xm6jucEhet6BVvh8vZlMTas+R9kWxqxungQlzxV34AvYKMRdRvkVZpSeP0aA==; 31:xJbgNlqcdI/zmt/CrvdRW9MZZEgxRcjqaYIE5/7q//JhPQCBFeogi7fDq65cucz7zH7Rm58ul/5N+xVff/HukIz+VkXCudzVnFZxopmIDw1iqXUK34poTMJ67g/2+qajmbT9znJ52ikGmVP+7pNJRqN+cdjgtPG1S4n5yUFRkDXh3loJ4UtEz+P0UGZ/CEYQ9OMXV83sCD5lFVIT4kw+ZIL0RliQfiLhNTEmpsPSqQ8= X-MS-TrafficTypeDiagnostic: MW2PR0102MB3419: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=mkelly@xevo.com; X-Microsoft-Exchange-Diagnostics: 1; MW2PR0102MB3419; 20:ez/iIsDg6MwCSyr86aPX6djXjibhjS/HrumdP+FAu6Bqi4+bYmsXxwlj6t/jeumy5DthoHKBThjwKzatikjvOnRYt/XbKYvJPoy2rds7ICu89p1t/M+8dGgTju5FdQImvL2iQ7UuNDdea70aLa+s7tIhYHYjPvV3X8K61uCBgPoUdzvsLkO2VxHqrOSwCHBE8MRhS2Nm/67P9O4q6eik+4lPs8KhFTGvM7dMKv6RDraknmZsWAjhpPVxLbR9k2n0wswwL/0flzgXav+olC+Cteyjh0jy+p846vhVvSrlw8PXa21BOnebxkL7Z521KbolfFZYjijLfHG8TWkG7sr6cVDFBcPRr2UQS6dxUVO+6qEWVijTn6mrPoVPqWtp6VhmWcg+OnXK/8oeHhMJaB/Sn42y8DWKHNAg739buLhfueux1oMooS6fudgLmn2F406rQ+f3crXweR1JPQoLNjLumOEaVJ9vMYLgMYwmSrGRrVVQ0YCRbaN3M0I2tmzoA8Ey; 4:4Xxo9JLgHYXoGDVZniS6bEMhP5rq7E9QZtE60HwdXYcmeoJWNXYeokm/i2xcMQI6MQTp53VtvVv14dESrIYiWzgg4YOgU6eVa+L/7q0x4y1Y4AglIs7Drdkm2AGeikHE/Nu6AJh+/J/HABLnXMJHiYlvE88bS8zzjWAq9qEtFZ+tMbH2aIS24tLE9caVd4tdByGSCj+J08PRwC2q6HdeyYgiQhX6b8BUUjmrChyilWSEhThdByAgGO5OENKPythfL5H6Elb8hj9iwXoXra9PVg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(3002001)(6041310)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:MW2PR0102MB3419; BCL:0; PCL:0; RULEID:; SRVR:MW2PR0102MB3419; X-Forefront-PRVS: 06592CCE58 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(396003)(366004)(376002)(39840400004)(39380400002)(189003)(199004)(8676002)(59450400001)(51416003)(16586007)(316002)(5660300001)(386003)(11346002)(86362001)(4326008)(107886003)(97736004)(36756003)(305945005)(956004)(2616005)(486006)(16526019)(446003)(6916009)(6666003)(26005)(76176011)(7736002)(476003)(186003)(52116002)(54906003)(2906002)(7696005)(66066001)(68736007)(2351001)(2361001)(48376002)(6116002)(50466002)(478600001)(106356001)(105586002)(81166006)(81156014)(1076002)(6486002)(8936002)(25786009)(3846002)(53936002)(47776003)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:MW2PR0102MB3419; H:columbia.corp.xevo.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: xevo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MW2PR0102MB3419; 23:Itcv6rHPXE88CmeiMhFfdUWIXxYE1KNs+Ymsr4a?= =?us-ascii?Q?2tpnTAnZMpA6FkdxTggR8ftsuwpTQBBqJDtvCNuzYT8eZ+gbA9MsPhdib6iX?= =?us-ascii?Q?KmSjKi2rp1TRwlpXcCvvQyupeqDNs+J+ONTYAyWoSXVivqpdtkta5QPG5t/d?= =?us-ascii?Q?JsIh8e/Gj1rlS2i+xR4+IZaevR9WYhEXTna1fcPBZ0K1o5iT2eSIUIS9nQUI?= =?us-ascii?Q?VYK2oM4b7p9S3nzo8mc09YWAu1lr+zvKPFuQs2twD8khyKzinP1H+vD557mJ?= =?us-ascii?Q?mBGpNObxQgWqXGhXWiymEZpve/V5FRnQUnJmK2SmMeNu36SHm9tjYXjoqbZv?= =?us-ascii?Q?Rs/pn3q/8akvuiI7LFv6WWqmAW7iZd1l5utBNw2kIJslKbdKE9F7ZogC2LwU?= =?us-ascii?Q?ktEO9MK8J2SJQn92hrYNKlB1O5NKbiok0XPXBuX6KvChzlu6X/EvSzgcHFys?= =?us-ascii?Q?xXzsZKzcxvveh6Ea01CBf91xbephMo+8tN9fLKS6ClbLa9vk1pjp48DhRRVO?= =?us-ascii?Q?YE2fMEqK4vxwf6Lt/WGpKpJrHPpxinMy/L8G+UyKRC7hQdcLJDGMyGSxqmG+?= =?us-ascii?Q?sbBHDKxKv0+uhQisIsZ7iuSjvrU0w6pWUD7isg9Qkk/CRjxIsIcFcOIOLMWj?= =?us-ascii?Q?uQssDT6MC7mcTMc49yoTYt9l14mdJmJEm01zKpGS0aZekqvcRdNSSaKaCwXU?= =?us-ascii?Q?0tRYifmTlhxiaAsLBB2sTItSyGOZDr50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lom5dRjMxJH2p5dY5gSzMEnxKJAKrUQ3arrJ2JCjLgPoDC1BT/NwzzZgxH/ND8eEVW5e0uIiXCJvNeoidgHQWMp/fwLlW//VytaaXZXLZVCV3qLsq1Z1eFI12ExO2YS4HXkwqeiPKtupnuIwEIe6VmeCgt/Xa7X8948Z6GHPz+Rum5/tZTO3khZHpvoMJ1as5aA3oKeZkCTur/actVQIYyE1DSOIAg9KQI1hG4GNczcVp/topAF0f1c7saNlxRFn2LbGS1daOvh/JQxLep+DPi58zvU8wDfGiaCFnavNZD8i6fG3pc/UyCQ8fHYH8Nuom5JtfJPYGryr4QPkomtwAuVui9IPhhcv0mr+kks6q6J7Xoz5pA==; 5:ZzjAswZ2rjoLi8lrBQY/0IqyTtcC5q61XvLndHGKSXI2izwPZ/z01NQIZekv/vs8WgUCohjr0QnqpoaSqhWleBVPU7QS09VqqFkhgmRqnc0mwGW7BvOwO1puYNp2bk7K6V36uBlQ1yTzZEDjlq3Md4Y+5xiN0dub7RYBI7HgtPU=; 24:dyUs8Lf87vVP+T4RXh1rwx1ZmQ5l6cus0Ml2ZlBR4K+jepZ8fZbXimAaD9ly/zKp3BOCqFb88t/1fGnUzJA8sEO/NYNoUAQN9XGYGKQFcy8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MW2PR0102MB3419; 7:Fteu2/vte8hLcuffo09nl5Smdm4wCvyV4U+HzAs0yIxvxMQVX7wnSIzl5Hi/uLHslciwriX/+/S8g1SsfXDXLcg6Qgi8uc2vQFdyI9z0msfDSNiAtCkxmwov4GdwC7dP97Or21XS2tADKOF/d0gQAogZHTdUiliRWS4lEosKydGBfm/MfVq8Kxl1XcEtFrN+P6/E+jDAPbxHffT+Jc1Gd6+wAwfJtj+8HFMZZChRFsnonEs6I0+ja/udYG4oCIth X-MS-Office365-Filtering-Correlation-Id: 9b15dcc0-29fa-4d08-bb78-08d5af8cf41c X-OriginatorOrg: xevo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2018 17:57:06.8286 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b15dcc0-29fa-4d08-bb78-08d5af8cf41c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e0a7ca1f-2458-4cd6-a7c7-d733c07495ab X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR0102MB3419 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Prior to this loop, we check if fifo_count < bytes_per_datum and bail if so. This means that when we hit the loop, we know that fifo_count >= bytes_per_datum, so the check is unneeded and we can turn the loop into a do-while for a slight performance improvement. Signed-off-by: Martin Kelly --- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c index 0cb7c20100ca..11593deaaebd 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c @@ -174,7 +174,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) if (kfifo_len(&st->timestamps) > fifo_count / bytes_per_datum + INV_MPU6050_TIME_STAMP_TOR) goto flush_fifo; - while (fifo_count >= bytes_per_datum) { + do { result = regmap_bulk_read(st->map, st->reg->fifo_r_w, data, bytes_per_datum); if (result) @@ -188,7 +188,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) iio_push_to_buffers_with_timestamp(indio_dev, data, timestamp); fifo_count -= bytes_per_datum; - } + } while (fifo_count >= bytes_per_datum); end_session: mutex_unlock(&st->lock);