From patchwork Mon Feb 9 08:16:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 5799061 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 63250BF440 for ; Mon, 9 Feb 2015 08:16:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 888A72010E for ; Mon, 9 Feb 2015 08:16:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE93E200D9 for ; Mon, 9 Feb 2015 08:16:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759817AbbBIIQ3 (ORCPT ); Mon, 9 Feb 2015 03:16:29 -0500 Received: from relmlor4.renesas.com ([210.160.252.174]:63270 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759814AbbBIIQ2 (ORCPT ); Mon, 9 Feb 2015 03:16:28 -0500 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie3.idc.renesas.com with ESMTP; 09 Feb 2015 17:16:27 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 18E3249C31; Mon, 9 Feb 2015 17:16:27 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id 1602B480A4; Mon, 9 Feb 2015 17:16:27 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id 0E8E0480A3; Mon, 9 Feb 2015 17:16:27 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac4.idc.renesas.com with ESMTP id TAB26346; Mon, 9 Feb 2015 17:16:27 +0900 X-IronPort-AV: E=Sophos;i="5.09,542,1418050800"; d="scan'208";a="180593227" Received: from mail-sg1lp0089.outbound.protection.outlook.com (HELO APAC01-SG1-obe.outbound.protection.outlook.com) ([207.46.51.89]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 09 Feb 2015 17:16:25 +0900 Received: from localhost (211.11.155.147) by HKXPR06MB327.apcprd06.prod.outlook.com (10.141.133.17) with Microsoft SMTP Server (TLS) id 15.1.81.19; Mon, 9 Feb 2015 08:16:23 +0000 From: Yoshihiro Shimoda To: , , , , , , CC: , , , Yoshihiro Shimoda Subject: [PATCH 1/4] usb: renesas_usbhs: fix spinlock recursion by usbhsf_dma_complete() Date: Mon, 9 Feb 2015 17:16:11 +0900 Message-ID: <1423469774-6532-2-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.1 In-Reply-To: <1423469774-6532-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1423469774-6532-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.147] X-ClientProxiedBy: HKXPR03CA0035.apcprd03.prod.outlook.com (10.141.129.25) To HKXPR06MB327.apcprd06.prod.outlook.com (10.141.133.17) Authentication-Results: linuxfoundation.org; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:HKXPR06MB327; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004); SRVR:HKXPR06MB327; X-Forefront-PRVS: 04825EA361 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(50226001)(42186005)(2950100001)(19580395003)(19580405001)(46102003)(36756003)(122386002)(66066001)(50466002)(33646002)(40100003)(87976001)(78352002)(48376002)(77096005)(47776003)(76506005)(50986999)(76176999)(92566002)(77156002)(62966003)(42382002)(229853001); DIR:OUT; SFP:1102; SCL:1; SRVR:HKXPR06MB327; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:HKXPR06MB327; X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2015 08:16:23.6074 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB327 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The usbhsf_pkt_handler(pipe, USBHSF_PKT_DMA_DONE) in usbhsf_dma_complete() will call the complete function of a usb gadget driver finally. According to the gadget.h, "The function will always be called with interrupts disabled". So, this patch adds a local_irq_save/local_irq_restore in the usbhsf_dma_complete() because a dmaengine driver may call this callback function when interrupts enabled (e.g. in tasklet). Signed-off-by: Yoshihiro Shimoda --- drivers/usb/renesas_usbhs/fifo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index d891bff..b1440d0 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -1165,11 +1165,14 @@ static void usbhsf_dma_complete(void *arg) struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); struct device *dev = usbhs_priv_to_dev(priv); int ret; + unsigned long flags; + local_irq_save(flags); ret = usbhsf_pkt_handler(pipe, USBHSF_PKT_DMA_DONE); if (ret < 0) dev_err(dev, "dma_complete run_error %d : %d\n", usbhs_pipe_number(pipe), ret); + local_irq_restore(flags); } void usbhs_fifo_clear_dcp(struct usbhs_pipe *pipe)