Thread (9 messages) 9 messages, 3 authors, 2021-11-25

Re: [PATCH] pata_falcon: Add missing __iomem annotations

From: Finn Thain <fthain@linux-m68k.org>
Date: 2021-11-25 01:08:35
Also in: lkml

On Wed, 24 Nov 2021, Geert Uytterhoeven wrote:
Thanks for your patch!
quoted
--- a/drivers/ata/pata_falcon.c
+++ b/drivers/ata/pata_falcon.c
@@ -55,14 +55,14 @@ static unsigned int pata_falcon_data_xfer(struct ata_queued_cmd *qc,
        /* Transfer multiple of 2 bytes */
        if (rw == READ) {
                if (swap)
-                       raw_insw_swapw((u16 *)data_addr, (u16 *)buf, words);
+                       raw_insw_swapw((u16 __iomem *)data_addr, (u16 *)buf, words);
                else
-                       raw_insw((u16 *)data_addr, (u16 *)buf, words);
+                       raw_insw((u16 __iomem *)data_addr, (u16 *)buf, words);
        } else {
                if (swap)
-                       raw_outsw_swapw((u16 *)data_addr, (u16 *)buf, words);
+                       raw_outsw_swapw((u16 __iomem *)data_addr, (u16 *)buf, words);
                else
-                       raw_outsw((u16 *)data_addr, (u16 *)buf, words);
+                       raw_outsw((u16 __iomem *)data_addr, (u16 *)buf, words);
Can't you just drop the casts? data_addr is an __iomem void *.
Yes, that works here (i.e. removing the data_addr casts and not the buf 
casts). But is it prudent?

Given the implementation of raw_in/out is subject to change, it seems like 
the original casts were defensive programming.

Here's an example of a recent regression that was fixed by casting a macro 
argument to a specific width:

https://lore.kernel.org/linuxppc-dev/79ae1f49-f6b1-e9ad-977d-0cc7e553c7b9@csgroup.eu/ (local) 
https://lore.kernel.org/linuxppc-dev/08bbe7240b384016e0b2912ecf3bf5e2d25ef2c6.1636501628.git.fthain@linux-m68k.org/ (local) 

BTW, that bug eventually got fixed using a different patch.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/powerpc/kernel/signal.h?id=5499802b2284331788a440585869590f1bd63f7f

Note that __get_user_sigset() still lacks width casts here, so it remains 
non-portable.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help