From: Finn Thain <fthain@linux-m68k.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Damien Le Moal <damien.lemoal@opensource.wdc.com>,
Michael Schmitz <schmitzmic@gmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Jens Axboe <axboe@kernel.dk>,
linux-ide@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pata_falcon: Add missing __iomem annotations
Date: Thu, 25 Nov 2021 12:06:27 +1100 (AEDT) [thread overview]
Message-ID: <35a85d2f-ab6a-4ab7-85a8-626f1560a57d@linux-m68k.org> (raw)
In-Reply-To: <CAMuHMdXTxTABOoVgC6fVR44dxUZZEbZV=ewSk9vKFY=U5u+fcw@mail.gmail.com>
On Wed, 24 Nov 2021, Geert Uytterhoeven wrote:
> Thanks for your patch!
>
> > --- 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/
https://lore.kernel.org/linuxppc-dev/08bbe7240b384016e0b2912ecf3bf5e2d25ef2c6.1636501628.git.fthain@linux-m68k.org/
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.
next prev parent reply other threads:[~2021-11-25 1:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 4:25 [PATCH] pata_falcon: Add missing __iomem annotations Finn Thain
2021-11-24 4:52 ` Michael Schmitz
2021-11-25 1:09 ` Finn Thain
2021-11-24 7:51 ` Geert Uytterhoeven
2021-11-24 20:50 ` Michael Schmitz
2021-11-25 7:33 ` Geert Uytterhoeven
2021-11-25 1:06 ` Finn Thain [this message]
2021-11-25 7:39 ` Geert Uytterhoeven
2021-11-25 22:36 ` Finn Thain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=35a85d2f-ab6a-4ab7-85a8-626f1560a57d@linux-m68k.org \
--to=fthain@linux-m68k.org \
--cc=axboe@kernel.dk \
--cc=b.zolnierkie@samsung.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=geert@linux-m68k.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=schmitzmic@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).