drivers/staging/comedi/comedi_fops.c:2380:8: error: 'PAGE_SHARED' undeclared; did you mean 'PAGE_SIZE'?
From: kbuild test robot
Date: Fri Jan 10 2020 - 06:08:12 EST
Hi Christoph,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4a3033ef6e6bb4c566bd1d556de69b494d76976c
commit: 6bd33e1ece528f67646db33bf97406b747dafda0 riscv: add nommu support
date: 8 weeks ago
config: riscv-randconfig-a001-20200110 (attached as .config)
compiler: riscv64-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 6bd33e1ece528f67646db33bf97406b747dafda0
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=riscv
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
drivers/staging/comedi/comedi_fops.c: In function 'comedi_mmap':
>> drivers/staging/comedi/comedi_fops.c:2380:8: error: 'PAGE_SHARED' undeclared (first use in this function); did you mean 'PAGE_SIZE'?
PAGE_SHARED);
^~~~~~~~~~~
PAGE_SIZE
drivers/staging/comedi/comedi_fops.c:2380:8: note: each undeclared identifier is reported only once for each function it appears in
--
In file included from arch/riscv/include/asm/hugetlb.h:5:0,
from include/linux/hugetlb.h:444,
from arch/riscv//mm/hugetlbpage.c:2:
include/asm-generic/hugetlb.h: In function 'mk_huge_pte':
>> include/asm-generic/hugetlb.h:7:9: error: implicit declaration of function 'mk_pte'; did you mean '__pte'? [-Werror=implicit-function-declaration]
return mk_pte(page, pgprot);
^~~~~~
__pte
>> include/asm-generic/hugetlb.h:7:9: error: incompatible types when returning type 'int' but 'pte_t {aka struct <anonymous>}' was expected
return mk_pte(page, pgprot);
^~~~~~~~~~~~~~~~~~~~
include/asm-generic/hugetlb.h: In function 'huge_pte_write':
>> include/asm-generic/hugetlb.h:12:9: error: implicit declaration of function 'pte_write'; did you mean 'pgd_write'? [-Werror=implicit-function-declaration]
return pte_write(pte);
^~~~~~~~~
pgd_write
include/asm-generic/hugetlb.h: In function 'huge_pte_dirty':
>> include/asm-generic/hugetlb.h:17:9: error: implicit declaration of function 'pte_dirty'; did you mean 'info_dirty'? [-Werror=implicit-function-declaration]
return pte_dirty(pte);
^~~~~~~~~
info_dirty
include/asm-generic/hugetlb.h: In function 'huge_pte_mkwrite':
>> include/asm-generic/hugetlb.h:22:9: error: implicit declaration of function 'pte_mkwrite'; did you mean 'pgd_write'? [-Werror=implicit-function-declaration]
return pte_mkwrite(pte);
^~~~~~~~~~~
pgd_write
include/asm-generic/hugetlb.h:22:9: error: incompatible types when returning type 'int' but 'pte_t {aka struct <anonymous>}' was expected
return pte_mkwrite(pte);
^~~~~~~~~~~~~~~~
include/asm-generic/hugetlb.h: In function 'huge_pte_mkdirty':
>> include/asm-generic/hugetlb.h:27:9: error: implicit declaration of function 'pte_mkdirty'; did you mean 'huge_pte_mkdirty'? [-Werror=implicit-function-declaration]
return pte_mkdirty(pte);
^~~~~~~~~~~
huge_pte_mkdirty
include/asm-generic/hugetlb.h:27:9: error: incompatible types when returning type 'int' but 'pte_t {aka struct <anonymous>}' was expected
return pte_mkdirty(pte);
^~~~~~~~~~~~~~~~
include/asm-generic/hugetlb.h: In function 'huge_pte_modify':
>> include/asm-generic/hugetlb.h:32:9: error: implicit declaration of function 'pte_modify'; did you mean 'lease_modify'? [-Werror=implicit-function-declaration]
return pte_modify(pte, newprot);
^~~~~~~~~~
lease_modify
include/asm-generic/hugetlb.h:32:9: error: incompatible types when returning type 'int' but 'pte_t {aka struct <anonymous>}' was expected
return pte_modify(pte, newprot);
^~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/hugetlb.h: In function 'huge_pte_clear':
>> include/asm-generic/hugetlb.h:39:2: error: implicit declaration of function 'pte_clear'; did you mean 'pud_clear'? [-Werror=implicit-function-declaration]
pte_clear(mm, addr, ptep);
^~~~~~~~~
pud_clear
include/asm-generic/hugetlb.h: In function 'set_huge_pte_at':
>> include/asm-generic/hugetlb.h:56:2: error: implicit declaration of function 'set_pte_at'; did you mean 'set_huge_pte_at'? [-Werror=implicit-function-declaration]
set_pte_at(mm, addr, ptep, pte);
^~~~~~~~~~
set_huge_pte_at
include/asm-generic/hugetlb.h: In function 'huge_ptep_get_and_clear':
>> include/asm-generic/hugetlb.h:64:9: error: implicit declaration of function 'ptep_get_and_clear'; did you mean 'huge_ptep_get_and_clear'? [-Werror=implicit-function-declaration]
return ptep_get_and_clear(mm, addr, ptep);
^~~~~~~~~~~~~~~~~~
huge_ptep_get_and_clear
include/asm-generic/hugetlb.h:64:9: error: incompatible types when returning type 'int' but 'pte_t {aka struct <anonymous>}' was expected
return ptep_get_and_clear(mm, addr, ptep);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/hugetlb.h: In function 'huge_ptep_clear_flush':
>> include/asm-generic/hugetlb.h:72:2: error: implicit declaration of function 'ptep_clear_flush'; did you mean 'huge_ptep_clear_flush'? [-Werror=implicit-function-declaration]
ptep_clear_flush(vma, addr, ptep);
^~~~~~~~~~~~~~~~
huge_ptep_clear_flush
include/asm-generic/hugetlb.h: In function 'huge_pte_none':
>> include/asm-generic/hugetlb.h:79:9: error: implicit declaration of function 'pte_none'; did you mean 'pud_none'? [-Werror=implicit-function-declaration]
return pte_none(pte);
^~~~~~~~
pud_none
include/asm-generic/hugetlb.h: In function 'huge_pte_wrprotect':
>> include/asm-generic/hugetlb.h:86:9: error: implicit declaration of function 'pte_wrprotect'; did you mean 'huge_pte_wrprotect'? [-Werror=implicit-function-declaration]
return pte_wrprotect(pte);
^~~~~~~~~~~~~
huge_pte_wrprotect
include/asm-generic/hugetlb.h:86:9: error: incompatible types when returning type 'int' but 'pte_t {aka struct <anonymous>}' was expected
return pte_wrprotect(pte);
^~~~~~~~~~~~~~~~~~
include/asm-generic/hugetlb.h: In function 'huge_ptep_set_wrprotect':
>> include/asm-generic/hugetlb.h:109:2: error: implicit declaration of function 'ptep_set_wrprotect'; did you mean 'huge_ptep_set_wrprotect'? [-Werror=implicit-function-declaration]
ptep_set_wrprotect(mm, addr, ptep);
^~~~~~~~~~~~~~~~~~
huge_ptep_set_wrprotect
include/asm-generic/hugetlb.h: In function 'huge_ptep_set_access_flags':
>> include/asm-generic/hugetlb.h:118:9: error: implicit declaration of function 'ptep_set_access_flags'; did you mean 'huge_ptep_set_access_flags'? [-Werror=implicit-function-declaration]
return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
^~~~~~~~~~~~~~~~~~~~~
huge_ptep_set_access_flags
arch/riscv//mm/hugetlbpage.c: In function 'pmd_huge':
>> arch/riscv//mm/hugetlbpage.c:13:9: error: implicit declaration of function 'pmd_present'; did you mean 'pud_present'? [-Werror=implicit-function-declaration]
return pmd_present(pmd) &&
^~~~~~~~~~~
pud_present
cc1: some warnings being treated as errors
vim +2380 drivers/staging/comedi/comedi_fops.c
ed9eccbe8970f6 David Schleef 2008-11-04 2296
ed9eccbe8970f6 David Schleef 2008-11-04 2297 static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
ed9eccbe8970f6 David Schleef 2008-11-04 2298 {
20f083c07565cb Ian Abbott 2014-11-04 2299 struct comedi_file *cfp = file->private_data;
20f083c07565cb Ian Abbott 2014-11-04 2300 struct comedi_device *dev = cfp->dev;
a52840a98bbb50 H Hartley Sweeten 2012-12-19 2301 struct comedi_subdevice *s;
a52840a98bbb50 H Hartley Sweeten 2012-12-19 2302 struct comedi_async *async;
b34aa86f12e884 Ian Abbott 2014-04-10 2303 struct comedi_buf_map *bm = NULL;
e36472145aa706 Ian Abbott 2019-06-25 2304 struct comedi_buf_page *buf;
ed9eccbe8970f6 David Schleef 2008-11-04 2305 unsigned long start = vma->vm_start;
ed9eccbe8970f6 David Schleef 2008-11-04 2306 unsigned long size;
ed9eccbe8970f6 David Schleef 2008-11-04 2307 int n_pages;
ed9eccbe8970f6 David Schleef 2008-11-04 2308 int i;
e36472145aa706 Ian Abbott 2019-06-25 2309 int retval = 0;
3ffab428f40849 Bernd Porr 2011-11-08 2310
b34aa86f12e884 Ian Abbott 2014-04-10 2311 /*
b34aa86f12e884 Ian Abbott 2014-04-10 2312 * 'trylock' avoids circular dependency with current->mm->mmap_sem
b34aa86f12e884 Ian Abbott 2014-04-10 2313 * and down-reading &dev->attach_lock should normally succeed without
b34aa86f12e884 Ian Abbott 2014-04-10 2314 * contention unless the device is in the process of being attached
b34aa86f12e884 Ian Abbott 2014-04-10 2315 * or detached.
b34aa86f12e884 Ian Abbott 2014-04-10 2316 */
b34aa86f12e884 Ian Abbott 2014-04-10 2317 if (!down_read_trylock(&dev->attach_lock))
b34aa86f12e884 Ian Abbott 2014-04-10 2318 return -EAGAIN;
a52840a98bbb50 H Hartley Sweeten 2012-12-19 2319
ed9eccbe8970f6 David Schleef 2008-11-04 2320 if (!dev->attached) {
272850f07c47ab H Hartley Sweeten 2013-11-26 2321 dev_dbg(dev->class_dev, "no driver attached\n");
ed9eccbe8970f6 David Schleef 2008-11-04 2322 retval = -ENODEV;
ed9eccbe8970f6 David Schleef 2008-11-04 2323 goto done;
ed9eccbe8970f6 David Schleef 2008-11-04 2324 }
a52840a98bbb50 H Hartley Sweeten 2012-12-19 2325
476b847733636c Greg Kroah-Hartman 2008-11-13 2326 if (vma->vm_flags & VM_WRITE)
20f083c07565cb Ian Abbott 2014-11-04 2327 s = comedi_file_write_subdevice(file);
476b847733636c Greg Kroah-Hartman 2008-11-13 2328 else
20f083c07565cb Ian Abbott 2014-11-04 2329 s = comedi_file_read_subdevice(file);
a52840a98bbb50 H Hartley Sweeten 2012-12-19 2330 if (!s) {
ed9eccbe8970f6 David Schleef 2008-11-04 2331 retval = -EINVAL;
ed9eccbe8970f6 David Schleef 2008-11-04 2332 goto done;
ed9eccbe8970f6 David Schleef 2008-11-04 2333 }
a52840a98bbb50 H Hartley Sweeten 2012-12-19 2334
ed9eccbe8970f6 David Schleef 2008-11-04 2335 async = s->async;
a52840a98bbb50 H Hartley Sweeten 2012-12-19 2336 if (!async) {
ed9eccbe8970f6 David Schleef 2008-11-04 2337 retval = -EINVAL;
ed9eccbe8970f6 David Schleef 2008-11-04 2338 goto done;
ed9eccbe8970f6 David Schleef 2008-11-04 2339 }
ed9eccbe8970f6 David Schleef 2008-11-04 2340
ed9eccbe8970f6 David Schleef 2008-11-04 2341 if (vma->vm_pgoff != 0) {
272850f07c47ab H Hartley Sweeten 2013-11-26 2342 dev_dbg(dev->class_dev, "mmap() offset must be 0.\n");
ed9eccbe8970f6 David Schleef 2008-11-04 2343 retval = -EINVAL;
ed9eccbe8970f6 David Schleef 2008-11-04 2344 goto done;
ed9eccbe8970f6 David Schleef 2008-11-04 2345 }
ed9eccbe8970f6 David Schleef 2008-11-04 2346
ed9eccbe8970f6 David Schleef 2008-11-04 2347 size = vma->vm_end - vma->vm_start;
ed9eccbe8970f6 David Schleef 2008-11-04 2348 if (size > async->prealloc_bufsz) {
ed9eccbe8970f6 David Schleef 2008-11-04 2349 retval = -EFAULT;
ed9eccbe8970f6 David Schleef 2008-11-04 2350 goto done;
ed9eccbe8970f6 David Schleef 2008-11-04 2351 }
44b8c793fc0d63 Sandhya Bankar 2016-03-06 2352 if (offset_in_page(size)) {
ed9eccbe8970f6 David Schleef 2008-11-04 2353 retval = -EFAULT;
ed9eccbe8970f6 David Schleef 2008-11-04 2354 goto done;
ed9eccbe8970f6 David Schleef 2008-11-04 2355 }
ed9eccbe8970f6 David Schleef 2008-11-04 2356
ec9d0754e0c640 sayli karnik 2016-09-20 2357 n_pages = vma_pages(vma);
b34aa86f12e884 Ian Abbott 2014-04-10 2358
b34aa86f12e884 Ian Abbott 2014-04-10 2359 /* get reference to current buf map (if any) */
b34aa86f12e884 Ian Abbott 2014-04-10 2360 bm = comedi_buf_map_from_subdev_get(s);
af93da31634d6d Ian Abbott 2013-11-08 2361 if (!bm || n_pages > bm->n_pages) {
af93da31634d6d Ian Abbott 2013-11-08 2362 retval = -EINVAL;
af93da31634d6d Ian Abbott 2013-11-08 2363 goto done;
af93da31634d6d Ian Abbott 2013-11-08 2364 }
e36472145aa706 Ian Abbott 2019-06-25 2365 if (bm->dma_dir != DMA_NONE) {
e36472145aa706 Ian Abbott 2019-06-25 2366 /*
e36472145aa706 Ian Abbott 2019-06-25 2367 * DMA buffer was allocated as a single block.
e36472145aa706 Ian Abbott 2019-06-25 2368 * Address is in page_list[0].
e36472145aa706 Ian Abbott 2019-06-25 2369 */
e36472145aa706 Ian Abbott 2019-06-25 2370 buf = &bm->page_list[0];
e36472145aa706 Ian Abbott 2019-06-25 2371 retval = dma_mmap_coherent(bm->dma_hw_dev, vma, buf->virt_addr,
e36472145aa706 Ian Abbott 2019-06-25 2372 buf->dma_addr, n_pages * PAGE_SIZE);
e36472145aa706 Ian Abbott 2019-06-25 2373 } else {
ed9eccbe8970f6 David Schleef 2008-11-04 2374 for (i = 0; i < n_pages; ++i) {
e36472145aa706 Ian Abbott 2019-06-25 2375 unsigned long pfn;
e36472145aa706 Ian Abbott 2019-06-25 2376
e36472145aa706 Ian Abbott 2019-06-25 2377 buf = &bm->page_list[i];
e36472145aa706 Ian Abbott 2019-06-25 2378 pfn = page_to_pfn(virt_to_page(buf->virt_addr));
e36472145aa706 Ian Abbott 2019-06-25 2379 retval = remap_pfn_range(vma, start, pfn, PAGE_SIZE,
e36472145aa706 Ian Abbott 2019-06-25 @2380 PAGE_SHARED);
e36472145aa706 Ian Abbott 2019-06-25 2381 if (retval)
e36472145aa706 Ian Abbott 2019-06-25 2382 break;
a52840a98bbb50 H Hartley Sweeten 2012-12-19 2383
ed9eccbe8970f6 David Schleef 2008-11-04 2384 start += PAGE_SIZE;
ed9eccbe8970f6 David Schleef 2008-11-04 2385 }
e36472145aa706 Ian Abbott 2019-06-25 2386 }
ed9eccbe8970f6 David Schleef 2008-11-04 2387
e36472145aa706 Ian Abbott 2019-06-25 2388 if (retval == 0) {
ed9eccbe8970f6 David Schleef 2008-11-04 2389 vma->vm_ops = &comedi_vm_ops;
af93da31634d6d Ian Abbott 2013-11-08 2390 vma->vm_private_data = bm;
ed9eccbe8970f6 David Schleef 2008-11-04 2391
af93da31634d6d Ian Abbott 2013-11-08 2392 vma->vm_ops->open(vma);
e36472145aa706 Ian Abbott 2019-06-25 2393 }
ed9eccbe8970f6 David Schleef 2008-11-04 2394
ed9eccbe8970f6 David Schleef 2008-11-04 2395 done:
b34aa86f12e884 Ian Abbott 2014-04-10 2396 up_read(&dev->attach_lock);
b34aa86f12e884 Ian Abbott 2014-04-10 2397 comedi_buf_map_put(bm); /* put reference to buf map - okay if NULL */
ed9eccbe8970f6 David Schleef 2008-11-04 2398 return retval;
ed9eccbe8970f6 David Schleef 2008-11-04 2399 }
ed9eccbe8970f6 David Schleef 2008-11-04 2400
:::::: The code at line 2380 was first introduced by commit
:::::: e36472145aa706c186a6bb4f6419c613b0b1305c staging: comedi: use dma_mmap_coherent for DMA-able buffer mmap
:::::: TO: Ian Abbott <abbotti@xxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation
Attachment:
.config.gz
Description: application/gzip