2021-01-25 12:43:28

by Zou Wei

[permalink] [raw]
Subject: [PATCH -next] scsi: gdth: Remove unused including <linux/version.h>

Fix the following versioncheck warning:

drivers/scsi/gdth.c:85:1: unused including <linux/version.h>

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Zou Wei <[email protected]>
---
drivers/scsi/gdth.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index f43bd53..f949001 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -82,7 +82,6 @@

#include <linux/module.h>

-#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/pci.h>
--
2.6.2


2021-01-26 19:08:02

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH -next] scsi: gdth: Remove unused including <linux/version.h>

Hi Zou,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20210125]

url: https://github.com/0day-ci/linux/commits/Zou-Wei/scsi-gdth-Remove-unused-including-linux-version-h/20210126-144114
base: 59fa6a163ffabc1bf25c5e0e33899e268a96d3cc
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/708189b9daeabee85678f76fe62b77125dead7fe
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Zou-Wei/scsi-gdth-Remove-unused-including-linux-version-h/20210126-144114
git checkout 708189b9daeabee85678f76fe62b77125dead7fe
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

drivers/scsi/gdth.c: In function 'gdth_ioctl':
>> drivers/scsi/gdth.c:3832:23: error: 'LINUX_VERSION_MAJOR' undeclared (first use in this function)
3832 | osv.version = LINUX_VERSION_MAJOR;
| ^~~~~~~~~~~~~~~~~~~
drivers/scsi/gdth.c:3832:23: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/scsi/gdth.c:3833:26: error: 'LINUX_VERSION_PATCHLEVEL' undeclared (first use in this function)
3833 | osv.subversion = LINUX_VERSION_PATCHLEVEL;
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/scsi/gdth.c:3834:24: error: 'LINUX_VERSION_SUBLEVEL' undeclared (first use in this function)
3834 | osv.revision = LINUX_VERSION_SUBLEVEL;
| ^~~~~~~~~~~~~~~~~~~~~~


vim +/LINUX_VERSION_MAJOR +3832 drivers/scsi/gdth.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 3668
^1da177e4c3f41 Linus Torvalds 2005-04-16 3669 static int ioc_rescan(void __user *arg, char *cmnd)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3670 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3671 gdth_ioctl_rescan *rsc;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3672 gdth_cmd_str *cmd;
1fe6dbf4d0afba Dave Jones 2010-01-04 3673 u16 i, status, hdr_cnt;
1fe6dbf4d0afba Dave Jones 2010-01-04 3674 u32 info;
45f1a41b2b2e02 Boaz Harrosh 2007-10-02 3675 int cyls, hds, secs;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3676 int rc = -ENOMEM;
1fe6dbf4d0afba Dave Jones 2010-01-04 3677 unsigned long flags;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3678 gdth_ha_str *ha;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3679
^1da177e4c3f41 Linus Torvalds 2005-04-16 3680 rsc = kmalloc(sizeof(*rsc), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3681 cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3682 if (!cmd || !rsc)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3683 goto free_fail;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3684
^1da177e4c3f41 Linus Torvalds 2005-04-16 3685 if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) ||
884f7fba096467 Boaz Harrosh 2007-10-02 3686 (NULL == (ha = gdth_find_ha(rsc->ionode)))) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3687 rc = -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3688 goto free_fail;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3689 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3690 memset(cmd, 0, sizeof(gdth_cmd_str));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3691
^1da177e4c3f41 Linus Torvalds 2005-04-16 3692 if (rsc->flag == 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3693 /* old method: re-init. cache service */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3694 cmd->Service = CACHESERVICE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3695 if (ha->cache_feat & GDT_64BIT) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3696 cmd->OpCode = GDT_X_INIT_HOST;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3697 cmd->u.cache64.DeviceNo = LINUX_OS;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3698 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3699 cmd->OpCode = GDT_INIT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3700 cmd->u.cache.DeviceNo = LINUX_OS;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3701 }
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3702
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3703 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3704 i = 0;
1fe6dbf4d0afba Dave Jones 2010-01-04 3705 hdr_cnt = (status == S_OK ? (u16)info : 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3706 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3707 i = rsc->hdr_no;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3708 hdr_cnt = i + 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3709 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3710
^1da177e4c3f41 Linus Torvalds 2005-04-16 3711 for (; i < hdr_cnt && i < MAX_HDRIVES; ++i) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3712 cmd->Service = CACHESERVICE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3713 cmd->OpCode = GDT_INFO;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3714 if (ha->cache_feat & GDT_64BIT)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3715 cmd->u.cache64.DeviceNo = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3716 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3717 cmd->u.cache.DeviceNo = i;
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3718
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3719 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3720
^1da177e4c3f41 Linus Torvalds 2005-04-16 3721 spin_lock_irqsave(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3722 rsc->hdr_list[i].bus = ha->virt_bus;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3723 rsc->hdr_list[i].target = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3724 rsc->hdr_list[i].lun = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3725 if (status != S_OK) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3726 ha->hdr[i].present = FALSE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3727 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3728 ha->hdr[i].present = TRUE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3729 ha->hdr[i].size = info;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3730 /* evaluate mapping */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3731 ha->hdr[i].size &= ~SECS32;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3732 gdth_eval_mapping(ha->hdr[i].size,&cyls,&hds,&secs);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3733 ha->hdr[i].heads = hds;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3734 ha->hdr[i].secs = secs;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3735 /* round size */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3736 ha->hdr[i].size = cyls * hds * secs;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3737 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3738 spin_unlock_irqrestore(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3739 if (status != S_OK)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3740 continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3741
^1da177e4c3f41 Linus Torvalds 2005-04-16 3742 /* extended info, if GDT_64BIT, for drives > 2 TB */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3743 /* but we need ha->info2, not yet stored in scp->SCp */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3744
^1da177e4c3f41 Linus Torvalds 2005-04-16 3745 /* devtype, cluster info, R/W attribs */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3746 cmd->Service = CACHESERVICE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3747 cmd->OpCode = GDT_DEVTYPE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3748 if (ha->cache_feat & GDT_64BIT)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3749 cmd->u.cache64.DeviceNo = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3750 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3751 cmd->u.cache.DeviceNo = i;
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3752
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3753 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3754
^1da177e4c3f41 Linus Torvalds 2005-04-16 3755 spin_lock_irqsave(&ha->smp_lock, flags);
1fe6dbf4d0afba Dave Jones 2010-01-04 3756 ha->hdr[i].devtype = (status == S_OK ? (u16)info : 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3757 spin_unlock_irqrestore(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3758
^1da177e4c3f41 Linus Torvalds 2005-04-16 3759 cmd->Service = CACHESERVICE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3760 cmd->OpCode = GDT_CLUST_INFO;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3761 if (ha->cache_feat & GDT_64BIT)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3762 cmd->u.cache64.DeviceNo = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3763 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3764 cmd->u.cache.DeviceNo = i;
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3765
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3766 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3767
^1da177e4c3f41 Linus Torvalds 2005-04-16 3768 spin_lock_irqsave(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3769 ha->hdr[i].cluster_type =
1fe6dbf4d0afba Dave Jones 2010-01-04 3770 ((status == S_OK && !shared_access) ? (u16)info : 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3771 spin_unlock_irqrestore(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3772 rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3773
^1da177e4c3f41 Linus Torvalds 2005-04-16 3774 cmd->Service = CACHESERVICE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3775 cmd->OpCode = GDT_RW_ATTRIBS;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3776 if (ha->cache_feat & GDT_64BIT)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3777 cmd->u.cache64.DeviceNo = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3778 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3779 cmd->u.cache.DeviceNo = i;
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3780
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3781 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3782
^1da177e4c3f41 Linus Torvalds 2005-04-16 3783 spin_lock_irqsave(&ha->smp_lock, flags);
1fe6dbf4d0afba Dave Jones 2010-01-04 3784 ha->hdr[i].rw_attribs = (status == S_OK ? (u16)info : 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3785 spin_unlock_irqrestore(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3786 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3787
^1da177e4c3f41 Linus Torvalds 2005-04-16 3788 if (copy_to_user(arg, rsc, sizeof(gdth_ioctl_rescan)))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3789 rc = -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3790 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3791 rc = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3792
^1da177e4c3f41 Linus Torvalds 2005-04-16 3793 free_fail:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3794 kfree(rsc);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3795 kfree(cmd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3796 return rc;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3797 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3798
f4927c45beda9a Arnd Bergmann 2010-04-27 3799 static int gdth_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3800 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3801 gdth_ha_str *ha;
91ebc1facd7797 Johannes Thumshirn 2018-06-13 3802 struct scsi_cmnd *scp;
1fe6dbf4d0afba Dave Jones 2010-01-04 3803 unsigned long flags;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3804 char cmnd[MAX_COMMAND_SIZE];
^1da177e4c3f41 Linus Torvalds 2005-04-16 3805 void __user *argp = (void __user *)arg;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3806
^1da177e4c3f41 Linus Torvalds 2005-04-16 3807 memset(cmnd, 0xff, 12);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3808
^1da177e4c3f41 Linus Torvalds 2005-04-16 3809 TRACE(("gdth_ioctl() cmd 0x%x\n", cmd));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3810
^1da177e4c3f41 Linus Torvalds 2005-04-16 3811 switch (cmd) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3812 case GDTIOCTL_CTRCNT:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3813 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3814 int cnt = gdth_ctr_count;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3815 if (put_user(cnt, (int __user *)argp))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3816 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3817 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3818 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3819
^1da177e4c3f41 Linus Torvalds 2005-04-16 3820 case GDTIOCTL_DRVERS:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3821 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3822 int ver = (GDTH_VERSION<<8) | GDTH_SUBVERSION;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3823 if (put_user(ver, (int __user *)argp))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3824 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3825 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3826 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3827
^1da177e4c3f41 Linus Torvalds 2005-04-16 3828 case GDTIOCTL_OSVERS:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3829 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3830 gdth_ioctl_osvers osv;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3831
537896fabed11f Sasha Levin 2021-01-18 @3832 osv.version = LINUX_VERSION_MAJOR;
537896fabed11f Sasha Levin 2021-01-18 @3833 osv.subversion = LINUX_VERSION_PATCHLEVEL;
537896fabed11f Sasha Levin 2021-01-18 @3834 osv.revision = LINUX_VERSION_SUBLEVEL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3835 if (copy_to_user(argp, &osv, sizeof(gdth_ioctl_osvers)))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3836 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3837 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3838 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3839
^1da177e4c3f41 Linus Torvalds 2005-04-16 3840 case GDTIOCTL_CTRTYPE:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3841 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3842 gdth_ioctl_ctrtype ctrt;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3843
^1da177e4c3f41 Linus Torvalds 2005-04-16 3844 if (copy_from_user(&ctrt, argp, sizeof(gdth_ioctl_ctrtype)) ||
884f7fba096467 Boaz Harrosh 2007-10-02 3845 (NULL == (ha = gdth_find_ha(ctrt.ionode))))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3846 return -EFAULT;
884f7fba096467 Boaz Harrosh 2007-10-02 3847
^1da177e4c3f41 Linus Torvalds 2005-04-16 3848 if (ha->type != GDT_PCIMPR) {
1fe6dbf4d0afba Dave Jones 2010-01-04 3849 ctrt.type = (u8)((ha->stype<<4) + 6);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3850 } else {
314814552a0adf Christoph Hellwig 2018-12-12 3851 ctrt.type = (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3852 if (ha->stype >= 0x300)
8e9a8a0d56c5d9 Jeff Garzik 2007-07-17 3853 ctrt.ext_type = 0x6000 | ha->pdev->subsystem_device;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3854 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3855 ctrt.ext_type = 0x6000 | ha->stype;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3856 }
8e9a8a0d56c5d9 Jeff Garzik 2007-07-17 3857 ctrt.device_id = ha->pdev->device;
8e9a8a0d56c5d9 Jeff Garzik 2007-07-17 3858 ctrt.sub_device_id = ha->pdev->subsystem_device;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3859 ctrt.info = ha->brd_phys;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3860 ctrt.oem_id = ha->oem_id;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3861 if (copy_to_user(argp, &ctrt, sizeof(gdth_ioctl_ctrtype)))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3862 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3863 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3864 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3865
^1da177e4c3f41 Linus Torvalds 2005-04-16 3866 case GDTIOCTL_GENERAL:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3867 return ioc_general(argp, cmnd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3868
^1da177e4c3f41 Linus Torvalds 2005-04-16 3869 case GDTIOCTL_EVENT:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3870 return ioc_event(argp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3871
^1da177e4c3f41 Linus Torvalds 2005-04-16 3872 case GDTIOCTL_LOCKDRV:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3873 return ioc_lockdrv(argp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3874
^1da177e4c3f41 Linus Torvalds 2005-04-16 3875 case GDTIOCTL_LOCKCHN:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3876 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3877 gdth_ioctl_lockchn lchn;
1fe6dbf4d0afba Dave Jones 2010-01-04 3878 u8 i, j;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3879
^1da177e4c3f41 Linus Torvalds 2005-04-16 3880 if (copy_from_user(&lchn, argp, sizeof(gdth_ioctl_lockchn)) ||
884f7fba096467 Boaz Harrosh 2007-10-02 3881 (NULL == (ha = gdth_find_ha(lchn.ionode))))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3882 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3883
^1da177e4c3f41 Linus Torvalds 2005-04-16 3884 i = lchn.channel;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3885 if (i < ha->bus_cnt) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3886 if (lchn.lock) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3887 spin_lock_irqsave(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3888 ha->raw[i].lock = 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3889 spin_unlock_irqrestore(&ha->smp_lock, flags);
242f9dcb8ba6f6 Jens Axboe 2008-09-14 3890 for (j = 0; j < ha->tid_cnt; ++j)
45f1a41b2b2e02 Boaz Harrosh 2007-10-02 3891 gdth_wait_completion(ha, i, j);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3892 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3893 spin_lock_irqsave(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3894 ha->raw[i].lock = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3895 spin_unlock_irqrestore(&ha->smp_lock, flags);
242f9dcb8ba6f6 Jens Axboe 2008-09-14 3896 for (j = 0; j < ha->tid_cnt; ++j)
45f1a41b2b2e02 Boaz Harrosh 2007-10-02 3897 gdth_next(ha);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3898 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3899 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3900 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3901 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3902
^1da177e4c3f41 Linus Torvalds 2005-04-16 3903 case GDTIOCTL_RESCAN:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3904 return ioc_rescan(argp, cmnd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3905
^1da177e4c3f41 Linus Torvalds 2005-04-16 3906 case GDTIOCTL_HDRLIST:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3907 return ioc_hdrlist(argp, cmnd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3908
^1da177e4c3f41 Linus Torvalds 2005-04-16 3909 case GDTIOCTL_RESET_BUS:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3910 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3911 gdth_ioctl_reset res;
45f1a41b2b2e02 Boaz Harrosh 2007-10-02 3912 int rval;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3913
^1da177e4c3f41 Linus Torvalds 2005-04-16 3914 if (copy_from_user(&res, argp, sizeof(gdth_ioctl_reset)) ||
884f7fba096467 Boaz Harrosh 2007-10-02 3915 (NULL == (ha = gdth_find_ha(res.ionode))))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3916 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3917
bbfbbbc1182f8b Mariusz Kozlowski 2007-08-11 3918 scp = kzalloc(sizeof(*scp), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3919 if (!scp)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3920 return -ENOMEM;
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3921 scp->device = ha->sdev;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3922 scp->cmd_len = 12;
52759e6abc88fe Christoph Hellwig 2007-10-02 3923 scp->device->channel = res.number;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3924 rval = gdth_eh_bus_reset(scp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3925 res.status = (rval == SUCCESS ? S_OK : S_GENERR);
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3926 kfree(scp);
8d7a5da4fc95cb Jeff Garzik 2007-10-02 3927
^1da177e4c3f41 Linus Torvalds 2005-04-16 3928 if (copy_to_user(argp, &res, sizeof(gdth_ioctl_reset)))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3929 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3930 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3931 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3932
^1da177e4c3f41 Linus Torvalds 2005-04-16 3933 case GDTIOCTL_RESET_DRV:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3934 return ioc_resetdrv(argp, cmnd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3935
^1da177e4c3f41 Linus Torvalds 2005-04-16 3936 default:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3937 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3938 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3939 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3940 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3941

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (24.06 kB)
.config.gz (65.81 kB)
Download all attachments

2021-01-27 21:18:39

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH -next] scsi: gdth: Remove unused including <linux/version.h>

Hi Zou,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20210125]

url: https://github.com/0day-ci/linux/commits/Zou-Wei/scsi-gdth-Remove-unused-including-linux-version-h/20210126-144114
base: 59fa6a163ffabc1bf25c5e0e33899e268a96d3cc
config: x86_64-randconfig-a006-20210126 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 925ae8c790c7e354f12ec14a6cac6aa49fc75b29)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/708189b9daeabee85678f76fe62b77125dead7fe
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Zou-Wei/scsi-gdth-Remove-unused-including-linux-version-h/20210126-144114
git checkout 708189b9daeabee85678f76fe62b77125dead7fe
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

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

>> drivers/scsi/gdth.c:3832:23: error: use of undeclared identifier 'LINUX_VERSION_MAJOR'
osv.version = LINUX_VERSION_MAJOR;
^
>> drivers/scsi/gdth.c:3833:26: error: use of undeclared identifier 'LINUX_VERSION_PATCHLEVEL'
osv.subversion = LINUX_VERSION_PATCHLEVEL;
^
>> drivers/scsi/gdth.c:3834:24: error: use of undeclared identifier 'LINUX_VERSION_SUBLEVEL'
osv.revision = LINUX_VERSION_SUBLEVEL;
^
>> drivers/scsi/gdth.c:4097:33: warning: shift count >= width of type [-Wshift-count-overflow]
if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
1 warning and 3 errors generated.


vim +/LINUX_VERSION_MAJOR +3832 drivers/scsi/gdth.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 3668
^1da177e4c3f41 Linus Torvalds 2005-04-16 3669 static int ioc_rescan(void __user *arg, char *cmnd)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3670 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3671 gdth_ioctl_rescan *rsc;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3672 gdth_cmd_str *cmd;
1fe6dbf4d0afba Dave Jones 2010-01-04 3673 u16 i, status, hdr_cnt;
1fe6dbf4d0afba Dave Jones 2010-01-04 3674 u32 info;
45f1a41b2b2e02 Boaz Harrosh 2007-10-02 3675 int cyls, hds, secs;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3676 int rc = -ENOMEM;
1fe6dbf4d0afba Dave Jones 2010-01-04 3677 unsigned long flags;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3678 gdth_ha_str *ha;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3679
^1da177e4c3f41 Linus Torvalds 2005-04-16 3680 rsc = kmalloc(sizeof(*rsc), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3681 cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3682 if (!cmd || !rsc)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3683 goto free_fail;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3684
^1da177e4c3f41 Linus Torvalds 2005-04-16 3685 if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) ||
884f7fba096467 Boaz Harrosh 2007-10-02 3686 (NULL == (ha = gdth_find_ha(rsc->ionode)))) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3687 rc = -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3688 goto free_fail;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3689 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3690 memset(cmd, 0, sizeof(gdth_cmd_str));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3691
^1da177e4c3f41 Linus Torvalds 2005-04-16 3692 if (rsc->flag == 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3693 /* old method: re-init. cache service */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3694 cmd->Service = CACHESERVICE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3695 if (ha->cache_feat & GDT_64BIT) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3696 cmd->OpCode = GDT_X_INIT_HOST;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3697 cmd->u.cache64.DeviceNo = LINUX_OS;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3698 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3699 cmd->OpCode = GDT_INIT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3700 cmd->u.cache.DeviceNo = LINUX_OS;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3701 }
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3702
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3703 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3704 i = 0;
1fe6dbf4d0afba Dave Jones 2010-01-04 3705 hdr_cnt = (status == S_OK ? (u16)info : 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3706 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3707 i = rsc->hdr_no;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3708 hdr_cnt = i + 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3709 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3710
^1da177e4c3f41 Linus Torvalds 2005-04-16 3711 for (; i < hdr_cnt && i < MAX_HDRIVES; ++i) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3712 cmd->Service = CACHESERVICE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3713 cmd->OpCode = GDT_INFO;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3714 if (ha->cache_feat & GDT_64BIT)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3715 cmd->u.cache64.DeviceNo = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3716 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3717 cmd->u.cache.DeviceNo = i;
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3718
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3719 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3720
^1da177e4c3f41 Linus Torvalds 2005-04-16 3721 spin_lock_irqsave(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3722 rsc->hdr_list[i].bus = ha->virt_bus;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3723 rsc->hdr_list[i].target = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3724 rsc->hdr_list[i].lun = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3725 if (status != S_OK) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3726 ha->hdr[i].present = FALSE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3727 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3728 ha->hdr[i].present = TRUE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3729 ha->hdr[i].size = info;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3730 /* evaluate mapping */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3731 ha->hdr[i].size &= ~SECS32;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3732 gdth_eval_mapping(ha->hdr[i].size,&cyls,&hds,&secs);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3733 ha->hdr[i].heads = hds;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3734 ha->hdr[i].secs = secs;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3735 /* round size */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3736 ha->hdr[i].size = cyls * hds * secs;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3737 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3738 spin_unlock_irqrestore(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3739 if (status != S_OK)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3740 continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3741
^1da177e4c3f41 Linus Torvalds 2005-04-16 3742 /* extended info, if GDT_64BIT, for drives > 2 TB */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3743 /* but we need ha->info2, not yet stored in scp->SCp */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3744
^1da177e4c3f41 Linus Torvalds 2005-04-16 3745 /* devtype, cluster info, R/W attribs */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3746 cmd->Service = CACHESERVICE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3747 cmd->OpCode = GDT_DEVTYPE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3748 if (ha->cache_feat & GDT_64BIT)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3749 cmd->u.cache64.DeviceNo = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3750 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3751 cmd->u.cache.DeviceNo = i;
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3752
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3753 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3754
^1da177e4c3f41 Linus Torvalds 2005-04-16 3755 spin_lock_irqsave(&ha->smp_lock, flags);
1fe6dbf4d0afba Dave Jones 2010-01-04 3756 ha->hdr[i].devtype = (status == S_OK ? (u16)info : 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3757 spin_unlock_irqrestore(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3758
^1da177e4c3f41 Linus Torvalds 2005-04-16 3759 cmd->Service = CACHESERVICE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3760 cmd->OpCode = GDT_CLUST_INFO;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3761 if (ha->cache_feat & GDT_64BIT)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3762 cmd->u.cache64.DeviceNo = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3763 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3764 cmd->u.cache.DeviceNo = i;
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3765
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3766 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3767
^1da177e4c3f41 Linus Torvalds 2005-04-16 3768 spin_lock_irqsave(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3769 ha->hdr[i].cluster_type =
1fe6dbf4d0afba Dave Jones 2010-01-04 3770 ((status == S_OK && !shared_access) ? (u16)info : 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3771 spin_unlock_irqrestore(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3772 rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3773
^1da177e4c3f41 Linus Torvalds 2005-04-16 3774 cmd->Service = CACHESERVICE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3775 cmd->OpCode = GDT_RW_ATTRIBS;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3776 if (ha->cache_feat & GDT_64BIT)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3777 cmd->u.cache64.DeviceNo = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3778 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3779 cmd->u.cache.DeviceNo = i;
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3780
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3781 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3782
^1da177e4c3f41 Linus Torvalds 2005-04-16 3783 spin_lock_irqsave(&ha->smp_lock, flags);
1fe6dbf4d0afba Dave Jones 2010-01-04 3784 ha->hdr[i].rw_attribs = (status == S_OK ? (u16)info : 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3785 spin_unlock_irqrestore(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3786 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3787
^1da177e4c3f41 Linus Torvalds 2005-04-16 3788 if (copy_to_user(arg, rsc, sizeof(gdth_ioctl_rescan)))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3789 rc = -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3790 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3791 rc = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3792
^1da177e4c3f41 Linus Torvalds 2005-04-16 3793 free_fail:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3794 kfree(rsc);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3795 kfree(cmd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3796 return rc;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3797 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3798
f4927c45beda9a Arnd Bergmann 2010-04-27 3799 static int gdth_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3800 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3801 gdth_ha_str *ha;
91ebc1facd7797 Johannes Thumshirn 2018-06-13 3802 struct scsi_cmnd *scp;
1fe6dbf4d0afba Dave Jones 2010-01-04 3803 unsigned long flags;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3804 char cmnd[MAX_COMMAND_SIZE];
^1da177e4c3f41 Linus Torvalds 2005-04-16 3805 void __user *argp = (void __user *)arg;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3806
^1da177e4c3f41 Linus Torvalds 2005-04-16 3807 memset(cmnd, 0xff, 12);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3808
^1da177e4c3f41 Linus Torvalds 2005-04-16 3809 TRACE(("gdth_ioctl() cmd 0x%x\n", cmd));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3810
^1da177e4c3f41 Linus Torvalds 2005-04-16 3811 switch (cmd) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3812 case GDTIOCTL_CTRCNT:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3813 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3814 int cnt = gdth_ctr_count;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3815 if (put_user(cnt, (int __user *)argp))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3816 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3817 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3818 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3819
^1da177e4c3f41 Linus Torvalds 2005-04-16 3820 case GDTIOCTL_DRVERS:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3821 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3822 int ver = (GDTH_VERSION<<8) | GDTH_SUBVERSION;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3823 if (put_user(ver, (int __user *)argp))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3824 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3825 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3826 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3827
^1da177e4c3f41 Linus Torvalds 2005-04-16 3828 case GDTIOCTL_OSVERS:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3829 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3830 gdth_ioctl_osvers osv;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3831
537896fabed11f Sasha Levin 2021-01-18 @3832 osv.version = LINUX_VERSION_MAJOR;
537896fabed11f Sasha Levin 2021-01-18 @3833 osv.subversion = LINUX_VERSION_PATCHLEVEL;
537896fabed11f Sasha Levin 2021-01-18 @3834 osv.revision = LINUX_VERSION_SUBLEVEL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3835 if (copy_to_user(argp, &osv, sizeof(gdth_ioctl_osvers)))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3836 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3837 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3838 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3839
^1da177e4c3f41 Linus Torvalds 2005-04-16 3840 case GDTIOCTL_CTRTYPE:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3841 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3842 gdth_ioctl_ctrtype ctrt;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3843
^1da177e4c3f41 Linus Torvalds 2005-04-16 3844 if (copy_from_user(&ctrt, argp, sizeof(gdth_ioctl_ctrtype)) ||
884f7fba096467 Boaz Harrosh 2007-10-02 3845 (NULL == (ha = gdth_find_ha(ctrt.ionode))))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3846 return -EFAULT;
884f7fba096467 Boaz Harrosh 2007-10-02 3847
^1da177e4c3f41 Linus Torvalds 2005-04-16 3848 if (ha->type != GDT_PCIMPR) {
1fe6dbf4d0afba Dave Jones 2010-01-04 3849 ctrt.type = (u8)((ha->stype<<4) + 6);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3850 } else {
314814552a0adf Christoph Hellwig 2018-12-12 3851 ctrt.type = (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3852 if (ha->stype >= 0x300)
8e9a8a0d56c5d9 Jeff Garzik 2007-07-17 3853 ctrt.ext_type = 0x6000 | ha->pdev->subsystem_device;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3854 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3855 ctrt.ext_type = 0x6000 | ha->stype;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3856 }
8e9a8a0d56c5d9 Jeff Garzik 2007-07-17 3857 ctrt.device_id = ha->pdev->device;
8e9a8a0d56c5d9 Jeff Garzik 2007-07-17 3858 ctrt.sub_device_id = ha->pdev->subsystem_device;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3859 ctrt.info = ha->brd_phys;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3860 ctrt.oem_id = ha->oem_id;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3861 if (copy_to_user(argp, &ctrt, sizeof(gdth_ioctl_ctrtype)))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3862 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3863 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3864 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3865
^1da177e4c3f41 Linus Torvalds 2005-04-16 3866 case GDTIOCTL_GENERAL:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3867 return ioc_general(argp, cmnd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3868
^1da177e4c3f41 Linus Torvalds 2005-04-16 3869 case GDTIOCTL_EVENT:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3870 return ioc_event(argp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3871
^1da177e4c3f41 Linus Torvalds 2005-04-16 3872 case GDTIOCTL_LOCKDRV:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3873 return ioc_lockdrv(argp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3874
^1da177e4c3f41 Linus Torvalds 2005-04-16 3875 case GDTIOCTL_LOCKCHN:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3876 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3877 gdth_ioctl_lockchn lchn;
1fe6dbf4d0afba Dave Jones 2010-01-04 3878 u8 i, j;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3879
^1da177e4c3f41 Linus Torvalds 2005-04-16 3880 if (copy_from_user(&lchn, argp, sizeof(gdth_ioctl_lockchn)) ||
884f7fba096467 Boaz Harrosh 2007-10-02 3881 (NULL == (ha = gdth_find_ha(lchn.ionode))))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3882 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3883
^1da177e4c3f41 Linus Torvalds 2005-04-16 3884 i = lchn.channel;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3885 if (i < ha->bus_cnt) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3886 if (lchn.lock) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3887 spin_lock_irqsave(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3888 ha->raw[i].lock = 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3889 spin_unlock_irqrestore(&ha->smp_lock, flags);
242f9dcb8ba6f6 Jens Axboe 2008-09-14 3890 for (j = 0; j < ha->tid_cnt; ++j)
45f1a41b2b2e02 Boaz Harrosh 2007-10-02 3891 gdth_wait_completion(ha, i, j);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3892 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3893 spin_lock_irqsave(&ha->smp_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3894 ha->raw[i].lock = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3895 spin_unlock_irqrestore(&ha->smp_lock, flags);
242f9dcb8ba6f6 Jens Axboe 2008-09-14 3896 for (j = 0; j < ha->tid_cnt; ++j)
45f1a41b2b2e02 Boaz Harrosh 2007-10-02 3897 gdth_next(ha);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3898 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3899 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3900 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3901 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3902
^1da177e4c3f41 Linus Torvalds 2005-04-16 3903 case GDTIOCTL_RESCAN:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3904 return ioc_rescan(argp, cmnd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3905
^1da177e4c3f41 Linus Torvalds 2005-04-16 3906 case GDTIOCTL_HDRLIST:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3907 return ioc_hdrlist(argp, cmnd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3908
^1da177e4c3f41 Linus Torvalds 2005-04-16 3909 case GDTIOCTL_RESET_BUS:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3910 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3911 gdth_ioctl_reset res;
45f1a41b2b2e02 Boaz Harrosh 2007-10-02 3912 int rval;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3913
^1da177e4c3f41 Linus Torvalds 2005-04-16 3914 if (copy_from_user(&res, argp, sizeof(gdth_ioctl_reset)) ||
884f7fba096467 Boaz Harrosh 2007-10-02 3915 (NULL == (ha = gdth_find_ha(res.ionode))))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3916 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3917
bbfbbbc1182f8b Mariusz Kozlowski 2007-08-11 3918 scp = kzalloc(sizeof(*scp), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3919 if (!scp)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3920 return -ENOMEM;
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3921 scp->device = ha->sdev;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3922 scp->cmd_len = 12;
52759e6abc88fe Christoph Hellwig 2007-10-02 3923 scp->device->channel = res.number;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3924 rval = gdth_eh_bus_reset(scp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3925 res.status = (rval == SUCCESS ? S_OK : S_GENERR);
cbd5f69b98bb5d Leubner, Achim 2006-06-09 3926 kfree(scp);
8d7a5da4fc95cb Jeff Garzik 2007-10-02 3927
^1da177e4c3f41 Linus Torvalds 2005-04-16 3928 if (copy_to_user(argp, &res, sizeof(gdth_ioctl_reset)))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3929 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3930 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3931 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3932
^1da177e4c3f41 Linus Torvalds 2005-04-16 3933 case GDTIOCTL_RESET_DRV:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3934 return ioc_resetdrv(argp, cmnd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3935
^1da177e4c3f41 Linus Torvalds 2005-04-16 3936 default:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3937 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3938 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3939 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3940 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3941

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (24.43 kB)
.config.gz (34.08 kB)
Download all attachments