Skip to contentSkip to conversation

mtdchar-replace-deprecated-mmap-hook-with-mmap_prepare-clean-up.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 31

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mtdchar: replace deprecated mmap hook with mmap_prepare, clean up
has been removed from the -mm tree. Its filename was
mtdchar-replace-deprecated-mmap-hook-with-mmap_prepare-clean-up.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: "Lorenzo Stoakes (Oracle)" <[email protected]>
Subject: mtdchar: replace deprecated mmap hook with mmap_prepare, clean up
Date: Fri, 20 Mar 2026 22:39:40 +0000

Replace the deprecated mmap callback with mmap_prepare.

Commit f5cf8f07423b ("mtd: Disable mtdchar mmap on MMU systems") commented out the CONFIG_MMU part of this function back in 2012, so after ~14 years it's probably reasonable to remove this altogether rather than updating dead code.

Cc Alexander Shishkin <[email protected]>
Cc Alexandre Torgue <[email protected]>
Cc Al Viro <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Bodo Stroesser <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Clemens Ladisch <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc David Howells <[email protected]>
Cc Dexuan Cui <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Haiyang Zhang <[email protected]>
Cc Jan Kara <[email protected]>
Cc Jann Horn <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc K. Y. Srinivasan <[email protected]>
Cc Liam Howlett <[email protected]>
Cc Long Li <[email protected]>
Cc Marc Dionne <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Miquel Raynal <[email protected]>
Cc Pedro Falcato <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Vignesh Raghavendra <[email protected]>
Cc Wei Liu <[email protected]>

---

 drivers/mtd/mtdchar.c |   21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)
drivers/mtd/mtdchar.c renamed from drivers/mtd/mtdchar.c~mtdchar-replace-deprecated-mmap-hook-with-mmap_prepare-clean-up +3 -18
@@ -1376,27 +1376,12 @@ static unsigned mtdchar_mmap_capabilitie
 /*
  * set up a mapping for shared memory segments
  */
-static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma)
+static int mtdchar_mmap_prepare(struct vm_area_desc *desc)
 {
 #ifdef CONFIG_MMU
-	struct mtd_file_info *mfi = file->private_data;
-	struct mtd_info *mtd = mfi->mtd;
-	struct map_info *map = mtd->priv;
-
-        /* This is broken because it assumes the MTD device is map-based
-	   and that mtd->priv is a valid struct map_info.  It should be
-	   replaced with something that uses the mtd_get_unmapped_area()
-	   operation properly. */
-	if (0 /*mtd->type == MTD_RAM || mtd->type == MTD_ROM*/) {
-#ifdef pgprot_noncached
-		if (file->f_flags & O_DSYNC || map->phys >= __pa(high_memory))
-			vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-#endif
-		return vm_iomap_memory(vma, map->phys, map->size);
-	}
 	return -ENODEV;
 #else
-	return vma->vm_flags & VM_SHARED ? 0 : -EACCES;
+	return vma_desc_test(desc, VMA_SHARED_BIT) ? 0 : -EACCES;
 #endif
 }
 
@@ -1411,7 +1396,7 @@ static const struct file_operations mtd_
 #endif
 	.open		= mtdchar_open,
 	.release	= mtdchar_close,
-	.mmap		= mtdchar_mmap,
+	.mmap_prepare	= mtdchar_mmap_prepare,
 #ifndef CONFIG_MMU
 	.get_unmapped_area = mtdchar_get_unmapped_area,
 	.mmap_capabilities = mtdchar_mmap_capabilities,

_

Patches currently in -mm which might be from [email protected] are

maintainers-update-mglru-entry-to-reflect-current-status.patch selftests-mm-add-merge-test-for-partial-msealed-range.patch