Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp490850pxb; Thu, 21 Oct 2021 03:47:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUM9djfyD1wBG6xOjrljGTpEXfiDmY3FUMKoNI+kzcig7tlX1CHNlbnU0TUVK2USHsv8Sq X-Received: by 2002:a17:90b:4d08:: with SMTP id mw8mr5882672pjb.96.1634813237392; Thu, 21 Oct 2021 03:47:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634813237; cv=none; d=google.com; s=arc-20160816; b=tE8rDSnHR/FEKC6RKAB8qxrylkSN0GJq9PHMwu2nBrrMUYBqbKAzbiGRn0EyCTlLPp fgqok9PIeGPgPIiIglSsQ8jyN+GvZ3W+f0IyucQ6lBfMOKjGVC4kS4Di+Ra1sHUVzR3n IPbr01nO8x28PkrnN6VV+JzpxEvfHsiwycWaLCG7guSuxxbeo8yXX9HzniMWvRHqh9gz 2XjJqMIesRc1LKHnJaio6UlqDBG1E8I8cMdwIO6KaxDZO/Q9aI2U/bPD8h1Gs+Ay9iSe 5V3oINuMSJJwZzy1Bz8g7R0K3HID9aFoqZyA+OsIxIBAnk+BL/W4dOfT+RAmdbm1Qd1h 96pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2E1D6vwca+FgojF8fi4EgSxVH7u0M7Vs1Pd2CACIP50=; b=dZb52leSchGMYFWpZ7vIdoMXF1RDAYFv00qLkEzZU9reHb5okTX1wUyujMQg5xMWnG Yp7dK1jfuARJ8pDFwFeXuKQLkrvZU02jLiaCohxXO2Drsv2lBOZT3cSoZ+orqBPZJAz9 B85tW630/Xvn5O5qDftPxPC4oDK8Ovt1MRnNqbYy7RXkp+iWH61wm/GqBcxHkW3LR5gk Bu3iXk5AyRButWBO2uxrcclsNcJbCNe8/hp3t/0Ct5VWAjSEDzYfeT669/R+LlVMwWgg 8DIIY6doV6DG3mu8ZEKwhev5PHEwmH4PGAUKliNzvbVEvbQfZBS8Th4Ouv0ZoE35BWZP PK9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d2LrAqWO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 11si6967602pgh.13.2021.10.21.03.47.04; Thu, 21 Oct 2021 03:47:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d2LrAqWO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231279AbhJUKr6 (ORCPT + 99 others); Thu, 21 Oct 2021 06:47:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:57800 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230413AbhJUKrt (ORCPT ); Thu, 21 Oct 2021 06:47:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E16226120C; Thu, 21 Oct 2021 10:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634813133; bh=afPaNM6wvpFiYxWvoOcUCgw1GJtsKqDLOtbDz3hIjU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d2LrAqWO46tVm06e0RFWXpP8U+oYLy5hn9KxQtr66RBacog0Fb+zjRV3H2D693DDf zkcFn4fdMBdKUwGGc2HgVjJHoHSdzQKgLwbT3yOxOf8AvGP6WJuizHBSBYtSf6w3Ct DdpPHxLLvhR4vrs5Rl7MGrnMJzqulaZohfhYJ6PG7N4L38lB8Z64GZtmm9PfSdKK+s ifTuG+Eg7lNSkib7E3h50c7GXKSPgdq+aEGnT2tZzCayWqZkCqmu4YtFyiglfYSHUz b6lJwD8YQ+OCsY77BphecOQcnseJQZync0587NlUMv9p7y87ItOKmynqeUjjdjzXz2 ToKRB5Ay1q8kQ== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1mdVZj-002z5H-5v; Thu, 21 Oct 2021 11:45:31 +0100 From: Mauro Carvalho Chehab To: Lorenzo Pieralisi Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Binghui Wang , Bjorn Helgaas , Rob Herring , Xiaowei Song , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v15 10/13] PCI: kirin: Move the power-off code to a common routine Date: Thu, 21 Oct 2021 11:45:17 +0100 Message-Id: <64f6e8da3e5fff38b6c8fcb208ace46efe6555bb.1634812676.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of having two copies of the same logic, place the power-off logic on a separate function. No functional changes. Acked-by: Xiaowei Song Signed-off-by: Mauro Carvalho Chehab --- To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH v15 00/13] at: https://lore.kernel.org/all/cover.1634812676.git.mchehab+huawei@kernel.org/ drivers/pci/controller/dwc/pcie-kirin.c | 26 ++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c index 64221a204db2..f4ea27b37968 100644 --- a/drivers/pci/controller/dwc/pcie-kirin.c +++ b/drivers/pci/controller/dwc/pcie-kirin.c @@ -680,6 +680,19 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = { .host_init = kirin_pcie_host_init, }; +static int kirin_pcie_power_off(struct kirin_pcie *kirin_pcie) +{ + int i; + + if (kirin_pcie->type == PCIE_KIRIN_INTERNAL_PHY) + return hi3660_pcie_phy_power_off(kirin_pcie); + + phy_power_off(kirin_pcie->phy); + phy_exit(kirin_pcie->phy); + + return 0; +} + static int kirin_pcie_power_on(struct platform_device *pdev, struct kirin_pcie *kirin_pcie) { @@ -725,12 +738,7 @@ static int kirin_pcie_power_on(struct platform_device *pdev, return 0; err: - if (kirin_pcie->type == PCIE_KIRIN_INTERNAL_PHY) { - hi3660_pcie_phy_power_off(kirin_pcie); - } else { - phy_power_off(kirin_pcie->phy); - phy_exit(kirin_pcie->phy); - } + kirin_pcie_power_off(kirin_pcie); return ret; } @@ -739,11 +747,7 @@ static int __exit kirin_pcie_remove(struct platform_device *pdev) { struct kirin_pcie *kirin_pcie = platform_get_drvdata(pdev); - if (kirin_pcie->type == PCIE_KIRIN_INTERNAL_PHY) - return hi3660_pcie_phy_power_off(kirin_pcie); - - phy_power_off(kirin_pcie->phy); - phy_exit(kirin_pcie->phy); + kirin_pcie_power_off(kirin_pcie); return 0; } -- 2.31.1