aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/gdth_proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/gdth_proc.c')
-rw-r--r--drivers/scsi/gdth_proc.c59
1 files changed, 34 insertions, 25 deletions
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
index 1258da34fbc2..652754319a4b 100644
--- a/drivers/scsi/gdth_proc.c
+++ b/drivers/scsi/gdth_proc.c
@@ -3,6 +3,7 @@
3 */ 3 */
4 4
5#include <linux/completion.h> 5#include <linux/completion.h>
6#include <linux/slab.h>
6 7
7int gdth_proc_info(struct Scsi_Host *host, char *buffer,char **start,off_t offset,int length, 8int gdth_proc_info(struct Scsi_Host *host, char *buffer,char **start,off_t offset,int length,
8 int inout) 9 int inout)
@@ -43,7 +44,7 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer,
43 int i, found; 44 int i, found;
44 gdth_cmd_str gdtcmd; 45 gdth_cmd_str gdtcmd;
45 gdth_cpar_str *pcpar; 46 gdth_cpar_str *pcpar;
46 ulong64 paddr; 47 u64 paddr;
47 48
48 char cmnd[MAX_COMMAND_SIZE]; 49 char cmnd[MAX_COMMAND_SIZE];
49 memset(cmnd, 0xff, 12); 50 memset(cmnd, 0xff, 12);
@@ -156,8 +157,8 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
156 off_t begin = 0,pos = 0; 157 off_t begin = 0,pos = 0;
157 int id, i, j, k, sec, flag; 158 int id, i, j, k, sec, flag;
158 int no_mdrv = 0, drv_no, is_mirr; 159 int no_mdrv = 0, drv_no, is_mirr;
159 ulong32 cnt; 160 u32 cnt;
160 ulong64 paddr; 161 u64 paddr;
161 int rc = -ENOMEM; 162 int rc = -ENOMEM;
162 163
163 gdth_cmd_str *gdtcmd; 164 gdth_cmd_str *gdtcmd;
@@ -220,14 +221,14 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
220 221
221 if (ha->more_proc) 222 if (ha->more_proc)
222 sprintf(hrec, "%d.%02d.%02d-%c%03X", 223 sprintf(hrec, "%d.%02d.%02d-%c%03X",
223 (unchar)(ha->binfo.upd_fw_ver>>24), 224 (u8)(ha->binfo.upd_fw_ver>>24),
224 (unchar)(ha->binfo.upd_fw_ver>>16), 225 (u8)(ha->binfo.upd_fw_ver>>16),
225 (unchar)(ha->binfo.upd_fw_ver), 226 (u8)(ha->binfo.upd_fw_ver),
226 ha->bfeat.raid ? 'R':'N', 227 ha->bfeat.raid ? 'R':'N',
227 ha->binfo.upd_revision); 228 ha->binfo.upd_revision);
228 else 229 else
229 sprintf(hrec, "%d.%02d", (unchar)(ha->cpar.version>>8), 230 sprintf(hrec, "%d.%02d", (u8)(ha->cpar.version>>8),
230 (unchar)(ha->cpar.version)); 231 (u8)(ha->cpar.version));
231 232
232 size = sprintf(buffer+len, 233 size = sprintf(buffer+len,
233 " Driver Ver.: \t%-10s\tFirmware Ver.: \t%s\n", 234 " Driver Ver.: \t%-10s\tFirmware Ver.: \t%s\n",
@@ -281,7 +282,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
281 pds->bid = ha->raw[i].local_no; 282 pds->bid = ha->raw[i].local_no;
282 pds->first = 0; 283 pds->first = 0;
283 pds->entries = ha->raw[i].pdev_cnt; 284 pds->entries = ha->raw[i].pdev_cnt;
284 cnt = (3*GDTH_SCRATCH/4 - 5 * sizeof(ulong32)) / 285 cnt = (3*GDTH_SCRATCH/4 - 5 * sizeof(u32)) /
285 sizeof(pds->list[0]); 286 sizeof(pds->list[0]);
286 if (pds->entries > cnt) 287 if (pds->entries > cnt)
287 pds->entries = cnt; 288 pds->entries = cnt;
@@ -364,8 +365,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
364 len = 0; 365 len = 0;
365 begin = pos; 366 begin = pos;
366 } 367 }
367 if (pos > offset + length) 368 if (pos > offset + length) {
369 gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
368 goto stop_output; 370 goto stop_output;
371 }
369 } 372 }
370 } 373 }
371 gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); 374 gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
@@ -449,8 +452,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
449 len = 0; 452 len = 0;
450 begin = pos; 453 begin = pos;
451 } 454 }
452 if (pos > offset + length) 455 if (pos > offset + length) {
456 gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
453 goto stop_output; 457 goto stop_output;
458 }
454 } while (drv_no != -1); 459 } while (drv_no != -1);
455 460
456 if (is_mirr) { 461 if (is_mirr) {
@@ -471,8 +476,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
471 len = 0; 476 len = 0;
472 begin = pos; 477 begin = pos;
473 } 478 }
474 if (pos > offset + length) 479 if (pos > offset + length) {
480 gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
475 goto stop_output; 481 goto stop_output;
482 }
476 } 483 }
477 gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); 484 gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
478 485
@@ -541,8 +548,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
541 len = 0; 548 len = 0;
542 begin = pos; 549 begin = pos;
543 } 550 }
544 if (pos > offset + length) 551 if (pos > offset + length) {
552 gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
545 goto stop_output; 553 goto stop_output;
554 }
546 } 555 }
547 } 556 }
548 gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); 557 gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
@@ -604,7 +613,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
604 613
605 size = sprintf(buffer+len, 614 size = sprintf(buffer+len,
606 " Capacity [MB]:\t%-6d \tStart Sector: \t%d\n", 615 " Capacity [MB]:\t%-6d \tStart Sector: \t%d\n",
607 (ulong32)(ha->hdr[i].size/2048), ha->hdr[i].start_sec); 616 (u32)(ha->hdr[i].size/2048), ha->hdr[i].start_sec);
608 len += size; pos = begin + len; 617 len += size; pos = begin + len;
609 if (pos < offset) { 618 if (pos < offset) {
610 len = 0; 619 len = 0;
@@ -664,9 +673,9 @@ free_fail:
664} 673}
665 674
666static char *gdth_ioctl_alloc(gdth_ha_str *ha, int size, int scratch, 675static char *gdth_ioctl_alloc(gdth_ha_str *ha, int size, int scratch,
667 ulong64 *paddr) 676 u64 *paddr)
668{ 677{
669 ulong flags; 678 unsigned long flags;
670 char *ret_val; 679 char *ret_val;
671 680
672 if (size == 0) 681 if (size == 0)
@@ -691,9 +700,9 @@ static char *gdth_ioctl_alloc(gdth_ha_str *ha, int size, int scratch,
691 return ret_val; 700 return ret_val;
692} 701}
693 702
694static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, ulong64 paddr) 703static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, u64 paddr)
695{ 704{
696 ulong flags; 705 unsigned long flags;
697 706
698 if (buf == ha->pscratch) { 707 if (buf == ha->pscratch) {
699 spin_lock_irqsave(&ha->smp_lock, flags); 708 spin_lock_irqsave(&ha->smp_lock, flags);
@@ -705,16 +714,16 @@ static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, ulong64 paddr)
705} 714}
706 715
707#ifdef GDTH_IOCTL_PROC 716#ifdef GDTH_IOCTL_PROC
708static int gdth_ioctl_check_bin(gdth_ha_str *ha, ushort size) 717static int gdth_ioctl_check_bin(gdth_ha_str *ha, u16 size)
709{ 718{
710 ulong flags; 719 unsigned long flags;
711 int ret_val; 720 int ret_val;
712 721
713 spin_lock_irqsave(&ha->smp_lock, flags); 722 spin_lock_irqsave(&ha->smp_lock, flags);
714 723
715 ret_val = FALSE; 724 ret_val = FALSE;
716 if (ha->scratch_busy) { 725 if (ha->scratch_busy) {
717 if (((gdth_iord_str *)ha->pscratch)->size == (ulong32)size) 726 if (((gdth_iord_str *)ha->pscratch)->size == (u32)size)
718 ret_val = TRUE; 727 ret_val = TRUE;
719 } 728 }
720 spin_unlock_irqrestore(&ha->smp_lock, flags); 729 spin_unlock_irqrestore(&ha->smp_lock, flags);
@@ -724,11 +733,11 @@ static int gdth_ioctl_check_bin(gdth_ha_str *ha, ushort size)
724 733
725static void gdth_wait_completion(gdth_ha_str *ha, int busnum, int id) 734static void gdth_wait_completion(gdth_ha_str *ha, int busnum, int id)
726{ 735{
727 ulong flags; 736 unsigned long flags;
728 int i; 737 int i;
729 Scsi_Cmnd *scp; 738 Scsi_Cmnd *scp;
730 struct gdth_cmndinfo *cmndinfo; 739 struct gdth_cmndinfo *cmndinfo;
731 unchar b, t; 740 u8 b, t;
732 741
733 spin_lock_irqsave(&ha->smp_lock, flags); 742 spin_lock_irqsave(&ha->smp_lock, flags);
734 743
@@ -738,8 +747,8 @@ static void gdth_wait_completion(gdth_ha_str *ha, int busnum, int id)
738 747
739 b = scp->device->channel; 748 b = scp->device->channel;
740 t = scp->device->id; 749 t = scp->device->id;
741 if (!SPECIAL_SCP(scp) && t == (unchar)id && 750 if (!SPECIAL_SCP(scp) && t == (u8)id &&
742 b == (unchar)busnum) { 751 b == (u8)busnum) {
743 cmndinfo->wait_for_completion = 0; 752 cmndinfo->wait_for_completion = 0;
744 spin_unlock_irqrestore(&ha->smp_lock, flags); 753 spin_unlock_irqrestore(&ha->smp_lock, flags);
745 while (!cmndinfo->wait_for_completion) 754 while (!cmndinfo->wait_for_completion)