aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/scsi_debug.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 65c88dde72b4..4e93b69207c4 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -148,7 +148,6 @@ static int scsi_debug_cmnd_count = 0;
148#define DEV_READONLY(TGT) (0) 148#define DEV_READONLY(TGT) (0)
149#define DEV_REMOVEABLE(TGT) (0) 149#define DEV_REMOVEABLE(TGT) (0)
150 150
151static unsigned int sdebug_store_size; /* in bytes */
152static unsigned int sdebug_store_sectors; 151static unsigned int sdebug_store_sectors;
153static sector_t sdebug_capacity; /* in sectors */ 152static sector_t sdebug_capacity; /* in sectors */
154 153
@@ -1969,7 +1968,8 @@ static void __init init_all_queued(void)
1969 spin_unlock_irqrestore(&queued_arr_lock, iflags); 1968 spin_unlock_irqrestore(&queued_arr_lock, iflags);
1970} 1969}
1971 1970
1972static void __init sdebug_build_parts(unsigned char * ramp) 1971static void __init sdebug_build_parts(unsigned char *ramp,
1972 unsigned int store_size)
1973{ 1973{
1974 struct partition * pp; 1974 struct partition * pp;
1975 int starts[SDEBUG_MAX_PARTS + 2]; 1975 int starts[SDEBUG_MAX_PARTS + 2];
@@ -1977,7 +1977,7 @@ static void __init sdebug_build_parts(unsigned char * ramp)
1977 int heads_by_sects, start_sec, end_sec; 1977 int heads_by_sects, start_sec, end_sec;
1978 1978
1979 /* assume partition table already zeroed */ 1979 /* assume partition table already zeroed */
1980 if ((scsi_debug_num_parts < 1) || (sdebug_store_size < 1048576)) 1980 if ((scsi_debug_num_parts < 1) || (store_size < 1048576))
1981 return; 1981 return;
1982 if (scsi_debug_num_parts > SDEBUG_MAX_PARTS) { 1982 if (scsi_debug_num_parts > SDEBUG_MAX_PARTS) {
1983 scsi_debug_num_parts = SDEBUG_MAX_PARTS; 1983 scsi_debug_num_parts = SDEBUG_MAX_PARTS;
@@ -2505,8 +2505,8 @@ static int __init scsi_debug_init(void)
2505 2505
2506 if (scsi_debug_dev_size_mb < 1) 2506 if (scsi_debug_dev_size_mb < 1)
2507 scsi_debug_dev_size_mb = 1; /* force minimum 1 MB ramdisk */ 2507 scsi_debug_dev_size_mb = 1; /* force minimum 1 MB ramdisk */
2508 sdebug_store_size = (unsigned int)scsi_debug_dev_size_mb * 1048576; 2508 sz = (unsigned int)scsi_debug_dev_size_mb * 1048576;
2509 sdebug_store_sectors = sdebug_store_size / SECT_SIZE; 2509 sdebug_store_sectors = sz / SECT_SIZE;
2510 if (scsi_debug_virtual_gb > 0) { 2510 if (scsi_debug_virtual_gb > 0) {
2511 sdebug_capacity = 2048 * 1024; 2511 sdebug_capacity = 2048 * 1024;
2512 sdebug_capacity *= scsi_debug_virtual_gb; 2512 sdebug_capacity *= scsi_debug_virtual_gb;
@@ -2530,7 +2530,6 @@ static int __init scsi_debug_init(void)
2530 (sdebug_sectors_per * sdebug_heads); 2530 (sdebug_sectors_per * sdebug_heads);
2531 } 2531 }
2532 2532
2533 sz = sdebug_store_size;
2534 fake_storep = vmalloc(sz); 2533 fake_storep = vmalloc(sz);
2535 if (NULL == fake_storep) { 2534 if (NULL == fake_storep) {
2536 printk(KERN_ERR "scsi_debug_init: out of memory, 1\n"); 2535 printk(KERN_ERR "scsi_debug_init: out of memory, 1\n");
@@ -2538,7 +2537,7 @@ static int __init scsi_debug_init(void)
2538 } 2537 }
2539 memset(fake_storep, 0, sz); 2538 memset(fake_storep, 0, sz);
2540 if (scsi_debug_num_parts > 0) 2539 if (scsi_debug_num_parts > 0)
2541 sdebug_build_parts(fake_storep); 2540 sdebug_build_parts(fake_storep, sz);
2542 2541
2543 ret = device_register(&pseudo_primary); 2542 ret = device_register(&pseudo_primary);
2544 if (ret < 0) { 2543 if (ret < 0) {