From patchwork Mon Apr 2 18:24:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10320151 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 2934360375 for ; Mon, 2 Apr 2018 18:24:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18FD328A4C for ; Mon, 2 Apr 2018 18:24:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DDAA28A5D; Mon, 2 Apr 2018 18:24:42 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 B34E228A4C for ; Mon, 2 Apr 2018 18:24:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753355AbeDBSYj (ORCPT ); Mon, 2 Apr 2018 14:24:39 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:38885 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753261AbeDBSYh (ORCPT ); Mon, 2 Apr 2018 14:24:37 -0400 Received: by mail-wr0-f193.google.com with SMTP id m13so15024324wrj.5 for ; Mon, 02 Apr 2018 11:24:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=n9WgaB+c0fe4zQ5Kw550K29G8+bCna2QgZVx1Vu8OgE=; b=eiFz0P5+l+fvyFc6n1oPkYEdysH/iCcg4o/6q7OQP4acwa8tupAXAIf2zbRTBg+mWa /upN31/ymgI7twc/3cBSnJJBMTPSLERb7XivYs67KUfx4DO/zpVPTJVXHU3Udh13DGgG oae0VfhFLwMpgghmoe25+6QatCfly13TdCB+VwC7ockfYrrPb41A3DKYF9nT1F3nk3E/ M3Gcs2bCX8+9ductN1icMrWlM7FckMmU4TV6o+fbIlkWCckHLk+Wb2DaIQDLIaN/3rhp 0GV2VuoCFlae65vQUL3frvXaPh1GKVR9hSqjQrKEQkSPpJaRrrjnvU0I8ZAhpYy1WnY6 wGCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=n9WgaB+c0fe4zQ5Kw550K29G8+bCna2QgZVx1Vu8OgE=; b=ecLgTsMlrfitKK1ambWE33dl8AB+i9kB7Sw+SFYB6OiUm9NivaUathOWfCsJT+bYVC 9K/+RGtws3j+qK8RgWaYMgstSJqZ1mC79fgkYhDGm3pDGtIN8nba0fRppCGLuN7pQjRq vB2TtjIAD1dop4DQzai5Z+i1KqZlNI5BT8kkImN5CXfvDATqXJU3R78bHvzP26S8d5gs EQ4HnStbdgkGBnkLQfmcXm60FlgfS7AYGtd95VhgXaNsLseYUduKoTYE14UqTMsQtDBZ dyv2BkvdJRpennfdk0Io1/aK+DwwOnPh6VHtQV/Yql8rhw+c3fpogGMgDEtXJCwVU5vn bsSw== X-Gm-Message-State: AElRT7EwMRu2lLst3pyDxeJyOOqK4wxJMCkOstYyRpSI7MEtv9/HCjxO It89LmX9dK1QVT5Pp6Z6tXhsEQ== X-Google-Smtp-Source: AIpwx4+YtFbkf2GOn4ESEXhTA46dMRgv9MQnrx7lHENbAsxj5M+X7a1IjX7yQTMZX2eViH8fhwwcgg== X-Received: by 10.223.178.163 with SMTP id g32mr7807779wrd.204.1522693476428; Mon, 02 Apr 2018 11:24:36 -0700 (PDT) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id x9sm2368273wrb.18.2018.04.02.11.24.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Apr 2018 11:24:35 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH 06/20] [media] ddbridge: move MSI IRQ cleanup to a helper function Date: Mon, 2 Apr 2018 20:24:13 +0200 Message-Id: <20180402182427.20918-7-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180402182427.20918-1-d.scheller.oss@gmail.com> References: <20180402182427.20918-1-d.scheller.oss@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Scheller Introduce the ddb_msi_exit() helper to be used for cleaning up previously allocated MSI IRQ vectors. Deduplicates code and makes things look cleaner as for all cleanup work the CONFIG_PCI_MSI ifdeffery is only needed in the helper now. Also, replace the call to the deprecated pci_disable_msi() function with pci_free_irq_vectors(). Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-main.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-main.c b/drivers/media/pci/ddbridge/ddbridge-main.c index 7088162af9d3..77089081db1f 100644 --- a/drivers/media/pci/ddbridge/ddbridge-main.c +++ b/drivers/media/pci/ddbridge/ddbridge-main.c @@ -65,16 +65,20 @@ static void ddb_irq_disable(struct ddb *dev) ddbwritel(dev, 0, MSI1_ENABLE); } +static void ddb_msi_exit(struct ddb *dev) +{ +#ifdef CONFIG_PCI_MSI + if (dev->msi) + pci_free_irq_vectors(dev->pdev); +#endif +} + static void ddb_irq_exit(struct ddb *dev) { ddb_irq_disable(dev); if (dev->msi == 2) free_irq(dev->pdev->irq + 1, dev); free_irq(dev->pdev->irq, dev); -#ifdef CONFIG_PCI_MSI - if (dev->msi) - pci_disable_msi(dev->pdev); -#endif } static void ddb_remove(struct pci_dev *pdev) @@ -86,6 +90,7 @@ static void ddb_remove(struct pci_dev *pdev) ddb_i2c_release(dev); ddb_irq_exit(dev); + ddb_msi_exit(dev); ddb_ports_release(dev); ddb_buffers_free(dev); @@ -230,8 +235,7 @@ static int ddb_probe(struct pci_dev *pdev, ddb_irq_exit(dev); fail0: dev_err(&pdev->dev, "fail0\n"); - if (dev->msi) - pci_disable_msi(dev->pdev); + ddb_msi_exit(dev); fail: dev_err(&pdev->dev, "fail\n");