diff mbox series

[v1,14/14] include: reduce dependencies on linux/mm.h

Message ID 20240215145602.1371274-15-max.kellermann@ionos.com (mailing list archive)
State New
Headers show
Series Fast kernel headers: split linux/mm.h | expand

Commit Message

Max Kellermann Feb. 15, 2024, 2:56 p.m. UTC
Replace <linux/mm.h> with the smaller pieces that were just splitted
out.  This affects a few headers that are included by many, e.g. bio.h
and highmem.h, which now no longer depend on the fat <linux/mm.h>
header.

For this, several missing includes need to be added because they are
no longer indirectly included, e.g. <linux/fs.h>.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
 include/linux/bio.h              | 2 ++
 include/linux/dma-mapping.h      | 1 +
 include/linux/highmem-internal.h | 2 ++
 include/linux/highmem.h          | 4 +++-
 include/linux/scatterlist.h      | 2 +-
 include/linux/skbuff.h           | 4 ++++
 6 files changed, 13 insertions(+), 2 deletions(-)

Comments

kernel test robot Feb. 17, 2024, 4:02 p.m. UTC | #1
Hi Max,

kernel test robot noticed the following build errors:

[auto build test ERROR on next-20240215]
[cannot apply to akpm-mm/mm-everything char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus powerpc/next powerpc/fixes linus/master v6.8-rc4 v6.8-rc3 v6.8-rc2 v6.8-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Max-Kellermann/drivers-add-missing-includes-on-linux-mm-h-and-others/20240215-225853
base:   next-20240215
patch link:    https://lore.kernel.org/r/20240215145602.1371274-15-max.kellermann%40ionos.com
patch subject: [PATCH v1 14/14] include: reduce dependencies on linux/mm.h
config: nios2-allnoconfig (https://download.01.org/0day-ci/archive/20240217/202402172345.crcmOhf2-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240217/202402172345.crcmOhf2-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402172345.crcmOhf2-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   lib/scatterlist.c: In function 'sg_page_count':
>> lib/scatterlist.c:739:16: error: implicit declaration of function 'PAGE_ALIGN'; did you mean 'PTR_ALIGN'? [-Werror=implicit-function-declaration]
     739 |         return PAGE_ALIGN(sg->offset + sg->length) >> PAGE_SHIFT;
         |                ^~~~~~~~~~
         |                PTR_ALIGN
   lib/scatterlist.c: In function 'extract_user_to_sg':
>> lib/scatterlist.c:1153:17: error: implicit declaration of function 'unpin_user_page'; did you mean 'copy_user_page'? [-Werror=implicit-function-declaration]
    1153 |                 unpin_user_page(sg_page(&sgtable->sgl[--sgtable->nents]));
         |                 ^~~~~~~~~~~~~~~
         |                 copy_user_page
   lib/scatterlist.c: In function 'extract_kvec_to_sg':
>> lib/scatterlist.c:1239:29: error: implicit declaration of function 'is_vmalloc_or_module_addr' [-Werror=implicit-function-declaration]
    1239 |                         if (is_vmalloc_or_module_addr((void *)kaddr))
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~
>> lib/scatterlist.c:1240:40: error: implicit declaration of function 'vmalloc_to_page'; did you mean 'vmalloc_nr_pages'? [-Werror=implicit-function-declaration]
    1240 |                                 page = vmalloc_to_page((void *)kaddr);
         |                                        ^~~~~~~~~~~~~~~
         |                                        vmalloc_nr_pages
>> lib/scatterlist.c:1240:38: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    1240 |                                 page = vmalloc_to_page((void *)kaddr);
         |                                      ^
   cc1: some warnings being treated as errors
--
   In file included from include/linux/mm_inline.h:6,
                    from mm/mmu_gather.c:6:
>> include/linux/huge_mm.h:12:19: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
      12 |                   pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
         |                   ^~~~~
         |                   pgd_t
   include/linux/huge_mm.h:12:35: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
      12 |                   pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
         |                                   ^~~~~
         |                                   pgd_t
>> include/linux/huge_mm.h:16:19: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
      16 |                   pud_t *dst_pud, pud_t *src_pud, unsigned long addr,
         |                   ^~~~~
         |                   pgd_t
   include/linux/huge_mm.h:16:35: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
      16 |                   pud_t *dst_pud, pud_t *src_pud, unsigned long addr,
         |                                   ^~~~~
         |                                   pgd_t
   include/linux/huge_mm.h:22:64: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
      22 | static inline void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud)
         |                                                                ^~~~~
         |                                                                pgd_t
   include/linux/huge_mm.h:29:28: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
      29 |                            pmd_t *pmd, unsigned long addr, unsigned long next);
         |                            ^~~~~
         |                            pgd_t
   include/linux/huge_mm.h:30:70: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
      30 | int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, pmd_t *pmd,
         |                                                                      ^~~~~
         |                                                                      pgd_t
   include/linux/huge_mm.h:32:70: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
      32 | int zap_huge_pud(struct mmu_gather *tlb, struct vm_area_struct *vma, pud_t *pud,
         |                                                                      ^~~~~
         |                                                                      pgd_t
   include/linux/huge_mm.h:35:44: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
      35 |                    unsigned long new_addr, pmd_t *old_pmd, pmd_t *new_pmd);
         |                                            ^~~~~
         |                                            pgd_t
   include/linux/huge_mm.h:35:60: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
      35 |                    unsigned long new_addr, pmd_t *old_pmd, pmd_t *new_pmd);
         |                                                            ^~~~~
         |                                                            pgd_t
   include/linux/huge_mm.h:37:21: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
      37 |                     pmd_t *pmd, unsigned long addr, pgprot_t newprot,
         |                     ^~~~~
         |                     pgd_t
   include/linux/huge_mm.h:437:65: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
     437 | static inline void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
         |                                                                 ^~~~~
         |                                                                 pgd_t
   include/linux/huge_mm.h:464:31: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
     464 | static inline int is_swap_pmd(pmd_t pmd)
         |                               ^~~~~
         |                               pgd_t
   include/linux/huge_mm.h:468:47: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
     468 | static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd,
         |                                               ^~~~~
         |                                               pgd_t
   include/linux/huge_mm.h:473:47: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
     473 | static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
         |                                               ^~~~~
         |                                               pgd_t
   include/linux/huge_mm.h:489:37: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
     489 | static inline bool is_huge_zero_pmd(pmd_t pmd)
         |                                     ^~~~~
         |                                     pgd_t
   include/linux/huge_mm.h:494:37: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
     494 | static inline bool is_huge_zero_pud(pud_t pud)
         |                                     ^~~~~
         |                                     pgd_t
   include/linux/huge_mm.h:505:29: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
     505 |         unsigned long addr, pmd_t *pmd, int flags, struct dev_pagemap **pgmap)
         |                             ^~~~~
         |                             pgd_t
   include/linux/huge_mm.h:511:29: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
     511 |         unsigned long addr, pud_t *pud, int flags, struct dev_pagemap **pgmap)
         |                             ^~~~~
         |                             pgd_t


vim +739 lib/scatterlist.c

a321e91b6d73ed Imre Deak 2013-02-27  736  
a321e91b6d73ed Imre Deak 2013-02-27  737  static int sg_page_count(struct scatterlist *sg)
a321e91b6d73ed Imre Deak 2013-02-27  738  {
a321e91b6d73ed Imre Deak 2013-02-27 @739  	return PAGE_ALIGN(sg->offset + sg->length) >> PAGE_SHIFT;
a321e91b6d73ed Imre Deak 2013-02-27  740  }
a321e91b6d73ed Imre Deak 2013-02-27  741
kernel test robot Feb. 17, 2024, 5:27 p.m. UTC | #2
Hi Max,

kernel test robot noticed the following build errors:

[auto build test ERROR on next-20240215]
[cannot apply to akpm-mm/mm-everything char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus powerpc/next powerpc/fixes linus/master v6.8-rc4 v6.8-rc3 v6.8-rc2 v6.8-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Max-Kellermann/drivers-add-missing-includes-on-linux-mm-h-and-others/20240215-225853
base:   next-20240215
patch link:    https://lore.kernel.org/r/20240215145602.1371274-15-max.kellermann%40ionos.com
patch subject: [PATCH v1 14/14] include: reduce dependencies on linux/mm.h
config: hexagon-allnoconfig (https://download.01.org/0day-ci/archive/20240218/202402180115.xH2WHdhd-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 36adfec155de366d722f2bac8ff9162289dcf06c)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240218/202402180115.xH2WHdhd-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402180115.xH2WHdhd-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from lib/scatterlist.c:9:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     547 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     560 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from lib/scatterlist.c:9:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     573 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from lib/scatterlist.c:9:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     584 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     594 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     604 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
>> lib/scatterlist.c:739:9: error: call to undeclared function 'PAGE_ALIGN'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     739 |         return PAGE_ALIGN(sg->offset + sg->length) >> PAGE_SHIFT;
         |                ^
   lib/scatterlist.c:763:9: error: call to undeclared function 'PAGE_ALIGN'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     763 |         return PAGE_ALIGN(sg->offset + sg_dma_len(sg)) >> PAGE_SHIFT;
         |                ^
>> lib/scatterlist.c:1153:3: error: call to undeclared function 'unpin_user_page'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1153 |                 unpin_user_page(sg_page(&sgtable->sgl[--sgtable->nents]));
         |                 ^
>> lib/scatterlist.c:1239:8: error: call to undeclared function 'is_vmalloc_or_module_addr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1239 |                         if (is_vmalloc_or_module_addr((void *)kaddr))
         |                             ^
>> lib/scatterlist.c:1240:12: error: call to undeclared function 'vmalloc_to_page'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1240 |                                 page = vmalloc_to_page((void *)kaddr);
         |                                        ^
   lib/scatterlist.c:1240:12: note: did you mean 'vmalloc_nr_pages'?
   include/linux/vmalloc.h:135:22: note: 'vmalloc_nr_pages' declared here
     135 | extern unsigned long vmalloc_nr_pages(void);
         |                      ^
>> lib/scatterlist.c:1240:10: error: incompatible integer to pointer conversion assigning to 'struct page *' from 'int' [-Wint-conversion]
    1240 |                                 page = vmalloc_to_page((void *)kaddr);
         |                                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   6 warnings and 6 errors generated.


vim +/PAGE_ALIGN +739 lib/scatterlist.c

a321e91b6d73ed Imre Deak 2013-02-27  736  
a321e91b6d73ed Imre Deak 2013-02-27  737  static int sg_page_count(struct scatterlist *sg)
a321e91b6d73ed Imre Deak 2013-02-27  738  {
a321e91b6d73ed Imre Deak 2013-02-27 @739  	return PAGE_ALIGN(sg->offset + sg->length) >> PAGE_SHIFT;
a321e91b6d73ed Imre Deak 2013-02-27  740  }
a321e91b6d73ed Imre Deak 2013-02-27  741
kernel test robot Feb. 17, 2024, 7:13 p.m. UTC | #3
Hi Max,

kernel test robot noticed the following build warnings:

[auto build test WARNING on next-20240215]
[cannot apply to akpm-mm/mm-everything char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus powerpc/next powerpc/fixes linus/master v6.8-rc4 v6.8-rc3 v6.8-rc2 v6.8-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Max-Kellermann/drivers-add-missing-includes-on-linux-mm-h-and-others/20240215-225853
base:   next-20240215
patch link:    https://lore.kernel.org/r/20240215145602.1371274-15-max.kellermann%40ionos.com
patch subject: [PATCH v1 14/14] include: reduce dependencies on linux/mm.h
config: um-allyesconfig (https://download.01.org/0day-ci/archive/20240218/202402180247.nziZ7rAH-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240218/202402180247.nziZ7rAH-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402180247.nziZ7rAH-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/kfifo.h:42,
                    from include/linux/tty_port.h:5,
                    from include/linux/tty.h:12,
                    from lib/bust_spinlocks.c:15:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
     189 |         sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
         |                         ^~~~~~~~~~~~
         |                         virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
     189 |         sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
         |                         ^~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
     136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
         |                                                        ~~~~~~~~~~~~~^~~~
   include/linux/scatterlist.h: In function 'sg_phys':
   include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
     389 |         return page_to_phys(sg_page(sg)) + sg->offset;
         |                ^~~~~~~~~~~~
         |                page_to_pfn
   cc1: some warnings being treated as errors
--
   In file included from include/linux/kfifo.h:42,
                    from lib/kfifo.c:14:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
     189 |         sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
         |                         ^~~~~~~~~~~~
         |                         virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
     189 |         sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
         |                         ^~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
     136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
         |                                                        ~~~~~~~~~~~~~^~~~
   include/linux/scatterlist.h: In function 'sg_phys':
   include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
     389 |         return page_to_phys(sg_page(sg)) + sg->offset;
         |                ^~~~~~~~~~~~
         |                page_to_pfn
   lib/kfifo.c: In function 'setup_sgl_buf':
>> lib/kfifo.c:310:14: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     310 |         page = virt_to_page(buf);
         |              ^
   lib/kfifo.c:319:23: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     319 |                 npage = virt_to_page(buf);
         |                       ^
   cc1: some warnings being treated as errors
--
   In file included from include/linux/dmapool.h:14,
                    from include/linux/pci.h:1654,
                    from lib/iomap.c:7:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
     189 |         sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
         |                         ^~~~~~~~~~~~
         |                         virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
     189 |         sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
         |                         ^~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
     136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
         |                                                        ~~~~~~~~~~~~~^~~~
   include/linux/scatterlist.h: In function 'sg_phys':
   include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
     389 |         return page_to_phys(sg_page(sg)) + sg->offset;
         |                ^~~~~~~~~~~~
         |                page_to_pfn
   In file included from include/linux/pci.h:2688:
   include/linux/dma-mapping.h: In function 'dma_free_noncoherent':
>> include/linux/dma-mapping.h:331:35: warning: passing argument 3 of 'dma_free_pages' makes pointer from integer without a cast [-Wint-conversion]
     331 |         dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
         |                                   ^~~~~~~~~~~~~~~~~~~
         |                                   |
         |                                   int
   include/linux/dma-mapping.h:316:67: note: expected 'struct page *' but argument is of type 'int'
     316 | void dma_free_pages(struct device *dev, size_t size, struct page *page,
         |                                                      ~~~~~~~~~~~~~^~~~
   include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
>> include/linux/dma-mapping.h:342:40: warning: passing argument 2 of 'dma_map_page_attrs' makes pointer from integer without a cast [-Wint-conversion]
     342 |         return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
         |                                        ^~~~~~~~~~~~~~~~~
         |                                        |
         |                                        int
   include/linux/dma-mapping.h:105:64: note: expected 'struct page *' but argument is of type 'int'
     105 | dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
         |                                                   ~~~~~~~~~~~~~^~~~
   lib/iomap.c: At top level:
   lib/iomap.c:156:5: warning: no previous prototype for 'ioread64_lo_hi' [-Wmissing-prototypes]
     156 | u64 ioread64_lo_hi(const void __iomem *addr)
         |     ^~~~~~~~~~~~~~
   lib/iomap.c:163:5: warning: no previous prototype for 'ioread64_hi_lo' [-Wmissing-prototypes]
     163 | u64 ioread64_hi_lo(const void __iomem *addr)
         |     ^~~~~~~~~~~~~~
   lib/iomap.c:170:5: warning: no previous prototype for 'ioread64be_lo_hi' [-Wmissing-prototypes]
     170 | u64 ioread64be_lo_hi(const void __iomem *addr)
         |     ^~~~~~~~~~~~~~~~
   lib/iomap.c:178:5: warning: no previous prototype for 'ioread64be_hi_lo' [-Wmissing-prototypes]
     178 | u64 ioread64be_hi_lo(const void __iomem *addr)
         |     ^~~~~~~~~~~~~~~~
   lib/iomap.c:264:6: warning: no previous prototype for 'iowrite64_lo_hi' [-Wmissing-prototypes]
     264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
         |      ^~~~~~~~~~~~~~~
   lib/iomap.c:272:6: warning: no previous prototype for 'iowrite64_hi_lo' [-Wmissing-prototypes]
     272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
         |      ^~~~~~~~~~~~~~~
   lib/iomap.c:280:6: warning: no previous prototype for 'iowrite64be_lo_hi' [-Wmissing-prototypes]
     280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
         |      ^~~~~~~~~~~~~~~~~
   lib/iomap.c:288:6: warning: no previous prototype for 'iowrite64be_hi_lo' [-Wmissing-prototypes]
     288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
         |      ^~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from include/linux/virtio.h:7,
                    from arch/um/drivers/virtio_uml.c:27:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
     189 |         sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
         |                         ^~~~~~~~~~~~
         |                         virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
     189 |         sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
         |                         ^~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
     136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
         |                                                        ~~~~~~~~~~~~~^~~~
   include/linux/scatterlist.h: In function 'sg_phys':
   include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
     389 |         return page_to_phys(sg_page(sg)) + sg->offset;
         |                ^~~~~~~~~~~~
         |                page_to_pfn
   In file included from include/linux/virtio.h:12:
   include/linux/dma-mapping.h: In function 'dma_free_noncoherent':
>> include/linux/dma-mapping.h:331:35: warning: passing argument 3 of 'dma_free_pages' makes pointer from integer without a cast [-Wint-conversion]
     331 |         dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
         |                                   ^~~~~~~~~~~~~~~~~~~
         |                                   |
         |                                   int
   include/linux/dma-mapping.h:316:67: note: expected 'struct page *' but argument is of type 'int'
     316 | void dma_free_pages(struct device *dev, size_t size, struct page *page,
         |                                                      ~~~~~~~~~~~~~^~~~
   include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
>> include/linux/dma-mapping.h:342:40: warning: passing argument 2 of 'dma_map_page_attrs' makes pointer from integer without a cast [-Wint-conversion]
     342 |         return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
         |                                        ^~~~~~~~~~~~~~~~~
         |                                        |
         |                                        int
   include/linux/dma-mapping.h:105:64: note: expected 'struct page *' but argument is of type 'int'
     105 | dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
         |                                                   ~~~~~~~~~~~~~^~~~
   In file included from arch/um/include/asm/thread_info.h:15,
                    from include/linux/thread_info.h:60,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/um/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:79,
                    from include/linux/spinlock.h:56,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:7,
                    from include/linux/umh.h:4,
                    from include/linux/kmod.h:9,
                    from include/linux/module.h:17,
                    from arch/um/drivers/virtio_uml.c:23:
   arch/um/drivers/virtio_uml.c: In function 'vhost_user_set_mem_table':
   arch/um/drivers/virtio_uml.c:678:54: error: 'end_iomem' undeclared (first use in this function)
     678 |                 rc = vhost_user_init_mem_region(__pa(end_iomem), highmem,
         |                                                      ^~~~~~~~~
   arch/um/include/asm/page.h:105:58: note: in definition of macro '__pa'
     105 | #define __pa(virt) uml_to_phys((void *) (unsigned long) (virt))
         |                                                          ^~~~
   arch/um/drivers/virtio_uml.c:678:54: note: each undeclared identifier is reported only once for each function it appears in
     678 |                 rc = vhost_user_init_mem_region(__pa(end_iomem), highmem,
         |                                                      ^~~~~~~~~
   arch/um/include/asm/page.h:105:58: note: in definition of macro '__pa'
     105 | #define __pa(virt) uml_to_phys((void *) (unsigned long) (virt))
         |                                                          ^~~~
   cc1: some warnings being treated as errors
--
   In file included from include/linux/dmapool.h:14,
                    from include/linux/pci.h:1654,
                    from arch/um/drivers/virt-pci.c:7:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
     189 |         sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
         |                         ^~~~~~~~~~~~
         |                         virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
     189 |         sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
         |                         ^~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
     136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
         |                                                        ~~~~~~~~~~~~~^~~~
   include/linux/scatterlist.h: In function 'sg_phys':
   include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
     389 |         return page_to_phys(sg_page(sg)) + sg->offset;
         |                ^~~~~~~~~~~~
         |                page_to_pfn
   In file included from include/linux/pci.h:2688:
   include/linux/dma-mapping.h: In function 'dma_free_noncoherent':
>> include/linux/dma-mapping.h:331:35: warning: passing argument 3 of 'dma_free_pages' makes pointer from integer without a cast [-Wint-conversion]
     331 |         dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
         |                                   ^~~~~~~~~~~~~~~~~~~
         |                                   |
         |                                   int
   include/linux/dma-mapping.h:316:67: note: expected 'struct page *' but argument is of type 'int'
     316 | void dma_free_pages(struct device *dev, size_t size, struct page *page,
         |                                                      ~~~~~~~~~~~~~^~~~
   include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
>> include/linux/dma-mapping.h:342:40: warning: passing argument 2 of 'dma_map_page_attrs' makes pointer from integer without a cast [-Wint-conversion]
     342 |         return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
         |                                        ^~~~~~~~~~~~~~~~~
         |                                        |
         |                                        int
   include/linux/dma-mapping.h:105:64: note: expected 'struct page *' but argument is of type 'int'
     105 | dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
         |                                                   ~~~~~~~~~~~~~^~~~
   cc1: some warnings being treated as errors
--
   In file included from include/linux/dma-mapping.h:11,
                    from include/linux/comedi/comedidev.h:13,
                    from drivers/comedi/comedi_buf.c:12:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
     189 |         sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
         |                         ^~~~~~~~~~~~
         |                         virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
     189 |         sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
         |                         ^~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
     136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
         |                                                        ~~~~~~~~~~~~~^~~~
   include/linux/scatterlist.h: In function 'sg_phys':
   include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
     389 |         return page_to_phys(sg_page(sg)) + sg->offset;
         |                ^~~~~~~~~~~~
         |                page_to_pfn
   include/linux/dma-mapping.h: In function 'dma_free_noncoherent':
>> include/linux/dma-mapping.h:331:35: warning: passing argument 3 of 'dma_free_pages' makes pointer from integer without a cast [-Wint-conversion]
     331 |         dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
         |                                   ^~~~~~~~~~~~~~~~~~~
         |                                   |
         |                                   int
   include/linux/dma-mapping.h:316:67: note: expected 'struct page *' but argument is of type 'int'
     316 | void dma_free_pages(struct device *dev, size_t size, struct page *page,
         |                                                      ~~~~~~~~~~~~~^~~~
   include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
>> include/linux/dma-mapping.h:342:40: warning: passing argument 2 of 'dma_map_page_attrs' makes pointer from integer without a cast [-Wint-conversion]
     342 |         return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
         |                                        ^~~~~~~~~~~~~~~~~
         |                                        |
         |                                        int
   include/linux/dma-mapping.h:105:64: note: expected 'struct page *' but argument is of type 'int'
     105 | dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
         |                                                   ~~~~~~~~~~~~~^~~~
   drivers/comedi/comedi_buf.c: In function 'comedi_buf_map_kref_release':
>> drivers/comedi/comedi_buf.c:41:51: warning: passing argument 1 of 'ClearPageReserved' makes pointer from integer without a cast [-Wint-conversion]
      41 |                                 ClearPageReserved(virt_to_page(buf->virt_addr));
         |                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                                   |
         |                                                   int
   In file included from include/linux/mmzone.h:23,
                    from include/linux/gfp.h:7,
                    from include/linux/slab.h:16,
                    from drivers/comedi/comedi_buf.c:11:
   include/linux/page-flags.h:390:59: note: expected 'struct page *' but argument is of type 'int'
     390 | static __always_inline void ClearPage##uname(struct page *page)         \
         |                                              ~~~~~~~~~~~~~^~~~
   include/linux/page-flags.h:424:9: note: in expansion of macro 'CLEARPAGEFLAG'
     424 |         CLEARPAGEFLAG(uname, lname, policy)
         |         ^~~~~~~~~~~~~
   include/linux/page-flags.h:492:1: note: in expansion of macro 'PAGEFLAG'
     492 | PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
         | ^~~~~~~~
   drivers/comedi/comedi_buf.c: In function 'comedi_buf_map_alloc':
>> drivers/comedi/comedi_buf.c:124:41: warning: passing argument 1 of 'SetPageReserved' makes pointer from integer without a cast [-Wint-conversion]
     124 |                         SetPageReserved(virt_to_page(buf->virt_addr));
         |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                         |
         |                                         int
   include/linux/page-flags.h:383:57: note: expected 'struct page *' but argument is of type 'int'
     383 | static __always_inline void SetPage##uname(struct page *page)           \
         |                                            ~~~~~~~~~~~~~^~~~
   include/linux/page-flags.h:423:9: note: in expansion of macro 'SETPAGEFLAG'
     423 |         SETPAGEFLAG(uname, lname, policy)                               \
         |         ^~~~~~~~~~~
   include/linux/page-flags.h:492:1: note: in expansion of macro 'PAGEFLAG'
     492 | PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
         | ^~~~~~~~
   drivers/comedi/comedi_buf.c: In function '__comedi_buf_alloc':
>> drivers/comedi/comedi_buf.c:178:34: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     178 |                         pages[i] = virt_to_page(buf->virt_addr);
         |                                  ^
   drivers/comedi/comedi_buf.c:18:41: error: 'PAGE_KERNEL' undeclared (first use in this function)
      18 | #define COMEDI_PAGE_PROTECTION          PAGE_KERNEL
         |                                         ^~~~~~~~~~~
   drivers/comedi/comedi_buf.c:183:44: note: in expansion of macro 'COMEDI_PAGE_PROTECTION'
     183 |                                            COMEDI_PAGE_PROTECTION);
         |                                            ^~~~~~~~~~~~~~~~~~~~~~
   drivers/comedi/comedi_buf.c:18:41: note: each undeclared identifier is reported only once for each function it appears in
      18 | #define COMEDI_PAGE_PROTECTION          PAGE_KERNEL
         |                                         ^~~~~~~~~~~
   drivers/comedi/comedi_buf.c:183:44: note: in expansion of macro 'COMEDI_PAGE_PROTECTION'
     183 |                                            COMEDI_PAGE_PROTECTION);
         |                                            ^~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
..


vim +/sg_set_page +189 include/linux/scatterlist.h

82f66fbef58de4 Jens Axboe    2007-10-22  175  
18dabf473e1585 Jens Axboe    2007-10-22  176  /**
18dabf473e1585 Jens Axboe    2007-10-22  177   * sg_set_buf - Set sg entry to point at given data
18dabf473e1585 Jens Axboe    2007-10-22  178   * @sg:		 SG entry
18dabf473e1585 Jens Axboe    2007-10-22  179   * @buf:	 Data
18dabf473e1585 Jens Axboe    2007-10-22  180   * @buflen:	 Data length
18dabf473e1585 Jens Axboe    2007-10-22  181   *
18dabf473e1585 Jens Axboe    2007-10-22  182   **/
82f66fbef58de4 Jens Axboe    2007-10-22  183  static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
d32311fed70d12 Herbert Xu    2005-09-17  184  			      unsigned int buflen)
d32311fed70d12 Herbert Xu    2005-09-17  185  {
ac4e97abce9b80 Rusty Russell 2013-05-30  186  #ifdef CONFIG_DEBUG_SG
ac4e97abce9b80 Rusty Russell 2013-05-30  187  	BUG_ON(!virt_addr_valid(buf));
ac4e97abce9b80 Rusty Russell 2013-05-30  188  #endif
642f149031d704 Jens Axboe    2007-10-24 @189  	sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
d32311fed70d12 Herbert Xu    2005-09-17  190  }
d32311fed70d12 Herbert Xu    2005-09-17  191
diff mbox series

Patch

diff --git a/include/linux/bio.h b/include/linux/bio.h
index 875d792bffff..e2f24d7235d3 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -5,7 +5,9 @@ 
 #ifndef __LINUX_BIO_H
 #define __LINUX_BIO_H
 
+#include <linux/fs.h> // for struct kiocb, IOCB_NOWAIT
 #include <linux/mempool.h>
+#include <linux/mm/folio_next.h>
 /* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */
 #include <linux/blk_types.h>
 #include <linux/uio.h>
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 4a658de44ee9..37d5591039c7 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -11,6 +11,7 @@ 
 #include <linux/scatterlist.h>
 #include <linux/bug.h>
 #include <linux/mem_encrypt.h>
+#include <linux/mm/vmalloc_addr.h>
 
 /**
  * List of possible attributes associated with a DMA mapping. The semantics
diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h
index a3028e400a9c..a479e6b7c54c 100644
--- a/include/linux/highmem-internal.h
+++ b/include/linux/highmem-internal.h
@@ -2,6 +2,8 @@ 
 #ifndef _LINUX_HIGHMEM_INTERNAL_H
 #define _LINUX_HIGHMEM_INTERNAL_H
 
+#include <linux/mm/page_address.h>
+
 /*
  * Outside of CONFIG_HIGHMEM to support X86 32bit iomap_atomic() cruft.
  */
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 00341b56d291..b9dd5dd915c3 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -7,7 +7,9 @@ 
 #include <linux/bug.h>
 #include <linux/cacheflush.h>
 #include <linux/kmsan.h>
-#include <linux/mm.h>
+#include <linux/mm/page_address.h>
+#include <linux/mm/page_size.h>
+#include <linux/mm/page_usage.h> // for folio_put()
 #include <linux/uaccess.h>
 #include <linux/hardirq.h>
 
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 77df3d7b18a6..d55cfcde1b09 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -5,7 +5,7 @@ 
 #include <linux/string.h>
 #include <linux/types.h>
 #include <linux/bug.h>
-#include <linux/mm.h>
+#include <linux/mm/page_address.h>
 #include <asm/io.h>
 
 struct scatterlist {
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 696e7680656f..5bd89f0f7e7e 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -16,6 +16,10 @@ 
 #include <linux/bug.h>
 #include <linux/bvec.h>
 #include <linux/cache.h>
+#include <linux/gfp.h> // for alloc_pages_node()
+#include <linux/mm/page_usage.h> // for get_page(), put_page()
+#include <linux/mm/page_zone.h> // for page_to_nid()
+#include <linux/mm/pfmemalloc.h> // for page_is_pfmemalloc()
 #include <linux/rbtree.h>
 #include <linux/socket.h>
 #include <linux/refcount.h>