summaryrefslogtreecommitdiffstats
path: root/drivers/block/pktcdvd.c
diff options
context:
space:
mode:
authorPeter Osterlund2006-02-21 03:28:04 +0100
committerLinus Torvalds2006-02-21 05:00:10 +0100
commitab863ec342cf148d02ed180b8ecf3a71a024e4be (patch)
treee13f614947329b305c32f9dddb99bda164440e70 /drivers/block/pktcdvd.c
parent[PATCH] pktcdvd: Remove useless printk statements (diff)
downloadkernel-qcow2-linux-ab863ec342cf148d02ed180b8ecf3a71a024e4be.tar.gz
kernel-qcow2-linux-ab863ec342cf148d02ed180b8ecf3a71a024e4be.tar.xz
kernel-qcow2-linux-ab863ec342cf148d02ed180b8ecf3a71a024e4be.zip
[PATCH] pktcdvd: Fix the logic in the pkt_writable_track function
Fix the pkt_writable_track() function to make it work correctly for all types of CD/DVD discs. Signed-off-by: Peter Osterlund <petero2@telia.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/block/pktcdvd.c')
-rw-r--r--drivers/block/pktcdvd.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index fb08ae6de403..eb83197cc36c 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -1499,28 +1499,30 @@ static int pkt_set_write_settings(struct pktcdvd_device *pd)
/*
* 1 -- we can write to this track, 0 -- we can't
*/
-static int pkt_writable_track(track_information *ti)
+static int pkt_writable_track(struct pktcdvd_device *pd, track_information *ti)
{
- /*
- * only good for CD-RW at the moment, not DVD-RW
- */
+ switch (pd->mmc3_profile) {
+ case 0x1a: /* DVD+RW */
+ case 0x12: /* DVD-RAM */
+ /* The track is always writable on DVD+RW/DVD-RAM */
+ return 1;
+ default:
+ break;
+ }
- /*
- * FIXME: only for FP
- */
- if (ti->fp == 0)
- return 1;
+ if (!ti->packet || !ti->fp)
+ return 0;
/*
* "good" settings as per Mt Fuji.
*/
- if (ti->rt == 0 && ti->blank == 0 && ti->packet == 1)
+ if (ti->rt == 0 && ti->blank == 0)
return 1;
- if (ti->rt == 0 && ti->blank == 1 && ti->packet == 1)
+ if (ti->rt == 0 && ti->blank == 1)
return 1;
- if (ti->rt == 1 && ti->blank == 0 && ti->packet == 1)
+ if (ti->rt == 1 && ti->blank == 0)
return 1;
printk("pktcdvd: bad state %d-%d-%d\n", ti->rt, ti->blank, ti->packet);
@@ -1605,7 +1607,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
return ret;
}
- if (!pkt_writable_track(&ti)) {
+ if (!pkt_writable_track(pd, &ti)) {
printk("pktcdvd: can't write to this track\n");
return -ENXIO;
}