Input: xilinx_ps2 - replace in_be32/out_be32 with ioread32be/iowrite32be
Subsystems (3)
PATCH 1/1 Input: xilinx_ps2 - replace in_be32/out_be32 with ioread32be/iowrite32be
Mechanical conversion of the ppc4xx-specific accessors to the generic portable helpers.
Allows enabling COMPILE_TEST for extra compile coverage.
--- drivers/input/serio/Kconfig | 2 +- drivers/input/serio/xilinx_ps2.c | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-)
drivers/input/serio/Kconfig +1 -1
@@ -190,7 +190,7 @@ config SERIO_RAW config SERIO_XILINX_XPS_PS2 tristate "Xilinx XPS PS/2 Controller Support" - depends on PPC || MICROBLAZE + depends on PPC || MICROBLAZE || COMPILE_TEST help This driver supports XPS PS/2 IP from the Xilinx EDK on PowerPC platform.
drivers/input/serio/xilinx_ps2.c +12 -12
@@ -89,9 +89,9 @@ static int xps2_recv(struct xps2data *drvdata, u8 *byte)int status =-1 ;/* If there is data available in the PS/2 receiver, read it */ - sr =in_be32 (drvdata->base_address +XPS2_STATUS_OFFSET ); + sr =ioread32be (drvdata->base_address +XPS2_STATUS_OFFSET );if (sr &XPS2_STATUS_RX_FULL ) { - *byte =in_be32 (drvdata->base_address +XPS2_RX_DATA_OFFSET ); + *byte =ioread32be (drvdata->base_address +XPS2_RX_DATA_OFFSET ); status =0 ; }
@@ -109,8 +109,8 @@ static irqreturn_t xps2_interrupt(int irq, void *dev_id)int status;/* Get the PS/2 interrupts and clear them */ - intr_sr =in_be32 (drvdata->base_address +XPS2_IPISR_OFFSET ); -out_be32 (drvdata->base_address +XPS2_IPISR_OFFSET , intr_sr); + intr_sr =ioread32be (drvdata->base_address +XPS2_IPISR_OFFSET ); +iowrite32be (intr_sr, drvdata->base_address +XPS2_IPISR_OFFSET );/* Check which interrupt is active */ if (intr_sr &XPS2_IPIXR_RX_OVF )
@@ -160,11 +160,11 @@ static int sxps2_write(struct serio *pserio, unsigned char c)guard (spinlock_irqsave)(&drvdata->lock);/* If the PS/2 transmitter is empty send a byte of data */ - sr =in_be32 (drvdata->base_address +XPS2_STATUS_OFFSET ); + sr =ioread32be (drvdata->base_address +XPS2_STATUS_OFFSET );if (sr &XPS2_STATUS_TX_FULL )return -EAGAIN ; -out_be32 (drvdata->base_address +XPS2_TX_DATA_OFFSET , c); +iowrite32be (c, drvdata->base_address +XPS2_TX_DATA_OFFSET );return 0 ; }
@@ -189,8 +189,8 @@ static int sxps2_open(struct serio *pserio) }/* start reception by enabling the interrupts */ -out_be32 (drvdata->base_address +XPS2_GIER_OFFSET ,XPS2_GIER_GIE_MASK ); -out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ,XPS2_IPIXR_RX_ALL ); +iowrite32be (XPS2_GIER_GIE_MASK , drvdata->base_address +XPS2_GIER_OFFSET ); +iowrite32be (XPS2_IPIXR_RX_ALL , drvdata->base_address +XPS2_IPIER_OFFSET ); (void )xps2_recv (drvdata, &c);return 0 ;/* success */
@@ -207,8 +207,8 @@ static void sxps2_close(struct serio *pserio)struct xps2data *drvdata = pserio->port_data;/* Disable the PS2 interrupts */ -out_be32 (drvdata->base_address +XPS2_GIER_OFFSET ,0x00 ); -out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ,0x00 ); +iowrite32be (0x00 , drvdata->base_address +XPS2_GIER_OFFSET ); +iowrite32be (0x00 , drvdata->base_address +XPS2_IPIER_OFFSET );free_irq (drvdata->irq, drvdata); }
@@ -278,13 +278,13 @@ static int xps2_of_probe(struct platform_device *ofdev) }/* Disable all the interrupts, just in case */ -out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ,0 ); +iowrite32be (0 , drvdata->base_address +XPS2_IPIER_OFFSET );/* * Reset the PS2 device and abort any current transaction, * to make sure we have the PS2 in a good state. */ -out_be32 (drvdata->base_address +XPS2_SRST_OFFSET ,XPS2_SRST_RESET ); +iowrite32be (XPS2_SRST_RESET , drvdata->base_address +XPS2_SRST_OFFSET ); dev_info(dev, "Xilinx PS2 at 0x%08llX mapped to 0x%p, irq=%d\n", (unsigned long long)phys_addr, drvdata->base_address,
Signature · 1 line
2.54.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Adding COMPILE_TEST exposes the driver to architectures without HAS_IOMEM, leading to build…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Adding COMPILE_TEST exposes the driver to architectures without HAS_IOMEM, leading to build failures. --
commit fa18055bb5a7f7464dd14a35a0c7198e7099cd71
Author: Rosen Penev <[email protected]>
Input: xilinx_ps2 - replace in_be32/out_be32 with ioread32be/iowrite32be
This commit mechanically converts ppc4xx-specific accessors to generic portable helpers. It also enables COMPILE_TEST for extra compile coverage.
drivers/input/serio/Kconfig config SERIO_RAW · line 193
Quoted 10 lines
drivers/input/serio/Kconfig +1
-1@@ -190,7 +190,7 @@ config SERIO_RAW config SERIO_XILINX_XPS_PS2 tristate "Xilinx XPS PS/2 Controller Support" - depends on PPC || MICROBLAZE + depends on PPC || MICROBLAZE || COMPILE_TEST
[Severity: Low]
Does adding COMPILE_TEST here expose this driver to architectures without HAS_IOMEM?
Since the driver relies heavily on memory-mapped I/O functions like ioremap(), ioread32be(), and iowrite32be(), allowing it to build on architectures that do not support MMIO (such as ARCH=um) could result in build or linker errors.
Would it be safer to add a dependency on HAS_IOMEM?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Michal Simek
maintainerQuoted 10 lines · Rosen Penev
Mechanical conversion of the ppc4xx-specific accessors to the generic portable helpers.
Allows enabling
COMPILE_TESTfor extra compile coverage.Assisted-by opencode:big-pickleSigned-off-by Rosen Penev <[email protected]>--- drivers/input/serio/Kconfig | 2 +- drivers/input/serio/xilinx_ps2.c | 24 ++++++++++++------------
I don't think that anybody is really using this driver and would be better to just remove it. If not, no issue with that changes.
Thanks,
Michal
Quoted 15 lines · Michal Simek
Quoted 10 lines · Rosen Penev
Mechanical conversion of the ppc4xx-specific accessors to the generic portable helpers.
Allows enabling
COMPILE_TESTfor extra compile coverage.Assisted-by opencode:big-pickleSigned-off-by Rosen Penev <[email protected]>--- drivers/input/serio/Kconfig | 2 +- drivers/input/serio/xilinx_ps2.c | 24 ++++++++++++------------
Quoted 3 lines
I don't think that anybody is really using this driver and would be better to just remove it.
If not, no issue with that changes.
I have no problem with removing.
Quoted 3 lines
Thanks,
Michal
Michal Simek
maintainerQuoted 16 lines · Rosen Penev
Quoted 15 lines · Michal Simek
Quoted 10 lines · Rosen Penev
Mechanical conversion of the ppc4xx-specific accessors to the generic portable helpers.
Allows enabling
COMPILE_TESTfor extra compile coverage.Assisted-by opencode:big-pickleSigned-off-by Rosen Penev <[email protected]>--- drivers/input/serio/Kconfig | 2 +- drivers/input/serio/xilinx_ps2.c | 24 ++++++++++++------------
Quoted 4 lines
Quoted 3 lines
I don't think that anybody is really using this driver and would be better to just remove it.
If not, no issue with that changes.I have no problem with removing.
Can you please send a patch for it?
Thanks,
Michal
Quoted 20 lines · Michal Simek
Quoted 16 lines · Rosen Penev
Quoted 15 lines · Michal Simek
Quoted 10 lines · Rosen Penev
Mechanical conversion of the ppc4xx-specific accessors to the generic portable helpers.
Allows enabling
COMPILE_TESTfor extra compile coverage.Assisted-by opencode:big-pickleSigned-off-by Rosen Penev <[email protected]>--- drivers/input/serio/Kconfig | 2 +- drivers/input/serio/xilinx_ps2.c | 24 ++++++++++++------------
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
I don't think that anybody is really using this driver and would be better to just remove it.
If not, no issue with that changes.I have no problem with removing.
Can you please send a patch for it?
Out of curiosity, I made a deep research AI prompt. Last known user it gave me was from 2012. Github code search however gave me a user from 5 or 6 years ago.
https://github.com/danielkasza/9444/blob/master/firmware/xilinx-fpga/genesys2.dts
Maybe someone knows more.
Quoted 3 lines
Thanks,
Michal