From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B3B7C433FE for ; Thu, 21 Oct 2021 10:45:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0420C61205 for ; Thu, 21 Oct 2021 10:45:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231214AbhJUKsB (ORCPT ); Thu, 21 Oct 2021 06:48:01 -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