Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / drivers / scsi / sg.c
index 34f9343..b098942 100644 (file)
@@ -18,8 +18,8 @@
  *
  */
 
-static int sg_version_num = 30534;     /* 2 digits for each component */
-#define SG_VERSION_STR "3.5.34"
+static int sg_version_num = 30533;     /* 2 digits for each component */
+#define SG_VERSION_STR "3.5.33"
 
 /*
  *  D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes:
@@ -28,6 +28,7 @@ static int sg_version_num = 30534;    /* 2 digits for each component */
  *        (otherwise the macros compile to empty statements).
  *
  */
+#include <linux/config.h>
 #include <linux/module.h>
 
 #include <linux/fs.h>
@@ -60,7 +61,7 @@ static int sg_version_num = 30534;    /* 2 digits for each component */
 
 #ifdef CONFIG_SCSI_PROC_FS
 #include <linux/proc_fs.h>
-static char *sg_version_date = "20060818";
+static char *sg_version_date = "20050908";
 
 static int sg_proc_init(void);
 static void sg_proc_cleanup(void);
@@ -1164,7 +1165,7 @@ sg_vma_nopage(struct vm_area_struct *vma, unsigned long addr, int *type)
                len = vma->vm_end - sa;
                len = (len < sg->length) ? len : sg->length;
                if (offset < len) {
-                       page = virt_to_page(page_address(sg->page) + offset);
+                       page = sg->page;
                        get_page(page); /* increment page count */
                        break;
                }
@@ -1401,7 +1402,6 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
        Sg_device *sdp = NULL;
        struct cdev * cdev = NULL;
        int error, k;
-       unsigned long iflags;
 
        disk = alloc_disk(1);
        if (!disk) {
@@ -1429,7 +1429,7 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
 
        error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, k), 1);
        if (error)
-               goto cdev_add_err;
+               goto out;
 
        sdp->cdev = cdev;
        if (sg_sysfs_valid) {
@@ -1456,13 +1456,6 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
 
        return 0;
 
-cdev_add_err:
-       write_lock_irqsave(&sg_dev_arr_lock, iflags);
-       kfree(sg_dev_arr[k]);
-       sg_dev_arr[k] = NULL;
-       sg_nr_dev--;
-       write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
-
 out:
        put_disk(disk);
        if (cdev)
@@ -2642,7 +2635,8 @@ static int
 sg_proc_init(void)
 {
        int k, mask;
-       int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr);
+       int num_leaves =
+           sizeof (sg_proc_leaf_arr) / sizeof (sg_proc_leaf_arr[0]);
        struct proc_dir_entry *pdep;
        struct sg_proc_leaf * leaf;
 
@@ -2667,7 +2661,8 @@ static void
 sg_proc_cleanup(void)
 {
        int k;
-       int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr);
+       int num_leaves =
+           sizeof (sg_proc_leaf_arr) / sizeof (sg_proc_leaf_arr[0]);
 
        if (!sg_proc_sgp)
                return;