aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/cciss.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index dcccaf2782f3..bc6602606fb5 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1923,7 +1923,6 @@ static void cciss_geometry_inquiry(int ctlr, int logvol,
1923{ 1923{
1924 int return_code; 1924 int return_code;
1925 unsigned long t; 1925 unsigned long t;
1926 unsigned long rem;
1927 1926
1928 memset(inq_buff, 0, sizeof(InquiryData_struct)); 1927 memset(inq_buff, 0, sizeof(InquiryData_struct));
1929 if (withirq) 1928 if (withirq)
@@ -1939,26 +1938,23 @@ static void cciss_geometry_inquiry(int ctlr, int logvol,
1939 printk(KERN_WARNING 1938 printk(KERN_WARNING
1940 "cciss: reading geometry failed, volume " 1939 "cciss: reading geometry failed, volume "
1941 "does not support reading geometry\n"); 1940 "does not support reading geometry\n");
1942 drv->block_size = block_size;
1943 drv->nr_blocks = total_size;
1944 drv->heads = 255; 1941 drv->heads = 255;
1945 drv->sectors = 32; // Sectors per track 1942 drv->sectors = 32; // Sectors per track
1946 t = drv->heads * drv->sectors;
1947 drv->cylinders = total_size;
1948 rem = do_div(drv->cylinders, t);
1949 } else { 1943 } else {
1950 drv->block_size = block_size;
1951 drv->nr_blocks = total_size;
1952 drv->heads = inq_buff->data_byte[6]; 1944 drv->heads = inq_buff->data_byte[6];
1953 drv->sectors = inq_buff->data_byte[7]; 1945 drv->sectors = inq_buff->data_byte[7];
1954 drv->cylinders = (inq_buff->data_byte[4] & 0xff) << 8; 1946 drv->cylinders = (inq_buff->data_byte[4] & 0xff) << 8;
1955 drv->cylinders += inq_buff->data_byte[5]; 1947 drv->cylinders += inq_buff->data_byte[5];
1956 drv->raid_level = inq_buff->data_byte[8]; 1948 drv->raid_level = inq_buff->data_byte[8];
1957 t = drv->heads * drv->sectors; 1949 }
1958 if (t > 1) { 1950 drv->block_size = block_size;
1959 drv->cylinders = total_size; 1951 drv->nr_blocks = total_size;
1960 rem = do_div(drv->cylinders, t); 1952 t = drv->heads * drv->sectors;
1961 } 1953 if (t > 1) {
1954 unsigned rem = sector_div(total_size, t);
1955 if (rem)
1956 total_size++;
1957 drv->cylinders = total_size;
1962 } 1958 }
1963 } else { /* Get geometry failed */ 1959 } else { /* Get geometry failed */
1964 printk(KERN_WARNING "cciss: reading geometry failed\n"); 1960 printk(KERN_WARNING "cciss: reading geometry failed\n");