aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message/fusion/mptctl.c')
-rw-r--r--drivers/message/fusion/mptctl.c233
1 files changed, 117 insertions, 116 deletions
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index 12dfa2e84f0f..5d137a8b3096 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -181,7 +181,6 @@ static inline int
181mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock) 181mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock)
182{ 182{
183 int rc = 0; 183 int rc = 0;
184// dctlprintk(ioc, printk(KERN_DEBUG MYNAM "::mptctl_syscall_down(%p,%d) called\n", ioc, nonblock));
185 184
186 if (nonblock) { 185 if (nonblock) {
187 if (!mutex_trylock(&ioc->ioctl->ioctl_mutex)) 186 if (!mutex_trylock(&ioc->ioctl->ioctl_mutex))
@@ -190,7 +189,6 @@ mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock)
190 if (mutex_lock_interruptible(&ioc->ioctl->ioctl_mutex)) 189 if (mutex_lock_interruptible(&ioc->ioctl->ioctl_mutex))
191 rc = -ERESTARTSYS; 190 rc = -ERESTARTSYS;
192 } 191 }
193// dctlprintk(ioc, printk(KERN_DEBUG MYNAM "::mptctl_syscall_down return %d\n", rc));
194 return rc; 192 return rc;
195} 193}
196 194
@@ -475,7 +473,7 @@ static int
475mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) 473mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
476{ 474{
477 MPT_IOCTL *ioctl = ioc->ioctl; 475 MPT_IOCTL *ioctl = ioc->ioctl;
478 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": IOC %s_reset routed to IOCTL driver!\n",ioc->name, 476 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "IOC %s_reset routed to IOCTL driver!\n", ioc->name,
479 reset_phase==MPT_IOC_SETUP_RESET ? "setup" : ( 477 reset_phase==MPT_IOC_SETUP_RESET ? "setup" : (
480 reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post"))); 478 reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post")));
481 479
@@ -581,7 +579,7 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
581 MPT_ADAPTER *iocp = NULL; 579 MPT_ADAPTER *iocp = NULL;
582 580
583 if (copy_from_user(&khdr, uhdr, sizeof(khdr))) { 581 if (copy_from_user(&khdr, uhdr, sizeof(khdr))) {
584 printk(KERN_ERR "%s::mptctl_ioctl() @%d - " 582 printk(KERN_ERR MYNAM "%s::mptctl_ioctl() @%d - "
585 "Unable to copy mpt_ioctl_header data @ %p\n", 583 "Unable to copy mpt_ioctl_header data @ %p\n",
586 __FILE__, __LINE__, uhdr); 584 __FILE__, __LINE__, uhdr);
587 return -EFAULT; 585 return -EFAULT;
@@ -594,13 +592,13 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
594 iocnumX = khdr.iocnum & 0xFF; 592 iocnumX = khdr.iocnum & 0xFF;
595 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) || 593 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
596 (iocp == NULL)) { 594 (iocp == NULL)) {
597 printk(KERN_DEBUG "%s::mptctl_ioctl() @%d - ioc%d not found!\n", 595 printk(KERN_DEBUG MYNAM "%s::mptctl_ioctl() @%d - ioc%d not found!\n",
598 __FILE__, __LINE__, iocnumX); 596 __FILE__, __LINE__, iocnumX);
599 return -ENODEV; 597 return -ENODEV;
600 } 598 }
601 599
602 if (!iocp->active) { 600 if (!iocp->active) {
603 printk(KERN_DEBUG "%s::mptctl_ioctl() @%d - Controller disabled.\n", 601 printk(KERN_DEBUG MYNAM "%s::mptctl_ioctl() @%d - Controller disabled.\n",
604 __FILE__, __LINE__); 602 __FILE__, __LINE__);
605 return -EFAULT; 603 return -EFAULT;
606 } 604 }
@@ -667,14 +665,14 @@ static int mptctl_do_reset(unsigned long arg)
667 MPT_ADAPTER *iocp; 665 MPT_ADAPTER *iocp;
668 666
669 if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) { 667 if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) {
670 printk(KERN_ERR "%s@%d::mptctl_do_reset - " 668 printk(KERN_ERR MYNAM "%s@%d::mptctl_do_reset - "
671 "Unable to copy mpt_ioctl_diag_reset struct @ %p\n", 669 "Unable to copy mpt_ioctl_diag_reset struct @ %p\n",
672 __FILE__, __LINE__, urinfo); 670 __FILE__, __LINE__, urinfo);
673 return -EFAULT; 671 return -EFAULT;
674 } 672 }
675 673
676 if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) { 674 if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) {
677 printk(KERN_DEBUG "%s@%d::mptctl_do_reset - ioc%d not found!\n", 675 printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n",
678 __FILE__, __LINE__, krinfo.hdr.iocnum); 676 __FILE__, __LINE__, krinfo.hdr.iocnum);
679 return -ENODEV; /* (-6) No such device or address */ 677 return -ENODEV; /* (-6) No such device or address */
680 } 678 }
@@ -683,8 +681,8 @@ static int mptctl_do_reset(unsigned long arg)
683 iocp->name)); 681 iocp->name));
684 682
685 if (mpt_HardResetHandler(iocp, CAN_SLEEP) != 0) { 683 if (mpt_HardResetHandler(iocp, CAN_SLEEP) != 0) {
686 printk (KERN_ERR "%s@%d::mptctl_do_reset - reset failed.\n", 684 printk (MYIOC_s_ERR_FMT "%s@%d::mptctl_do_reset - reset failed.\n",
687 __FILE__, __LINE__); 685 iocp->name, __FILE__, __LINE__);
688 return -1; 686 return -1;
689 } 687 }
690 688
@@ -715,7 +713,7 @@ mptctl_fw_download(unsigned long arg)
715 struct mpt_fw_xfer kfwdl; 713 struct mpt_fw_xfer kfwdl;
716 714
717 if (copy_from_user(&kfwdl, ufwdl, sizeof(struct mpt_fw_xfer))) { 715 if (copy_from_user(&kfwdl, ufwdl, sizeof(struct mpt_fw_xfer))) {
718 printk(KERN_ERR "%s@%d::_ioctl_fwdl - " 716 printk(KERN_ERR MYNAM "%s@%d::_ioctl_fwdl - "
719 "Unable to copy mpt_fw_xfer struct @ %p\n", 717 "Unable to copy mpt_fw_xfer struct @ %p\n",
720 __FILE__, __LINE__, ufwdl); 718 __FILE__, __LINE__, ufwdl);
721 return -EFAULT; 719 return -EFAULT;
@@ -763,7 +761,8 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
763 pFWDownloadReply_t ReplyMsg = NULL; 761 pFWDownloadReply_t ReplyMsg = NULL;
764 762
765 if (mpt_verify_adapter(ioc, &iocp) < 0) { 763 if (mpt_verify_adapter(ioc, &iocp) < 0) {
766 printk(KERN_DEBUG "ioctl_fwdl - ioc%d not found!\n", ioc); 764 printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n",
765 ioc);
767 return -ENODEV; /* (-6) No such device or address */ 766 return -ENODEV; /* (-6) No such device or address */
768 } else { 767 } else {
769 768
@@ -875,9 +874,9 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
875 mpt_add_sge(sgOut, sgIn->FlagsLength, sgIn->Address); 874 mpt_add_sge(sgOut, sgIn->FlagsLength, sgIn->Address);
876 n++; 875 n++;
877 if (copy_from_user(bl->kptr, ufwbuf+fw_bytes_copied, bl->len)) { 876 if (copy_from_user(bl->kptr, ufwbuf+fw_bytes_copied, bl->len)) {
878 printk(KERN_ERR "%s@%d::_ioctl_fwdl - " 877 printk(MYIOC_s_ERR_FMT "%s@%d::_ioctl_fwdl - "
879 "Unable to copy f/w buffer hunk#%d @ %p\n", 878 "Unable to copy f/w buffer hunk#%d @ %p\n",
880 __FILE__, __LINE__, n, ufwbuf); 879 iocp->name, __FILE__, __LINE__, n, ufwbuf);
881 goto fwdl_out; 880 goto fwdl_out;
882 } 881 }
883 fw_bytes_copied += bl->len; 882 fw_bytes_copied += bl->len;
@@ -913,21 +912,22 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
913 ReplyMsg = (pFWDownloadReply_t)iocp->ioctl->ReplyFrame; 912 ReplyMsg = (pFWDownloadReply_t)iocp->ioctl->ReplyFrame;
914 iocstat = le16_to_cpu(ReplyMsg->IOCStatus) & MPI_IOCSTATUS_MASK; 913 iocstat = le16_to_cpu(ReplyMsg->IOCStatus) & MPI_IOCSTATUS_MASK;
915 if (iocstat == MPI_IOCSTATUS_SUCCESS) { 914 if (iocstat == MPI_IOCSTATUS_SUCCESS) {
916 printk(KERN_INFO MYNAM ": F/W update successfully sent to %s!\n", iocp->name); 915 printk(MYIOC_s_INFO_FMT "F/W update successfull!\n", iocp->name);
917 return 0; 916 return 0;
918 } else if (iocstat == MPI_IOCSTATUS_INVALID_FUNCTION) { 917 } else if (iocstat == MPI_IOCSTATUS_INVALID_FUNCTION) {
919 printk(KERN_WARNING MYNAM ": ?Hmmm... %s says it doesn't support F/W download!?!\n", 918 printk(MYIOC_s_WARN_FMT "Hmmm... F/W download not supported!?!\n",
920 iocp->name); 919 iocp->name);
921 printk(KERN_WARNING MYNAM ": (time to go bang on somebodies door)\n"); 920 printk(MYIOC_s_WARN_FMT "(time to go bang on somebodies door)\n",
921 iocp->name);
922 return -EBADRQC; 922 return -EBADRQC;
923 } else if (iocstat == MPI_IOCSTATUS_BUSY) { 923 } else if (iocstat == MPI_IOCSTATUS_BUSY) {
924 printk(KERN_WARNING MYNAM ": Warning! %s says: IOC_BUSY!\n", iocp->name); 924 printk(MYIOC_s_WARN_FMT "IOC_BUSY!\n", iocp->name);
925 printk(KERN_WARNING MYNAM ": (try again later?)\n"); 925 printk(MYIOC_s_WARN_FMT "(try again later?)\n", iocp->name);
926 return -EBUSY; 926 return -EBUSY;
927 } else { 927 } else {
928 printk(KERN_WARNING MYNAM "::ioctl_fwdl() ERROR! %s returned [bad] status = %04xh\n", 928 printk(MYIOC_s_WARN_FMT "ioctl_fwdl() returned [bad] status = %04xh\n",
929 iocp->name, iocstat); 929 iocp->name, iocstat);
930 printk(KERN_WARNING MYNAM ": (bad VooDoo)\n"); 930 printk(MYIOC_s_WARN_FMT "(bad VooDoo)\n", iocp->name);
931 return -ENOMSG; 931 return -ENOMSG;
932 } 932 }
933 return 0; 933 return 0;
@@ -1014,10 +1014,10 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
1014 if (buflist[buflist_ent].kptr == NULL) { 1014 if (buflist[buflist_ent].kptr == NULL) {
1015 alloc_sz = alloc_sz / 2; 1015 alloc_sz = alloc_sz / 2;
1016 if (alloc_sz == 0) { 1016 if (alloc_sz == 0) {
1017 printk(KERN_WARNING MYNAM "-SG: No can do - " 1017 printk(MYIOC_s_WARN_FMT "-SG: No can do - "
1018 "not enough memory! :-(\n"); 1018 "not enough memory! :-(\n", ioc->name);
1019 printk(KERN_WARNING MYNAM "-SG: (freeing %d frags)\n", 1019 printk(MYIOC_s_WARN_FMT "-SG: (freeing %d frags)\n",
1020 numfrags); 1020 ioc->name, numfrags);
1021 goto free_and_fail; 1021 goto free_and_fail;
1022 } 1022 }
1023 continue; 1023 continue;
@@ -1040,18 +1040,19 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
1040 1040
1041 /* Need to chain? */ 1041 /* Need to chain? */
1042 if (fragcnt == sg_spill) { 1042 if (fragcnt == sg_spill) {
1043 printk(KERN_WARNING MYNAM "-SG: No can do - " "Chain required! :-(\n"); 1043 printk(MYIOC_s_WARN_FMT
1044 printk(KERN_WARNING MYNAM "(freeing %d frags)\n", numfrags); 1044 "-SG: No can do - " "Chain required! :-(\n", ioc->name);
1045 printk(MYIOC_s_WARN_FMT "(freeing %d frags)\n", ioc->name, numfrags);
1045 goto free_and_fail; 1046 goto free_and_fail;
1046 } 1047 }
1047 1048
1048 /* overflow check... */ 1049 /* overflow check... */
1049 if (numfrags*8 > MAX_SGL_BYTES){ 1050 if (numfrags*8 > MAX_SGL_BYTES){
1050 /* GRRRRR... */ 1051 /* GRRRRR... */
1051 printk(KERN_WARNING MYNAM "-SG: No can do - " 1052 printk(MYIOC_s_WARN_FMT "-SG: No can do - "
1052 "too many SG frags! :-(\n"); 1053 "too many SG frags! :-(\n", ioc->name);
1053 printk(KERN_WARNING MYNAM "-SG: (freeing %d frags)\n", 1054 printk(MYIOC_s_WARN_FMT "-SG: (freeing %d frags)\n",
1054 numfrags); 1055 ioc->name, numfrags);
1055 goto free_and_fail; 1056 goto free_and_fail;
1056 } 1057 }
1057 } 1058 }
@@ -1072,8 +1073,6 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
1072 1073
1073free_and_fail: 1074free_and_fail:
1074 if (sglbuf != NULL) { 1075 if (sglbuf != NULL) {
1075 int i;
1076
1077 for (i = 0; i < numfrags; i++) { 1076 for (i = 0; i < numfrags; i++) {
1078 dma_addr_t dma_addr; 1077 dma_addr_t dma_addr;
1079 u8 *kptr; 1078 u8 *kptr;
@@ -1195,13 +1194,13 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1195 1194
1196 karg = kmalloc(data_size, GFP_KERNEL); 1195 karg = kmalloc(data_size, GFP_KERNEL);
1197 if (karg == NULL) { 1196 if (karg == NULL) {
1198 printk(KERN_ERR "%s::mpt_ioctl_iocinfo() @%d - no memory available!\n", 1197 printk(KERN_ERR MYNAM "%s::mpt_ioctl_iocinfo() @%d - no memory available!\n",
1199 __FILE__, __LINE__); 1198 __FILE__, __LINE__);
1200 return -ENOMEM; 1199 return -ENOMEM;
1201 } 1200 }
1202 1201
1203 if (copy_from_user(karg, uarg, data_size)) { 1202 if (copy_from_user(karg, uarg, data_size)) {
1204 printk(KERN_ERR "%s@%d::mptctl_getiocinfo - " 1203 printk(KERN_ERR MYNAM "%s@%d::mptctl_getiocinfo - "
1205 "Unable to read in mpt_ioctl_iocinfo struct @ %p\n", 1204 "Unable to read in mpt_ioctl_iocinfo struct @ %p\n",
1206 __FILE__, __LINE__, uarg); 1205 __FILE__, __LINE__, uarg);
1207 kfree(karg); 1206 kfree(karg);
@@ -1210,7 +1209,7 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1210 1209
1211 if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) || 1210 if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) ||
1212 (ioc == NULL)) { 1211 (ioc == NULL)) {
1213 printk(KERN_DEBUG "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n", 1212 printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n",
1214 __FILE__, __LINE__, iocnum); 1213 __FILE__, __LINE__, iocnum);
1215 kfree(karg); 1214 kfree(karg);
1216 return -ENODEV; 1215 return -ENODEV;
@@ -1218,9 +1217,9 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1218 1217
1219 /* Verify the data transfer size is correct. */ 1218 /* Verify the data transfer size is correct. */
1220 if (karg->hdr.maxDataSize != data_size) { 1219 if (karg->hdr.maxDataSize != data_size) {
1221 printk(KERN_ERR "%s@%d::mptctl_getiocinfo - " 1220 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - "
1222 "Structure size mismatch. Command not completed.\n", 1221 "Structure size mismatch. Command not completed.\n",
1223 __FILE__, __LINE__); 1222 ioc->name, __FILE__, __LINE__);
1224 kfree(karg); 1223 kfree(karg);
1225 return -EFAULT; 1224 return -EFAULT;
1226 } 1225 }
@@ -1296,9 +1295,9 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1296 /* Copy the data from kernel memory to user memory 1295 /* Copy the data from kernel memory to user memory
1297 */ 1296 */
1298 if (copy_to_user((char __user *)arg, karg, data_size)) { 1297 if (copy_to_user((char __user *)arg, karg, data_size)) {
1299 printk(KERN_ERR "%s@%d::mptctl_getiocinfo - " 1298 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - "
1300 "Unable to write out mpt_ioctl_iocinfo struct @ %p\n", 1299 "Unable to write out mpt_ioctl_iocinfo struct @ %p\n",
1301 __FILE__, __LINE__, uarg); 1300 ioc->name, __FILE__, __LINE__, uarg);
1302 kfree(karg); 1301 kfree(karg);
1303 return -EFAULT; 1302 return -EFAULT;
1304 } 1303 }
@@ -1335,7 +1334,7 @@ mptctl_gettargetinfo (unsigned long arg)
1335 struct scsi_device *sdev; 1334 struct scsi_device *sdev;
1336 1335
1337 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_targetinfo))) { 1336 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_targetinfo))) {
1338 printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - " 1337 printk(KERN_ERR MYNAM "%s@%d::mptctl_gettargetinfo - "
1339 "Unable to read in mpt_ioctl_targetinfo struct @ %p\n", 1338 "Unable to read in mpt_ioctl_targetinfo struct @ %p\n",
1340 __FILE__, __LINE__, uarg); 1339 __FILE__, __LINE__, uarg);
1341 return -EFAULT; 1340 return -EFAULT;
@@ -1343,7 +1342,7 @@ mptctl_gettargetinfo (unsigned long arg)
1343 1342
1344 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1343 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1345 (ioc == NULL)) { 1344 (ioc == NULL)) {
1346 printk(KERN_DEBUG "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n", 1345 printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n",
1347 __FILE__, __LINE__, iocnum); 1346 __FILE__, __LINE__, iocnum);
1348 return -ENODEV; 1347 return -ENODEV;
1349 } 1348 }
@@ -1359,8 +1358,8 @@ mptctl_gettargetinfo (unsigned long arg)
1359 port = karg.hdr.port; 1358 port = karg.hdr.port;
1360 1359
1361 if (maxWordsLeft <= 0) { 1360 if (maxWordsLeft <= 0) {
1362 printk(KERN_ERR "%s::mptctl_gettargetinfo() @%d - no memory available!\n", 1361 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_gettargetinfo() - no memory available!\n",
1363 __FILE__, __LINE__); 1362 ioc->name, __FILE__, __LINE__);
1364 return -ENOMEM; 1363 return -ENOMEM;
1365 } 1364 }
1366 1365
@@ -1380,8 +1379,8 @@ mptctl_gettargetinfo (unsigned long arg)
1380 */ 1379 */
1381 pmem = kzalloc(numBytes, GFP_KERNEL); 1380 pmem = kzalloc(numBytes, GFP_KERNEL);
1382 if (!pmem) { 1381 if (!pmem) {
1383 printk(KERN_ERR "%s::mptctl_gettargetinfo() @%d - no memory available!\n", 1382 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_gettargetinfo() - no memory available!\n",
1384 __FILE__, __LINE__); 1383 ioc->name, __FILE__, __LINE__);
1385 return -ENOMEM; 1384 return -ENOMEM;
1386 } 1385 }
1387 pdata = (int *) pmem; 1386 pdata = (int *) pmem;
@@ -1410,9 +1409,9 @@ mptctl_gettargetinfo (unsigned long arg)
1410 */ 1409 */
1411 if (copy_to_user((char __user *)arg, &karg, 1410 if (copy_to_user((char __user *)arg, &karg,
1412 sizeof(struct mpt_ioctl_targetinfo))) { 1411 sizeof(struct mpt_ioctl_targetinfo))) {
1413 printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - " 1412 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_gettargetinfo - "
1414 "Unable to write out mpt_ioctl_targetinfo struct @ %p\n", 1413 "Unable to write out mpt_ioctl_targetinfo struct @ %p\n",
1415 __FILE__, __LINE__, uarg); 1414 ioc->name, __FILE__, __LINE__, uarg);
1416 kfree(pmem); 1415 kfree(pmem);
1417 return -EFAULT; 1416 return -EFAULT;
1418 } 1417 }
@@ -1420,9 +1419,9 @@ mptctl_gettargetinfo (unsigned long arg)
1420 /* Copy the remaining data from kernel memory to user memory 1419 /* Copy the remaining data from kernel memory to user memory
1421 */ 1420 */
1422 if (copy_to_user(uarg->targetInfo, pmem, numBytes)) { 1421 if (copy_to_user(uarg->targetInfo, pmem, numBytes)) {
1423 printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - " 1422 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_gettargetinfo - "
1424 "Unable to write out mpt_ioctl_targetinfo struct @ %p\n", 1423 "Unable to write out mpt_ioctl_targetinfo struct @ %p\n",
1425 __FILE__, __LINE__, pdata); 1424 ioc->name, __FILE__, __LINE__, pdata);
1426 kfree(pmem); 1425 kfree(pmem);
1427 return -EFAULT; 1426 return -EFAULT;
1428 } 1427 }
@@ -1449,7 +1448,7 @@ mptctl_readtest (unsigned long arg)
1449 int iocnum; 1448 int iocnum;
1450 1449
1451 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) { 1450 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) {
1452 printk(KERN_ERR "%s@%d::mptctl_readtest - " 1451 printk(KERN_ERR MYNAM "%s@%d::mptctl_readtest - "
1453 "Unable to read in mpt_ioctl_test struct @ %p\n", 1452 "Unable to read in mpt_ioctl_test struct @ %p\n",
1454 __FILE__, __LINE__, uarg); 1453 __FILE__, __LINE__, uarg);
1455 return -EFAULT; 1454 return -EFAULT;
@@ -1457,7 +1456,7 @@ mptctl_readtest (unsigned long arg)
1457 1456
1458 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1457 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1459 (ioc == NULL)) { 1458 (ioc == NULL)) {
1460 printk(KERN_DEBUG "%s::mptctl_readtest() @%d - ioc%d not found!\n", 1459 printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n",
1461 __FILE__, __LINE__, iocnum); 1460 __FILE__, __LINE__, iocnum);
1462 return -ENODEV; 1461 return -ENODEV;
1463 } 1462 }
@@ -1481,9 +1480,9 @@ mptctl_readtest (unsigned long arg)
1481 /* Copy the data from kernel memory to user memory 1480 /* Copy the data from kernel memory to user memory
1482 */ 1481 */
1483 if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_test))) { 1482 if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_test))) {
1484 printk(KERN_ERR "%s@%d::mptctl_readtest - " 1483 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_readtest - "
1485 "Unable to write out mpt_ioctl_test struct @ %p\n", 1484 "Unable to write out mpt_ioctl_test struct @ %p\n",
1486 __FILE__, __LINE__, uarg); 1485 ioc->name, __FILE__, __LINE__, uarg);
1487 return -EFAULT; 1486 return -EFAULT;
1488 } 1487 }
1489 1488
@@ -1510,7 +1509,7 @@ mptctl_eventquery (unsigned long arg)
1510 int iocnum; 1509 int iocnum;
1511 1510
1512 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) { 1511 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) {
1513 printk(KERN_ERR "%s@%d::mptctl_eventquery - " 1512 printk(KERN_ERR MYNAM "%s@%d::mptctl_eventquery - "
1514 "Unable to read in mpt_ioctl_eventquery struct @ %p\n", 1513 "Unable to read in mpt_ioctl_eventquery struct @ %p\n",
1515 __FILE__, __LINE__, uarg); 1514 __FILE__, __LINE__, uarg);
1516 return -EFAULT; 1515 return -EFAULT;
@@ -1518,7 +1517,7 @@ mptctl_eventquery (unsigned long arg)
1518 1517
1519 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1518 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1520 (ioc == NULL)) { 1519 (ioc == NULL)) {
1521 printk(KERN_DEBUG "%s::mptctl_eventquery() @%d - ioc%d not found!\n", 1520 printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n",
1522 __FILE__, __LINE__, iocnum); 1521 __FILE__, __LINE__, iocnum);
1523 return -ENODEV; 1522 return -ENODEV;
1524 } 1523 }
@@ -1531,9 +1530,9 @@ mptctl_eventquery (unsigned long arg)
1531 /* Copy the data from kernel memory to user memory 1530 /* Copy the data from kernel memory to user memory
1532 */ 1531 */
1533 if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_eventquery))) { 1532 if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_eventquery))) {
1534 printk(KERN_ERR "%s@%d::mptctl_eventquery - " 1533 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_eventquery - "
1535 "Unable to write out mpt_ioctl_eventquery struct @ %p\n", 1534 "Unable to write out mpt_ioctl_eventquery struct @ %p\n",
1536 __FILE__, __LINE__, uarg); 1535 ioc->name, __FILE__, __LINE__, uarg);
1537 return -EFAULT; 1536 return -EFAULT;
1538 } 1537 }
1539 return 0; 1538 return 0;
@@ -1549,7 +1548,7 @@ mptctl_eventenable (unsigned long arg)
1549 int iocnum; 1548 int iocnum;
1550 1549
1551 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) { 1550 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) {
1552 printk(KERN_ERR "%s@%d::mptctl_eventenable - " 1551 printk(KERN_ERR MYNAM "%s@%d::mptctl_eventenable - "
1553 "Unable to read in mpt_ioctl_eventenable struct @ %p\n", 1552 "Unable to read in mpt_ioctl_eventenable struct @ %p\n",
1554 __FILE__, __LINE__, uarg); 1553 __FILE__, __LINE__, uarg);
1555 return -EFAULT; 1554 return -EFAULT;
@@ -1557,7 +1556,7 @@ mptctl_eventenable (unsigned long arg)
1557 1556
1558 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1557 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1559 (ioc == NULL)) { 1558 (ioc == NULL)) {
1560 printk(KERN_DEBUG "%s::mptctl_eventenable() @%d - ioc%d not found!\n", 1559 printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n",
1561 __FILE__, __LINE__, iocnum); 1560 __FILE__, __LINE__, iocnum);
1562 return -ENODEV; 1561 return -ENODEV;
1563 } 1562 }
@@ -1570,7 +1569,9 @@ mptctl_eventenable (unsigned long arg)
1570 int sz = MPTCTL_EVENT_LOG_SIZE * sizeof(MPT_IOCTL_EVENTS); 1569 int sz = MPTCTL_EVENT_LOG_SIZE * sizeof(MPT_IOCTL_EVENTS);
1571 ioc->events = kzalloc(sz, GFP_KERNEL); 1570 ioc->events = kzalloc(sz, GFP_KERNEL);
1572 if (!ioc->events) { 1571 if (!ioc->events) {
1573 printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n"); 1572 printk(MYIOC_s_ERR_FMT
1573 ": ERROR - Insufficient memory to add adapter!\n",
1574 ioc->name);
1574 return -ENOMEM; 1575 return -ENOMEM;
1575 } 1576 }
1576 ioc->alloc_total += sz; 1577 ioc->alloc_total += sz;
@@ -1596,7 +1597,7 @@ mptctl_eventreport (unsigned long arg)
1596 int numBytes, maxEvents, max; 1597 int numBytes, maxEvents, max;
1597 1598
1598 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) { 1599 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) {
1599 printk(KERN_ERR "%s@%d::mptctl_eventreport - " 1600 printk(KERN_ERR MYNAM "%s@%d::mptctl_eventreport - "
1600 "Unable to read in mpt_ioctl_eventreport struct @ %p\n", 1601 "Unable to read in mpt_ioctl_eventreport struct @ %p\n",
1601 __FILE__, __LINE__, uarg); 1602 __FILE__, __LINE__, uarg);
1602 return -EFAULT; 1603 return -EFAULT;
@@ -1604,7 +1605,7 @@ mptctl_eventreport (unsigned long arg)
1604 1605
1605 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1606 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1606 (ioc == NULL)) { 1607 (ioc == NULL)) {
1607 printk(KERN_DEBUG "%s::mptctl_eventreport() @%d - ioc%d not found!\n", 1608 printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n",
1608 __FILE__, __LINE__, iocnum); 1609 __FILE__, __LINE__, iocnum);
1609 return -ENODEV; 1610 return -ENODEV;
1610 } 1611 }
@@ -1630,9 +1631,9 @@ mptctl_eventreport (unsigned long arg)
1630 */ 1631 */
1631 numBytes = max * sizeof(MPT_IOCTL_EVENTS); 1632 numBytes = max * sizeof(MPT_IOCTL_EVENTS);
1632 if (copy_to_user(uarg->eventData, ioc->events, numBytes)) { 1633 if (copy_to_user(uarg->eventData, ioc->events, numBytes)) {
1633 printk(KERN_ERR "%s@%d::mptctl_eventreport - " 1634 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_eventreport - "
1634 "Unable to write out mpt_ioctl_eventreport struct @ %p\n", 1635 "Unable to write out mpt_ioctl_eventreport struct @ %p\n",
1635 __FILE__, __LINE__, ioc->events); 1636 ioc->name, __FILE__, __LINE__, ioc->events);
1636 return -EFAULT; 1637 return -EFAULT;
1637 } 1638 }
1638 1639
@@ -1650,7 +1651,7 @@ mptctl_replace_fw (unsigned long arg)
1650 int newFwSize; 1651 int newFwSize;
1651 1652
1652 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) { 1653 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) {
1653 printk(KERN_ERR "%s@%d::mptctl_replace_fw - " 1654 printk(KERN_ERR MYNAM "%s@%d::mptctl_replace_fw - "
1654 "Unable to read in mpt_ioctl_replace_fw struct @ %p\n", 1655 "Unable to read in mpt_ioctl_replace_fw struct @ %p\n",
1655 __FILE__, __LINE__, uarg); 1656 __FILE__, __LINE__, uarg);
1656 return -EFAULT; 1657 return -EFAULT;
@@ -1658,7 +1659,7 @@ mptctl_replace_fw (unsigned long arg)
1658 1659
1659 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1660 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1660 (ioc == NULL)) { 1661 (ioc == NULL)) {
1661 printk(KERN_DEBUG "%s::mptctl_replace_fw() @%d - ioc%d not found!\n", 1662 printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n",
1662 __FILE__, __LINE__, iocnum); 1663 __FILE__, __LINE__, iocnum);
1663 return -ENODEV; 1664 return -ENODEV;
1664 } 1665 }
@@ -1688,9 +1689,9 @@ mptctl_replace_fw (unsigned long arg)
1688 /* Copy the data from user memory to kernel space 1689 /* Copy the data from user memory to kernel space
1689 */ 1690 */
1690 if (copy_from_user(ioc->cached_fw, uarg->newImage, newFwSize)) { 1691 if (copy_from_user(ioc->cached_fw, uarg->newImage, newFwSize)) {
1691 printk(KERN_ERR "%s@%d::mptctl_replace_fw - " 1692 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_replace_fw - "
1692 "Unable to read in mpt_ioctl_replace_fw image " 1693 "Unable to read in mpt_ioctl_replace_fw image "
1693 "@ %p\n", __FILE__, __LINE__, uarg); 1694 "@ %p\n", ioc->name, __FILE__, __LINE__, uarg);
1694 mpt_free_fw_memory(ioc); 1695 mpt_free_fw_memory(ioc);
1695 return -EFAULT; 1696 return -EFAULT;
1696 } 1697 }
@@ -1724,7 +1725,7 @@ mptctl_mpt_command (unsigned long arg)
1724 1725
1725 1726
1726 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_command))) { 1727 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_command))) {
1727 printk(KERN_ERR "%s@%d::mptctl_mpt_command - " 1728 printk(KERN_ERR MYNAM "%s@%d::mptctl_mpt_command - "
1728 "Unable to read in mpt_ioctl_command struct @ %p\n", 1729 "Unable to read in mpt_ioctl_command struct @ %p\n",
1729 __FILE__, __LINE__, uarg); 1730 __FILE__, __LINE__, uarg);
1730 return -EFAULT; 1731 return -EFAULT;
@@ -1732,7 +1733,7 @@ mptctl_mpt_command (unsigned long arg)
1732 1733
1733 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1734 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1734 (ioc == NULL)) { 1735 (ioc == NULL)) {
1735 printk(KERN_DEBUG "%s::mptctl_mpt_command() @%d - ioc%d not found!\n", 1736 printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n",
1736 __FILE__, __LINE__, iocnum); 1737 __FILE__, __LINE__, iocnum);
1737 return -ENODEV; 1738 return -ENODEV;
1738 } 1739 }
@@ -1777,17 +1778,17 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1777 1778
1778 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1779 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1779 (ioc == NULL)) { 1780 (ioc == NULL)) {
1780 printk(KERN_DEBUG "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n", 1781 printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n",
1781 __FILE__, __LINE__, iocnum); 1782 __FILE__, __LINE__, iocnum);
1782 return -ENODEV; 1783 return -ENODEV;
1783 } 1784 }
1784 if (!ioc->ioctl) { 1785 if (!ioc->ioctl) {
1785 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 1786 printk(KERN_ERR MYNAM "%s@%d::mptctl_do_mpt_command - "
1786 "No memory available during driver init.\n", 1787 "No memory available during driver init.\n",
1787 __FILE__, __LINE__); 1788 __FILE__, __LINE__);
1788 return -ENOMEM; 1789 return -ENOMEM;
1789 } else if (ioc->ioctl->status & MPT_IOCTL_STATUS_DID_IOCRESET) { 1790 } else if (ioc->ioctl->status & MPT_IOCTL_STATUS_DID_IOCRESET) {
1790 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 1791 printk(KERN_ERR MYNAM "%s@%d::mptctl_do_mpt_command - "
1791 "Busy with IOC Reset \n", __FILE__, __LINE__); 1792 "Busy with IOC Reset \n", __FILE__, __LINE__);
1792 return -EBUSY; 1793 return -EBUSY;
1793 } 1794 }
@@ -1801,9 +1802,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1801 sz += sizeof(dma_addr_t) + sizeof(u32); 1802 sz += sizeof(dma_addr_t) + sizeof(u32);
1802 1803
1803 if (sz > ioc->req_sz) { 1804 if (sz > ioc->req_sz) {
1804 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 1805 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
1805 "Request frame too large (%d) maximum (%d)\n", 1806 "Request frame too large (%d) maximum (%d)\n",
1806 __FILE__, __LINE__, sz, ioc->req_sz); 1807 ioc->name, __FILE__, __LINE__, sz, ioc->req_sz);
1807 return -EFAULT; 1808 return -EFAULT;
1808 } 1809 }
1809 1810
@@ -1821,9 +1822,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1821 * Request frame in user space 1822 * Request frame in user space
1822 */ 1823 */
1823 if (copy_from_user(mf, mfPtr, karg.dataSgeOffset * 4)) { 1824 if (copy_from_user(mf, mfPtr, karg.dataSgeOffset * 4)) {
1824 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 1825 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
1825 "Unable to read MF from mpt_ioctl_command struct @ %p\n", 1826 "Unable to read MF from mpt_ioctl_command struct @ %p\n",
1826 __FILE__, __LINE__, mfPtr); 1827 ioc->name, __FILE__, __LINE__, mfPtr);
1827 rc = -EFAULT; 1828 rc = -EFAULT;
1828 goto done_free_mem; 1829 goto done_free_mem;
1829 } 1830 }
@@ -1874,17 +1875,17 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1874 1875
1875 id = (ioc->devices_per_bus == 0) ? 256 : ioc->devices_per_bus; 1876 id = (ioc->devices_per_bus == 0) ? 256 : ioc->devices_per_bus;
1876 if (pScsiReq->TargetID > id) { 1877 if (pScsiReq->TargetID > id) {
1877 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 1878 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
1878 "Target ID out of bounds. \n", 1879 "Target ID out of bounds. \n",
1879 __FILE__, __LINE__); 1880 ioc->name, __FILE__, __LINE__);
1880 rc = -ENODEV; 1881 rc = -ENODEV;
1881 goto done_free_mem; 1882 goto done_free_mem;
1882 } 1883 }
1883 1884
1884 if (pScsiReq->Bus >= ioc->number_of_buses) { 1885 if (pScsiReq->Bus >= ioc->number_of_buses) {
1885 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 1886 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
1886 "Target Bus out of bounds. \n", 1887 "Target Bus out of bounds. \n",
1887 __FILE__, __LINE__); 1888 ioc->name, __FILE__, __LINE__);
1888 rc = -ENODEV; 1889 rc = -ENODEV;
1889 goto done_free_mem; 1890 goto done_free_mem;
1890 } 1891 }
@@ -1936,9 +1937,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1936 ioc->ioctl->id = pScsiReq->TargetID; 1937 ioc->ioctl->id = pScsiReq->TargetID;
1937 1938
1938 } else { 1939 } else {
1939 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 1940 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
1940 "SCSI driver is not loaded. \n", 1941 "SCSI driver is not loaded. \n",
1941 __FILE__, __LINE__); 1942 ioc->name, __FILE__, __LINE__);
1942 rc = -EFAULT; 1943 rc = -EFAULT;
1943 goto done_free_mem; 1944 goto done_free_mem;
1944 } 1945 }
@@ -1955,9 +1956,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1955 1956
1956 case MPI_FUNCTION_SATA_PASSTHROUGH: 1957 case MPI_FUNCTION_SATA_PASSTHROUGH:
1957 if (!ioc->sh) { 1958 if (!ioc->sh) {
1958 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 1959 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
1959 "SCSI driver is not loaded. \n", 1960 "SCSI driver is not loaded. \n",
1960 __FILE__, __LINE__); 1961 ioc->name, __FILE__, __LINE__);
1961 rc = -EFAULT; 1962 rc = -EFAULT;
1962 goto done_free_mem; 1963 goto done_free_mem;
1963 } 1964 }
@@ -2014,9 +2015,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2014 ioc->ioctl->reset = MPTCTL_RESET_OK; 2015 ioc->ioctl->reset = MPTCTL_RESET_OK;
2015 ioc->ioctl->id = pScsiReq->TargetID; 2016 ioc->ioctl->id = pScsiReq->TargetID;
2016 } else { 2017 } else {
2017 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 2018 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
2018 "SCSI driver is not loaded. \n", 2019 "SCSI driver is not loaded. \n",
2019 __FILE__, __LINE__); 2020 ioc->name, __FILE__, __LINE__);
2020 rc = -EFAULT; 2021 rc = -EFAULT;
2021 goto done_free_mem; 2022 goto done_free_mem;
2022 } 2023 }
@@ -2026,9 +2027,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2026 { 2027 {
2027 MPT_SCSI_HOST *hd = NULL; 2028 MPT_SCSI_HOST *hd = NULL;
2028 if ((ioc->sh == NULL) || ((hd = (MPT_SCSI_HOST *)ioc->sh->hostdata) == NULL)) { 2029 if ((ioc->sh == NULL) || ((hd = (MPT_SCSI_HOST *)ioc->sh->hostdata) == NULL)) {
2029 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 2030 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
2030 "SCSI driver not loaded or SCSI host not found. \n", 2031 "SCSI driver not loaded or SCSI host not found. \n",
2031 __FILE__, __LINE__); 2032 ioc->name, __FILE__, __LINE__);
2032 rc = -EFAULT; 2033 rc = -EFAULT;
2033 goto done_free_mem; 2034 goto done_free_mem;
2034 } else if (mptctl_set_tm_flags(hd) != 0) { 2035 } else if (mptctl_set_tm_flags(hd) != 0) {
@@ -2059,9 +2060,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2059 (pInit->ReplyFrameSize != cpu_to_le16(ioc->reply_sz)) || 2060 (pInit->ReplyFrameSize != cpu_to_le16(ioc->reply_sz)) ||
2060 (pInit->HostMfaHighAddr != high_addr) || 2061 (pInit->HostMfaHighAddr != high_addr) ||
2061 (pInit->SenseBufferHighAddr != sense_high)) { 2062 (pInit->SenseBufferHighAddr != sense_high)) {
2062 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 2063 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
2063 "IOC_INIT issued with 1 or more incorrect parameters. Rejected.\n", 2064 "IOC_INIT issued with 1 or more incorrect parameters. Rejected.\n",
2064 __FILE__, __LINE__); 2065 ioc->name, __FILE__, __LINE__);
2065 rc = -EFAULT; 2066 rc = -EFAULT;
2066 goto done_free_mem; 2067 goto done_free_mem;
2067 } 2068 }
@@ -2092,9 +2093,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2092 MPI_FUNCTION_LAN_RESET 2093 MPI_FUNCTION_LAN_RESET
2093 */ 2094 */
2094 2095
2095 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 2096 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
2096 "Illegal request (function 0x%x) \n", 2097 "Illegal request (function 0x%x) \n",
2097 __FILE__, __LINE__, hdr->Function); 2098 ioc->name, __FILE__, __LINE__, hdr->Function);
2098 rc = -EFAULT; 2099 rc = -EFAULT;
2099 goto done_free_mem; 2100 goto done_free_mem;
2100 } 2101 }
@@ -2151,11 +2152,11 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2151 if (copy_from_user(bufOut.kptr, 2152 if (copy_from_user(bufOut.kptr,
2152 karg.dataOutBufPtr, 2153 karg.dataOutBufPtr,
2153 bufOut.len)) { 2154 bufOut.len)) {
2154 printk(KERN_ERR 2155 printk(MYIOC_s_ERR_FMT
2155 "%s@%d::mptctl_do_mpt_command - Unable " 2156 "%s@%d::mptctl_do_mpt_command - Unable "
2156 "to read user data " 2157 "to read user data "
2157 "struct @ %p\n", 2158 "struct @ %p\n",
2158 __FILE__, __LINE__,karg.dataOutBufPtr); 2159 ioc->name, __FILE__, __LINE__,karg.dataOutBufPtr);
2159 rc = -EFAULT; 2160 rc = -EFAULT;
2160 goto done_free_mem; 2161 goto done_free_mem;
2161 } 2162 }
@@ -2242,10 +2243,10 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2242 if (sz > 0) { 2243 if (sz > 0) {
2243 if (copy_to_user(karg.replyFrameBufPtr, 2244 if (copy_to_user(karg.replyFrameBufPtr,
2244 &ioc->ioctl->ReplyFrame, sz)){ 2245 &ioc->ioctl->ReplyFrame, sz)){
2245 printk(KERN_ERR 2246 printk(MYIOC_s_ERR_FMT
2246 "%s@%d::mptctl_do_mpt_command - " 2247 "%s@%d::mptctl_do_mpt_command - "
2247 "Unable to write out reply frame %p\n", 2248 "Unable to write out reply frame %p\n",
2248 __FILE__, __LINE__, karg.replyFrameBufPtr); 2249 ioc->name, __FILE__, __LINE__, karg.replyFrameBufPtr);
2249 rc = -ENODATA; 2250 rc = -ENODATA;
2250 goto done_free_mem; 2251 goto done_free_mem;
2251 } 2252 }
@@ -2258,9 +2259,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2258 sz = min(karg.maxSenseBytes, MPT_SENSE_BUFFER_SIZE); 2259 sz = min(karg.maxSenseBytes, MPT_SENSE_BUFFER_SIZE);
2259 if (sz > 0) { 2260 if (sz > 0) {
2260 if (copy_to_user(karg.senseDataPtr, ioc->ioctl->sense, sz)) { 2261 if (copy_to_user(karg.senseDataPtr, ioc->ioctl->sense, sz)) {
2261 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 2262 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
2262 "Unable to write sense data to user %p\n", 2263 "Unable to write sense data to user %p\n",
2263 __FILE__, __LINE__, 2264 ioc->name, __FILE__, __LINE__,
2264 karg.senseDataPtr); 2265 karg.senseDataPtr);
2265 rc = -ENODATA; 2266 rc = -ENODATA;
2266 goto done_free_mem; 2267 goto done_free_mem;
@@ -2276,9 +2277,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2276 2277
2277 if (copy_to_user(karg.dataInBufPtr, 2278 if (copy_to_user(karg.dataInBufPtr,
2278 bufIn.kptr, karg.dataInSize)) { 2279 bufIn.kptr, karg.dataInSize)) {
2279 printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " 2280 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
2280 "Unable to write data to user %p\n", 2281 "Unable to write data to user %p\n",
2281 __FILE__, __LINE__, 2282 ioc->name, __FILE__, __LINE__,
2282 karg.dataInBufPtr); 2283 karg.dataInBufPtr);
2283 rc = -ENODATA; 2284 rc = -ENODATA;
2284 } 2285 }
@@ -2349,7 +2350,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2349 return -EFAULT; 2350 return -EFAULT;
2350 2351
2351 if (copy_from_user(&karg, uarg, sizeof(hp_host_info_t))) { 2352 if (copy_from_user(&karg, uarg, sizeof(hp_host_info_t))) {
2352 printk(KERN_ERR "%s@%d::mptctl_hp_host_info - " 2353 printk(KERN_ERR MYNAM "%s@%d::mptctl_hp_host_info - "
2353 "Unable to read in hp_host_info struct @ %p\n", 2354 "Unable to read in hp_host_info struct @ %p\n",
2354 __FILE__, __LINE__, uarg); 2355 __FILE__, __LINE__, uarg);
2355 return -EFAULT; 2356 return -EFAULT;
@@ -2357,7 +2358,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2357 2358
2358 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 2359 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2359 (ioc == NULL)) { 2360 (ioc == NULL)) {
2360 printk(KERN_DEBUG "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n", 2361 printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n",
2361 __FILE__, __LINE__, iocnum); 2362 __FILE__, __LINE__, iocnum);
2362 return -ENODEV; 2363 return -ENODEV;
2363 } 2364 }
@@ -2538,9 +2539,9 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2538 /* Copy the data from kernel memory to user memory 2539 /* Copy the data from kernel memory to user memory
2539 */ 2540 */
2540 if (copy_to_user((char __user *)arg, &karg, sizeof(hp_host_info_t))) { 2541 if (copy_to_user((char __user *)arg, &karg, sizeof(hp_host_info_t))) {
2541 printk(KERN_ERR "%s@%d::mptctl_hpgethostinfo - " 2542 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_hpgethostinfo - "
2542 "Unable to write out hp_host_info @ %p\n", 2543 "Unable to write out hp_host_info @ %p\n",
2543 __FILE__, __LINE__, uarg); 2544 ioc->name, __FILE__, __LINE__, uarg);
2544 return -EFAULT; 2545 return -EFAULT;
2545 } 2546 }
2546 2547
@@ -2576,7 +2577,7 @@ mptctl_hp_targetinfo(unsigned long arg)
2576 int tmp, np, rc = 0; 2577 int tmp, np, rc = 0;
2577 2578
2578 if (copy_from_user(&karg, uarg, sizeof(hp_target_info_t))) { 2579 if (copy_from_user(&karg, uarg, sizeof(hp_target_info_t))) {
2579 printk(KERN_ERR "%s@%d::mptctl_hp_targetinfo - " 2580 printk(KERN_ERR MYNAM "%s@%d::mptctl_hp_targetinfo - "
2580 "Unable to read in hp_host_targetinfo struct @ %p\n", 2581 "Unable to read in hp_host_targetinfo struct @ %p\n",
2581 __FILE__, __LINE__, uarg); 2582 __FILE__, __LINE__, uarg);
2582 return -EFAULT; 2583 return -EFAULT;
@@ -2584,11 +2585,11 @@ mptctl_hp_targetinfo(unsigned long arg)
2584 2585
2585 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 2586 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2586 (ioc == NULL)) { 2587 (ioc == NULL)) {
2587 printk(KERN_DEBUG "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n", 2588 printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n",
2588 __FILE__, __LINE__, iocnum); 2589 __FILE__, __LINE__, iocnum);
2589 return -ENODEV; 2590 return -ENODEV;
2590 } 2591 }
2591 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_targetinfo called.\n", 2592 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n",
2592 ioc->name)); 2593 ioc->name));
2593 2594
2594 /* There is nothing to do for FCP parts. 2595 /* There is nothing to do for FCP parts.
@@ -2689,9 +2690,9 @@ mptctl_hp_targetinfo(unsigned long arg)
2689 /* Copy the data from kernel memory to user memory 2690 /* Copy the data from kernel memory to user memory
2690 */ 2691 */
2691 if (copy_to_user((char __user *)arg, &karg, sizeof(hp_target_info_t))) { 2692 if (copy_to_user((char __user *)arg, &karg, sizeof(hp_target_info_t))) {
2692 printk(KERN_ERR "%s@%d::mptctl_hp_target_info - " 2693 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_hp_target_info - "
2693 "Unable to write out mpt_ioctl_targetinfo struct @ %p\n", 2694 "Unable to write out mpt_ioctl_targetinfo struct @ %p\n",
2694 __FILE__, __LINE__, uarg); 2695 ioc->name, __FILE__, __LINE__, uarg);
2695 return -EFAULT; 2696 return -EFAULT;
2696 } 2697 }
2697 2698
@@ -2741,7 +2742,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd,
2741 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) || 2742 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
2742 (iocp == NULL)) { 2743 (iocp == NULL)) {
2743 printk(KERN_DEBUG MYNAM "::compat_mptfwxfer_ioctl @%d - ioc%d not found!\n", 2744 printk(KERN_DEBUG MYNAM "::compat_mptfwxfer_ioctl @%d - ioc%d not found!\n",
2744 __LINE__, iocnumX); 2745 __LINE__, iocnumX);
2745 return -ENODEV; 2746 return -ENODEV;
2746 } 2747 }
2747 2748
@@ -2781,7 +2782,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
2781 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) || 2782 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
2782 (iocp == NULL)) { 2783 (iocp == NULL)) {
2783 printk(KERN_DEBUG MYNAM "::compat_mpt_command @%d - ioc%d not found!\n", 2784 printk(KERN_DEBUG MYNAM "::compat_mpt_command @%d - ioc%d not found!\n",
2784 __LINE__, iocnumX); 2785 __LINE__, iocnumX);
2785 return -ENODEV; 2786 return -ENODEV;
2786 } 2787 }
2787 2788