From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7B63C433E0 for ; Mon, 25 May 2020 12:25:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91E7C20812 for ; Mon, 25 May 2020 12:25:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390504AbgEYMZI (ORCPT ); Mon, 25 May 2020 08:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390360AbgEYMZI (ORCPT ); Mon, 25 May 2020 08:25:08 -0400 Received: from mailout2.hostsharing.net (mailout2.hostsharing.net [IPv6:2a01:37:3000::53df:4ee9:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 011D5C061A0E for ; Mon, 25 May 2020 05:25:07 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by mailout2.hostsharing.net (Postfix) with ESMTPS id C57D410189CEA; Mon, 25 May 2020 14:25:04 +0200 (CEST) Received: from localhost (unknown [87.130.102.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id 88E8E6029C6E; Mon, 25 May 2020 14:25:04 +0200 (CEST) X-Mailbox-Line: From 58b2ac6942ca1f91aaeeafe512144bc5343e1d84 Mon Sep 17 00:00:00 2001 Message-Id: From: Lukas Wunner Date: Mon, 25 May 2020 14:25:00 +0200 Subject: [PATCH 0/3] Intel SPI unbind fixes To: Mark Brown Cc: Andy Shevchenko , Jarkko Nikula , linux-spi@vger.kernel.org, Baruch Siach , Serge Semin , Tsuchiya Yuto , Daniel Mack , Haojian Zhuang , Robert Jarzmik Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Fix unbind ordering issues in the Designware and PXA2xx SPI controllers built into Intel SoCs. To test, you'll also need the following commit: https://git.kernel.org/broonie/spi/c/84855678add8 This is compile-tested only, so please review and test thoroughly. Pay particular attention to the IRQ handlers dw_spi_irq() and ssp_int(): Both drivers request the interrupt with IRQF_SHARED, so the IRQ handler may run even though the SPI controller itself hasn't signalled an interrupt. The IRQ is requested before registering the controller and freed after unregistering the controller. Thus, the IRQ handler should immediately bail out if the controller is not yet or no longer registered, e.g. by checking in the controller's registers whether an interrupt is actually pending. The drivers may need to disable interrupts in the controllers' registers upon unbinding and they need to make sure that the registers are accessible until the IRQ is freed. I don't have a datasheet for these SPI controllers but I hope someone who is more familiar with them will be able to check for correctness of the IRQ handling. Lukas Wunner (3): spi: dw: Fix controller unregister order spi: pxa2xx: Fix controller unregister order spi: pxa2xx: Fix runtime PM ref imbalance on probe error drivers/spi/spi-dw.c | 4 +++- drivers/spi/spi-pxa2xx.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) -- 2.25.0