From patchwork Thu Nov 24 11:04:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gao Pan X-Patchwork-Id: 9445269 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 BBB1F6071C for ; Thu, 24 Nov 2016 11:22:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A46F327CAF for ; Thu, 24 Nov 2016 11:22:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9930227D7F; Thu, 24 Nov 2016 11:22:29 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, 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 0B34827CAF for ; Thu, 24 Nov 2016 11:22:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965060AbcKXLWV (ORCPT ); Thu, 24 Nov 2016 06:22:21 -0500 Received: from mail-db5eur01on0082.outbound.protection.outlook.com ([104.47.2.82]:11776 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964851AbcKXLWS (ORCPT ); Thu, 24 Nov 2016 06:22:18 -0500 X-Greylist: delayed 35138 seconds by postgrey-1.27 at vger.kernel.org; Thu, 24 Nov 2016 06:22:18 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=+P3eK6oebSmlm9JzTNTmFaBRFDwLJHhCtN5SniP3NJg=; b=QD/AZRfmim6wR4VT6Z/WCGdyxyQqLE0lhKFPbEKhfgQRH03oTaGmovaVlMnr4pbupJj/D3ohbED1cwNgJu7vWfQEqPGvXDuYmtpP2KsYE/RmtmyXSCB8Glofo20bs48+DZWRv0ISnS+kC5z9AWioAWoM3mNSgtpe7AAZV4P1KJo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pandy.gao@nxp.com; Received: from b54642-OptiPlex-3020.ap.freescale.net (199.59.225.131) by AM4PR0401MB1778.eurprd04.prod.outlook.com (10.165.244.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.10; Thu, 24 Nov 2016 11:05:57 +0000 From: Gao Pan To: CC: , , , Subject: [Patch V1 1/3] spi: imx: replace schedule() with cond_resched() Date: Thu, 24 Nov 2016 19:04:42 +0800 Message-ID: <1479985484-6641-1-git-send-email-pandy.gao@nxp.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [199.59.225.131] X-ClientProxiedBy: SG2PR01CA0040.apcprd01.prod.exchangelabs.com (10.165.9.178) To AM4PR0401MB1778.eurprd04.prod.outlook.com (10.165.244.148) X-MS-Office365-Filtering-Correlation-Id: 1f2fefb1-5bdc-4949-aa5b-08d41459e072 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:AM4PR0401MB1778; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB1778; 3:FoMN1RrYzkkEpXmJ8Z0wIjGR5ZS4D4JeQeOfxAPvNRjEXT3BpcpV2uYYzFMkm5se8j9lPRLNThv4/x/sl+usV28Sw83470bxwwuhe2oarouTwpS8h2h5kmvofAf4hf6zdkY3xcmwtpYw00gVXYJYWAAs3k+b/Vh6PMAFQnS1VgLVshFMdJP0XF5rx1diiHEKXjtisU6QtY5ZHwhchXSlHpa4J+r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mmKIZWXLp+tsfTKzIpOxAliJ8g8RIPUyCvfNSoAJye11Kb/7Ap2N2aK4pZ0JjWFZ95u5MxkmXOV0VmElZ/AkiDlaE7fko7xvH9Sv2HSQEXAEYrYgeiD+8RJlpBhxUgdSW4cabzuDNIYMajz6WA8CTtdmW+keRMpMxUZOQv1o8lH6bCDEhwVKPD8oJoBZTk+Z0A9g4yZjfsAw22jixkQlptpPswB/0F20NvOOXzRypFztkOoypDc+4X5lV7n4tBxIiCGeJXyJVpdqqf9lFtJeEMDnuS/AVtlhUstk4TrWtxaL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6060326)(6045199)(6040361)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6046074)(6061324)(6041248)(20161123555025)(20161123564025)(20161123560025)(20161123562025); SRVR:AM4PR0401MB1778; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0401MB1778; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB1778; 4:q1pX9SLv7ZqmJFSNSTO6XZwUi9PcW2u2lL7uA+FbLsz4qHO6PGEOlL2khx9GCGjkQCMa40oSOanD4aBFYRq5nGjNzePAmoP/vpLQWdsSuu/hOqTpf+VyuRRK5VtgKtOeDUPNZQJ2/VL4lqSf5Bfs5BxD5eZbZ0yWdpPH9c6xRfCIiwHSHsF/GVOi1ZLIXYiqEQ+F64l9/SCuTWANpjNn+xPxIMZpybgjgpijhPqM7YMXGZfwsp4051UsOAxtn4aDi2wI3fX+B/GAewF7NbwhnMMhzU07b2fQMSI/2FCgIDsU6a14bWiVhOS2/9uJ9ACGIblS2HafzUK/ejMkI17udiznwp6GlmF5hZ4ZwLsKakY/wYbVVR9Bkc5ICnIVT+xziHK9Tw4Hyy31jxKRMo6cwI0sz02AvimJ2Yp53QlB6vfn96iVqY3je/5S9kMsYc1Mbe0PCKFlmubbsomYDe0zUUGzAftZ/rysOIMXq0ZwQyAJFQkmizXKNNg9wrDq27WeunEsWxCYTZcA9tfSu/7//OkI43IiaGsqV3OWKuanuGdcOH3Kfqji0aIn6fXd+lVJFZpT5hG46mJNI0Xe59lsdyDlRaQ94XKI2WgJ88J0l8JyfQrb6iNhbOQrWIIErk0Zaz7mP1tHAHezfk8g04Y9MdUY5I6Q/HixpgcLpK4lmr62SZExiJCqg5phKdR6B+J9/TctRC5LcvsZTuTeLQOVdGFl0/vwoNzhn/KZZCcTTwE= X-Forefront-PRVS: 0136C1DDA4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(189002)(39380400001)(39410400001)(36756003)(4326007)(33646002)(81156014)(7736002)(50226002)(81166006)(5660300001)(305945005)(2906002)(7846002)(110136003)(8676002)(66066001)(6916009)(6666003)(50466002)(47776003)(48376002)(3846002)(2351001)(97736004)(92566002)(6116002)(189998001)(77096005)(86362001)(106356001)(5003940100001)(38730400001)(105586002)(68736007)(50986999)(42186005)(101416001)(39400400001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0401MB1778; H:b54642-OptiPlex-3020.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR0401MB1778; 23:9SDS3IBHK+ncW4fmW9EUu/afEqvM0hKMDBw8rVo?= =?us-ascii?Q?p6Q/QHSDhK6iLKGyx97R5RBKZ+RfIgNziaQQJjzpfjbUzM8QYMrVIamNlyty?= =?us-ascii?Q?FdYAoYuK2jRRXeFo+ewwZe/m8LhqGWwHxxRV4OUhrTPCoSLeSmYIcLka9zRG?= =?us-ascii?Q?fSfL3esHB1x0B4tXqn6AB10TqFaMoi5iaE4jupVhpkHYPPLrMReHQyNRIiry?= =?us-ascii?Q?7iD3gZTyXTVKkvwZABQPV3CqwHQMcWo6kTSz6wAF3j9EpdPjsS9eQ/ivRWE0?= =?us-ascii?Q?+teGjHBN19qa39fjQezU6cLMMHjFD7NM7x6P4LEdArBmpWkedr7Uy6IbaEvK?= =?us-ascii?Q?TV0gMUjj/R/eqGDug7fITXF1UeMfsLMQBn3kWhrR+jFqtPYLOu0LX0sChDoh?= =?us-ascii?Q?Wdyt9vCMcLM3a0h4/B5SfqT9EXOSu5f/dj32jgJrQTHq9z6ZbiSn2ObVZbYU?= =?us-ascii?Q?RA4zk/fz3eOpmB4u81t9GNCJ9mOfqDmHpzI3z5K/IT4igrLOJmC649vSxs1o?= =?us-ascii?Q?bF1V27ejgHmjPv4dpITdTr9A3Be0yH41g6o0DPapLfJgqcI1mXnalbW+a5fg?= =?us-ascii?Q?UEROurNphvu8sStxgf1FRrqFAR5FgeZC+f1Op7oEuScbPpRJpEl0Soed4njW?= =?us-ascii?Q?tlinvi5CAFwolRT/+oKHz5FLkvOar0LRhjpW4U3rCMPIdh74N9PWfDkmTqnG?= =?us-ascii?Q?gX/dQJZRoFT42iVH/z1tQomWlGEPzFeeEeT8e0X/UB3Pw4AsWfZGrmHvC4Ms?= =?us-ascii?Q?IS14+/L5qciVka6EECsXciYo06tjNu2Dk6xLxu8flXjDY81FameEO1wyGKNv?= =?us-ascii?Q?EibGoWUSH/xVu2CvpN5f25INUZyUWFXeHExftc1fczUShviM4M/3bA2rHdUi?= =?us-ascii?Q?aANrfRVvkgIHmID9Z14qhRQgbFIbMk2OgXV8ax+cXbuc/Wu57KrzBg9yhCrb?= =?us-ascii?Q?Lug3dVd9dcq7a+q5aAIasS1Z0GOHXuZyb/GDS5B/hs/CW3zak74Pcwo6e+H8?= =?us-ascii?Q?NVCBO/hc8ArUIKNWXciMKbUh2xw8u9NGmHpEOuq375/yKOteyKfLnq9YNbOC?= =?us-ascii?Q?/klbNvEZkuQhWLa8ajL80ieLkSRV5?= X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB1778; 6:GK23TM2GrMcxJOI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gup13AlqYJWlffV+9CA4oAIRqXKl8mnaiHum+FiLQCAe0OsBYde6yWGpEmq0r/CCkEgNsQuogq3+gzfPxjJ2jNTq3tI7AVRTZZHO755r/wXJOeUn68ehH/wbSkzZO6/fyCZ+bQSvNDl2yqkXmKBNE00gDg3h5IRndhGyNpXnMo2fUrEIZ+k0e79FshzzbzzbzuDCS+NgVyC03XLaIyPV105GW1JEbGZdIUkOlvC0Jy3HaMvog== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2016 11:05:57.6846 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0401MB1778 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's more rational that just do the schedule when necessary other than do it every time. Thus, it's better to replace schedule() with cond_resched() in fsl_lpspi_txfifo_empty(), which contributes to saving cpu time. Signed-off-by: Gao Pan --- drivers/spi/spi-fsl-lpspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index bcb7b28..901bef4 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -178,7 +178,7 @@ static int fsl_lpspi_txfifo_empty(struct fsl_lpspi_data *fsl_lpspi) dev_dbg(fsl_lpspi->dev, "txfifo empty timeout\n"); return -ETIMEDOUT; } - schedule(); + cond_resched(); } while (txcnt);