[tip:tmp.tmp2 260/364] drivers/scsi/sg.c:1567:11: error: implicit declaration of function 'sysfs_create_link'; did you mean 'kernfs_create_link'?

From: kernel test robot
Date: Sun Jun 13 2021 - 21:23:43 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git tmp.tmp2
head: adcceb5eb7aee38e4a9c15bdf599655f0e1b1324
commit: 7fa6225737e4d872b612659345f0ece8922ba765 [260/364] sched/headers, kobject: Use <linux/sysfs_types.h> in <linux/kobject.h>
config: x86_64-kexec (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=7fa6225737e4d872b612659345f0ece8922ba765
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip tmp.tmp2
git checkout 7fa6225737e4d872b612659345f0ece8922ba765
# save the attached .config to linux build tree
make W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

In file included from include/linux/workqueue.h:16,
from include/linux/srcu_types.h:20,
from include/linux/srcu.h:19,
from include/linux/notifier.h:16,
from arch/x86/include/asm/uprobes.h:13,
from include/linux/uprobes.h:49,
from include/linux/mm_types.h:14,
from include/linux/mmzone.h:21,
from include/linux/gfp.h:7,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:15,
from drivers/scsi/sg.c:24:
include/linux/rcuwait.h: In function 'rcuwait_active':
include/linux/rcupdate.h:364:9: error: dereferencing pointer to incomplete type 'struct task_struct'
364 | typeof(*p) *_________p1 = (typeof(*p) *__force)READ_ONCE(p); \
| ^
include/linux/rcupdate.h:474:31: note: in expansion of macro '__rcu_access_pointer'
474 | #define rcu_access_pointer(p) __rcu_access_pointer((p), __rcu)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/rcuwait.h:33:11: note: in expansion of macro 'rcu_access_pointer'
33 | return !!rcu_access_pointer(w->task);
| ^~~~~~~~~~~~~~~~~~
drivers/scsi/sg.c: In function 'sg_add_device':
>> drivers/scsi/sg.c:1567:11: error: implicit declaration of function 'sysfs_create_link'; did you mean 'kernfs_create_link'? [-Werror=implicit-function-declaration]
1567 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj,
| ^~~~~~~~~~~~~~~~~
| kernfs_create_link
drivers/scsi/sg.c: In function 'sg_remove_device':
>> drivers/scsi/sg.c:1644:2: error: implicit declaration of function 'sysfs_remove_link' [-Werror=implicit-function-declaration]
1644 | sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic");
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/uaccess.h:11,
from include/linux/sched/task.h:11,
from include/linux/sched/signal.h:12,
from drivers/scsi/sg.c:28:
drivers/scsi/sg.c: At top level:
arch/x86/include/asm/uaccess.h:46:20: warning: 'pagefault_disabled' used but never defined
46 | static inline bool pagefault_disabled(void);
| ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/rculist.h:11,
from include/linux/dcache.h:8,
from include/linux/fs.h:10,
from include/linux/backing-dev.h:13,
from drivers/nvme/host/multipath.c:6:
include/linux/rcuwait.h: In function 'rcuwait_active':
include/linux/rcupdate.h:364:9: error: dereferencing pointer to incomplete type 'struct task_struct'
364 | typeof(*p) *_________p1 = (typeof(*p) *__force)READ_ONCE(p); \
| ^
include/linux/rcupdate.h:474:31: note: in expansion of macro '__rcu_access_pointer'
474 | #define rcu_access_pointer(p) __rcu_access_pointer((p), __rcu)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/rcuwait.h:33:11: note: in expansion of macro 'rcu_access_pointer'
33 | return !!rcu_access_pointer(w->task);
| ^~~~~~~~~~~~~~~~~~
drivers/nvme/host/multipath.c: In function 'nvme_subsys_iopolicy_show':
>> drivers/nvme/host/multipath.c:675:9: error: implicit declaration of function 'sysfs_emit' [-Werror=implicit-function-declaration]
675 | return sysfs_emit(buf, "%s\n",
| ^~~~~~~~~~
In file included from include/linux/uaccess.h:11,
from arch/x86/include/asm/fpu/xstate.h:5,
from arch/x86/include/asm/pgtable.h:26,
from include/linux/pgtable.h:6,
from include/linux/mm.h:35,
from include/linux/bvec.h:14,
from include/linux/blk_types.h:10,
from include/linux/genhd.h:19,
from include/linux/blkdev.h:6,
from include/linux/backing-dev.h:15,
from drivers/nvme/host/multipath.c:6:
drivers/nvme/host/multipath.c: At top level:
arch/x86/include/asm/uaccess.h:46:20: warning: 'pagefault_disabled' used but never defined
46 | static inline bool pagefault_disabled(void);
| ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/radix-tree.h:16,
from include/linux/idr.h:15,
from include/linux/kernfs.h:13,
from include/linux/kobject.h:20,
from include/linux/of.h:18,
from include/linux/irqdomain.h:35,
from include/linux/acpi.h:13,
from drivers/nvme/host/pci.c:7:
include/linux/rcuwait.h: In function 'rcuwait_active':
include/linux/rcupdate.h:364:9: error: dereferencing pointer to incomplete type 'struct task_struct'
364 | typeof(*p) *_________p1 = (typeof(*p) *__force)READ_ONCE(p); \
| ^
include/linux/rcupdate.h:474:31: note: in expansion of macro '__rcu_access_pointer'
474 | #define rcu_access_pointer(p) __rcu_access_pointer((p), __rcu)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/rcuwait.h:33:11: note: in expansion of macro 'rcu_access_pointer'
33 | return !!rcu_access_pointer(w->task);
| ^~~~~~~~~~~~~~~~~~
drivers/nvme/host/pci.c: In function 'nvme_map_cmb':
>> drivers/nvme/host/pci.c:1872:6: error: implicit declaration of function 'sysfs_add_file_to_group' [-Werror=implicit-function-declaration]
1872 | if (sysfs_add_file_to_group(&dev->ctrl.device->kobj,
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/nvme/host/pci.c: In function 'nvme_release_cmb':
>> drivers/nvme/host/pci.c:1881:3: error: implicit declaration of function 'sysfs_remove_file_from_group' [-Werror=implicit-function-declaration]
1881 | sysfs_remove_file_from_group(&dev->ctrl.device->kobj,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/uaccess.h:11,
from arch/x86/include/asm/fpu/xstate.h:5,
from arch/x86/include/asm/pgtable.h:26,
from include/linux/pgtable.h:6,
from include/linux/mm.h:35,
from include/linux/bvec.h:14,
from include/linux/blk_types.h:10,
from include/linux/genhd.h:19,
from include/linux/blkdev.h:6,
from drivers/nvme/host/pci.c:10:
drivers/nvme/host/pci.c: At top level:
arch/x86/include/asm/uaccess.h:46:20: warning: 'pagefault_disabled' used but never defined
46 | static inline bool pagefault_disabled(void);
| ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +1567 drivers/scsi/sg.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 1516
^1da177e4c3f41 Linus Torvalds 2005-04-16 1517 static int
cc833acbee9db5 Douglas Gilbert 2014-06-25 1518 sg_add_device(struct device *cl_dev, struct class_interface *cl_intf)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1519 {
ee959b00c335d7 Tony Jones 2008-02-22 1520 struct scsi_device *scsidp = to_scsi_device(cl_dev->parent);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1521 struct gendisk *disk;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1522 Sg_device *sdp = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1523 struct cdev * cdev = NULL;
7c07d613d22680 James Bottomley 2007-08-05 1524 int error;
454e8957eb6084 Ishai Rabinovitz 2006-06-29 1525 unsigned long iflags;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1526
^1da177e4c3f41 Linus Torvalds 2005-04-16 1527 disk = alloc_disk(1);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1528 if (!disk) {
cc833acbee9db5 Douglas Gilbert 2014-06-25 1529 pr_warn("%s: alloc_disk failed\n", __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1530 return -ENOMEM;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1531 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1532 disk->major = SCSI_GENERIC_MAJOR;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1533
^1da177e4c3f41 Linus Torvalds 2005-04-16 1534 error = -ENOMEM;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1535 cdev = cdev_alloc();
^1da177e4c3f41 Linus Torvalds 2005-04-16 1536 if (!cdev) {
cc833acbee9db5 Douglas Gilbert 2014-06-25 1537 pr_warn("%s: cdev_alloc failed\n", __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1538 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1539 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1540 cdev->owner = THIS_MODULE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1541 cdev->ops = &sg_fops;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1542
7c07d613d22680 James Bottomley 2007-08-05 1543 sdp = sg_alloc(disk, scsidp);
7c07d613d22680 James Bottomley 2007-08-05 1544 if (IS_ERR(sdp)) {
cc833acbee9db5 Douglas Gilbert 2014-06-25 1545 pr_warn("%s: sg_alloc failed\n", __func__);
7c07d613d22680 James Bottomley 2007-08-05 1546 error = PTR_ERR(sdp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1547 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1548 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1549
7c07d613d22680 James Bottomley 2007-08-05 1550 error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, sdp->index), 1);
5e3c34c1e988a0 Greg Kroah-Hartman 2006-01-18 1551 if (error)
454e8957eb6084 Ishai Rabinovitz 2006-06-29 1552 goto cdev_add_err;
5e3c34c1e988a0 Greg Kroah-Hartman 2006-01-18 1553
^1da177e4c3f41 Linus Torvalds 2005-04-16 1554 sdp->cdev = cdev;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1555 if (sg_sysfs_valid) {
ee959b00c335d7 Tony Jones 2008-02-22 1556 struct device *sg_class_member;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1557
d73a1a674b5383 Greg Kroah-Hartman 2008-07-21 1558 sg_class_member = device_create(sg_sysfs_class, cl_dev->parent,
ee959b00c335d7 Tony Jones 2008-02-22 1559 MKDEV(SCSI_GENERIC_MAJOR,
ee959b00c335d7 Tony Jones 2008-02-22 1560 sdp->index),
d73a1a674b5383 Greg Kroah-Hartman 2008-07-21 1561 sdp, "%s", disk->disk_name);
d07e03610ca1f4 FUJITA Tomonori 2008-01-15 1562 if (IS_ERR(sg_class_member)) {
cc833acbee9db5 Douglas Gilbert 2014-06-25 1563 pr_err("%s: device_create failed\n", __func__);
d07e03610ca1f4 FUJITA Tomonori 2008-01-15 1564 error = PTR_ERR(sg_class_member);
d07e03610ca1f4 FUJITA Tomonori 2008-01-15 1565 goto cdev_add_err;
d07e03610ca1f4 FUJITA Tomonori 2008-01-15 1566 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 @1567 error = sysfs_create_link(&scsidp->sdev_gendev.kobj,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1568 &sg_class_member->kobj, "generic");
^1da177e4c3f41 Linus Torvalds 2005-04-16 1569 if (error)
cc833acbee9db5 Douglas Gilbert 2014-06-25 1570 pr_err("%s: unable to make symlink 'generic' back "
cc833acbee9db5 Douglas Gilbert 2014-06-25 1571 "to sg%d\n", __func__, sdp->index);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1572 } else
cc833acbee9db5 Douglas Gilbert 2014-06-25 1573 pr_warn("%s: sg_sys Invalid\n", __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1574
cc833acbee9db5 Douglas Gilbert 2014-06-25 1575 sdev_printk(KERN_NOTICE, scsidp, "Attached scsi generic sg%d "
cc833acbee9db5 Douglas Gilbert 2014-06-25 1576 "type %d\n", sdp->index, scsidp->type);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1577
ee959b00c335d7 Tony Jones 2008-02-22 1578 dev_set_drvdata(cl_dev, sdp);
a24484f281dda1 FUJITA Tomonori 2008-01-15 1579
^1da177e4c3f41 Linus Torvalds 2005-04-16 1580 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1581
454e8957eb6084 Ishai Rabinovitz 2006-06-29 1582 cdev_add_err:
7c07d613d22680 James Bottomley 2007-08-05 1583 write_lock_irqsave(&sg_index_lock, iflags);
7c07d613d22680 James Bottomley 2007-08-05 1584 idr_remove(&sg_index_idr, sdp->index);
7c07d613d22680 James Bottomley 2007-08-05 1585 write_unlock_irqrestore(&sg_index_lock, iflags);
7c07d613d22680 James Bottomley 2007-08-05 1586 kfree(sdp);
454e8957eb6084 Ishai Rabinovitz 2006-06-29 1587
^1da177e4c3f41 Linus Torvalds 2005-04-16 1588 out:
^1da177e4c3f41 Linus Torvalds 2005-04-16 1589 put_disk(disk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1590 if (cdev)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1591 cdev_del(cdev);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1592 return error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1593 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1594
cc833acbee9db5 Douglas Gilbert 2014-06-25 1595 static void
cc833acbee9db5 Douglas Gilbert 2014-06-25 1596 sg_device_destroy(struct kref *kref)
c6517b7942fad6 Tony Battersby 2009-01-21 1597 {
c6517b7942fad6 Tony Battersby 2009-01-21 1598 struct sg_device *sdp = container_of(kref, struct sg_device, d_ref);
c6517b7942fad6 Tony Battersby 2009-01-21 1599 unsigned long flags;
c6517b7942fad6 Tony Battersby 2009-01-21 1600
c6517b7942fad6 Tony Battersby 2009-01-21 1601 /* CAUTION! Note that the device can still be found via idr_find()
c6517b7942fad6 Tony Battersby 2009-01-21 1602 * even though the refcount is 0. Therefore, do idr_remove() BEFORE
c6517b7942fad6 Tony Battersby 2009-01-21 1603 * any other cleanup.
c6517b7942fad6 Tony Battersby 2009-01-21 1604 */
c6517b7942fad6 Tony Battersby 2009-01-21 1605
c6517b7942fad6 Tony Battersby 2009-01-21 1606 write_lock_irqsave(&sg_index_lock, flags);
c6517b7942fad6 Tony Battersby 2009-01-21 1607 idr_remove(&sg_index_idr, sdp->index);
c6517b7942fad6 Tony Battersby 2009-01-21 1608 write_unlock_irqrestore(&sg_index_lock, flags);
c6517b7942fad6 Tony Battersby 2009-01-21 1609
c6517b7942fad6 Tony Battersby 2009-01-21 1610 SCSI_LOG_TIMEOUT(3,
95e159d6dd808b Hannes Reinecke 2014-06-25 1611 sg_printk(KERN_INFO, sdp, "sg_device_destroy\n"));
c6517b7942fad6 Tony Battersby 2009-01-21 1612
c6517b7942fad6 Tony Battersby 2009-01-21 1613 put_disk(sdp->disk);
c6517b7942fad6 Tony Battersby 2009-01-21 1614 kfree(sdp);
c6517b7942fad6 Tony Battersby 2009-01-21 1615 }
c6517b7942fad6 Tony Battersby 2009-01-21 1616
cc833acbee9db5 Douglas Gilbert 2014-06-25 1617 static void
cc833acbee9db5 Douglas Gilbert 2014-06-25 1618 sg_remove_device(struct device *cl_dev, struct class_interface *cl_intf)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1619 {
ee959b00c335d7 Tony Jones 2008-02-22 1620 struct scsi_device *scsidp = to_scsi_device(cl_dev->parent);
ee959b00c335d7 Tony Jones 2008-02-22 1621 Sg_device *sdp = dev_get_drvdata(cl_dev);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1622 unsigned long iflags;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1623 Sg_fd *sfp;
cc833acbee9db5 Douglas Gilbert 2014-06-25 1624 int val;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1625
cc833acbee9db5 Douglas Gilbert 2014-06-25 1626 if (!sdp)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1627 return;
cc833acbee9db5 Douglas Gilbert 2014-06-25 1628 /* want sdp->detaching non-zero as soon as possible */
cc833acbee9db5 Douglas Gilbert 2014-06-25 1629 val = atomic_inc_return(&sdp->detaching);
cc833acbee9db5 Douglas Gilbert 2014-06-25 1630 if (val > 1)
cc833acbee9db5 Douglas Gilbert 2014-06-25 1631 return; /* only want to do following once per device */
7c07d613d22680 James Bottomley 2007-08-05 1632
95e159d6dd808b Hannes Reinecke 2014-06-25 1633 SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
95e159d6dd808b Hannes Reinecke 2014-06-25 1634 "%s\n", __func__));
c6517b7942fad6 Tony Battersby 2009-01-21 1635
cc833acbee9db5 Douglas Gilbert 2014-06-25 1636 read_lock_irqsave(&sdp->sfd_lock, iflags);
3442f802a8169a FUJITA Tomonori 2009-02-16 1637 list_for_each_entry(sfp, &sdp->sfds, sfd_siblings) {
cc833acbee9db5 Douglas Gilbert 2014-06-25 1638 wake_up_interruptible_all(&sfp->read_wait);
c6517b7942fad6 Tony Battersby 2009-01-21 1639 kill_fasync(&sfp->async_qp, SIGPOLL, POLL_HUP);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1640 }
cc833acbee9db5 Douglas Gilbert 2014-06-25 1641 wake_up_interruptible_all(&sdp->open_wait);
cc833acbee9db5 Douglas Gilbert 2014-06-25 1642 read_unlock_irqrestore(&sdp->sfd_lock, iflags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1643
^1da177e4c3f41 Linus Torvalds 2005-04-16 @1644 sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic");
ee959b00c335d7 Tony Jones 2008-02-22 1645 device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, sdp->index));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1646 cdev_del(sdp->cdev);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1647 sdp->cdev = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1648
cc833acbee9db5 Douglas Gilbert 2014-06-25 1649 kref_put(&sdp->d_ref, sg_device_destroy);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1650 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1651

:::::: The code at line 1567 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip