aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ch.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ch.c')
-rw-r--r--drivers/scsi/ch.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index ccbbae2bf478..c3f27285db1b 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -20,9 +20,9 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/blkdev.h> 21#include <linux/blkdev.h>
22#include <linux/completion.h> 22#include <linux/completion.h>
23#include <linux/ioctl32.h>
24#include <linux/compat.h> 23#include <linux/compat.h>
25#include <linux/chio.h> /* here are all the ioctls */ 24#include <linux/chio.h> /* here are all the ioctls */
25#include <linux/mutex.h>
26 26
27#include <scsi/scsi.h> 27#include <scsi/scsi.h>
28#include <scsi/scsi_cmnd.h> 28#include <scsi/scsi_cmnd.h>
@@ -75,7 +75,7 @@ static int vendor_counts[CH_TYPES-4];
75module_param_array(vendor_firsts, int, NULL, 0444); 75module_param_array(vendor_firsts, int, NULL, 0444);
76module_param_array(vendor_counts, int, NULL, 0444); 76module_param_array(vendor_counts, int, NULL, 0444);
77 77
78static char *vendor_labels[CH_TYPES-4] = { 78static const char * vendor_labels[CH_TYPES-4] = {
79 "v0", "v1", "v2", "v3" 79 "v0", "v1", "v2", "v3"
80}; 80};
81// module_param_string_array(vendor_labels, NULL, 0444); 81// module_param_string_array(vendor_labels, NULL, 0444);
@@ -112,7 +112,7 @@ typedef struct {
112 u_int counts[CH_TYPES]; 112 u_int counts[CH_TYPES];
113 u_int unit_attention; 113 u_int unit_attention;
114 u_int voltags; 114 u_int voltags;
115 struct semaphore lock; 115 struct mutex lock;
116} scsi_changer; 116} scsi_changer;
117 117
118static LIST_HEAD(ch_devlist); 118static LIST_HEAD(ch_devlist);
@@ -140,7 +140,7 @@ static struct file_operations changer_fops =
140#endif 140#endif
141}; 141};
142 142
143static struct { 143static const struct {
144 unsigned char sense; 144 unsigned char sense;
145 unsigned char asc; 145 unsigned char asc;
146 unsigned char ascq; 146 unsigned char ascq;
@@ -566,7 +566,7 @@ static int ch_gstatus(scsi_changer *ch, int type, unsigned char __user *dest)
566 u_char data[16]; 566 u_char data[16];
567 unsigned int i; 567 unsigned int i;
568 568
569 down(&ch->lock); 569 mutex_lock(&ch->lock);
570 for (i = 0; i < ch->counts[type]; i++) { 570 for (i = 0; i < ch->counts[type]; i++) {
571 if (0 != ch_read_element_status 571 if (0 != ch_read_element_status
572 (ch, ch->firsts[type]+i,data)) { 572 (ch, ch->firsts[type]+i,data)) {
@@ -583,7 +583,7 @@ static int ch_gstatus(scsi_changer *ch, int type, unsigned char __user *dest)
583 if (0 != retval) 583 if (0 != retval)
584 break; 584 break;
585 } 585 }
586 up(&ch->lock); 586 mutex_unlock(&ch->lock);
587 return retval; 587 return retval;
588} 588}
589 589
@@ -688,11 +688,11 @@ static int ch_ioctl(struct inode * inode, struct file * file,
688 dprintk("CHIOPOSITION: invalid parameter\n"); 688 dprintk("CHIOPOSITION: invalid parameter\n");
689 return -EBADSLT; 689 return -EBADSLT;
690 } 690 }
691 down(&ch->lock); 691 mutex_lock(&ch->lock);
692 retval = ch_position(ch,0, 692 retval = ch_position(ch,0,
693 ch->firsts[pos.cp_type] + pos.cp_unit, 693 ch->firsts[pos.cp_type] + pos.cp_unit,
694 pos.cp_flags & CP_INVERT); 694 pos.cp_flags & CP_INVERT);
695 up(&ch->lock); 695 mutex_unlock(&ch->lock);
696 return retval; 696 return retval;
697 } 697 }
698 698
@@ -709,12 +709,12 @@ static int ch_ioctl(struct inode * inode, struct file * file,
709 return -EBADSLT; 709 return -EBADSLT;
710 } 710 }
711 711
712 down(&ch->lock); 712 mutex_lock(&ch->lock);
713 retval = ch_move(ch,0, 713 retval = ch_move(ch,0,
714 ch->firsts[mv.cm_fromtype] + mv.cm_fromunit, 714 ch->firsts[mv.cm_fromtype] + mv.cm_fromunit,
715 ch->firsts[mv.cm_totype] + mv.cm_tounit, 715 ch->firsts[mv.cm_totype] + mv.cm_tounit,
716 mv.cm_flags & CM_INVERT); 716 mv.cm_flags & CM_INVERT);
717 up(&ch->lock); 717 mutex_unlock(&ch->lock);
718 return retval; 718 return retval;
719 } 719 }
720 720
@@ -732,14 +732,14 @@ static int ch_ioctl(struct inode * inode, struct file * file,
732 return -EBADSLT; 732 return -EBADSLT;
733 } 733 }
734 734
735 down(&ch->lock); 735 mutex_lock(&ch->lock);
736 retval = ch_exchange 736 retval = ch_exchange
737 (ch,0, 737 (ch,0,
738 ch->firsts[mv.ce_srctype] + mv.ce_srcunit, 738 ch->firsts[mv.ce_srctype] + mv.ce_srcunit,
739 ch->firsts[mv.ce_fdsttype] + mv.ce_fdstunit, 739 ch->firsts[mv.ce_fdsttype] + mv.ce_fdstunit,
740 ch->firsts[mv.ce_sdsttype] + mv.ce_sdstunit, 740 ch->firsts[mv.ce_sdsttype] + mv.ce_sdstunit,
741 mv.ce_flags & CE_INVERT1, mv.ce_flags & CE_INVERT2); 741 mv.ce_flags & CE_INVERT1, mv.ce_flags & CE_INVERT2);
742 up(&ch->lock); 742 mutex_unlock(&ch->lock);
743 return retval; 743 return retval;
744 } 744 }
745 745
@@ -773,7 +773,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
773 buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); 773 buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
774 if (!buffer) 774 if (!buffer)
775 return -ENOMEM; 775 return -ENOMEM;
776 down(&ch->lock); 776 mutex_lock(&ch->lock);
777 777
778 voltag_retry: 778 voltag_retry:
779 memset(cmd,0,sizeof(cmd)); 779 memset(cmd,0,sizeof(cmd));
@@ -824,7 +824,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
824 goto voltag_retry; 824 goto voltag_retry;
825 } 825 }
826 kfree(buffer); 826 kfree(buffer);
827 up(&ch->lock); 827 mutex_unlock(&ch->lock);
828 828
829 if (copy_to_user(argp, &cge, sizeof (cge))) 829 if (copy_to_user(argp, &cge, sizeof (cge)))
830 return -EFAULT; 830 return -EFAULT;
@@ -833,9 +833,9 @@ static int ch_ioctl(struct inode * inode, struct file * file,
833 833
834 case CHIOINITELEM: 834 case CHIOINITELEM:
835 { 835 {
836 down(&ch->lock); 836 mutex_lock(&ch->lock);
837 retval = ch_init_elem(ch); 837 retval = ch_init_elem(ch);
838 up(&ch->lock); 838 mutex_unlock(&ch->lock);
839 return retval; 839 return retval;
840 } 840 }
841 841
@@ -852,12 +852,12 @@ static int ch_ioctl(struct inode * inode, struct file * file,
852 return -EBADSLT; 852 return -EBADSLT;
853 } 853 }
854 elem = ch->firsts[csv.csv_type] + csv.csv_unit; 854 elem = ch->firsts[csv.csv_type] + csv.csv_unit;
855 down(&ch->lock); 855 mutex_lock(&ch->lock);
856 retval = ch_set_voltag(ch, elem, 856 retval = ch_set_voltag(ch, elem,
857 csv.csv_flags & CSV_AVOLTAG, 857 csv.csv_flags & CSV_AVOLTAG,
858 csv.csv_flags & CSV_CLEARTAG, 858 csv.csv_flags & CSV_CLEARTAG,
859 csv.csv_voltag); 859 csv.csv_voltag);
860 up(&ch->lock); 860 mutex_unlock(&ch->lock);
861 return retval; 861 return retval;
862 } 862 }
863 863
@@ -930,7 +930,7 @@ static int ch_probe(struct device *dev)
930 memset(ch,0,sizeof(*ch)); 930 memset(ch,0,sizeof(*ch));
931 ch->minor = ch_devcount; 931 ch->minor = ch_devcount;
932 sprintf(ch->name,"ch%d",ch->minor); 932 sprintf(ch->name,"ch%d",ch->minor);
933 init_MUTEX(&ch->lock); 933 mutex_init(&ch->lock);
934 ch->device = sd; 934 ch->device = sd;
935 ch_readconfig(ch); 935 ch_readconfig(ch);
936 if (init) 936 if (init)