aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 49b9269d487a..4f30a37db63c 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -49,6 +49,7 @@ static int sg_version_num = 30533; /* 2 digits for each component */
49#include <linux/seq_file.h> 49#include <linux/seq_file.h>
50#include <linux/blkdev.h> 50#include <linux/blkdev.h>
51#include <linux/delay.h> 51#include <linux/delay.h>
52#include <linux/scatterlist.h>
52 53
53#include "scsi.h" 54#include "scsi.h"
54#include <scsi/scsi_dbg.h> 55#include <scsi/scsi_dbg.h>
@@ -104,8 +105,8 @@ static int sg_allow_dio = SG_ALLOW_DIO_DEF;
104 105
105#define SG_DEV_ARR_LUMP 32 /* amount to over allocate sg_dev_arr by */ 106#define SG_DEV_ARR_LUMP 32 /* amount to over allocate sg_dev_arr by */
106 107
107static int sg_add(struct class_device *); 108static int sg_add(struct class_device *, struct class_interface *);
108static void sg_remove(struct class_device *); 109static void sg_remove(struct class_device *, struct class_interface *);
109 110
110static Scsi_Request *dummy_cmdp; /* only used for sizeof */ 111static Scsi_Request *dummy_cmdp; /* only used for sizeof */
111 112
@@ -1505,7 +1506,7 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
1505} 1506}
1506 1507
1507static int 1508static int
1508sg_add(struct class_device *cl_dev) 1509sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
1509{ 1510{
1510 struct scsi_device *scsidp = to_scsi_device(cl_dev->dev); 1511 struct scsi_device *scsidp = to_scsi_device(cl_dev->dev);
1511 struct gendisk *disk; 1512 struct gendisk *disk;
@@ -1549,7 +1550,7 @@ sg_add(struct class_device *cl_dev)
1549 if (sg_sysfs_valid) { 1550 if (sg_sysfs_valid) {
1550 struct class_device * sg_class_member; 1551 struct class_device * sg_class_member;
1551 1552
1552 sg_class_member = class_device_create(sg_sysfs_class, 1553 sg_class_member = class_device_create(sg_sysfs_class, NULL,
1553 MKDEV(SCSI_GENERIC_MAJOR, k), 1554 MKDEV(SCSI_GENERIC_MAJOR, k),
1554 cl_dev->dev, "%s", 1555 cl_dev->dev, "%s",
1555 disk->disk_name); 1556 disk->disk_name);
@@ -1578,7 +1579,7 @@ out:
1578} 1579}
1579 1580
1580static void 1581static void
1581sg_remove(struct class_device *cl_dev) 1582sg_remove(struct class_device *cl_dev, struct class_interface *cl_intf)
1582{ 1583{
1583 struct scsi_device *scsidp = to_scsi_device(cl_dev->dev); 1584 struct scsi_device *scsidp = to_scsi_device(cl_dev->dev);
1584 Sg_device *sdp = NULL; 1585 Sg_device *sdp = NULL;
@@ -1882,13 +1883,17 @@ st_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_pages,
1882 int i; 1883 int i;
1883 1884
1884 for (i=0; i < nr_pages; i++) { 1885 for (i=0; i < nr_pages; i++) {
1885 if (dirtied && !PageReserved(sgl[i].page)) 1886 struct page *page = sgl[i].page;
1886 SetPageDirty(sgl[i].page); 1887
1887 /* unlock_page(sgl[i].page); */ 1888 /* XXX: just for debug. Remove when PageReserved is removed */
1889 BUG_ON(PageReserved(page));
1890 if (dirtied)
1891 SetPageDirty(page);
1892 /* unlock_page(page); */
1888 /* FIXME: cache flush missing for rw==READ 1893 /* FIXME: cache flush missing for rw==READ
1889 * FIXME: call the correct reference counting function 1894 * FIXME: call the correct reference counting function
1890 */ 1895 */
1891 page_cache_release(sgl[i].page); 1896 page_cache_release(page);
1892 } 1897 }
1893 1898
1894 return 0; 1899 return 0;
@@ -1988,9 +1993,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
1988 if (!p) 1993 if (!p)
1989 break; 1994 break;
1990 } 1995 }
1991 sclp->page = virt_to_page(p); 1996 sg_set_buf(sclp, p, ret_sz);
1992 sclp->offset = offset_in_page(p);
1993 sclp->length = ret_sz;
1994 1997
1995 SCSI_LOG_TIMEOUT(5, printk("sg_build_build: k=%d, a=0x%p, len=%d\n", 1998 SCSI_LOG_TIMEOUT(5, printk("sg_build_build: k=%d, a=0x%p, len=%d\n",
1996 k, sg_scatg2virt(sclp), ret_sz)); 1999 k, sg_scatg2virt(sclp), ret_sz));