xref: /openbmc/linux/drivers/scsi/sr_vendor.c (revision 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2)
1*1da177e4SLinus Torvalds /* -*-linux-c-*-
2*1da177e4SLinus Torvalds 
3*1da177e4SLinus Torvalds  * vendor-specific code for SCSI CD-ROM's goes here.
4*1da177e4SLinus Torvalds  *
5*1da177e4SLinus Torvalds  * This is needed becauce most of the new features (multisession and
6*1da177e4SLinus Torvalds  * the like) are too new to be included into the SCSI-II standard (to
7*1da177e4SLinus Torvalds  * be exact: there is'nt anything in my draft copy).
8*1da177e4SLinus Torvalds  *
9*1da177e4SLinus Torvalds  * Aug 1997: Ha! Got a SCSI-3 cdrom spec across my fingers. SCSI-3 does
10*1da177e4SLinus Torvalds  *           multisession using the READ TOC command (like SONY).
11*1da177e4SLinus Torvalds  *
12*1da177e4SLinus Torvalds  *           Rearranged stuff here: SCSI-3 is included allways, support
13*1da177e4SLinus Torvalds  *           for NEC/TOSHIBA/HP commands is optional.
14*1da177e4SLinus Torvalds  *
15*1da177e4SLinus Torvalds  *   Gerd Knorr <kraxel@cs.tu-berlin.de>
16*1da177e4SLinus Torvalds  *
17*1da177e4SLinus Torvalds  * --------------------------------------------------------------------------
18*1da177e4SLinus Torvalds  *
19*1da177e4SLinus Torvalds  * support for XA/multisession-CD's
20*1da177e4SLinus Torvalds  *
21*1da177e4SLinus Torvalds  *   - NEC:     Detection and support of multisession CD's.
22*1da177e4SLinus Torvalds  *
23*1da177e4SLinus Torvalds  *   - TOSHIBA: Detection and support of multisession CD's.
24*1da177e4SLinus Torvalds  *              Some XA-Sector tweaking, required for older drives.
25*1da177e4SLinus Torvalds  *
26*1da177e4SLinus Torvalds  *   - SONY:    Detection and support of multisession CD's.
27*1da177e4SLinus Torvalds  *              added by Thomas Quinot <thomas@cuivre.freenix.fr>
28*1da177e4SLinus Torvalds  *
29*1da177e4SLinus Torvalds  *   - PIONEER, HITACHI, PLEXTOR, MATSHITA, TEAC, PHILIPS: known to
30*1da177e4SLinus Torvalds  *              work with SONY (SCSI3 now)  code.
31*1da177e4SLinus Torvalds  *
32*1da177e4SLinus Torvalds  *   - HP:      Much like SONY, but a little different... (Thomas)
33*1da177e4SLinus Torvalds  *              HP-Writers only ??? Maybe other CD-Writers work with this too ?
34*1da177e4SLinus Torvalds  *              HP 6020 writers now supported.
35*1da177e4SLinus Torvalds  */
36*1da177e4SLinus Torvalds 
37*1da177e4SLinus Torvalds #include <linux/config.h>
38*1da177e4SLinus Torvalds #include <linux/cdrom.h>
39*1da177e4SLinus Torvalds #include <linux/errno.h>
40*1da177e4SLinus Torvalds #include <linux/string.h>
41*1da177e4SLinus Torvalds #include <linux/bcd.h>
42*1da177e4SLinus Torvalds #include <linux/blkdev.h>
43*1da177e4SLinus Torvalds 
44*1da177e4SLinus Torvalds #include <scsi/scsi.h>
45*1da177e4SLinus Torvalds #include <scsi/scsi_cmnd.h>
46*1da177e4SLinus Torvalds #include <scsi/scsi_device.h>
47*1da177e4SLinus Torvalds #include <scsi/scsi_host.h>
48*1da177e4SLinus Torvalds #include <scsi/scsi_ioctl.h>
49*1da177e4SLinus Torvalds 
50*1da177e4SLinus Torvalds #include "sr.h"
51*1da177e4SLinus Torvalds 
52*1da177e4SLinus Torvalds #if 0
53*1da177e4SLinus Torvalds #define DEBUG
54*1da177e4SLinus Torvalds #endif
55*1da177e4SLinus Torvalds 
56*1da177e4SLinus Torvalds /* here are some constants to sort the vendors into groups */
57*1da177e4SLinus Torvalds 
58*1da177e4SLinus Torvalds #define VENDOR_SCSI3           1	/* default: scsi-3 mmc */
59*1da177e4SLinus Torvalds 
60*1da177e4SLinus Torvalds #define VENDOR_NEC             2
61*1da177e4SLinus Torvalds #define VENDOR_TOSHIBA         3
62*1da177e4SLinus Torvalds #define VENDOR_WRITER          4	/* pre-scsi3 writers */
63*1da177e4SLinus Torvalds 
64*1da177e4SLinus Torvalds #define VENDOR_TIMEOUT	30*HZ
65*1da177e4SLinus Torvalds 
66*1da177e4SLinus Torvalds void sr_vendor_init(Scsi_CD *cd)
67*1da177e4SLinus Torvalds {
68*1da177e4SLinus Torvalds #ifndef CONFIG_BLK_DEV_SR_VENDOR
69*1da177e4SLinus Torvalds 	cd->vendor = VENDOR_SCSI3;
70*1da177e4SLinus Torvalds #else
71*1da177e4SLinus Torvalds 	char *vendor = cd->device->vendor;
72*1da177e4SLinus Torvalds 	char *model = cd->device->model;
73*1da177e4SLinus Torvalds 
74*1da177e4SLinus Torvalds 	/* default */
75*1da177e4SLinus Torvalds 	cd->vendor = VENDOR_SCSI3;
76*1da177e4SLinus Torvalds 	if (cd->readcd_known)
77*1da177e4SLinus Torvalds 		/* this is true for scsi3/mmc drives - no more checks */
78*1da177e4SLinus Torvalds 		return;
79*1da177e4SLinus Torvalds 
80*1da177e4SLinus Torvalds 	if (cd->device->type == TYPE_WORM) {
81*1da177e4SLinus Torvalds 		cd->vendor = VENDOR_WRITER;
82*1da177e4SLinus Torvalds 
83*1da177e4SLinus Torvalds 	} else if (!strncmp(vendor, "NEC", 3)) {
84*1da177e4SLinus Torvalds 		cd->vendor = VENDOR_NEC;
85*1da177e4SLinus Torvalds 		if (!strncmp(model, "CD-ROM DRIVE:25", 15) ||
86*1da177e4SLinus Torvalds 		    !strncmp(model, "CD-ROM DRIVE:36", 15) ||
87*1da177e4SLinus Torvalds 		    !strncmp(model, "CD-ROM DRIVE:83", 15) ||
88*1da177e4SLinus Torvalds 		    !strncmp(model, "CD-ROM DRIVE:84 ", 16)
89*1da177e4SLinus Torvalds #if 0
90*1da177e4SLinus Torvalds 		/* my NEC 3x returns the read-raw data if a read-raw
91*1da177e4SLinus Torvalds 		   is followed by a read for the same sector - aeb */
92*1da177e4SLinus Torvalds 		    || !strncmp(model, "CD-ROM DRIVE:500", 16)
93*1da177e4SLinus Torvalds #endif
94*1da177e4SLinus Torvalds 		    )
95*1da177e4SLinus Torvalds 			/* these can't handle multisession, may hang */
96*1da177e4SLinus Torvalds 			cd->cdi.mask |= CDC_MULTI_SESSION;
97*1da177e4SLinus Torvalds 
98*1da177e4SLinus Torvalds 	} else if (!strncmp(vendor, "TOSHIBA", 7)) {
99*1da177e4SLinus Torvalds 		cd->vendor = VENDOR_TOSHIBA;
100*1da177e4SLinus Torvalds 
101*1da177e4SLinus Torvalds 	}
102*1da177e4SLinus Torvalds #endif
103*1da177e4SLinus Torvalds }
104*1da177e4SLinus Torvalds 
105*1da177e4SLinus Torvalds 
106*1da177e4SLinus Torvalds /* small handy function for switching block length using MODE SELECT,
107*1da177e4SLinus Torvalds  * used by sr_read_sector() */
108*1da177e4SLinus Torvalds 
109*1da177e4SLinus Torvalds int sr_set_blocklength(Scsi_CD *cd, int blocklength)
110*1da177e4SLinus Torvalds {
111*1da177e4SLinus Torvalds 	unsigned char *buffer;	/* the buffer for the ioctl */
112*1da177e4SLinus Torvalds 	struct packet_command cgc;
113*1da177e4SLinus Torvalds 	struct ccs_modesel_head *modesel;
114*1da177e4SLinus Torvalds 	int rc, density = 0;
115*1da177e4SLinus Torvalds 
116*1da177e4SLinus Torvalds #ifdef CONFIG_BLK_DEV_SR_VENDOR
117*1da177e4SLinus Torvalds 	if (cd->vendor == VENDOR_TOSHIBA)
118*1da177e4SLinus Torvalds 		density = (blocklength > 2048) ? 0x81 : 0x83;
119*1da177e4SLinus Torvalds #endif
120*1da177e4SLinus Torvalds 
121*1da177e4SLinus Torvalds 	buffer = (unsigned char *) kmalloc(512, GFP_KERNEL | GFP_DMA);
122*1da177e4SLinus Torvalds 	if (!buffer)
123*1da177e4SLinus Torvalds 		return -ENOMEM;
124*1da177e4SLinus Torvalds 
125*1da177e4SLinus Torvalds #ifdef DEBUG
126*1da177e4SLinus Torvalds 	printk("%s: MODE SELECT 0x%x/%d\n", cd->cdi.name, density, blocklength);
127*1da177e4SLinus Torvalds #endif
128*1da177e4SLinus Torvalds 	memset(&cgc, 0, sizeof(struct packet_command));
129*1da177e4SLinus Torvalds 	cgc.cmd[0] = MODE_SELECT;
130*1da177e4SLinus Torvalds 	cgc.cmd[1] = (1 << 4);
131*1da177e4SLinus Torvalds 	cgc.cmd[4] = 12;
132*1da177e4SLinus Torvalds 	modesel = (struct ccs_modesel_head *) buffer;
133*1da177e4SLinus Torvalds 	memset(modesel, 0, sizeof(*modesel));
134*1da177e4SLinus Torvalds 	modesel->block_desc_length = 0x08;
135*1da177e4SLinus Torvalds 	modesel->density = density;
136*1da177e4SLinus Torvalds 	modesel->block_length_med = (blocklength >> 8) & 0xff;
137*1da177e4SLinus Torvalds 	modesel->block_length_lo = blocklength & 0xff;
138*1da177e4SLinus Torvalds 	cgc.buffer = buffer;
139*1da177e4SLinus Torvalds 	cgc.buflen = sizeof(*modesel);
140*1da177e4SLinus Torvalds 	cgc.data_direction = DMA_TO_DEVICE;
141*1da177e4SLinus Torvalds 	cgc.timeout = VENDOR_TIMEOUT;
142*1da177e4SLinus Torvalds 	if (0 == (rc = sr_do_ioctl(cd, &cgc))) {
143*1da177e4SLinus Torvalds 		cd->device->sector_size = blocklength;
144*1da177e4SLinus Torvalds 	}
145*1da177e4SLinus Torvalds #ifdef DEBUG
146*1da177e4SLinus Torvalds 	else
147*1da177e4SLinus Torvalds 		printk("%s: switching blocklength to %d bytes failed\n",
148*1da177e4SLinus Torvalds 		       cd->cdi.name, blocklength);
149*1da177e4SLinus Torvalds #endif
150*1da177e4SLinus Torvalds 	kfree(buffer);
151*1da177e4SLinus Torvalds 	return rc;
152*1da177e4SLinus Torvalds }
153*1da177e4SLinus Torvalds 
154*1da177e4SLinus Torvalds /* This function gets called after a media change. Checks if the CD is
155*1da177e4SLinus Torvalds    multisession, asks for offset etc. */
156*1da177e4SLinus Torvalds 
157*1da177e4SLinus Torvalds int sr_cd_check(struct cdrom_device_info *cdi)
158*1da177e4SLinus Torvalds {
159*1da177e4SLinus Torvalds 	Scsi_CD *cd = cdi->handle;
160*1da177e4SLinus Torvalds 	unsigned long sector;
161*1da177e4SLinus Torvalds 	unsigned char *buffer;	/* the buffer for the ioctl */
162*1da177e4SLinus Torvalds 	struct packet_command cgc;
163*1da177e4SLinus Torvalds 	int rc, no_multi;
164*1da177e4SLinus Torvalds 
165*1da177e4SLinus Torvalds 	if (cd->cdi.mask & CDC_MULTI_SESSION)
166*1da177e4SLinus Torvalds 		return 0;
167*1da177e4SLinus Torvalds 
168*1da177e4SLinus Torvalds 	buffer = (unsigned char *) kmalloc(512, GFP_KERNEL | GFP_DMA);
169*1da177e4SLinus Torvalds 	if (!buffer)
170*1da177e4SLinus Torvalds 		return -ENOMEM;
171*1da177e4SLinus Torvalds 
172*1da177e4SLinus Torvalds 	sector = 0;		/* the multisession sector offset goes here  */
173*1da177e4SLinus Torvalds 	no_multi = 0;		/* flag: the drive can't handle multisession */
174*1da177e4SLinus Torvalds 	rc = 0;
175*1da177e4SLinus Torvalds 
176*1da177e4SLinus Torvalds 	memset(&cgc, 0, sizeof(struct packet_command));
177*1da177e4SLinus Torvalds 
178*1da177e4SLinus Torvalds 	switch (cd->vendor) {
179*1da177e4SLinus Torvalds 
180*1da177e4SLinus Torvalds 	case VENDOR_SCSI3:
181*1da177e4SLinus Torvalds 		cgc.cmd[0] = READ_TOC;
182*1da177e4SLinus Torvalds 		cgc.cmd[8] = 12;
183*1da177e4SLinus Torvalds 		cgc.cmd[9] = 0x40;
184*1da177e4SLinus Torvalds 		cgc.buffer = buffer;
185*1da177e4SLinus Torvalds 		cgc.buflen = 12;
186*1da177e4SLinus Torvalds 		cgc.quiet = 1;
187*1da177e4SLinus Torvalds 		cgc.data_direction = DMA_FROM_DEVICE;
188*1da177e4SLinus Torvalds 		cgc.timeout = VENDOR_TIMEOUT;
189*1da177e4SLinus Torvalds 		rc = sr_do_ioctl(cd, &cgc);
190*1da177e4SLinus Torvalds 		if (rc != 0)
191*1da177e4SLinus Torvalds 			break;
192*1da177e4SLinus Torvalds 		if ((buffer[0] << 8) + buffer[1] < 0x0a) {
193*1da177e4SLinus Torvalds 			printk(KERN_INFO "%s: Hmm, seems the drive "
194*1da177e4SLinus Torvalds 			   "doesn't support multisession CD's\n", cd->cdi.name);
195*1da177e4SLinus Torvalds 			no_multi = 1;
196*1da177e4SLinus Torvalds 			break;
197*1da177e4SLinus Torvalds 		}
198*1da177e4SLinus Torvalds 		sector = buffer[11] + (buffer[10] << 8) +
199*1da177e4SLinus Torvalds 		    (buffer[9] << 16) + (buffer[8] << 24);
200*1da177e4SLinus Torvalds 		if (buffer[6] <= 1) {
201*1da177e4SLinus Torvalds 			/* ignore sector offsets from first track */
202*1da177e4SLinus Torvalds 			sector = 0;
203*1da177e4SLinus Torvalds 		}
204*1da177e4SLinus Torvalds 		break;
205*1da177e4SLinus Torvalds 
206*1da177e4SLinus Torvalds #ifdef CONFIG_BLK_DEV_SR_VENDOR
207*1da177e4SLinus Torvalds 	case VENDOR_NEC:{
208*1da177e4SLinus Torvalds 			unsigned long min, sec, frame;
209*1da177e4SLinus Torvalds 			cgc.cmd[0] = 0xde;
210*1da177e4SLinus Torvalds 			cgc.cmd[1] = 0x03;
211*1da177e4SLinus Torvalds 			cgc.cmd[2] = 0xb0;
212*1da177e4SLinus Torvalds 			cgc.buffer = buffer;
213*1da177e4SLinus Torvalds 			cgc.buflen = 0x16;
214*1da177e4SLinus Torvalds 			cgc.quiet = 1;
215*1da177e4SLinus Torvalds 			cgc.data_direction = DMA_FROM_DEVICE;
216*1da177e4SLinus Torvalds 			cgc.timeout = VENDOR_TIMEOUT;
217*1da177e4SLinus Torvalds 			rc = sr_do_ioctl(cd, &cgc);
218*1da177e4SLinus Torvalds 			if (rc != 0)
219*1da177e4SLinus Torvalds 				break;
220*1da177e4SLinus Torvalds 			if (buffer[14] != 0 && buffer[14] != 0xb0) {
221*1da177e4SLinus Torvalds 				printk(KERN_INFO "%s: Hmm, seems the cdrom "
222*1da177e4SLinus Torvalds 				       "doesn't support multisession CD's\n",
223*1da177e4SLinus Torvalds 				       cd->cdi.name);
224*1da177e4SLinus Torvalds 				no_multi = 1;
225*1da177e4SLinus Torvalds 				break;
226*1da177e4SLinus Torvalds 			}
227*1da177e4SLinus Torvalds 			min = BCD2BIN(buffer[15]);
228*1da177e4SLinus Torvalds 			sec = BCD2BIN(buffer[16]);
229*1da177e4SLinus Torvalds 			frame = BCD2BIN(buffer[17]);
230*1da177e4SLinus Torvalds 			sector = min * CD_SECS * CD_FRAMES + sec * CD_FRAMES + frame;
231*1da177e4SLinus Torvalds 			break;
232*1da177e4SLinus Torvalds 		}
233*1da177e4SLinus Torvalds 
234*1da177e4SLinus Torvalds 	case VENDOR_TOSHIBA:{
235*1da177e4SLinus Torvalds 			unsigned long min, sec, frame;
236*1da177e4SLinus Torvalds 
237*1da177e4SLinus Torvalds 			/* we request some disc information (is it a XA-CD ?,
238*1da177e4SLinus Torvalds 			 * where starts the last session ?) */
239*1da177e4SLinus Torvalds 			cgc.cmd[0] = 0xc7;
240*1da177e4SLinus Torvalds 			cgc.cmd[1] = 0x03;
241*1da177e4SLinus Torvalds 			cgc.buffer = buffer;
242*1da177e4SLinus Torvalds 			cgc.buflen = 4;
243*1da177e4SLinus Torvalds 			cgc.quiet = 1;
244*1da177e4SLinus Torvalds 			cgc.data_direction = DMA_FROM_DEVICE;
245*1da177e4SLinus Torvalds 			cgc.timeout = VENDOR_TIMEOUT;
246*1da177e4SLinus Torvalds 			rc = sr_do_ioctl(cd, &cgc);
247*1da177e4SLinus Torvalds 			if (rc == -EINVAL) {
248*1da177e4SLinus Torvalds 				printk(KERN_INFO "%s: Hmm, seems the drive "
249*1da177e4SLinus Torvalds 				       "doesn't support multisession CD's\n",
250*1da177e4SLinus Torvalds 				       cd->cdi.name);
251*1da177e4SLinus Torvalds 				no_multi = 1;
252*1da177e4SLinus Torvalds 				break;
253*1da177e4SLinus Torvalds 			}
254*1da177e4SLinus Torvalds 			if (rc != 0)
255*1da177e4SLinus Torvalds 				break;
256*1da177e4SLinus Torvalds 			min = BCD2BIN(buffer[1]);
257*1da177e4SLinus Torvalds 			sec = BCD2BIN(buffer[2]);
258*1da177e4SLinus Torvalds 			frame = BCD2BIN(buffer[3]);
259*1da177e4SLinus Torvalds 			sector = min * CD_SECS * CD_FRAMES + sec * CD_FRAMES + frame;
260*1da177e4SLinus Torvalds 			if (sector)
261*1da177e4SLinus Torvalds 				sector -= CD_MSF_OFFSET;
262*1da177e4SLinus Torvalds 			sr_set_blocklength(cd, 2048);
263*1da177e4SLinus Torvalds 			break;
264*1da177e4SLinus Torvalds 		}
265*1da177e4SLinus Torvalds 
266*1da177e4SLinus Torvalds 	case VENDOR_WRITER:
267*1da177e4SLinus Torvalds 		cgc.cmd[0] = READ_TOC;
268*1da177e4SLinus Torvalds 		cgc.cmd[8] = 0x04;
269*1da177e4SLinus Torvalds 		cgc.cmd[9] = 0x40;
270*1da177e4SLinus Torvalds 		cgc.buffer = buffer;
271*1da177e4SLinus Torvalds 		cgc.buflen = 0x04;
272*1da177e4SLinus Torvalds 		cgc.quiet = 1;
273*1da177e4SLinus Torvalds 		cgc.data_direction = DMA_FROM_DEVICE;
274*1da177e4SLinus Torvalds 		cgc.timeout = VENDOR_TIMEOUT;
275*1da177e4SLinus Torvalds 		rc = sr_do_ioctl(cd, &cgc);
276*1da177e4SLinus Torvalds 		if (rc != 0) {
277*1da177e4SLinus Torvalds 			break;
278*1da177e4SLinus Torvalds 		}
279*1da177e4SLinus Torvalds 		if ((rc = buffer[2]) == 0) {
280*1da177e4SLinus Torvalds 			printk(KERN_WARNING
281*1da177e4SLinus Torvalds 			       "%s: No finished session\n", cd->cdi.name);
282*1da177e4SLinus Torvalds 			break;
283*1da177e4SLinus Torvalds 		}
284*1da177e4SLinus Torvalds 		cgc.cmd[0] = READ_TOC;	/* Read TOC */
285*1da177e4SLinus Torvalds 		cgc.cmd[6] = rc & 0x7f;	/* number of last session */
286*1da177e4SLinus Torvalds 		cgc.cmd[8] = 0x0c;
287*1da177e4SLinus Torvalds 		cgc.cmd[9] = 0x40;
288*1da177e4SLinus Torvalds 		cgc.buffer = buffer;
289*1da177e4SLinus Torvalds 		cgc.buflen = 12;
290*1da177e4SLinus Torvalds 		cgc.quiet = 1;
291*1da177e4SLinus Torvalds 		cgc.data_direction = DMA_FROM_DEVICE;
292*1da177e4SLinus Torvalds 		cgc.timeout = VENDOR_TIMEOUT;
293*1da177e4SLinus Torvalds 		rc = sr_do_ioctl(cd, &cgc);
294*1da177e4SLinus Torvalds 		if (rc != 0) {
295*1da177e4SLinus Torvalds 			break;
296*1da177e4SLinus Torvalds 		}
297*1da177e4SLinus Torvalds 		sector = buffer[11] + (buffer[10] << 8) +
298*1da177e4SLinus Torvalds 		    (buffer[9] << 16) + (buffer[8] << 24);
299*1da177e4SLinus Torvalds 		break;
300*1da177e4SLinus Torvalds #endif				/* CONFIG_BLK_DEV_SR_VENDOR */
301*1da177e4SLinus Torvalds 
302*1da177e4SLinus Torvalds 	default:
303*1da177e4SLinus Torvalds 		/* should not happen */
304*1da177e4SLinus Torvalds 		printk(KERN_WARNING
305*1da177e4SLinus Torvalds 		   "%s: unknown vendor code (%i), not initialized ?\n",
306*1da177e4SLinus Torvalds 		       cd->cdi.name, cd->vendor);
307*1da177e4SLinus Torvalds 		sector = 0;
308*1da177e4SLinus Torvalds 		no_multi = 1;
309*1da177e4SLinus Torvalds 		break;
310*1da177e4SLinus Torvalds 	}
311*1da177e4SLinus Torvalds 	cd->ms_offset = sector;
312*1da177e4SLinus Torvalds 	cd->xa_flag = 0;
313*1da177e4SLinus Torvalds 	if (CDS_AUDIO != sr_disk_status(cdi) && 1 == sr_is_xa(cd))
314*1da177e4SLinus Torvalds 		cd->xa_flag = 1;
315*1da177e4SLinus Torvalds 
316*1da177e4SLinus Torvalds 	if (2048 != cd->device->sector_size) {
317*1da177e4SLinus Torvalds 		sr_set_blocklength(cd, 2048);
318*1da177e4SLinus Torvalds 	}
319*1da177e4SLinus Torvalds 	if (no_multi)
320*1da177e4SLinus Torvalds 		cdi->mask |= CDC_MULTI_SESSION;
321*1da177e4SLinus Torvalds 
322*1da177e4SLinus Torvalds #ifdef DEBUG
323*1da177e4SLinus Torvalds 	if (sector)
324*1da177e4SLinus Torvalds 		printk(KERN_DEBUG "%s: multisession offset=%lu\n",
325*1da177e4SLinus Torvalds 		       cd->cdi.name, sector);
326*1da177e4SLinus Torvalds #endif
327*1da177e4SLinus Torvalds 	kfree(buffer);
328*1da177e4SLinus Torvalds 	return rc;
329*1da177e4SLinus Torvalds }
330