Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935241AbcKNRQg (ORCPT ); Mon, 14 Nov 2016 12:16:36 -0500 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:60453 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934522AbcKNRPq (ORCPT ); Mon, 14 Nov 2016 12:15:46 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.wolfsonmicro.com From: Charles Keepax To: CC: , Subject: [PATCH 2/3] mfd: arizona: Disable IRQs during driver remove Date: Mon, 14 Nov 2016 17:15:56 +0000 Message-ID: <1479143757-30531-2-git-send-email-ckeepax@opensource.wolfsonmicro.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1479143757-30531-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> References: <1479143757-30531-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611140347 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1455 Lines: 35 As DCVDD will often be supplied by a child node of the MFD, we can't call mfd_remove_devices as the first step in arizona_dev_exit as might be expected (tidy up the children before we tidy up the MFD). We need to disable and put the DCVDD regulator before we call mfd_remove_devices, to prevent PM runtime from turning this back on we also need to disable the PM runtime before we do this. Finally we can not clean up the IRQs until all the MFD children have been removed, as they may have registered IRQs themselves. This creates a window of time where the interrupts are enabled but the PM runtime, on which the IRQ handler depends, is not available, any interrupts in this window will go unhandled and fill the log with failed to resume device messages. To avoid this we simply disable the main IRQ at the start of arizona_dev_exit, we don't need to actually handle any IRQs in this window as we are removing the driver. Signed-off-by: Charles Keepax --- drivers/mfd/arizona-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index 41767f7..b6d4bc6 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c @@ -1553,6 +1553,7 @@ EXPORT_SYMBOL_GPL(arizona_dev_init); int arizona_dev_exit(struct arizona *arizona) { + disable_irq(arizona->irq); pm_runtime_disable(arizona->dev); regulator_disable(arizona->dcvdd); -- 2.1.4