2023-06-18 23:12:10

by Maciej W. Rozycki

[permalink] [raw]
Subject: [PATCH] SPARC: Fix parport_pc support for 32-bit platforms

For 32-bit SPARC platforms PC-style parallel ports are only available as
PCI options. Adjust <asm/parport.h> 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'

Signed-off-by: Maciej W. Rozycki <[email protected]>
Fixes: 66bcd06099bb ("parport_pc: Also enable driver for PCI systems")
Cc: [email protected] # v5.18+
---
arch/sparc/include/asm/parport.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

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,7 +19,9 @@
* 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
static DEFINE_SPINLOCK(dma_spin_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 */


2023-06-18 23:43:07

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] SPARC: Fix parport_pc support for 32-bit platforms

Hi--

On 6/18/23 16:00, Maciej W. Rozycki wrote:
> For 32-bit SPARC platforms PC-style parallel ports are only available as
> PCI options. Adjust <asm/parport.h> 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'
>
> Signed-off-by: Maciej W. Rozycki <[email protected]>
> Fixes: 66bcd06099bb ("parport_pc: Also enable driver for PCI systems")
> Cc: [email protected] # v5.18+

Yes, this fixes the build errors. Thanks for the patch.

There is one new warning that should be fixed as well:

<stdin>:1519:2: warning: #warning syscall clone3 not implemented [-Wcpp]
In file included from ../include/linux/spinlock.h:88,
from ../include/linux/kref.h:16,
from ../include/linux/mm_types.h:8,
from ../include/linux/buildid.h:5,
from ../include/linux/module.h:14,
from ../drivers/parport/parport_pc.c:46:
../arch/sparc/include/asm/parport.h:27:24: warning: 'dma_spin_lock' defined but not used [-Wunused-variable]
27 | static DEFINE_SPINLOCK(dma_spin_lock);
| ^~~~~~~~~~~~~
../include/linux/spinlock_types.h:43:44: note: in definition of macro 'DEFINE_SPINLOCK'
43 | #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
| ^


> ---
> arch/sparc/include/asm/parport.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> 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,7 +19,9 @@
> * 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
> static DEFINE_SPINLOCK(dma_spin_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 */

--
~Randy

2023-06-19 00:16:01

by Maciej W. Rozycki

[permalink] [raw]
Subject: Re: [PATCH] SPARC: Fix parport_pc support for 32-bit platforms

On Sun, 18 Jun 2023, Randy Dunlap wrote:

> There is one new warning that should be fixed as well:
>
> <stdin>:1519:2: warning: #warning syscall clone3 not implemented [-Wcpp]
> In file included from ../include/linux/spinlock.h:88,
> from ../include/linux/kref.h:16,
> from ../include/linux/mm_types.h:8,
> from ../include/linux/buildid.h:5,
> from ../include/linux/module.h:14,
> from ../drivers/parport/parport_pc.c:46:
> ../arch/sparc/include/asm/parport.h:27:24: warning: 'dma_spin_lock' defined but not used [-Wunused-variable]
> 27 | static DEFINE_SPINLOCK(dma_spin_lock);
> | ^~~~~~~~~~~~~
> ../include/linux/spinlock_types.h:43:44: note: in definition of macro 'DEFINE_SPINLOCK'
> 43 | #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
> | ^

Ah, that's because `sparc32_defconfig' doesn't have CONFIG_WERROR enabled
and I didn't double-check. Thanks for your input. I'll send v2 shortly.

Maciej