From patchwork Sat Apr 8 13:21:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 81208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp877386vqo; Sat, 8 Apr 2023 06:33:19 -0700 (PDT) X-Google-Smtp-Source: AKy350b1yYXDimXXz3OgAewKBb8JGZFB4shqo/6/ZxdeyvFnanH3tVlcD/xj2cmex833RTRJPEOv X-Received: by 2002:a62:5206:0:b0:626:444:bfa6 with SMTP id g6-20020a625206000000b006260444bfa6mr2306291pfb.26.1680960799400; Sat, 08 Apr 2023 06:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680960799; cv=none; d=google.com; s=arc-20160816; b=x6clCHtyOdAwWKoPW307GJ6tMyw+ffEVrpZpz01hZNXur8EA5RiSKThl5bdjC6wPyQ McpAKAr+31Hs6BGliczLEzOix/7rMJRrE9WQu2ugcGB0cqjLkw6mct4yygBJNNyI9GYg VY24Qm5Ms1Yu5T3XuJPq3QY0zvkjeI8D60Tt36+WeGed6Ne5eG0veALhRGVD2imLJFuB ITjLQiTLLgtTSBNUA+X5jG6ggkW5y2UJOod3Eky2CJwmf36vfpAZ3cw/V4FMcv3moUbQ AumQrQ8JBcwL6gBl59H2YeeerDgNwwhPG4mxT1a8GGhBRkEtD6JbTLM9CwvzyY87ldmv Gy3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NS/leeoJc7HPA+RaL0e1zOP9pwqxK2gI2WZ3KR1xBN4=; b=ohFYv4A7pFiM5+K4gD1vS08hlj45cPBzst/4rDOyaTigDm+PkA60M0ZfxvGh5KJKbL XrwsOjZM55bEykk1g3UlKEiDAieSQJwapeF0tQkWDmTWP8qM+5qnYPemzvuHAqVy0M8V NQEvg3aEQOxms5iOQ6PTPZeTIckZXy6V5mzvUS3WLP3uGA+t+FfwPBouSFsdSlwPALq0 VG7rM6Ks7rylfqFvoZ4ksbTq0XVkBhTNELK5vLPS0zII+fKmq9tgc+LzwYUqzljJomtp QIgP9rvtlAkwPFAgYUN0qafUmktaxECQfCp3u8MEhgsE605PXqXeifDwZ4dBfUcPm8VJ jhyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MdxuSe+L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a6-20020aa78e86000000b00625d00d1eb7si6148896pfr.96.2023.04.08.06.33.05; Sat, 08 Apr 2023 06:33:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MdxuSe+L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230135AbjDHNYS (ORCPT + 99 others); Sat, 8 Apr 2023 09:24:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229756AbjDHNYK (ORCPT ); Sat, 8 Apr 2023 09:24:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 603E6D524 for ; Sat, 8 Apr 2023 06:24:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D9B28614AE for ; Sat, 8 Apr 2023 13:24:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18E34C4339E; Sat, 8 Apr 2023 13:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680960248; bh=Ycr7jTbAN7a67s9Ksm6I4CQ7mN9wdogyCtOnF9CVtvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MdxuSe+LGcMjPGW4s4MBfLc4ay1yMaMhj5hJnik1bVIBWEmhdEygdUtUCZSXAiCvg 28wiN5rrZnZMBaStGPphkC0IhmslAZCRqadt6BgA3d2D0ALiF4B9XahwbrpF0BEzmA Tm3ZbyltDJ+d/SzG9PxLUs8rvVW6McW+2Sz9/UL5KOH3E+dzRvbho4YL8xsLRcFafS 0dgTxKuhMYiwc1IYNo0W5lKb8QcKFIBQm9ygCVa2recOwMslclHih3N8EMP4Xhp9ak pVk+WHMhtwGEXdBt7yJwdop6iLEdEGR60s+X6mW3DC8stexV8rS32fQ498xLOjA8hf EkaNeF1d1gTSA== Received: by pali.im (Postfix) id 9734A2047; Sat, 8 Apr 2023 15:24:05 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Michael Ellerman , Christophe Leroy , Nicholas Piggin Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/8] powerpc/fsl_uli1575: Simplify uli_exclude_device() usage Date: Sat, 8 Apr 2023 15:21:46 +0200 Message-Id: <20230408132151.8902-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230408132151.8902-1-pali@kernel.org> References: <20230408132151.8902-1-pali@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762615151221008299?= X-GMAIL-MSGID: =?utf-8?q?1762615151221008299?= Function uli_exclude_device() is called only from mpc86xx_exclude_device() and mpc85xx_exclude_device() functions. Both those functions are same, so merge its logic directly into the uli_exclude_device() function. Signed-off-by: Pali Rohár --- arch/powerpc/platforms/85xx/mpc85xx_ds.c | 13 +------------ arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 13 +------------ arch/powerpc/platforms/fsl_uli1575.c | 4 +++- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c index 0c905a838942..581b5f0ef3be 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c @@ -107,17 +107,6 @@ void __init mpc85xx_ds_pic_init(void) #endif /* CONFIG_PPC_I8259 */ } -#ifdef CONFIG_PCI -static int mpc85xx_exclude_device(struct pci_controller *hose, - u_char bus, u_char devfn) -{ - if (hose->dn == fsl_pci_primary) - return uli_exclude_device(hose, bus, devfn); - - return PCIBIOS_SUCCESSFUL; -} -#endif /* CONFIG_PCI */ - static void __init mpc85xx_ds_uli_init(void) { #ifdef CONFIG_PCI @@ -132,7 +121,7 @@ static void __init mpc85xx_ds_uli_init(void) node = pci_with_uli; if (pci_with_uli == fsl_pci_primary) { - ppc_md.pci_exclude_device = mpc85xx_exclude_device; + ppc_md.pci_exclude_device = uli_exclude_device; break; } } diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c index 3dbd396a0df5..645125cc8420 100644 --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c @@ -39,17 +39,6 @@ #define DBG(fmt...) do { } while(0) #endif -#ifdef CONFIG_PCI -static int mpc86xx_exclude_device(struct pci_controller *hose, - u_char bus, u_char devfn) -{ - if (hose->dn == fsl_pci_primary) - return uli_exclude_device(hose, bus, devfn); - - return PCIBIOS_SUCCESSFUL; -} -#endif /* CONFIG_PCI */ - static void __init mpc86xx_hpcn_setup_arch(void) @@ -58,7 +47,7 @@ mpc86xx_hpcn_setup_arch(void) ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0); #ifdef CONFIG_PCI - ppc_md.pci_exclude_device = mpc86xx_exclude_device; + ppc_md.pci_exclude_device = uli_exclude_device; #endif printk("MPC86xx HPCN board from Freescale Semiconductor\n"); diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c index a32f9cef7845..1350db0b935d 100644 --- a/arch/powerpc/platforms/fsl_uli1575.c +++ b/arch/powerpc/platforms/fsl_uli1575.c @@ -15,6 +15,8 @@ #include #include +#include + #define ULI_PIRQA 0x08 #define ULI_PIRQB 0x09 #define ULI_PIRQC 0x0a @@ -344,7 +346,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5288, hpcd_final_uli5288); int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn) { - if (bus == (hose->first_busno + 2)) { + if (hose->dn == fsl_pci_primary && bus == (hose->first_busno + 2)) { /* exclude Modem controller */ if ((PCI_SLOT(devfn) == 29) && (PCI_FUNC(devfn) == 1)) return PCIBIOS_DEVICE_NOT_FOUND;