From 02178d4b697cb58cebefd9dccc56d614b1795e5f Mon Sep 17 00:00:00 2001 From: Danish Khateeb Date: Mon, 21 Sep 2026 13:24:48 -0500 Subject: [PATCH] ata: libata-sff: replace kmap_atomic() with kmap_local_page() kmap_atomic() is deprecated in favour of kmap_local_page(), as described in Documentation/mm/highmem.rst. ata_pio_xfer() and __atapi_pio_bytes() each map a single page, pass the address to ->sff_data_xfer() for one transfer and unmap it again, so the mapping never leaves the function that created it. Neither needs the pagefault_disable() and preempt_disable() implied by kmap_atomic(). ->sff_data_xfer() only moves data between the device and the mapped buffer, and both functions are reached only through ata_sff_hsm_move() with the host lock held, whether from the PIO task, an interrupt handler or EH. kmap_local_page() is fine in all of these. Assisted-by: LLM sparse Signed-off-by: Danish Khateeb Reviewed-by: Damien Le Moal Link: https://lore.kernel.org/r/20260921182448.194307-1-danishkhateeb03@gmail.com Signed-off-by: Niklas Cassel --- drivers/ata/libata-sff.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index d5ef0338735c..a263f886abc7 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c @@ -580,9 +580,9 @@ static void ata_pio_xfer(struct ata_queued_cmd *qc, struct page *page, bool do_write = (qc->tf.flags & ATA_TFLAG_WRITE); unsigned char *buf; - buf = kmap_atomic(page); + buf = kmap_local_page(page); qc->ap->ops->sff_data_xfer(qc, buf + offset, xfer_size, do_write); - kunmap_atomic(buf); + kunmap_local(buf); if (!do_write && !PageSlab(page)) flush_dcache_page(page); @@ -763,9 +763,9 @@ static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes) trace_atapi_pio_transfer_data(qc, offset, count); /* do the actual data transfer */ - buf = kmap_atomic(page); + buf = kmap_local_page(page); consumed = ap->ops->sff_data_xfer(qc, buf + offset, count, rw); - kunmap_atomic(buf); + kunmap_local(buf); bytes -= min(bytes, consumed); qc->curbytes += count;