From patchwork Wed May 4 23:41:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Daudt X-Patchwork-Id: 9019541 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@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 7ECBBBF29F for ; Wed, 4 May 2016 23:41:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46DDB20414 for ; Wed, 4 May 2016 23:41:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B31B20412 for ; Wed, 4 May 2016 23:41:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755256AbcEDXlh (ORCPT ); Wed, 4 May 2016 19:41:37 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:33539 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755224AbcEDXlg (ORCPT ); Wed, 4 May 2016 19:41:36 -0400 Received: by mail-pa0-f44.google.com with SMTP id xk12so29408899pac.0 for ; Wed, 04 May 2016 16:41:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id; bh=V1orgpfHrUFlocYDot43kDmoKPzCDSK7a02qtzWVJ2I=; b=hhFW1WDH+ltY2Y4qUhBYyJwx+hlZx2x3WYE3JnlUJNWlPLFSfdS15JxicQEBEymMnW U4lJtDCtSk53Uha6vqRRJHcYB/3otYAOk35Vp4sZPupP1lwdXUDaevdmgbuwt881YhCj yld77xCn0Vbifab8XIlwJp4nqxGkf/SDM06ak= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=V1orgpfHrUFlocYDot43kDmoKPzCDSK7a02qtzWVJ2I=; b=eYEnTMQbCri1MEly/uXj++y57TjVsoHhwJ86DNK4fjo2JKmRoOcE9ElVPh9hrjQ6Rg cdpuycWFyySxViTb5w5DQzDKoodwxMHbAaN0OkvNCqawm77ZQOWcX/OCSIRIAnGHuP1z B8zpRRtV2Wtgu1WEIC66RxZz+ufhbKFekq7ErIZjiiW6QO+YUXY60CTVTqsTWrqq+Q5V X7KvxZMdrLjMmelYT8Db+48QUtHWAfpGjzkdH83DdgYGfMtLIuxCG+p/q7vbydYJiDZc zz2N91VViqMK+kgCRxXgNVMQz2LWzT1gspCy/PTM/TUM60AufDgZ24opftE7OY/fKHt4 bnRQ== X-Gm-Message-State: AOPr4FVqsuWMpKASE8TSbbjgKAo6/U9FD9NqNwN6EsoX929OC4feEInq6ckcWAD2gvktpbAM X-Received: by 10.66.86.161 with SMTP id q1mr15951346paz.59.1462405295116; Wed, 04 May 2016 16:41:35 -0700 (PDT) Received: from rodan.ric.broadcom.com ([216.31.219.19]) by smtp.gmail.com with ESMTPSA id 5sm8578853pfn.46.2016.05.04.16.41.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 May 2016 16:41:33 -0700 (PDT) From: Christian Daudt To: linux-wireless@vger.kernel.org Cc: Christian Daudt , brcm80211-dev-list@broadcom.com, Brett Rudley , Arend van Spriel , Franky Lin , Hante Meuleman Subject: [PATCH] brcmfmac: Fix 'did not remove int handler' warning Date: Wed, 4 May 2016 16:41:20 -0700 Message-Id: <1462405280-5947-1-git-send-email-csd@broadcom.com> X-Mailer: git-send-email 1.9.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 brcmf_sdiod_intr_unregister call that removes both func1 and func2 interrupt handlers only called when brcmf_ops_sdio_remove is called for func 1 (which is the 2nd call) but sdio is expecting it to be removed at the end of each sdio_remove call. This is causing 'rmmod bcmrfmac' on a 4356-sdio chip to complain with: WARNING: driver brcmfmac did not remove its interrupt handler! The modification makes calling brcmf_sdiod_intr_unregister multiple times harmless by clearing the variables that track if interrupt handlers have been installed, and then calls it on every brcmf_ops_sdio_remove call instead of just remove for func 1. Note: this needs to be applied on top of "[PATCH] Fix kernel oops in failed chip_attach" Signed-off-by: Christian Daudt --- .../net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 17 +++++++++++------ drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index 09635a9..590cd41 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -172,7 +172,7 @@ int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev) return 0; } -int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev) +void brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev) { brcmf_dbg(SDIO, "Entering oob=%d sd=%d\n", @@ -195,6 +195,7 @@ int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev) } free_irq(pdata->oob_irq_nr, &sdiodev->func[1]->dev); sdiodev->irq_en = false; + sdiodev->oob_irq_requested = false; } if (sdiodev->sd_irq_requested) { @@ -202,9 +203,8 @@ int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev) sdio_release_irq(sdiodev->func[2]); sdio_release_irq(sdiodev->func[1]); sdio_release_host(sdiodev->func[1]); + sdiodev->sd_irq_requested = false; } - - return 0; } void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev, @@ -1200,12 +1200,17 @@ static void brcmf_ops_sdio_remove(struct sdio_func *func) brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device); brcmf_dbg(SDIO, "Function: %d\n", func->num); - if (func->num != 1) - return; - bus_if = dev_get_drvdata(&func->dev); if (bus_if) { sdiodev = bus_if->bus_priv.sdio; + + /* start by unregistering irqs */ + brcmf_sdiod_intr_unregister(sdiodev); + + if (func->num != 1) + return; + + /* only proceed with rest of cleanup if func 1 */ brcmf_sdiod_remove(sdiodev); dev_set_drvdata(&sdiodev->func[1]->dev, NULL); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h index c07ad25..f3da32f 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h @@ -294,7 +294,7 @@ struct sdpcmd_regs { /* Register/deregister interrupt handler. */ int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev); -int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev); +void brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev); /* sdio device register access interface */ u8 brcmf_sdiod_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret);