diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-02-16 20:40:24 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-02-16 20:40:24 -0500 |
commit | c94964a4555eb58be3f45edf2b63a2b3f549ef29 (patch) | |
tree | a8a0bf41a6c2b675e8f376e870f26724e5870327 /drivers/ide/ide-floppy.c | |
parent | 7b77d864af29c193f6cee8338dbda40accb9b27b (diff) |
ide: remove ide_drive_t.usage
This field is no longer used by the core IDE code so fix ide-{disk,floppy}
drivers to keep openers count in the driver specific objects and remove
it from ide-{cd,scsi,tape} drivers (it was write-only).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 07fa37d84df2..61969415c57b 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -279,6 +279,7 @@ typedef struct ide_floppy_obj { | |||
279 | ide_driver_t *driver; | 279 | ide_driver_t *driver; |
280 | struct gendisk *disk; | 280 | struct gendisk *disk; |
281 | struct kref kref; | 281 | struct kref kref; |
282 | unsigned int openers; /* protected by BKL for now */ | ||
282 | 283 | ||
283 | /* Current packet command */ | 284 | /* Current packet command */ |
284 | idefloppy_pc_t *pc; | 285 | idefloppy_pc_t *pc; |
@@ -1950,9 +1951,9 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
1950 | 1951 | ||
1951 | drive = floppy->drive; | 1952 | drive = floppy->drive; |
1952 | 1953 | ||
1953 | drive->usage++; | 1954 | floppy->openers++; |
1954 | 1955 | ||
1955 | if (drive->usage == 1) { | 1956 | if (floppy->openers == 1) { |
1956 | clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags); | 1957 | clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags); |
1957 | /* Just in case */ | 1958 | /* Just in case */ |
1958 | 1959 | ||
@@ -1970,13 +1971,11 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
1970 | ** capacity of the drive or begin the format - Sam | 1971 | ** capacity of the drive or begin the format - Sam |
1971 | */ | 1972 | */ |
1972 | ) { | 1973 | ) { |
1973 | drive->usage--; | ||
1974 | ret = -EIO; | 1974 | ret = -EIO; |
1975 | goto out_put_floppy; | 1975 | goto out_put_floppy; |
1976 | } | 1976 | } |
1977 | 1977 | ||
1978 | if (floppy->wp && (filp->f_mode & 2)) { | 1978 | if (floppy->wp && (filp->f_mode & 2)) { |
1979 | drive->usage--; | ||
1980 | ret = -EROFS; | 1979 | ret = -EROFS; |
1981 | goto out_put_floppy; | 1980 | goto out_put_floppy; |
1982 | } | 1981 | } |
@@ -1988,13 +1987,13 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
1988 | } | 1987 | } |
1989 | check_disk_change(inode->i_bdev); | 1988 | check_disk_change(inode->i_bdev); |
1990 | } else if (test_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags)) { | 1989 | } else if (test_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags)) { |
1991 | drive->usage--; | ||
1992 | ret = -EBUSY; | 1990 | ret = -EBUSY; |
1993 | goto out_put_floppy; | 1991 | goto out_put_floppy; |
1994 | } | 1992 | } |
1995 | return 0; | 1993 | return 0; |
1996 | 1994 | ||
1997 | out_put_floppy: | 1995 | out_put_floppy: |
1996 | floppy->openers--; | ||
1998 | ide_floppy_put(floppy); | 1997 | ide_floppy_put(floppy); |
1999 | return ret; | 1998 | return ret; |
2000 | } | 1999 | } |
@@ -2008,7 +2007,7 @@ static int idefloppy_release(struct inode *inode, struct file *filp) | |||
2008 | 2007 | ||
2009 | debug_log(KERN_INFO "Reached idefloppy_release\n"); | 2008 | debug_log(KERN_INFO "Reached idefloppy_release\n"); |
2010 | 2009 | ||
2011 | if (drive->usage == 1) { | 2010 | if (floppy->openers == 1) { |
2012 | /* IOMEGA Clik! drives do not support lock/unlock commands */ | 2011 | /* IOMEGA Clik! drives do not support lock/unlock commands */ |
2013 | if (!test_bit(IDEFLOPPY_CLIK_DRIVE, &floppy->flags)) { | 2012 | if (!test_bit(IDEFLOPPY_CLIK_DRIVE, &floppy->flags)) { |
2014 | idefloppy_create_prevent_cmd(&pc, 0); | 2013 | idefloppy_create_prevent_cmd(&pc, 0); |
@@ -2017,7 +2016,8 @@ static int idefloppy_release(struct inode *inode, struct file *filp) | |||
2017 | 2016 | ||
2018 | clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags); | 2017 | clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags); |
2019 | } | 2018 | } |
2020 | drive->usage--; | 2019 | |
2020 | floppy->openers--; | ||
2021 | 2021 | ||
2022 | ide_floppy_put(floppy); | 2022 | ide_floppy_put(floppy); |
2023 | 2023 | ||
@@ -2051,7 +2051,7 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, | |||
2051 | prevent = 0; | 2051 | prevent = 0; |
2052 | /* fall through */ | 2052 | /* fall through */ |
2053 | case CDROM_LOCKDOOR: | 2053 | case CDROM_LOCKDOOR: |
2054 | if (drive->usage > 1) | 2054 | if (floppy->openers > 1) |
2055 | return -EBUSY; | 2055 | return -EBUSY; |
2056 | 2056 | ||
2057 | /* The IOMEGA Clik! Drive doesn't support this command - no room for an eject mechanism */ | 2057 | /* The IOMEGA Clik! Drive doesn't support this command - no room for an eject mechanism */ |
@@ -2073,7 +2073,7 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, | |||
2073 | if (!(file->f_mode & 2)) | 2073 | if (!(file->f_mode & 2)) |
2074 | return -EPERM; | 2074 | return -EPERM; |
2075 | 2075 | ||
2076 | if (drive->usage > 1) { | 2076 | if (floppy->openers > 1) { |
2077 | /* Don't format if someone is using the disk */ | 2077 | /* Don't format if someone is using the disk */ |
2078 | 2078 | ||
2079 | clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, | 2079 | clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, |