hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/include/linux/io-mapping.h
....@@ -1,18 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright © 2008 Keith Packard <keithp@keithp.com>
3
- *
4
- * This file is free software; you can redistribute it and/or modify
5
- * it under the terms of version 2 of the GNU General Public License
6
- * as published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
- *
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software Foundation,
15
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
164 */
175
186 #ifndef _LINUX_IO_MAPPING_H
....@@ -22,13 +10,14 @@
2210 #include <linux/slab.h>
2311 #include <linux/bug.h>
2412 #include <linux/io.h>
13
+#include <linux/pgtable.h>
2514 #include <asm/page.h>
2615
2716 /*
2817 * The io_mapping mechanism provides an abstraction for mapping
2918 * individual pages from an io device to the CPU in an efficient fashion.
3019 *
31
- * See Documentation/io-mapping.txt
20
+ * See Documentation/driver-api/io-mapping.rst
3221 */
3322
3423 struct io_mapping {
....@@ -40,6 +29,7 @@
4029
4130 #ifdef CONFIG_HAVE_ATOMIC_IOMAP
4231
32
+#include <linux/pfn.h>
4333 #include <asm/iomap.h>
4434 /*
4535 * For small address space machines, mapping large objects
....@@ -76,12 +66,10 @@
7666 unsigned long offset)
7767 {
7868 resource_size_t phys_addr;
79
- unsigned long pfn;
8069
8170 BUG_ON(offset >= mapping->size);
8271 phys_addr = mapping->base + offset;
83
- pfn = (unsigned long) (phys_addr >> PAGE_SHIFT);
84
- return iomap_atomic_prot_pfn(pfn, mapping->prot);
72
+ return iomap_atomic_prot_pfn(PHYS_PFN(phys_addr), mapping->prot);
8573 }
8674
8775 static inline void
....@@ -112,7 +100,6 @@
112100 #else
113101
114102 #include <linux/uaccess.h>
115
-#include <asm/pgtable.h>
116103
117104 /* Create the io_mapping object*/
118105 static inline struct io_mapping *