From patchwork Fri Apr 29 21:42:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 568213 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE631C4167E for ; Fri, 29 Apr 2022 21:42:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238625AbiD2VqQ (ORCPT ); Fri, 29 Apr 2022 17:46:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238667AbiD2VqP (ORCPT ); Fri, 29 Apr 2022 17:46:15 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A92C78FE9 for ; Fri, 29 Apr 2022 14:42:55 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id p12so16244362lfs.5 for ; Fri, 29 Apr 2022 14:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5fpTEUNCvgnc9AMwKVJD3wLMKlj8TQ48QZUL6p2NQR8=; b=DO7+ehfwWU/IwRsXvlPGr465j4cjpUNYJaO+tApyASgbdK5nxn34EnUDJoLMeRkx8a BU8dnW0tZp8oZS0HIyvlO1v0F9stykFFTQWyYeB6IrrieBGdM5Znii3OziziJfz0SkeJ DMwUQmq4utc/S9wzNVf3H95RPm29K1fYH+ySthSaEdWLTYvrwHDu3O3efgkYSR8AgDI8 pbZCbeJrmNFKI9vCD5b2Cgd+FtgNJ1imLlbK/Xw2ke3jt1ZuyfxKsdABQivDrU119Pch y+fb/1FyHuQZFALRyjwcTsQNC+T7TmSCOF/N5EBYk/QHTmI24DRbIgKdedC3zvZnzj4r 3a7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5fpTEUNCvgnc9AMwKVJD3wLMKlj8TQ48QZUL6p2NQR8=; b=4DEphlyNoST5nAxTQvMNa2PLoyDJhz/ZgRIOrBkikQKRKHMfz/21iO4zr7VyzunrgB mzQj010S0CVvZzq3WymvIoNxd1cdT8v9v2HLyfdwFapdmLxM55y6HSRRxoNPckhhJJ8U gPea9EAucsFFRA3Zua/UddcllSteIsGrIaxGPWuQ8q8l1DL/BIRwEHtF4gbEQcZuWPpl EQp2/wfS2smcnJRVH7eMuGAX4vt0Ay6ZevKlk1fKh8E1AFToLQtLgzXk2mgoAnBZDfnh uuaMtvjV8yfTiL9+9O8NOCcexasSrxCsg+mkS9uGB5IO8L5Lr86AfHDoPgE/5akHuIKv GuIA== X-Gm-Message-State: AOAM533m1mbdkAJV+BNR8lbsV1GH6Xjwui3V+lWIt/UC3yBvQ3IWYgOG Pde07nHzvAeA7S3OKe+z6dfNNg== X-Google-Smtp-Source: ABdhPJy4LZ8ehR5vdwsglOOXsOvFnp1R39xx861X4rwi7zGtIy5IoqUPE0ZlkkJ3qApcX41V3YUXFw== X-Received: by 2002:a05:6512:e82:b0:46b:8466:f515 with SMTP id bi2-20020a0565120e8200b0046b8466f515mr885533lfb.400.1651268573664; Fri, 29 Apr 2022 14:42:53 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id g4-20020a19ac04000000b0047255d211f6sm30520lfc.293.2022.04.29.14.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 14:42:53 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Rob Herring , Krzysztof Kozlowski , Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas , Stanimir Varbanov , Manivannan Sadhasivam Cc: Vinod Koul , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 3/7] PCI: dwc: Add msi_host_deinit callback Date: Sat, 30 Apr 2022 00:42:46 +0300 Message-Id: <20220429214250.3728510-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220429214250.3728510-1-dmitry.baryshkov@linaro.org> References: <20220429214250.3728510-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add msi_host_deinit() callback as a counterpart to msi_host_init(). It will tear down MSI support in case host has to run host-specific ops. Signed-off-by: Dmitry Baryshkov --- drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++-- drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 43d1d6116007..92dcaeabe2bf 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -424,7 +424,9 @@ int dw_pcie_host_init(struct pcie_port *pp) return 0; err_free_msi: - if (pp->has_msi_ctrl) + if (pp->ops->msi_host_deinit) + pp->ops->msi_host_deinit(pp); + else if (pp->has_msi_ctrl) dw_pcie_free_msi(pp); return ret; } @@ -434,7 +436,9 @@ void dw_pcie_host_deinit(struct pcie_port *pp) { pci_stop_root_bus(pp->bridge->bus); pci_remove_root_bus(pp->bridge->bus); - if (pp->has_msi_ctrl) + if (pp->ops->msi_host_deinit) + pp->ops->msi_host_deinit(pp); + else if (pp->has_msi_ctrl) dw_pcie_free_msi(pp); } EXPORT_SYMBOL_GPL(dw_pcie_host_deinit); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 7d6e9b7576be..e1c48b71e0d2 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -175,6 +175,7 @@ enum dw_pcie_device_mode { struct dw_pcie_host_ops { int (*host_init)(struct pcie_port *pp); int (*msi_host_init)(struct pcie_port *pp); + void (*msi_host_deinit)(struct pcie_port *pp); }; struct pcie_port {