Commit 99db2bb5 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] IDE cleanups (2.5; similar to ones done for other drivers)

	OK, before the next bunch of gendisk merges, here comes a couple
of 2.5 IDE cleanups.

	a) exclusion between rereading partition tables and open() is done
in fs/block_dev.c these days, so homegrown one in ide.c is redundant - that
code _never_ blocks now.  Removed, just as it had been done with counterparts
in other drivers.

	b) blk_ioctl() calls are done in blkdev_ioctl() now; driver doesn't
need to handle them.  Again, removed as it had been done in all other drivers.
parent e42e97d6
...@@ -275,7 +275,6 @@ static void init_hwif_data (unsigned int index) ...@@ -275,7 +275,6 @@ static void init_hwif_data (unsigned int index)
drive->name[1] = 'd'; drive->name[1] = 'd';
drive->name[2] = 'a' + (index * MAX_DRIVES) + unit; drive->name[2] = 'a' + (index * MAX_DRIVES) + unit;
drive->max_failures = IDE_DEFAULT_MAX_FAILURES; drive->max_failures = IDE_DEFAULT_MAX_FAILURES;
init_waitqueue_head(&drive->wqueue);
INIT_LIST_HEAD(&drive->list); INIT_LIST_HEAD(&drive->list);
} }
} }
...@@ -1805,8 +1804,6 @@ static int ide_open (struct inode * inode, struct file * filp) ...@@ -1805,8 +1804,6 @@ static int ide_open (struct inode * inode, struct file * filp)
#endif /* defined(CONFIG_BLK_DEV_IDESCSI) && defined(CONFIG_SCSI) */ #endif /* defined(CONFIG_BLK_DEV_IDESCSI) && defined(CONFIG_SCSI) */
} }
#endif /* CONFIG_KMOD */ #endif /* CONFIG_KMOD */
while (drive->busy)
sleep_on(&drive->wqueue);
drive->usage++; drive->usage++;
if (drive->driver != NULL) if (drive->driver != NULL)
return DRIVER(drive)->open(inode, filp, drive); return DRIVER(drive)->open(inode, filp, drive);
...@@ -1877,7 +1874,7 @@ struct seq_operations ide_drivers_op = { ...@@ -1877,7 +1874,7 @@ struct seq_operations ide_drivers_op = {
*/ */
int ide_replace_subdriver (ide_drive_t *drive, const char *driver) int ide_replace_subdriver (ide_drive_t *drive, const char *driver)
{ {
if (!drive->present || drive->busy || drive->usage) if (!drive->present || drive->usage)
goto abort; goto abort;
if (drive->driver != NULL && DRIVER(drive)->cleanup(drive)) if (drive->driver != NULL && DRIVER(drive)->cleanup(drive))
goto abort; goto abort;
...@@ -1961,7 +1958,7 @@ void ide_unregister (unsigned int index) ...@@ -1961,7 +1958,7 @@ void ide_unregister (unsigned int index)
drive = &hwif->drives[unit]; drive = &hwif->drives[unit];
if (!drive->present) if (!drive->present)
continue; continue;
if (drive->busy || drive->usage) if (drive->usage)
goto abort; goto abort;
if (drive->driver != NULL && DRIVER(drive)->cleanup(drive)) if (drive->driver != NULL && DRIVER(drive)->cleanup(drive))
goto abort; goto abort;
...@@ -2653,18 +2650,6 @@ static int ide_ioctl (struct inode *inode, struct file *file, ...@@ -2653,18 +2650,6 @@ static int ide_ioctl (struct inode *inode, struct file *file,
} }
return 0; return 0;
} }
case BLKGETSIZE:
case BLKGETSIZE64:
case BLKROSET:
case BLKROGET:
case BLKFLSBUF:
case BLKSSZGET:
case BLKPG:
case BLKELVGET:
case BLKELVSET:
case BLKBSZGET:
case BLKBSZSET:
return blk_ioctl(inode->i_bdev, cmd, arg);
case CDROMEJECT: case CDROMEJECT:
case CDROMCLOSETRAY: case CDROMCLOSETRAY:
...@@ -3434,7 +3419,7 @@ int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int versio ...@@ -3434,7 +3419,7 @@ int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int versio
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
if (version != IDE_SUBDRIVER_VERSION || !drive->present || if (version != IDE_SUBDRIVER_VERSION || !drive->present ||
drive->driver != NULL || drive->busy || drive->usage) { drive->driver != NULL || drive->usage) {
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
return 1; return 1;
} }
...@@ -3463,8 +3448,7 @@ int ide_unregister_subdriver (ide_drive_t *drive) ...@@ -3463,8 +3448,7 @@ int ide_unregister_subdriver (ide_drive_t *drive)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
if (drive->usage || drive->busy || if (drive->usage || drive->driver == NULL || DRIVER(drive)->busy) {
drive->driver == NULL || DRIVER(drive)->busy) {
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
return 1; return 1;
} }
......
...@@ -464,7 +464,6 @@ typedef struct ide_drive_s { ...@@ -464,7 +464,6 @@ typedef struct ide_drive_s {
byte nice1; /* flag: give potential excess bandwidth */ byte nice1; /* flag: give potential excess bandwidth */
unsigned present : 1; /* drive is physically present */ unsigned present : 1; /* drive is physically present */
unsigned noprobe : 1; /* from: hdx=noprobe */ unsigned noprobe : 1; /* from: hdx=noprobe */
unsigned busy : 1; /* currently doing revalidate_disk() */
unsigned removable : 1; /* 1 if need to do check_media_change */ unsigned removable : 1; /* 1 if need to do check_media_change */
unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */ unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */
unsigned no_unmask : 1; /* disallow setting unmask bit */ unsigned no_unmask : 1; /* disallow setting unmask bit */
...@@ -506,7 +505,6 @@ typedef struct ide_drive_s { ...@@ -506,7 +505,6 @@ typedef struct ide_drive_s {
unsigned long long capacity48; /* total number of sectors */ unsigned long long capacity48; /* total number of sectors */
unsigned int drive_data; /* for use by tuneproc/selectproc as needed */ unsigned int drive_data; /* for use by tuneproc/selectproc as needed */
struct hwif_s *hwif; /* actually (ide_hwif_t *) */ struct hwif_s *hwif; /* actually (ide_hwif_t *) */
wait_queue_head_t wqueue; /* used to wait for drive in open() */
struct hd_driveid *id; /* drive model identification info */ struct hd_driveid *id; /* drive model identification info */
struct hd_struct *part; /* drive partition table */ struct hd_struct *part; /* drive partition table */
char name[4]; /* drive name, such as "hda" */ char name[4]; /* drive name, such as "hda" */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment