Re: 2.1.10 FYI

Gerd Knorr (kraxel@cs.tu-berlin.de)
Sat, 16 Nov 1996 15:24:56 +0100 (MET)


On Sat, 16 Nov 1996, Gerd Knorr wrote:

> > The ide-cd driver simply adds a cast to suppress the compiler warning.

> > ---> *(int *)&devinfo->speed = 0;
> > ---> *(int *)&devinfo->capacity = nslots;

> + (int)scsi_CDs[i].cdi.speed = 1;
> + (int)scsi_CDs[i].cdi.capacity = 1;

Aargh! Tried to make it better, but forgot to reverse the ucdrom.h changes
before trying if it works :-(

Is'nt there a way to get around this read-only warning with a simple cast?
I don't like this complicated reference-cast-dereference construct just
for avoiding a warning...

Anyway, here is the *working* version.

Gerd

--------------------------------------------------------------------
--- linux/drivers/scsi/sr.c-2.1.10 Sat Nov 16 09:17:18 1996
+++ linux/drivers/scsi/sr.c Sat Nov 16 15:10:51 1996
@@ -793,8 +793,8 @@
scsi_CDs[i].cdi.handle = &scsi_CDs[i];
scsi_CDs[i].cdi.dev = MKDEV(MAJOR_NR,i);
scsi_CDs[i].cdi.mask = 0;
- scsi_CDs[i].cdi.speed = 1;
- scsi_CDs[i].cdi.capacity = 1;
+ *(int*)&scsi_CDs[i].cdi.speed = 1;
+ *(int*)&scsi_CDs[i].cdi.capacity = 1;
register_cdrom(&scsi_CDs[i].cdi, "sr");

#ifdef CONFIG_BLK_DEV_SR_VENDOR