X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=drivers%2Fscsi%2Fch.c;h=f6caa43077680b3a87d1621e3006f40883a1eb35;hb=23e735bc7b0e1d614656881794257b4224efda3a;hp=4299fabca5547469dc9fe59aee9f04c4c48fd529;hpb=bf785ee0aeea7a3e717cb1e11df4135b6cbde7da;p=linux-2.6-omap-h63xx.git diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 4299fabca55..f6caa430776 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -7,7 +7,6 @@ #define VERSION "0.25" -#include #include #include #include @@ -22,6 +21,7 @@ #include #include #include /* here are all the ioctls */ +#include #include #include @@ -38,6 +38,7 @@ MODULE_DESCRIPTION("device driver for scsi media changer devices"); MODULE_AUTHOR("Gerd Knorr "); MODULE_LICENSE("GPL"); +MODULE_ALIAS_CHARDEV_MAJOR(SCSI_CHANGER_MAJOR); static int init = 1; module_param(init, int, 0444); @@ -111,7 +112,7 @@ typedef struct { u_int counts[CH_TYPES]; u_int unit_attention; u_int voltags; - struct semaphore lock; + struct mutex lock; } scsi_changer; static LIST_HEAD(ch_devlist); @@ -565,7 +566,7 @@ static int ch_gstatus(scsi_changer *ch, int type, unsigned char __user *dest) u_char data[16]; unsigned int i; - down(&ch->lock); + mutex_lock(&ch->lock); for (i = 0; i < ch->counts[type]; i++) { if (0 != ch_read_element_status (ch, ch->firsts[type]+i,data)) { @@ -582,7 +583,7 @@ static int ch_gstatus(scsi_changer *ch, int type, unsigned char __user *dest) if (0 != retval) break; } - up(&ch->lock); + mutex_unlock(&ch->lock); return retval; } @@ -687,11 +688,11 @@ static int ch_ioctl(struct inode * inode, struct file * file, dprintk("CHIOPOSITION: invalid parameter\n"); return -EBADSLT; } - down(&ch->lock); + mutex_lock(&ch->lock); retval = ch_position(ch,0, ch->firsts[pos.cp_type] + pos.cp_unit, pos.cp_flags & CP_INVERT); - up(&ch->lock); + mutex_unlock(&ch->lock); return retval; } @@ -708,12 +709,12 @@ static int ch_ioctl(struct inode * inode, struct file * file, return -EBADSLT; } - down(&ch->lock); + mutex_lock(&ch->lock); retval = ch_move(ch,0, ch->firsts[mv.cm_fromtype] + mv.cm_fromunit, ch->firsts[mv.cm_totype] + mv.cm_tounit, mv.cm_flags & CM_INVERT); - up(&ch->lock); + mutex_unlock(&ch->lock); return retval; } @@ -731,14 +732,14 @@ static int ch_ioctl(struct inode * inode, struct file * file, return -EBADSLT; } - down(&ch->lock); + mutex_lock(&ch->lock); retval = ch_exchange (ch,0, ch->firsts[mv.ce_srctype] + mv.ce_srcunit, ch->firsts[mv.ce_fdsttype] + mv.ce_fdstunit, ch->firsts[mv.ce_sdsttype] + mv.ce_sdstunit, mv.ce_flags & CE_INVERT1, mv.ce_flags & CE_INVERT2); - up(&ch->lock); + mutex_unlock(&ch->lock); return retval; } @@ -772,7 +773,7 @@ static int ch_ioctl(struct inode * inode, struct file * file, buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); if (!buffer) return -ENOMEM; - down(&ch->lock); + mutex_lock(&ch->lock); voltag_retry: memset(cmd,0,sizeof(cmd)); @@ -823,7 +824,7 @@ static int ch_ioctl(struct inode * inode, struct file * file, goto voltag_retry; } kfree(buffer); - up(&ch->lock); + mutex_unlock(&ch->lock); if (copy_to_user(argp, &cge, sizeof (cge))) return -EFAULT; @@ -832,9 +833,9 @@ static int ch_ioctl(struct inode * inode, struct file * file, case CHIOINITELEM: { - down(&ch->lock); + mutex_lock(&ch->lock); retval = ch_init_elem(ch); - up(&ch->lock); + mutex_unlock(&ch->lock); return retval; } @@ -851,12 +852,12 @@ static int ch_ioctl(struct inode * inode, struct file * file, return -EBADSLT; } elem = ch->firsts[csv.csv_type] + csv.csv_unit; - down(&ch->lock); + mutex_lock(&ch->lock); retval = ch_set_voltag(ch, elem, csv.csv_flags & CSV_AVOLTAG, csv.csv_flags & CSV_CLEARTAG, csv.csv_voltag); - up(&ch->lock); + mutex_unlock(&ch->lock); return retval; } @@ -929,7 +930,7 @@ static int ch_probe(struct device *dev) memset(ch,0,sizeof(*ch)); ch->minor = ch_devcount; sprintf(ch->name,"ch%d",ch->minor); - init_MUTEX(&ch->lock); + mutex_init(&ch->lock); ch->device = sd; ch_readconfig(ch); if (init)