Commit 13d41b53 authored by Chaitanya Kulkarni's avatar Chaitanya Kulkarni Committed by Thomas Bogendoerfer

n64: store dev instance into disk private data

The device instance is declared globally. Remove global variable & use
the disk->private_data to store the device instance in the
n64cart_probe() and get the same instance from bio->bi_disk->private
data in n64cart_submit_bio.
Signed-off-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: default avatarLauri Kasanen <cand@gmx.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent 0d424780
...@@ -30,7 +30,6 @@ enum { ...@@ -30,7 +30,6 @@ enum {
#define MIN_ALIGNMENT 8 #define MIN_ALIGNMENT 8
static u32 __iomem *reg_base; static u32 __iomem *reg_base;
static struct device *dev;
static unsigned int start; static unsigned int start;
module_param(start, uint, 0); module_param(start, uint, 0);
...@@ -89,6 +88,7 @@ static blk_qc_t n64cart_submit_bio(struct bio *bio) ...@@ -89,6 +88,7 @@ static blk_qc_t n64cart_submit_bio(struct bio *bio)
{ {
struct bio_vec bvec; struct bio_vec bvec;
struct bvec_iter iter; struct bvec_iter iter;
struct device *dev = bio->bi_disk->private_data;
u32 pos = bio->bi_iter.bi_sector << SECTOR_SHIFT; u32 pos = bio->bi_iter.bi_sector << SECTOR_SHIFT;
bio_for_each_segment(bvec, bio, iter) { bio_for_each_segment(bvec, bio, iter) {
...@@ -140,11 +140,10 @@ static int __init n64cart_probe(struct platform_device *pdev) ...@@ -140,11 +140,10 @@ static int __init n64cart_probe(struct platform_device *pdev)
if (!disk->queue) if (!disk->queue)
return -ENOMEM; return -ENOMEM;
dev = &pdev->dev;
disk->first_minor = 0; disk->first_minor = 0;
disk->flags = GENHD_FL_NO_PART_SCAN | GENHD_FL_EXT_DEVT; disk->flags = GENHD_FL_NO_PART_SCAN | GENHD_FL_EXT_DEVT;
disk->fops = &n64cart_fops; disk->fops = &n64cart_fops;
disk->private_data = &pdev->dev;
strcpy(disk->disk_name, "n64cart"); strcpy(disk->disk_name, "n64cart");
set_capacity(disk, size >> SECTOR_SHIFT); set_capacity(disk, size >> SECTOR_SHIFT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment