From: Florian Fuchs <fuchsfl@gmail.com>
To: linux-sh@vger.kernel.org,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
Artur Rojek <contact@artur-rojek.eu>
Cc: Adrian McMenamin <adrianmcmenamin@gmail.com>,
linux-kernel@vger.kernel.org, Florian Fuchs <fuchsfl@gmail.com>
Subject: [PATCH v2 1/2] cdrom: gdrom: replace port I/O with MMIO accessors
Date: Sun, 19 Apr 2026 18:28:22 +0200 [thread overview]
Message-ID: <20260419162823.2829286-2-fuchsfl@gmail.com> (raw)
In-Reply-To: <20260419162823.2829286-1-fuchsfl@gmail.com>
GDROM_DATA_REG is a memory-mapped data register, but the driver uses
outsw() and insw() only for this register. Replace this with MMIO
accessors readsw() / writesw().
Before, it oopsed accessing the data register, as the io_port_base
P2SEG gets added to the argument in outsw() / insw(), which leads to an
unusable drive:
BUG: unable to handle kernel paging request at 405f7080
PC: [<8c28d5b4>] gdrom_spicommand+0x6c/0xb0
Signed-off-by: Florian Fuchs <fuchsfl@gmail.com>
---
v1->v2: Don't use helper functions with io.*_rep(), but writesw() and
readsw() local in the respective functions
v1: https://lore.kernel.org/linux-sh/20260405082330.4104672-2-fuchsfl@gmail.com/
---
drivers/cdrom/gdrom.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 4ba4dd06cbf4..89938d9b2825 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -198,7 +198,7 @@ static void gdrom_spicommand(void *spi_string, int buflen)
gdrom_getsense(NULL);
return;
}
- outsw(GDROM_DATA_REG, cmd, 6);
+ writesw((void __iomem *)GDROM_DATA_REG, cmd, 6);
}
@@ -282,7 +282,7 @@ static int gdrom_readtoc_cmd(struct gdromtoc *toc, int session)
err = -EINVAL;
goto cleanup_readtoc;
}
- insw(GDROM_DATA_REG, toc, tocsize/2);
+ readsw((void __iomem *)GDROM_DATA_REG, toc, tocsize / 2);
if (gd.status & 0x01)
err = -EINVAL;
@@ -433,7 +433,7 @@ static int gdrom_getsense(short *bufstring)
GDROM_DEFAULT_TIMEOUT);
if (gd.pending)
goto cleanup_sense;
- insw(GDROM_DATA_REG, &sense, sense_command->buflen/2);
+ readsw((void __iomem *)GDROM_DATA_REG, &sense, sense_command->buflen / 2);
if (sense[1] & 40) {
pr_info("Drive not ready - command aborted\n");
goto cleanup_sense;
@@ -612,7 +612,7 @@ static blk_status_t gdrom_readdisk_dma(struct request *req)
cpu_relax();
gd.pending = 1;
gd.transfer = 1;
- outsw(GDROM_DATA_REG, &read_command->cmd, 6);
+ writesw((void __iomem *)GDROM_DATA_REG, read_command->cmd, 6);
timeout = jiffies + HZ / 2;
/* Wait for any pending DMA to finish */
while (__raw_readb(GDROM_DMA_STATUS_REG) &&
--
2.43.0
next prev parent reply other threads:[~2026-04-19 16:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-19 16:28 [PATCH v2 0/2] cdrom: gdrom: fix block I/O and capacity setting Florian Fuchs
2026-04-19 16:28 ` Florian Fuchs [this message]
2026-04-19 16:50 ` [PATCH v2 1/2] cdrom: gdrom: replace port I/O with MMIO accessors Artur Rojek
2026-04-20 10:20 ` Adrian McMenamin
2026-04-20 11:01 ` John Paul Adrian Glaubitz
2026-04-20 12:29 ` Adrian McMenamin
2026-04-19 16:28 ` [PATCH v2 2/2] cdrom: gdrom: update gendisk capacity on open Florian Fuchs
2026-04-19 16:59 ` Artur Rojek
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=20260419162823.2829286-2-fuchsfl@gmail.com \
--to=fuchsfl@gmail.com \
--cc=adrianmcmenamin@gmail.com \
--cc=contact@artur-rojek.eu \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
/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