From patchwork Mon Jun 19 01:01:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 109701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2713124vqr; Sun, 18 Jun 2023 18:09:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ78sp6ScYk/hNUn7nTC4w2a1YHyxVYtQIfN6pIDOW2NuxUIDCWPznYQQkIehqQpj538+zB3 X-Received: by 2002:a05:6a00:3926:b0:664:9579:d31c with SMTP id fh38-20020a056a00392600b006649579d31cmr11881703pfb.8.1687136978145; Sun, 18 Jun 2023 18:09:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687136978; cv=none; d=google.com; s=arc-20160816; b=ygUunEtFeR66F7CPM9IqEynUf6lpjpcyOCo0vrohsLNTT6Gisd/lIkj6G6hAgrG2Dr 0Y1B4bE+3/iBn9+F18+oAhB1CkVXXPfN3/dXRGiuH79ImlN4u3ntNo6SUNbZEXDuY2qD uYQRnHatzsNHJzWevmiq217nEC/e/RiY16hgEOomtJzOj6FlOm1ivus8rQ486LtCAXNV PD2ayqP3ZT4yRCUkv2uW8fPOCF+JlCrVr8oEo3WVhb5KFCLkNIOx91SESQgj92d2YZEe 2TDt7NdbXmtko79BBc4NRd7pIh8DiuoSlo5A2DUOzjQo5x5xaeam0gW62Mly/ZSGInQl FQ8Q== 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 :user-agent:message-id:subject:cc:to:from:date; bh=O6nye5zoCgO6Mk0r+8o8VTrspLnuE+40/G2IXLA2pLc=; b=pE3dhDGpx1euEyMmmdcRa4O/SFX1yFYJRweBod3vddLOnqc9Gj17v2iPpCUa+8EUTO UBxeCm3RtUkj/8a6U9Fm08vaR+lvoRdmihlsPIGSxUy9seylkVHHRfCRhDDudxq/dzlN b1jIEOPQysaCpADUI15XCJvIpm61TzVdn/LnEAIswc/6hckBOvqjwCTSaLx5/NZ/1uKZ fWK5AObLTo3Fex8lPHND9QQdCGvEv6F0mcVbdGokl8ZQPGDgn9L0W6eBrbBabpGkZeNB 2JYI8vBxkzbiSQrrPl742WyQzmQeHxIw0FIkktbsVFD1Mq3Ry925kgPT542dqUnyYaV9 ZrHw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k28-20020aa79d1c000000b00625c6092a12si4980915pfp.215.2023.06.18.18.09.22; Sun, 18 Jun 2023 18:09:38 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229560AbjFSBBN (ORCPT + 99 others); Sun, 18 Jun 2023 21:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjFSBBM (ORCPT ); Sun, 18 Jun 2023 21:01:12 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C679DC4; Sun, 18 Jun 2023 18:01:06 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id CE8BD92009C; Mon, 19 Jun 2023 03:01:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id BF91792009B; Mon, 19 Jun 2023 02:01:05 +0100 (BST) Date: Mon, 19 Jun 2023 02:01:05 +0100 (BST) From: "Maciej W. Rozycki" To: "David S. Miller" cc: Randy Dunlap , Sudip Mukherjee , Sam Ravnborg , sparclinux@vger.kernel.org, linux-parport@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] SPARC: Fix parport_pc support for 32-bit platforms Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,HDRS_LCASE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR autolearn=no 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?1769084070800016150?= X-GMAIL-MSGID: =?utf-8?q?1769091344023808120?= For 32-bit SPARC platforms PC-style parallel ports are only available as PCI options. Adjust accordingly, fixing build errors: sparc-linux-gnu-ld: drivers/parport/parport_pc.o: in function `ecpp_remove': parport_pc.c:(.text+0x8f0): undefined reference to `ebus_dma_irq_enable' sparc-linux-gnu-ld: parport_pc.c:(.text+0x8f8): undefined reference to `ebus_dma_unregister' sparc-linux-gnu-ld: drivers/parport/parport_pc.o: in function `parport_pc_fifo_write_block_dma': parport_pc.c:(.text+0x1430): undefined reference to `ebus_dma_enable' sparc-linux-gnu-ld: parport_pc.c:(.text+0x1444): undefined reference to `ebus_dma_prepare' sparc-linux-gnu-ld: parport_pc.c:(.text+0x14e4): undefined reference to `ebus_dma_enable' sparc-linux-gnu-ld: parport_pc.c:(.text+0x14f4): undefined reference to `ebus_dma_request' sparc-linux-gnu-ld: parport_pc.c:(.text+0x1584): undefined reference to `ebus_dma_enable' sparc-linux-gnu-ld: parport_pc.c:(.text+0x1594): undefined reference to `ebus_dma_residue' sparc-linux-gnu-ld: parport_pc.c:(.text+0x1608): undefined reference to `ebus_dma_enable' sparc-linux-gnu-ld: parport_pc.c:(.text+0x1618): undefined reference to `ebus_dma_residue' sparc-linux-gnu-ld: drivers/parport/parport_pc.o: in function `ecpp_probe': parport_pc.c:(.text+0x33a0): undefined reference to `ebus_dma_register' sparc-linux-gnu-ld: parport_pc.c:(.text+0x33b8): undefined reference to `ebus_dma_irq_enable' sparc-linux-gnu-ld: parport_pc.c:(.text+0x34b0): undefined reference to `ebus_dma_irq_enable' sparc-linux-gnu-ld: parport_pc.c:(.text+0x34bc): undefined reference to `ebus_dma_unregister' Reported-by: Randy Dunlap Closes: https://lore.kernel.org/r/20230406160548.25721-1-rdunlap@infradead.org/ Signed-off-by: Maciej W. Rozycki Fixes: 66bcd06099bb ("parport_pc: Also enable driver for PCI systems") Cc: stable@vger.kernel.org # v5.18+ Acked-by: Randy Dunlap Tested-by: Randy Dunlap # build-tested --- NB by enabling CONFIG_WERROR I hit: sparc-linux-gnu-gcc -Wp,-MMD,kernel/.workqueue.o.d -nostdinc -I./arch/sparc/include -I./arch/sparc/include/generated -I./include -I./arch/sparc/include/uapi -I./arch/sparc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Werror -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -funsigned-char -std=gnu11 -m32 -mcpu=v8 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 -Wa,-Av8 -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=1024 -fno-stack-protector -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-p ointer -fomit-frame-pointer -ftrivial-auto-var-init=zero -fno-stack-clash-protection -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -DKBUILD_MODFILE='"kernel/workqueue"' -DKBUILD_BASENAME='"workqueue"' -DKBUILD_MODNAME='"workqueue"' -D__KBUILD_MODNAME=kmod_workqueue -c -o kernel/workqueue.o kernel/workqueue.c kernel/workqueue.c: In function 'get_work_pwq': kernel/workqueue.c:713:24: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 713 | return (void *)(data & WORK_STRUCT_WQ_DATA_MASK); | ^ kernel/workqueue.c: In function 'get_work_pool': kernel/workqueue.c:741:25: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 741 | return ((struct pool_workqueue *) | ^ kernel/workqueue.c: In function 'get_work_pool_id': kernel/workqueue.c:763:25: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 763 | return ((struct pool_workqueue *) | ^ cc1: all warnings being treated as errors make[2]: *** [scripts/Makefile.build:252: kernel/workqueue.o] Error 1 make[1]: *** [scripts/Makefile.build:494: kernel] Error 2 make: *** [Makefile:2026: .] Error 2 with top of tree GCC 14 and even came up with a fix, but I can see the issue is already being handled with an identical change from Arnd here: , so there's nothing to do about it; let's just wait for 6.5. Changes from v1: - Wrap `dma_spin_lock' into HAS_DMA to fix a "'dma_spin_lock' defined but not used" warning. I think it's slightly cleaner this way compared to wrapping the whole part into CONFIG_SPARC64, as this better reflects the structure of the dependencies here. It also follows the structure of parport_pc.c, which likewise has `parport_pc_fifo_write_block_dma' put into CONFIG_PARPORT_PC_FIFO and then HAS_DMA conditionals. - Add Reported-by tag. --- arch/sparc/include/asm/parport.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) linux-sparc32-parport-pc.diff Index: linux-macro/arch/sparc/include/asm/parport.h =================================================================== --- linux-macro.orig/arch/sparc/include/asm/parport.h +++ linux-macro/arch/sparc/include/asm/parport.h @@ -19,9 +19,11 @@ * While sparc64 doesn't have an ISA DMA API, we provide something that looks * close enough to make parport_pc happy */ +#ifdef CONFIG_SPARC64 #define HAS_DMA +#endif -#ifdef CONFIG_PARPORT_PC_FIFO +#if defined(CONFIG_PARPORT_PC_FIFO) && defined(HAS_DMA) static DEFINE_SPINLOCK(dma_spin_lock); #define claim_dma_lock() \ @@ -249,7 +251,8 @@ static struct platform_driver ecpp_drive static int parport_pc_find_nonpci_ports(int autoirq, int autodma) { - return platform_driver_register(&ecpp_driver); + return (IS_ENABLED(CONFIG_SPARC64) && + platform_driver_register(&ecpp_driver)); } #endif /* !(_ASM_SPARC64_PARPORT_H */