aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-09-11 17:25:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 18:59:30 -0400
commit5323fb770b6254a4c218a2dfb0ef9aa007b7725a (patch)
tree97a385ac489ce3302d5f0d1f84995f9b05659c26
parent6723734cdff15211bb78aeea76ca847374bd93ae (diff)
pktcdvd: convert ZONE macro to static function get_zone()
Macros should be converted to functions where feasible to verify arguments and the like. Signed-off-by: Joe Perches <joe@perches.com> Cc: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/block/pktcdvd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index f5d0ea11d9fd..aa18a2584249 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -83,9 +83,6 @@
83 83
84#define MAX_SPEED 0xffff 84#define MAX_SPEED 0xffff
85 85
86#define ZONE(sector, pd) (((sector) + (pd)->offset) & \
87 ~(sector_t)((pd)->settings.size - 1))
88
89static DEFINE_MUTEX(pktcdvd_mutex); 86static DEFINE_MUTEX(pktcdvd_mutex);
90static struct pktcdvd_device *pkt_devs[MAX_WRITERS]; 87static struct pktcdvd_device *pkt_devs[MAX_WRITERS];
91static struct proc_dir_entry *pkt_proc; 88static struct proc_dir_entry *pkt_proc;
@@ -103,7 +100,10 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev);
103static int pkt_remove_dev(dev_t pkt_dev); 100static int pkt_remove_dev(dev_t pkt_dev);
104static int pkt_seq_show(struct seq_file *m, void *p); 101static int pkt_seq_show(struct seq_file *m, void *p);
105 102
106 103static sector_t get_zone(sector_t sector, struct pktcdvd_device *pd)
104{
105 return (sector + pd->offset) & ~(sector_t)(pd->settings.size - 1);
106}
107 107
108/* 108/*
109 * create and register a pktcdvd kernel object. 109 * create and register a pktcdvd kernel object.
@@ -1224,7 +1224,7 @@ static int pkt_handle_queue(struct pktcdvd_device *pd)
1224 node = first_node; 1224 node = first_node;
1225 while (node) { 1225 while (node) {
1226 bio = node->bio; 1226 bio = node->bio;
1227 zone = ZONE(bio->bi_sector, pd); 1227 zone = get_zone(bio->bi_sector, pd);
1228 list_for_each_entry(p, &pd->cdrw.pkt_active_list, list) { 1228 list_for_each_entry(p, &pd->cdrw.pkt_active_list, list) {
1229 if (p->sector == zone) { 1229 if (p->sector == zone) {
1230 bio = NULL; 1230 bio = NULL;
@@ -1264,8 +1264,8 @@ try_next_bio:
1264 while ((node = pkt_rbtree_find(pd, zone)) != NULL) { 1264 while ((node = pkt_rbtree_find(pd, zone)) != NULL) {
1265 bio = node->bio; 1265 bio = node->bio;
1266 VPRINTK("pkt_handle_queue: found zone=%llx\n", 1266 VPRINTK("pkt_handle_queue: found zone=%llx\n",
1267 (unsigned long long)ZONE(bio->bi_sector, pd)); 1267 (unsigned long long)get_zone(bio->bi_sector, pd));
1268 if (ZONE(bio->bi_sector, pd) != zone) 1268 if (get_zone(bio->bi_sector, pd) != zone)
1269 break; 1269 break;
1270 pkt_rbtree_erase(pd, node); 1270 pkt_rbtree_erase(pd, node);
1271 spin_lock(&pkt->lock); 1271 spin_lock(&pkt->lock);
@@ -2394,7 +2394,7 @@ static void pkt_make_request(struct request_queue *q, struct bio *bio)
2394 2394
2395 blk_queue_bounce(q, &bio); 2395 blk_queue_bounce(q, &bio);
2396 2396
2397 zone = ZONE(bio->bi_sector, pd); 2397 zone = get_zone(bio->bi_sector, pd);
2398 VPRINTK("pkt_make_request: start = %6llx stop = %6llx\n", 2398 VPRINTK("pkt_make_request: start = %6llx stop = %6llx\n",
2399 (unsigned long long)bio->bi_sector, 2399 (unsigned long long)bio->bi_sector,
2400 (unsigned long long)bio_end_sector(bio)); 2400 (unsigned long long)bio_end_sector(bio));
@@ -2405,7 +2405,7 @@ static void pkt_make_request(struct request_queue *q, struct bio *bio)
2405 sector_t last_zone; 2405 sector_t last_zone;
2406 int first_sectors; 2406 int first_sectors;
2407 2407
2408 last_zone = ZONE(bio_end_sector(bio) - 1, pd); 2408 last_zone = get_zone(bio_end_sector(bio) - 1, pd);
2409 if (last_zone != zone) { 2409 if (last_zone != zone) {
2410 BUG_ON(last_zone != zone + pd->settings.size); 2410 BUG_ON(last_zone != zone + pd->settings.size);
2411 first_sectors = last_zone - bio->bi_sector; 2411 first_sectors = last_zone - bio->bi_sector;
@@ -2500,7 +2500,7 @@ static int pkt_merge_bvec(struct request_queue *q, struct bvec_merge_data *bmd,
2500 struct bio_vec *bvec) 2500 struct bio_vec *bvec)
2501{ 2501{
2502 struct pktcdvd_device *pd = q->queuedata; 2502 struct pktcdvd_device *pd = q->queuedata;
2503 sector_t zone = ZONE(bmd->bi_sector, pd); 2503 sector_t zone = get_zone(bmd->bi_sector, pd);
2504 int used = ((bmd->bi_sector - zone) << 9) + bmd->bi_size; 2504 int used = ((bmd->bi_sector - zone) << 9) + bmd->bi_size;
2505 int remaining = (pd->settings.size << 9) - used; 2505 int remaining = (pd->settings.size << 9) - used;
2506 int remaining2; 2506 int remaining2;