aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2006-02-20 21:28:02 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-20 23:00:10 -0500
commit7c613d593370292d1685f5794c743a2323be3a09 (patch)
treef15deb96433b1684ef1f00ec292fffd05e730e56
parentcef289633a9321cd99dd5f6cc935657dc487e9f0 (diff)
[PATCH] pktcdvd: Rename functions and make their return values sane
Boolean functions should return non-zero when they mean "true", otherwise the calling code looks weird. (As suggested by Linus.) Signed-off-by: Peter Osterlund <petero2@telia.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/block/pktcdvd.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index f40310a42ba1..fb2c31edca24 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -1497,9 +1497,9 @@ static int pkt_set_write_settings(struct pktcdvd_device *pd)
1497} 1497}
1498 1498
1499/* 1499/*
1500 * 0 -- we can write to this track, 1 -- we can't 1500 * 1 -- we can write to this track, 0 -- we can't
1501 */ 1501 */
1502static int pkt_good_track(track_information *ti) 1502static int pkt_writable_track(track_information *ti)
1503{ 1503{
1504 /* 1504 /*
1505 * only good for CD-RW at the moment, not DVD-RW 1505 * only good for CD-RW at the moment, not DVD-RW
@@ -1509,28 +1509,28 @@ static int pkt_good_track(track_information *ti)
1509 * FIXME: only for FP 1509 * FIXME: only for FP
1510 */ 1510 */
1511 if (ti->fp == 0) 1511 if (ti->fp == 0)
1512 return 0; 1512 return 1;
1513 1513
1514 /* 1514 /*
1515 * "good" settings as per Mt Fuji. 1515 * "good" settings as per Mt Fuji.
1516 */ 1516 */
1517 if (ti->rt == 0 && ti->blank == 0 && ti->packet == 1) 1517 if (ti->rt == 0 && ti->blank == 0 && ti->packet == 1)
1518 return 0; 1518 return 1;
1519 1519
1520 if (ti->rt == 0 && ti->blank == 1 && ti->packet == 1) 1520 if (ti->rt == 0 && ti->blank == 1 && ti->packet == 1)
1521 return 0; 1521 return 1;
1522 1522
1523 if (ti->rt == 1 && ti->blank == 0 && ti->packet == 1) 1523 if (ti->rt == 1 && ti->blank == 0 && ti->packet == 1)
1524 return 0; 1524 return 1;
1525 1525
1526 printk("pktcdvd: bad state %d-%d-%d\n", ti->rt, ti->blank, ti->packet); 1526 printk("pktcdvd: bad state %d-%d-%d\n", ti->rt, ti->blank, ti->packet);
1527 return 1; 1527 return 0;
1528} 1528}
1529 1529
1530/* 1530/*
1531 * 0 -- we can write to this disc, 1 -- we can't 1531 * 1 -- we can write to this disc, 0 -- we can't
1532 */ 1532 */
1533static int pkt_good_disc(struct pktcdvd_device *pd, disc_information *di) 1533static int pkt_writable_disc(struct pktcdvd_device *pd, disc_information *di)
1534{ 1534{
1535 switch (pd->mmc3_profile) { 1535 switch (pd->mmc3_profile) {
1536 case 0x0a: /* CD-RW */ 1536 case 0x0a: /* CD-RW */
@@ -1539,10 +1539,10 @@ static int pkt_good_disc(struct pktcdvd_device *pd, disc_information *di)
1539 case 0x1a: /* DVD+RW */ 1539 case 0x1a: /* DVD+RW */
1540 case 0x13: /* DVD-RW */ 1540 case 0x13: /* DVD-RW */
1541 case 0x12: /* DVD-RAM */ 1541 case 0x12: /* DVD-RAM */
1542 return 0; 1542 return 1;
1543 default: 1543 default:
1544 VPRINTK("pktcdvd: Wrong disc profile (%x)\n", pd->mmc3_profile); 1544 VPRINTK("pktcdvd: Wrong disc profile (%x)\n", pd->mmc3_profile);
1545 return 1; 1545 return 0;
1546 } 1546 }
1547 1547
1548 /* 1548 /*
@@ -1551,25 +1551,25 @@ static int pkt_good_disc(struct pktcdvd_device *pd, disc_information *di)
1551 */ 1551 */
1552 if (di->disc_type == 0xff) { 1552 if (di->disc_type == 0xff) {
1553 printk("pktcdvd: Unknown disc. No track?\n"); 1553 printk("pktcdvd: Unknown disc. No track?\n");
1554 return 1; 1554 return 0;
1555 } 1555 }
1556 1556
1557 if (di->disc_type != 0x20 && di->disc_type != 0) { 1557 if (di->disc_type != 0x20 && di->disc_type != 0) {
1558 printk("pktcdvd: Wrong disc type (%x)\n", di->disc_type); 1558 printk("pktcdvd: Wrong disc type (%x)\n", di->disc_type);
1559 return 1; 1559 return 0;
1560 } 1560 }
1561 1561
1562 if (di->erasable == 0) { 1562 if (di->erasable == 0) {
1563 printk("pktcdvd: Disc not erasable\n"); 1563 printk("pktcdvd: Disc not erasable\n");
1564 return 1; 1564 return 0;
1565 } 1565 }
1566 1566
1567 if (di->border_status == PACKET_SESSION_RESERVED) { 1567 if (di->border_status == PACKET_SESSION_RESERVED) {
1568 printk("pktcdvd: Can't write to last track (reserved)\n"); 1568 printk("pktcdvd: Can't write to last track (reserved)\n");
1569 return 1; 1569 return 0;
1570 } 1570 }
1571 1571
1572 return 0; 1572 return 1;
1573} 1573}
1574 1574
1575static int pkt_probe_settings(struct pktcdvd_device *pd) 1575static int pkt_probe_settings(struct pktcdvd_device *pd)
@@ -1594,7 +1594,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
1594 return ret; 1594 return ret;
1595 } 1595 }
1596 1596
1597 if (pkt_good_disc(pd, &di)) 1597 if (!pkt_writable_disc(pd, &di))
1598 return -ENXIO; 1598 return -ENXIO;
1599 1599
1600 switch (pd->mmc3_profile) { 1600 switch (pd->mmc3_profile) {
@@ -1619,7 +1619,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
1619 return ret; 1619 return ret;
1620 } 1620 }
1621 1621
1622 if (pkt_good_track(&ti)) { 1622 if (!pkt_writable_track(&ti)) {
1623 printk("pktcdvd: can't write to this track\n"); 1623 printk("pktcdvd: can't write to this track\n");
1624 return -ENXIO; 1624 return -ENXIO;
1625 } 1625 }