From patchwork Tue Feb 12 15:11:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 10808107 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8363C13A4 for ; Tue, 12 Feb 2019 15:11:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73CB12BB75 for ; Tue, 12 Feb 2019 15:11:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 682A72BC71; Tue, 12 Feb 2019 15:11:59 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 CDC122BC8E for ; Tue, 12 Feb 2019 15:11:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729636AbfBLPL6 (ORCPT ); Tue, 12 Feb 2019 10:11:58 -0500 Received: from mail-eopbgr780087.outbound.protection.outlook.com ([40.107.78.87]:42416 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728165AbfBLPL6 (ORCPT ); Tue, 12 Feb 2019 10:11:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ax05oCin/s3KbSWIj2mmPZSsxdlQxKQDMF5WA5vrkac=; b=rPIkICi3zoMkyJUPyjCXPxKthBDdbUyeBFhgQtLWLGPIH2+/51ARcZjikQZhPiivUp4VKEP4JxFK5F3E3Ue7fnHp90J2baCxVAkq2k/KiG/isV65cn8kdAtuF0yYr5j2pN3hqsax7+Uuy7LUTMoojNQq15yQy0oASgmHWH6w4BQ= Received: from BN8PR03CA0026.namprd03.prod.outlook.com (2603:10b6:408:94::39) by SN6PR03MB3758.namprd03.prod.outlook.com (2603:10b6:805:69::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.19; Tue, 12 Feb 2019 15:11:54 +0000 Received: from SN1NAM02FT023.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::206) by BN8PR03CA0026.outlook.office365.com (2603:10b6:408:94::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1601.19 via Frontend Transport; Tue, 12 Feb 2019 15:11:54 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.55) smtp.mailfrom=analog.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=analog.com; Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.55 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.55; helo=nwd2mta1.analog.com; Received: from nwd2mta1.analog.com (137.71.25.55) by SN1NAM02FT023.mail.protection.outlook.com (10.152.72.156) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1580.10 via Frontend Transport; Tue, 12 Feb 2019 15:11:50 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id x1CFBjjM024198 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Tue, 12 Feb 2019 07:11:45 -0800 Received: from saturn.analog.com (10.50.1.244) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Tue, 12 Feb 2019 10:11:44 -0500 From: Alexandru Ardelean To: , CC: Alexandru Ardelean Subject: [V2 PATCH 2/3] dmaengine: dmatest: add short-hand `buf_size` var in dmatest_func() Date: Tue, 12 Feb 2019 17:11:38 +0200 Message-ID: <20190212151139.20613-2-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190212151139.20613-1-alexandru.ardelean@analog.com> References: <20190212151139.20613-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.55;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(346002)(376002)(39860400002)(136003)(2980300002)(199004)(189003)(36756003)(50226002)(50466002)(47776003)(106002)(336012)(44832011)(76176011)(110136005)(1076003)(316002)(48376002)(16586007)(126002)(476003)(2616005)(426003)(305945005)(86362001)(106466001)(246002)(7696005)(51416003)(7636002)(26005)(446003)(14444005)(186003)(107886003)(11346002)(4326008)(356004)(8936002)(478600001)(6666004)(486006)(77096007)(53416004)(2906002)(8676002)(81973001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR03MB3758;H:nwd2mta1.analog.com;FPR:;SPF:Pass;LANG:en;PTR:nwd2mail10.analog.com;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;SN1NAM02FT023;1:cjMgnsjQPX01hspP0GwQh2xrCELIn7UcNqf9C7CrbbDGf0CuefeyQ92bUWpNsD/GfEYuv1mzNPu1lnaUpVtx859Z8N/aYyc7Tz9UXBImgw6zRSlng8W9jjRFZPJto4c3OIzj2h8o6DCoZdllYOB3ug== X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 73119c50-d2b2-4e2a-c69c-08d690fc6ad0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600110)(711020)(4605077)(4608076)(4709027)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060);SRVR:SN6PR03MB3758; X-MS-TrafficTypeDiagnostic: SN6PR03MB3758: X-Microsoft-Exchange-Diagnostics: 1;SN6PR03MB3758;20:vBMryipl4cU/QR04+DLA1owZCq+mpqnyt0YInje6+I/dRva42SFbJq6X2YUQsVycSjnrE1fVIlw3YzLsqxEsvf2gEusplIQVYt99LWQlLWT5ANczRK5JahF2Z7AHqGqbaIekpVHBjn4m0ZoAHflbEOsuswa8K1jeqE5sf0e6GHaL3s0TvGTsW2g3klLBUI+89EImEx/DYFv6hzdu58Wenhxg52dZkQ9deHgcccvESny8iXQ0v5NUIs3qmYYlgkzKBUVm/G0EK0UfUVj5WuByHs2bymfa5DPijL2MmQOKcVxg+HPiwT+CZSsPXGCdLu3stZxCCjdpoeUdTOzqPgPHrcnx5zARhQTpiQjL6CSYnk2xbuQ7XsDFv8MTOBuNRrvm9f7oYGyYHajxpXNKbXclhCTcCwRyMjsqcn3gHAJ48HqwFFDC7NMJNntd8S3Kt2poy3Dc4EKO7lxrPNlgkaeD31v0px7e1HemagalvUj/igtX2EwscASDaOUWM+UwudeQ X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0946DC87A1 X-Microsoft-Exchange-Diagnostics: 1;SN6PR03MB3758;23:aSh85is0MEoYXBArSQOxbkoaKR22ys5vMeP0er4j+ouTd+bsN10RW82nBSvDPE5Zf4hQMnfsbQ3ZZDBFarCQ/AoBQ88SvsG0JGPYSx/MHybZ/dfKQsX4+tMVxHkXBMNolBTuvDmKKrrypuO+iGDz3ixOQEMEIySi7WY+E/vGVtvCQNdwrJwnQV6OJFqSfJwy10MytjZPjoTz+iVaZ4RVbvslI+XQdDsGiLxZ+esKuITZ7c2yiDyMsgalzlaPfOC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3BGE1ogn0qhu0CBaDZhtfpA2aL/IBD9/7Pv7twihJZQhx04UYXtGKZpQIkz7wgPFsNaYuIGhwWFn2Jtl8BHAqTciH3m455RvOYjdclhibjkMXEo2MaM1ZGOuT3wihhM0ABuJdUoW0/Pnlwn+/RqBBvZV1HB0xbtO+BCYTiblwhHJiVKL94DfRtlhYkb427Sik4iuWeGi3wkwXhPd9exPEhNgZm5Xw/Pt0Nu8= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2019 15:11:50.2846 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 73119c50-d2b2-4e2a-c69c-08d690fc6ad0 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a;Ip=[137.71.25.55];Helo=[nwd2mta1.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB3758 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is just a cosmetic change, since this variable gets used quite a bit inside the dmatest_func() routine. Signed-off-by: Alexandru Ardelean --- drivers/dma/dmatest.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index ea1f885e70f4..3b148c2647f8 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -516,6 +516,7 @@ static int dmatest_func(void *data) enum dma_ctrl_flags flags; u8 *pq_coefs = NULL; int ret; + unsigned int buf_size; struct dmatest_data *src; struct dmatest_data *dst; int i; @@ -580,9 +581,10 @@ static int dmatest_func(void *data) goto err_free_coefs; } - if (1 << align > params->buf_size) { + buf_size = params->buf_size; + if (1 << align > buf_size) { pr_err("%u-byte buffer too small for %d-byte alignment\n", - params->buf_size, 1 << align); + buf_size, 1 << align); goto err_free_coefs; } @@ -595,7 +597,7 @@ static int dmatest_func(void *data) goto err_usrcs; for (i = 0; i < src->cnt; i++) { - src->raw[i] = kmalloc(params->buf_size + align, + src->raw[i] = kmalloc(buf_size + align, GFP_KERNEL); if (!src->raw[i]) goto err_srcbuf; @@ -617,7 +619,7 @@ static int dmatest_func(void *data) goto err_udsts; for (i = 0; i < dst->cnt; i++) { - dst->raw[i] = kmalloc(params->buf_size + align, + dst->raw[i] = kmalloc(buf_size + align, GFP_KERNEL); if (!dst->raw[i]) goto err_dstbuf; @@ -656,16 +658,16 @@ static int dmatest_func(void *data) total_tests++; if (params->transfer_size) { - if (params->transfer_size >= params->buf_size) { + if (params->transfer_size >= buf_size) { pr_err("%u-byte transfer size must be lower than %u-buffer size\n", - params->transfer_size, params->buf_size); + params->transfer_size, buf_size); break; } len = params->transfer_size; } else if (params->norandom) { - len = params->buf_size; + len = buf_size; } else { - len = dmatest_random() % params->buf_size + 1; + len = dmatest_random() % buf_size + 1; } /* Do not alter transfer size explicitly defined by user */ @@ -680,8 +682,8 @@ static int dmatest_func(void *data) src->off = 0; dst->off = 0; } else { - src->off = dmatest_random() % (params->buf_size - len + 1); - dst->off = dmatest_random() % (params->buf_size - len + 1); + src->off = dmatest_random() % (buf_size - len + 1); + dst->off = dmatest_random() % (buf_size - len + 1); src->off = (src->off >> align) << align; dst->off = (dst->off >> align) << align; @@ -690,9 +692,9 @@ static int dmatest_func(void *data) if (!params->noverify) { start = ktime_get(); dmatest_init_srcs(src->aligned, src->off, len, - params->buf_size, is_memset); + buf_size, is_memset); dmatest_init_dsts(dst->aligned, dst->off, len, - params->buf_size, is_memset); + buf_size, is_memset); diff = ktime_sub(ktime_get(), start); filltime = ktime_add(filltime, diff); @@ -707,7 +709,7 @@ static int dmatest_func(void *data) continue; } - um->len = params->buf_size; + um->len = buf_size; for (i = 0; i < src->cnt; i++) { void *buf = src->aligned[i]; struct page *pg = virt_to_page(buf); @@ -827,7 +829,7 @@ static int dmatest_func(void *data) src->off + len, src->off, PATTERN_SRC | PATTERN_COPY, true, is_memset); error_count += dmatest_verify(src->aligned, src->off + len, - params->buf_size, src->off + len, + buf_size, src->off + len, PATTERN_SRC, true, is_memset); pr_debug("%s: verifying dest buffer...\n", current->comm); @@ -839,7 +841,7 @@ static int dmatest_func(void *data) PATTERN_SRC | PATTERN_COPY, false, is_memset); error_count += dmatest_verify(dst->aligned, dst->off + len, - params->buf_size, dst->off + len, + buf_size, dst->off + len, PATTERN_DST, false, is_memset); diff = ktime_sub(ktime_get(), start);