summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2011-04-06 14:35:02 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-20 13:33:24 -0700
commit273083bef5a1204b6ce67eb8e23682a2d3cd2dd9 (patch)
tree7d02559be0885c8374fedb398931f13982642cd3 /drivers/staging
parenta55af7bee859e183c059415b608b6d72e5cd7426 (diff)
downloadlinux-273083bef5a1204b6ce67eb8e23682a2d3cd2dd9.tar.bz2
Staging: hv: Get rid of the forward declaration of blkvsc_getgeo()
Get rid of the forward declaration of blkvsc_getgeo() by moving the code around. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Abhishek Kane <v-abkane@microsoft.com> Signed-off-by: Hank Janssen <hjanssen@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/hv/blkvsc_drv.c162
1 files changed, 81 insertions, 81 deletions
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 797bcdbd2a51..c45e475e0389 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -275,6 +275,87 @@ static int blkvsc_open(struct block_device *bdev, fmode_t mode)
return 0;
}
+
+static int blkvsc_getgeo(struct block_device *bd, struct hd_geometry *hg)
+{
+ sector_t total_sectors = get_capacity(bd->bd_disk);
+ sector_t cylinder_times_heads = 0;
+ sector_t temp = 0;
+
+ int sectors_per_track = 0;
+ int heads = 0;
+ int cylinders = 0;
+ int rem = 0;
+
+ if (total_sectors > (65535 * 16 * 255))
+ total_sectors = (65535 * 16 * 255);
+
+ if (total_sectors >= (65535 * 16 * 63)) {
+ sectors_per_track = 255;
+ heads = 16;
+
+ cylinder_times_heads = total_sectors;
+ /* sector_div stores the quotient in cylinder_times_heads */
+ rem = sector_div(cylinder_times_heads, sectors_per_track);
+ } else {
+ sectors_per_track = 17;
+
+ cylinder_times_heads = total_sectors;
+ /* sector_div stores the quotient in cylinder_times_heads */
+ rem = sector_div(cylinder_times_heads, sectors_per_track);
+
+ temp = cylinder_times_heads + 1023;
+ /* sector_div stores the quotient in temp */
+ rem = sector_div(temp, 1024);
+
+ heads = temp;
+
+ if (heads < 4)
+ heads = 4;
+
+
+ if (cylinder_times_heads >= (heads * 1024) || (heads > 16)) {
+ sectors_per_track = 31;
+ heads = 16;
+
+ cylinder_times_heads = total_sectors;
+ /*
+ * sector_div stores the quotient in
+ * cylinder_times_heads
+ */
+ rem = sector_div(cylinder_times_heads,
+ sectors_per_track);
+ }
+
+ if (cylinder_times_heads >= (heads * 1024)) {
+ sectors_per_track = 63;
+ heads = 16;
+
+ cylinder_times_heads = total_sectors;
+ /*
+ * sector_div stores the quotient in
+ * cylinder_times_heads
+ */
+ rem = sector_div(cylinder_times_heads,
+ sectors_per_track);
+ }
+ }
+
+ temp = cylinder_times_heads;
+ /* sector_div stores the quotient in temp */
+ rem = sector_div(temp, heads);
+ cylinders = temp;
+
+ hg->heads = heads;
+ hg->sectors = sectors_per_track;
+ hg->cylinders = cylinders;
+
+ DPRINT_INFO(BLKVSC_DRV, "CHS (%d, %d, %d)", cylinders, heads,
+ sectors_per_track);
+
+ return 0;
+}
+
/* Static decl */
static int blkvsc_probe(struct device *dev);
static int blkvsc_remove(struct device *device);
@@ -282,7 +363,6 @@ static void blkvsc_shutdown(struct device *device);
static int blkvsc_release(struct gendisk *disk, fmode_t mode);
static int blkvsc_revalidate_disk(struct gendisk *gd);
-static int blkvsc_getgeo(struct block_device *bd, struct hd_geometry *hg);
static int blkvsc_ioctl(struct block_device *bd, fmode_t mode,
unsigned cmd, unsigned long argument);
static void blkvsc_request(struct request_queue *queue);
@@ -1427,86 +1507,6 @@ static int blkvsc_revalidate_disk(struct gendisk *gd)
return 0;
}
-static int blkvsc_getgeo(struct block_device *bd, struct hd_geometry *hg)
-{
- sector_t total_sectors = get_capacity(bd->bd_disk);
- sector_t cylinder_times_heads = 0;
- sector_t temp = 0;
-
- int sectors_per_track = 0;
- int heads = 0;
- int cylinders = 0;
- int rem = 0;
-
- if (total_sectors > (65535 * 16 * 255))
- total_sectors = (65535 * 16 * 255);
-
- if (total_sectors >= (65535 * 16 * 63)) {
- sectors_per_track = 255;
- heads = 16;
-
- cylinder_times_heads = total_sectors;
- /* sector_div stores the quotient in cylinder_times_heads */
- rem = sector_div(cylinder_times_heads, sectors_per_track);
- } else {
- sectors_per_track = 17;
-
- cylinder_times_heads = total_sectors;
- /* sector_div stores the quotient in cylinder_times_heads */
- rem = sector_div(cylinder_times_heads, sectors_per_track);
-
- temp = cylinder_times_heads + 1023;
- /* sector_div stores the quotient in temp */
- rem = sector_div(temp, 1024);
-
- heads = temp;
-
- if (heads < 4)
- heads = 4;
-
-
- if (cylinder_times_heads >= (heads * 1024) || (heads > 16)) {
- sectors_per_track = 31;
- heads = 16;
-
- cylinder_times_heads = total_sectors;
- /*
- * sector_div stores the quotient in
- * cylinder_times_heads
- */
- rem = sector_div(cylinder_times_heads,
- sectors_per_track);
- }
-
- if (cylinder_times_heads >= (heads * 1024)) {
- sectors_per_track = 63;
- heads = 16;
-
- cylinder_times_heads = total_sectors;
- /*
- * sector_div stores the quotient in
- * cylinder_times_heads
- */
- rem = sector_div(cylinder_times_heads,
- sectors_per_track);
- }
- }
-
- temp = cylinder_times_heads;
- /* sector_div stores the quotient in temp */
- rem = sector_div(temp, heads);
- cylinders = temp;
-
- hg->heads = heads;
- hg->sectors = sectors_per_track;
- hg->cylinders = cylinders;
-
- DPRINT_INFO(BLKVSC_DRV, "CHS (%d, %d, %d)", cylinders, heads,
- sectors_per_track);
-
- return 0;
-}
-
static int blkvsc_ioctl(struct block_device *bd, fmode_t mode,
unsigned cmd, unsigned long argument)
{