From patchwork Sun Apr 13 10:45:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 3973641 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8D68C9F2CC for ; Sun, 13 Apr 2014 10:45:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4A4A20213 for ; Sun, 13 Apr 2014 10:45:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE3FA20212 for ; Sun, 13 Apr 2014 10:45:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753739AbaDMKp0 (ORCPT ); Sun, 13 Apr 2014 06:45:26 -0400 Received: from mout.web.de ([212.227.17.11]:63617 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753545AbaDMKp0 (ORCPT ); Sun, 13 Apr 2014 06:45:26 -0400 Received: from kongar.lan.local ([77.64.221.251]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0Ljrlt-1X6grB1fez-00bwBp; Sun, 13 Apr 2014 12:45:20 +0200 From: Alexander Stein To: Nicolas Ferre , Mark Brown Cc: Alexander Stein , linux-spi@vger.kernel.org Subject: [PATCH] spi: atmel: Fix scheduling while atomic bug Date: Sun, 13 Apr 2014 12:45:10 +0200 Message-Id: <1397385910-28368-1-git-send-email-alexanders83@web.de> X-Mailer: git-send-email 1.9.2 In-Reply-To: <20140411214815.GI28800@sirena.org.uk> References: <20140411214815.GI28800@sirena.org.uk> X-Provags-ID: V03:K0:vufUn6F5THqPMiiqV9SbUK0wm1Wt+EXVG9qfjRaaQFL35hGOKoL CPBhFqUU9gGEWX7O6uyS+w6hncFy8UMLpMkhgSd//ly29Z/rKSnr4hfcLaJKN5wg8T3qvzG fHFg9gojLBwmti7yOSkJ2x/J58p9/88Dx/F5DFVaeGbK7rRP4klJFMjuxm158pj8Xpm0aRT zPphrdy/aFEnje+mHll0w== Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 atmel_spi_lock does a spin_lock_irqsave, so we need to renable the interrupts when we want to schedule. Signed-off-by: Alexander Stein --- I'm not sure what the lock is actually good for, so I kept it and release it when we are about to schedule, thus reenabling interrupts. drivers/spi/spi-atmel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 5d7b07f..ae22f3d 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1130,8 +1130,11 @@ static int atmel_spi_one_transfer(struct spi_master *master, atmel_spi_next_xfer_pio(master, xfer); } + /* interrupts are disabled, so free the lock for schedule */ + atmel_spi_unlock(as); ret = wait_for_completion_timeout(&as->xfer_completion, SPI_DMA_TIMEOUT); + atmel_spi_lock(as); if (WARN_ON(ret == 0)) { dev_err(&spi->dev, "spi trasfer timeout, err %d\n", ret);