]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/sg.c
[PATCH] usb-storage: Readd missing SDDR-05b unusual_devs entry
[linux-2.6-omap-h63xx.git] / drivers / scsi / sg.c
index e822ca0e97cf441ca7ea407266dec3a8aee132f9..861e51375d70c541609105548e25d507df7f00fc 100644 (file)
@@ -61,7 +61,7 @@ static int sg_version_num = 30533;    /* 2 digits for each component */
 
 #ifdef CONFIG_SCSI_PROC_FS
 #include <linux/proc_fs.h>
-static char *sg_version_date = "20050328";
+static char *sg_version_date = "20050908";
 
 static int sg_proc_init(void);
 static void sg_proc_cleanup(void);
@@ -104,8 +104,8 @@ static int sg_allow_dio = SG_ALLOW_DIO_DEF;
 
 #define SG_DEV_ARR_LUMP 32     /* amount to over allocate sg_dev_arr by */
 
-static int sg_add(struct class_device *);
-static void sg_remove(struct class_device *);
+static int sg_add(struct class_device *, struct class_interface *);
+static void sg_remove(struct class_device *, struct class_interface *);
 
 static Scsi_Request *dummy_cmdp;       /* only used for sizeof */
 
@@ -1027,8 +1027,7 @@ sg_ioctl(struct inode *inode, struct file *filp,
                if (sdp->detached)
                        return -ENODEV;
                if (filp->f_flags & O_NONBLOCK) {
-                       if (test_bit(SHOST_RECOVERY,
-                                    &sdp->device->host->shost_state))
+                       if (scsi_host_in_recovery(sdp->device->host))
                                return -EBUSY;
                } else if (!scsi_block_when_processing_errors(sdp->device))
                        return -EBUSY;
@@ -1300,7 +1299,7 @@ sg_mmap(struct file *filp, struct vm_area_struct *vma)
                sg_rb_correct4mmap(rsv_schp, 1);        /* do only once per fd lifetime */
                sfp->mmap_called = 1;
        }
-       vma->vm_flags |= (VM_RESERVED | VM_IO);
+       vma->vm_flags |= VM_RESERVED;
        vma->vm_private_data = sfp;
        vma->vm_ops = &sg_mmap_vm_ops;
        return 0;
@@ -1507,7 +1506,7 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
 }
 
 static int
-sg_add(struct class_device *cl_dev)
+sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
 {
        struct scsi_device *scsidp = to_scsi_device(cl_dev->dev);
        struct gendisk *disk;
@@ -1551,7 +1550,7 @@ sg_add(struct class_device *cl_dev)
        if (sg_sysfs_valid) {
                struct class_device * sg_class_member;
 
-               sg_class_member = class_device_create(sg_sysfs_class,
+               sg_class_member = class_device_create(sg_sysfs_class, NULL,
                                MKDEV(SCSI_GENERIC_MAJOR, k), 
                                cl_dev->dev, "%s", 
                                disk->disk_name);
@@ -1583,7 +1582,7 @@ out:
 }
 
 static void
-sg_remove(struct class_device *cl_dev)
+sg_remove(struct class_device *cl_dev, struct class_interface *cl_intf)
 {
        struct scsi_device *scsidp = to_scsi_device(cl_dev->dev);
        Sg_device *sdp = NULL;
@@ -1795,12 +1794,12 @@ st_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages,
                  unsigned long uaddr, size_t count, int rw,
                  unsigned long max_pfn)
 {
+       unsigned long end = (uaddr + count + PAGE_SIZE - 1) >> PAGE_SHIFT;
+       unsigned long start = uaddr >> PAGE_SHIFT;
+       const int nr_pages = end - start;
        int res, i, j;
-       unsigned int nr_pages;
        struct page **pages;
 
-       nr_pages = ((uaddr & ~PAGE_MASK) + count + ~PAGE_MASK) >> PAGE_SHIFT;
-
        /* User attempted Overflow! */
        if ((uaddr + count) < uaddr)
                return -EINVAL;
@@ -2645,7 +2644,7 @@ static char *
 sg_page_malloc(int rqSz, int lowDma, int *retSzp)
 {
        char *resp = NULL;
-       int page_mask;
+       gfp_t page_mask;
        int order, a_size;
        int resSz = rqSz;
 
@@ -2850,8 +2849,7 @@ sg_proc_init(void)
        struct proc_dir_entry *pdep;
        struct sg_proc_leaf * leaf;
 
-       sg_proc_sgp = create_proc_entry(sg_proc_sg_dirname,
-                                       S_IFDIR | S_IRUGO | S_IXUGO, NULL);
+       sg_proc_sgp = proc_mkdir(sg_proc_sg_dirname, NULL);
        if (!sg_proc_sgp)
                return 1;
        for (k = 0; k < num_leaves; ++k) {