From patchwork Tue Dec 12 10:36:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michele Dionisio X-Patchwork-Id: 10106603 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 EF586602B3 for ; Tue, 12 Dec 2017 10:37:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE1CE29B64 for ; Tue, 12 Dec 2017 10:37:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E159B29B7B; Tue, 12 Dec 2017 10:37:22 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 8732029B64 for ; Tue, 12 Dec 2017 10:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752262AbdLLKhV (ORCPT ); Tue, 12 Dec 2017 05:37:21 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:37890 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752358AbdLLKhU (ORCPT ); Tue, 12 Dec 2017 05:37:20 -0500 Received: by mail-wr0-f193.google.com with SMTP id o2so20594983wro.5; Tue, 12 Dec 2017 02:37:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=07KCMlvCycJF1yaucl85IaMM2agRDRinKdpziSqcUIg=; b=bVtCTF5QDq1Rn5YIHnst2oGW8E9GtT9Q8bIq0UO0FmlBiLik4cbLTCtrL+kNLo3db9 ciVabi+OXd+On8jT/YcHvxBVWb4zdakvurMKKp3FBjN+AErQxDmTDebu8ypYahH4UZNN 5e9f09VSM6d9vtCWIKk7k4wqy2XdtD1UWliFHWiPnOUt2qWT9zyXr8Jm3BrDyHegNh5Y 6N0gai4DN7MNyUHBtss5/BgFc8hAqQPWD4KDr6hqaMtYqJ0iMI8jmlpSStEkAsTMii/x NSt0zaWQFOo9SgRthfGo26HfcV0g+3sR8mdUVD3DH4yNLZ9BQE90xrRg9bR3qdCUOJh9 3log== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=07KCMlvCycJF1yaucl85IaMM2agRDRinKdpziSqcUIg=; b=VNck+GW6/g1ACDpLb2cOhLhIfhJQL0LOHI4OdADYDrGzBZuPaOk6IaxRCu7AgXat0d IOlfVDb+/x+sjPZftOcQBO469eyEmgllxZoTUyhkvYVjzOh8X7k2kEe4ekuPiMetIGIC NKZFWg90fkqNaXctKAclxGuzCkKXpDC6jntbUzUeBc8noBCaw2kHOIxmvae1I8k5Vp/Z i6nR0JIxNmgmwCssgoLnAbcfBa4Gva9gUIUbMfJh7g1fGvIGuEF9gP+f4Ts6NAaIOm27 vmAlHfl00jpxmB2xoEXsWzs32KKO/oNFhaMfAVxWAQyC7vuLue/q4BivdUA5FYy3ib6n 7mcQ== X-Gm-Message-State: AKGB3mLtvW+nW0Gto+UzrGuwmMh2t12nOHDz9Eic6CzYtXXLjnGNZT/f A/u1oDVmyjh12QhUuVD+iRM= X-Google-Smtp-Source: ACJfBouLOdoWMfw6vl/BU7yoa+O3Win1iJzK6rQCj+3YaIeoyEEwidIUzAdIY4u34MrZdueh+3FySg== X-Received: by 10.223.158.136 with SMTP id a8mr3277501wrf.47.1513075039587; Tue, 12 Dec 2017 02:37:19 -0800 (PST) Received: from localhost.localdomain (net-93-146-228-90.cust.vodafonedsl.it. [93.146.228.90]) by smtp.gmail.com with ESMTPSA id 139sm11520754wmp.7.2017.12.12.02.37.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 02:37:18 -0800 (PST) From: Michele Dionisio To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Michele Dionisio Subject: spi: davinci: Initialize dspi->done before any possible use of it Date: Tue, 12 Dec 2017 11:36:59 +0100 Message-Id: <20171212103659.23116-1-michele.dionisio@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171212101630.GB16323@sirena.org.uk> References: <20171212101630.GB16323@sirena.org.uk> 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 On SOC with multiple cpu (like omal l138) it is possible that spi periferic is already initialized when this module is loaded and so it is possible to recieve interrupt when the modules is not fully initialized. this patch initialize dspi->done before refister the interrupt handler that use it Signed-off-by: Michele Dionisio --- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 6ddb6ef1fda4..60d59b003aa4 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -945,6 +945,8 @@ static int davinci_spi_probe(struct platform_device *pdev) goto free_master; } + init_completion(&dspi->done); + ret = platform_get_irq(pdev, 0); if (ret == 0) ret = -EINVAL; @@ -1021,8 +1023,6 @@ static int davinci_spi_probe(struct platform_device *pdev) dspi->get_rx = davinci_spi_rx_buf_u8; dspi->get_tx = davinci_spi_tx_buf_u8; - init_completion(&dspi->done); - /* Reset In/OUT SPI module */ iowrite32(0, dspi->base + SPIGCR0); udelay(100);