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.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index ad94367df430..d86d5c26061d 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
@@ -1506,7 +1507,7 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
1506} 1507}
1507 1508
1508static int 1509static int
1509sg_add(struct class_device *cl_dev) 1510sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
1510{ 1511{
1511 struct scsi_device *scsidp = to_scsi_device(cl_dev->dev); 1512 struct scsi_device *scsidp = to_scsi_device(cl_dev->dev);
1512 struct gendisk *disk; 1513 struct gendisk *disk;
@@ -1550,7 +1551,7 @@ sg_add(struct class_device *cl_dev)
1550 if (sg_sysfs_valid) { 1551 if (sg_sysfs_valid) {
1551 struct class_device * sg_class_member; 1552 struct class_device * sg_class_member;
1552 1553
1553 sg_class_member = class_device_create(sg_sysfs_class, 1554 sg_class_member = class_device_create(sg_sysfs_class, NULL,
1554 MKDEV(SCSI_GENERIC_MAJOR, k), 1555 MKDEV(SCSI_GENERIC_MAJOR, k),
1555 cl_dev->dev, "%s", 1556 cl_dev->dev, "%s",
1556 disk->disk_name); 1557 disk->disk_name);
@@ -1582,7 +1583,7 @@ out:
1582} 1583}
1583 1584
1584static void 1585static void
1585sg_remove(struct class_device *cl_dev) 1586sg_remove(struct class_device *cl_dev, struct class_interface *cl_intf)
1586{ 1587{
1587 struct scsi_device *scsidp = to_scsi_device(cl_dev->dev); 1588 struct scsi_device *scsidp = to_scsi_device(cl_dev->dev);
1588 Sg_device *sdp = NULL; 1589 Sg_device *sdp = NULL;
@@ -1886,13 +1887,17 @@ st_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_pages,
1886 int i; 1887 int i;
1887 1888
1888 for (i=0; i < nr_pages; i++) { 1889 for (i=0; i < nr_pages; i++) {
1889 if (dirtied && !PageReserved(sgl[i].page)) 1890 struct page *page = sgl[i].page;
1890 SetPageDirty(sgl[i].page); 1891
1891 /* unlock_page(sgl[i].page); */ 1892 /* XXX: just for debug. Remove when PageReserved is removed */
1893 BUG_ON(PageReserved(page));
1894 if (dirtied)
1895 SetPageDirty(page);
1896 /* unlock_page(page); */
1892 /* FIXME: cache flush missing for rw==READ 1897 /* FIXME: cache flush missing for rw==READ
1893 * FIXME: call the correct reference counting function 1898 * FIXME: call the correct reference counting function
1894 */ 1899 */
1895 page_cache_release(sgl[i].page); 1900 page_cache_release(page);
1896 } 1901 }
1897 1902
1898 return 0; 1903 return 0;
@@ -1992,9 +1997,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
1992 if (!p) 1997 if (!p)
1993 break; 1998 break;
1994 } 1999 }
1995 sclp->page = virt_to_page(p); 2000 sg_set_buf(sclp, p, ret_sz);
1996 sclp->offset = offset_in_page(p);
1997 sclp->length = ret_sz;
1998 2001
1999 SCSI_LOG_TIMEOUT(5, printk("sg_build_build: k=%d, a=0x%p, len=%d\n", 2002 SCSI_LOG_TIMEOUT(5, printk("sg_build_build: k=%d, a=0x%p, len=%d\n",
2000 k, sg_scatg2virt(sclp), ret_sz)); 2003 k, sg_scatg2virt(sclp), ret_sz));
@@ -2644,7 +2647,7 @@ static char *
2644sg_page_malloc(int rqSz, int lowDma, int *retSzp) 2647sg_page_malloc(int rqSz, int lowDma, int *retSzp)
2645{ 2648{
2646 char *resp = NULL; 2649 char *resp = NULL;
2647 int page_mask; 2650 gfp_t page_mask;
2648 int order, a_size; 2651 int order, a_size;
2649 int resSz = rqSz; 2652 int resSz = rqSz;
2650 2653