From patchwork Thu Aug 4 10:59:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 9263401 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 D3B0260839 for ; Thu, 4 Aug 2016 11:03:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4CE5283DF for ; Thu, 4 Aug 2016 11:03:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B94BF283E2; Thu, 4 Aug 2016 11:03:47 +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 51098283E1 for ; Thu, 4 Aug 2016 11:03:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755407AbcHDLDp (ORCPT ); Thu, 4 Aug 2016 07:03:45 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:52132 "EHLO relmlie4.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753676AbcHDLDm (ORCPT ); Thu, 4 Aug 2016 07:03:42 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie4.idc.renesas.com with ESMTP; 04 Aug 2016 20:03:16 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 30ACC6370A; Thu, 4 Aug 2016 20:03:16 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 2D9B08002E; Thu, 4 Aug 2016 20:03:16 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 233F08002D; Thu, 4 Aug 2016 20:03:16 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac1.idc.renesas.com with ESMTP id WAW28386; Thu, 4 Aug 2016 20:03:15 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="216693497" Received: from mail-hk2apc01lp0212.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.212]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 04 Aug 2016 20:03:15 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sLEaETh/EtPDhE6t/f2pbbCvs15DWhDhU6g5qEr1Mhk=; b=mTr8MZQ8A6OQxi5hgwb9Z/oW4nEAheRvR5yypXca+IqoLTJU/pX581J1vaI9ap/kjA2BCLInLUvdihrAwDqtd4C04OyKQHG9tWtKZ24DoB4fQF3xiqUXJ7FMrz4auCRxiu2MvemLlKZzxTpR4DTBz1aaxy2s70rvtFoJnoo61VY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost.localdomain (211.11.155.144) by HKXPR06MB0549.apcprd06.prod.outlook.com (10.161.177.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15; Thu, 4 Aug 2016 11:03:13 +0000 From: Yoshihiro Shimoda To: , CC: , , Yoshihiro Shimoda , Subject: [PATCH] dmaengine: usb-dmac: check CHCR.DE bit in usb_dmac_isr_channel() Date: Thu, 4 Aug 2016 19:59:41 +0900 Message-ID: <1470308381-11206-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR0201CA0018.apcprd02.prod.outlook.com (10.164.90.156) To HKXPR06MB0549.apcprd06.prod.outlook.com (10.161.177.139) X-MS-Office365-Filtering-Correlation-Id: 1f77778d-f450-41ba-f21f-08d3bc56ee14 X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB0549; 2:GYxMGL7XfIKa9oxGGIv4/tcfkZZmugoPIZQAV7iMlKNnv7YNP62UYgmE0XHXeqmgdgmulnz4jtX+1uj+DRlOAuC3KXG952OGSHErVCSy3rFKk6hkVngy0hOE3N6Zv1/W2L3zx/VhZSazSSR+aCJvEihHbgxNCqO8Mt1EU1PwiIKy/0BbwxmG8Ap6V7zyiDSH; 3:Ab2oo8JFemXXXj+XADXBTLSXas9SffQbrJ+OGZdrgHzGZk15i2RdUF6gkAFpMvxdsYLMJCGqaTba2P8PzE0hGdyWZ20VOjTBpHzIjIyJgFy7YHjYWBTe6kAxJK8+qVs8 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKXPR06MB0549; X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB0549; 25:fEunrybnclnutO92bEg9buRS2pJIJkTo4NEsPs4Kv5pK2ZcIiw8jg7rEhlkO7w4QFZ7Y+fP5PmwSk2TbQWhMabdoGmf6BnH8npza/0gs8rNCVz3+0pemTFQt8tBTwMo5cCMm5mdvKgFWYu2BKktiKXa95V0jzzaCXG9Sw8GnsOdJHhV5wtC6/h0Km4utYDbCBcukEe+bnEf9NeuUqq5p8Th3ZXyYVVhTks9N7wc+gQbpVFIzrXsueYCmxFaXcPCAGijf9a7WYOi4Y/x+A11Zbq4t4UKAgJqMh1erbbOZygzOfvpRizOo14ZjvCbIGcJ3K4EoELUHXN06YWSz7iOfMNckDDbIU3fPBR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RnKQeOKqC0FjM6OdzvhkolftDQtQ8ctoMRfgnWi7LALIAyRyoj0f5QhPZPNc4pprm52SkgW6SPAq/624RoZXxtc1M/WFzMFC5ZD4Qu5AkqV8V1TGVWGHXKgi/JhW3C/a4VvCrSe4/4RcluvhuapgNg2jaB9iSSiYfnim X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:HKXPR06MB0549; BCL:0; PCL:0; RULEID:; SRVR:HKXPR06MB0549; X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB0549; 4:kQ1T6Q4AtH9WMryuRTDZhOpt+ktfnaurnWwW1ZwdSWDe7UYmhyXURpFlovVOkHa+qkqe2PWYVm6f2Fr8e9sxiV1OXtGoffphzd6iPXjfDkWhH02Qdc0Mw306/h7iwJ1BeHJwp78SPNOgkvQ96CRS9zUyQgIvjN35dief2hEEaFCMepN16otieWRBAHL7a7I2v8Nrz9xQIJdCuC1TVfyLAfR9tvgeO1EPL4XUbl8Kmtckj5uJ5ETAhPdkUrNxYWd0izVpOfslsZggLZTvC568yWZCD+GPhv4N95J66zeUN9275cRo4l8PHbJJKyLAb4Rn443s3ZNY31NlqSvsm7u5wIhVtixDqO1eFTAQA82SvgNQBlGV1aNBNu2UnzuEkmvvZINDbMFA9/9Aw7pfPp/GUoldWZD4nVSI+YCNjumTn+Q+CTt6+lUJmYoOg/vF8GxE X-Forefront-PRVS: 00246AB517 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(105586002)(19580405001)(81156014)(7846002)(4326007)(81166006)(5001770100001)(305945005)(19580395003)(2906002)(97736004)(78352004)(189998001)(8676002)(33646002)(48376002)(92566002)(50226002)(68736007)(6116002)(5003940100001)(3846002)(50986999)(229853001)(47776003)(50466002)(106356001)(101416001)(66066001)(36756003)(77096005)(42186005)(7736002)(586003)(61793002); DIR:OUT; SFP:1102; SCL:1; SRVR:HKXPR06MB0549; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX:0; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HKXPR06MB0549; 23:OyERrs3nDCenORW24cOfZ8P8lbAXhPEUoI+Pjf4bI?= =?us-ascii?Q?TgWTUC1e2wzgDS49vaNrN5ZjNsAVy2ehgAQYykB7iYG9DFSw+ZKAokBF/oSN?= =?us-ascii?Q?oHIdONgPkCy84Wp6AL83QG5RYEP8eZ4gG01h4WmBkL95+Eawm08Zh1iKYnGB?= =?us-ascii?Q?ikcmzRLK/JdAmhc+cMamqBuj6STLUp+xz/dIylCk4SkttydUw2gqUjK2gFZj?= =?us-ascii?Q?2r8ssA5AT76cQ1lLniv5aqU6jjN2ueHAQU+cFaLTv1rjckg6/Tvw6zd+E/Hg?= =?us-ascii?Q?22dwJNLj5MK6IEuwSeW6nQCvbOX/FT01yHQ4yMqnzR34QriRMEY6+iVFwSbb?= =?us-ascii?Q?dACwoOy2CCem/NHBIuvCbGej7qXEpWhGSRpi7219Va8zbTdZolZGhnKMspTo?= =?us-ascii?Q?gN2QelRKjR/M0Zevg5mBWRZQjGF6wfkFauuSrLtY9I2nLMXCQ658i9YkRfnK?= =?us-ascii?Q?8vpRGIRzj3TvSjSnulYcZmRYyYrKExdH6D6M/+PqRLg9GoWzMTov0WYrFhvG?= =?us-ascii?Q?/8+ZJN3dLZCz3ITLjgk6I/OnThciSaZuVM6HExSYkb8buJJAjIWmp3PC8MNa?= =?us-ascii?Q?Ow1AbhPVrc81ZqoTnIkIr2C+y5vgCiSJHDBP8dqSY7ps8QHZ0tcYiVV6aHK/?= =?us-ascii?Q?HMwlIpVJ36THpKTVnUAQBVHGDCe9f5Vw52AM+TqHoATS15nOTvvQ6A/bR3mc?= =?us-ascii?Q?M0DK/mFwEb6aH6b69ox+2kZeKAD77dp1A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7FQy/HIWL4CbZBJzlcPjB/MTjW9jcjNFchzrMkxU1yIo3ATMoyq/0cm42UASkDh85NFsEnzreFwcJ7KqMoJ0y/rRJCuuaw96INYLcGW/hrVpURpv9oLu5EQbBPrlUwl97bUb/bignwsm/KfBdZCgYauE5zOB2xoSZRMqc20ODlw/9gIvF1OSynyB47yg5dLi4PjacC8WjODU11ZVZXrRJaQA4slBiYf+R1AtkdF4k5ZllIwa SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB0549; 20:lNTzZL2C58bkbdBOxv1/0sgDJz+1/9VQKnh1jj9PJj5OpgWngC9tOPRAM8ichD3qMXvLWRB4bLJXPdlX3JJygr6RDKtDi6wXYRkEp/dfa7XWLDGm42VoyimD5A4rb1haWjYYaxtcDnpmgd+/Ze87ETgwwospkqXkd8qxECtBF8w= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2016 11:03:13.1957 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB0549 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The USB-DMAC's interruption happens even if the CHCR.DE is not set to 1 because CHCR.NULLE is set to 1. So, this driver should call usb_dmac_isr_transfer_end() if the DE bit is set to 1 only. Otherwise, the desc is possible to be NULL in the usb_dmac_isr_transfer_end(). Fixes: 0c1c8ff32fa2 ("dmaengine: usb-dmac: Add Renesas USB DMA Controller (USB-DMAC) driver) Cc: # v4.1+ Signed-off-by: Yoshihiro Shimoda --- drivers/dma/sh/usb-dmac.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c index 749f1bd..06ecdc3 100644 --- a/drivers/dma/sh/usb-dmac.c +++ b/drivers/dma/sh/usb-dmac.c @@ -600,27 +600,30 @@ static irqreturn_t usb_dmac_isr_channel(int irq, void *dev) { struct usb_dmac_chan *chan = dev; irqreturn_t ret = IRQ_NONE; - u32 mask = USB_DMACHCR_TE; - u32 check_bits = USB_DMACHCR_TE | USB_DMACHCR_SP; + u32 mask = 0; u32 chcr; + bool xfer_end = false; spin_lock(&chan->vc.lock); chcr = usb_dmac_chan_read(chan, USB_DMACHCR); - if (chcr & check_bits) - mask |= USB_DMACHCR_DE | check_bits; + if (chcr & (USB_DMACHCR_TE | USB_DMACHCR_SP)) { + mask |= USB_DMACHCR_DE | USB_DMACHCR_TE | USB_DMACHCR_SP; + if (chcr & USB_DMACHCR_DE) + xfer_end = true; + ret |= IRQ_HANDLED; + } if (chcr & USB_DMACHCR_NULL) { /* An interruption of TE will happen after we set FTE */ mask |= USB_DMACHCR_NULL; chcr |= USB_DMACHCR_FTE; ret |= IRQ_HANDLED; } - usb_dmac_chan_write(chan, USB_DMACHCR, chcr & ~mask); + if (mask) + usb_dmac_chan_write(chan, USB_DMACHCR, chcr & ~mask); - if (chcr & check_bits) { + if (xfer_end) usb_dmac_isr_transfer_end(chan); - ret |= IRQ_HANDLED; - } spin_unlock(&chan->vc.lock);