SCSI: osst: remove gendisk from private data struct
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 SCSI: osst: remove gendisk from private data struct
Since gendisk is now part of scsi_device, don't store this struct in private data struct
drivers/scsi/osst.c +1 -1
@@ -191,7 +191,7 @@ static int osst_write_error_recovery(strstatic inline char *tape_name (struct osst_tape *tape) { -return tape->drive->disk_name; +return tape->device->disk->disk_name; }
/* Routines that handle the interaction with mid-layer SCSI routines */
@@ -5803,7 +5803,6 @@ static int osst_probe(struct device *dev
drive->private_data = &tpnt->driver; sprintf(drive->disk_name, "osst%d", dev_num); tpnt->driver = &osst_template;
- tpnt->drive = drive;
tpnt->in_use = 0;
tpnt->capacity = 0xfffff;
tpnt->dirty = 0;
@@ -5885,6 +5884,8 @@ static int osst_probe(struct device *dev
goto out_free_sysfs1;
}
+ SDp->disk = drive;
+
sdev_printk(KERN_INFO, SDp,
"osst :I: Attached OnStream %.5s tape as %s\n", SDp->model, tape_name(tpnt));
@@ -5915,7 +5916,7 @@ static int osst_remove(struct device *de
osst_sysfs_destroy(MKDEV(OSST_MAJOR, i)); osst_sysfs_destroy(MKDEV(OSST_MAJOR, i+128)); tpnt->device = NULL;
- put_disk(tpnt->drive);
+ put_disk(tpnt->device->disk);
os_scsi_tapes[i] = NULL; osst_nr_dev--; write_unlock(&os_scsi_tapes_lock);
@@ -5988,7 +5989,7 @@ static void __exit exit_osst (void)
normalize_buffer(STp->buffer); kfree(STp->buffer);
}
- put_disk(STp->drive);
+ put_disk(STp->device->disk);
kfree(STp);
}
kfree(os_scsi_tapes);
drivers/scsi/osst.h +0 -1
@@ -623,7 +623,6 @@ struct osst_tape {unsigned char last_cmnd[6 ];unsigned char last_sense[16 ];#endif -struct gendisk *drive; } ;/* scsi tape command */
PATCH 2/3 SCSI: sr: remove gendisk from private data struct
In reply to a message not in the archiveSince gendisk is now part of scsi_device, don't store this struct in private data struct
drivers/scsi/sr.c +9 -8
@@ -265,9 +265,9 @@ static void rw_intr(struct scsi_cmnd * S* last 75 2K sectors, we decrease the saved size * value. */ -if (error_sector <get_capacity (cd->disk) && +if (error_sector <get_capacity (cd->device->disk) && cd->capacity - error_sector <4 *75 ) -set_capacity (cd->disk, error_sector); +set_capacity (cd->device->disk, error_sector);break ;case RECOVERED_ERROR :
@@ -302,7 +302,7 @@ static int sr_init_command(struct scsi_cstruct scsi_cd *cd =scsi_cd (SCpnt->request->rq_disk);SCSI_LOG_HLQUEUE (1 ,printk ("Doing sr request, dev = %s, block = %d\n" , - cd->disk->disk_name, block)); + cd->device->disk->disk_name, block));if (!cd->device || !scsi_device_online (cd->device)) { SCSI_LOG_HLQUEUE(2, printk("Finishing %ld sectors\n",
@@ -571,9 +571,7 @@ static int sr_probe(struct device *dev) disk->flags =GENHD_FL_CD ; cd->device = sdev; - cd->disk = disk; cd->driver = &sr_template; - cd->disk = disk; cd->capacity =0x1fffff ; cd->device->changed =1 ;/* force recheck CD type */ cd->use =1 ;
@@ -603,7 +601,10 @@ static int sr_probe(struct device *dev)dev_set_drvdata (dev, cd); disk->flags |=GENHD_FL_REMOVABLE ; +if (sdev->media_change_notify) + disk->flags |=GENHD_FL_MEDIA_CHANGE_NOTIFY ;add_disk (disk); + sdev->disk = disk;sdev_printk (KERN_DEBUG , sdev,"Attached scsi CD-ROM %s\n" , cd->cdi.name);
@@ -688,7 +689,7 @@ static void get_sectorsize(struct scsi_c* Add this so that we have the ability to correctly gauge * what the device is capable of. */ -set_capacity (cd->disk, cd->capacity); +set_capacity (cd->device->disk, cd->capacity); } queue = cd->device->request_queue;
@@ -850,7 +851,7 @@ static int sr_packet(struct cdrom_devicestatic void sr_kref_release (struct kref *kref) { struct scsi_cd *cd = container_of(kref, struct scsi_cd, kref); -struct gendisk *disk = cd->disk; +struct gendisk *disk = cd->device->disk;spin_lock (&sr_index_lock);clear_bit (disk->first_minor, sr_index_bits);
@@ -869,7 +870,7 @@ static int sr_remove(struct device *dev) {struct scsi_cd *cd =dev_get_drvdata (dev); -del_gendisk (cd->disk); +del_gendisk (cd->device->disk);mutex_lock (&sr_ref_mutex);kref_put (&cd->kref, sr_kref_release);
drivers/scsi/sr.h +1 -2
@@ -38,10 +38,9 @@ typedef struct scsi_cd { unsigned readcd_known:1; /* drive supports READ_CD (0xbe) */ unsigned readcd_cdda:1; /* reading audio data using READ_CD */struct cdrom_device_info cdi; -/* We hold gendisk and scsi_device references on probe and use +/* We hold scsi_device references on probe and use * the refs on this kref to decide when to release them */ struct kref kref; -struct gendisk *disk; } Scsi_CD;int sr_do_ioctl (Scsi_CD *,struct packet_command *);
PATCH 3/3 SCSI: st: remove gendisk from private data struct
In reply to a message not in the archiveSince gendisk is now part of scsi_device, don't store this struct in private data struct
drivers/scsi/st.c +7 -5
@@ -306,7 +306,7 @@ static char * st_incompatible(struct scsstatic inline char *tape_name (struct scsi_tape *tape) { -return tape->disk->disk_name; +return tape->device->disk->disk_name; }
@@ -3549,7 +3549,8 @@ static int st_ioctl(struct inode *inode, !capable(CAP_SYS_RAWIO)) i = -EPERM ; else - i =scsi_cmd_ioctl (file, STp->disk, cmd_in, p); + i =scsi_cmd_ioctl (file, STp->device->disk, + cmd_in, p);if (i != -ENOTTY )return i;break ;
@@ -3961,7 +3962,6 @@ static int st_probe(struct device *dev) goto out_put_disk; }kref_init (&tpnt->kref); - tpnt->disk = disk;sprintf (disk->disk_name,"st%d" , i); disk->private_data = &tpnt->driver; disk->queue = SDp->request_queue;
@@ -4063,6 +4063,8 @@ static int st_probe(struct device *dev) goto out_free_tape; } + SDp->disk = disk; +sdev_printk (KERN_NOTICE , SDp,"Attached scsi tape %s\n" ,tape_name (tpnt)); sdev_printk(KERN_INFO, SDp, "%s: try direct i/o: %s (alignment %d B)\n",
@@ -4151,7 +4153,7 @@ static int st_remove(struct device *dev)static void scsi_tape_release (struct kref *kref) {struct scsi_tape *tpnt =to_scsi_tape (kref); -struct gendisk *disk = tpnt->disk; +struct gendisk *disk = tpnt->device->disk; tpnt->device =NULL ;
@@ -4348,7 +4350,7 @@ static int do_create_class_files(structfirst modes always get the same names */ i = mode << (4 -ST_NBR_MODE_BITS );snprintf (name,10 ,"%s%s%s" , rew ?"n" :"" , - STp->disk->disk_name, st_formats[i]); + STp->device->disk->disk_name, st_formats[i]); st_class_member = class_device_create(st_sysfs_class, NULL, MKDEV(SCSI_TAPE_MAJOR,
drivers/scsi/st.h +0 -1
@@ -167,7 +167,6 @@ struct scsi_tape {unsigned char last_cmnd[6 ];unsigned char last_sense[16 ];#endif -struct gendisk *disk;struct kref kref; };