Skip to content

Commit

Permalink
block_device_operations->release() should return void
Browse files Browse the repository at this point in the history
The value passed is 0 in all but "it can never happen" cases (and those
only in a couple of drivers) *and* it would've been lost on the way
out anyway, even if something tried to pass something meaningful.
Just don't bother.

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed May 7, 2013
1 parent a8ca889 commit db2a144
Show file tree
Hide file tree
Showing 37 changed files with 62 additions and 121 deletions.
5 changes: 2 additions & 3 deletions arch/um/drivers/ubd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static DEFINE_MUTEX(ubd_lock);
static DEFINE_MUTEX(ubd_mutex); /* replaces BKL, might not be needed */

static int ubd_open(struct block_device *bdev, fmode_t mode);
static int ubd_release(struct gendisk *disk, fmode_t mode);
static void ubd_release(struct gendisk *disk, fmode_t mode);
static int ubd_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg);
static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo);
Expand Down Expand Up @@ -1138,15 +1138,14 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
return err;
}

static int ubd_release(struct gendisk *disk, fmode_t mode)
static void ubd_release(struct gendisk *disk, fmode_t mode)
{
struct ubd *ubd_dev = disk->private_data;

mutex_lock(&ubd_mutex);
if(--ubd_dev->count == 0)
ubd_close_dev(ubd_dev);
mutex_unlock(&ubd_mutex);
return 0;
}

static void cowify_bitmap(__u64 io_offset, int length, unsigned long *cow_mask,
Expand Down
3 changes: 1 addition & 2 deletions arch/xtensa/platforms/iss/simdisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,12 @@ static int simdisk_open(struct block_device *bdev, fmode_t mode)
return 0;
}

static int simdisk_release(struct gendisk *disk, fmode_t mode)
static void simdisk_release(struct gendisk *disk, fmode_t mode)
{
struct simdisk *dev = disk->private_data;
spin_lock(&dev->lock);
--dev->users;
spin_unlock(&dev->lock);
return 0;
}

static const struct block_device_operations simdisk_ops = {
Expand Down
3 changes: 1 addition & 2 deletions drivers/block/amiflop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
return 0;
}

static int floppy_release(struct gendisk *disk, fmode_t mode)
static void floppy_release(struct gendisk *disk, fmode_t mode)
{
struct amiga_floppy_struct *p = disk->private_data;
int drive = p - unit;
Expand All @@ -1654,7 +1654,6 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
floppy_off (drive | 0x40000000);
#endif
mutex_unlock(&amiflop_mutex);
return 0;
}

/*
Expand Down
6 changes: 2 additions & 4 deletions drivers/block/aoe/aoeblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ aoeblk_open(struct block_device *bdev, fmode_t mode)
return -ENODEV;
}

static int
static void
aoeblk_release(struct gendisk *disk, fmode_t mode)
{
struct aoedev *d = disk->private_data;
Expand All @@ -180,11 +180,9 @@ aoeblk_release(struct gendisk *disk, fmode_t mode)
if (--d->nopen == 0) {
spin_unlock_irqrestore(&d->lock, flags);
aoecmd_cfg(d->aoemajor, d->aoeminor);
return 0;
return;
}
spin_unlock_irqrestore(&d->lock, flags);

return 0;
}

static void
Expand Down
5 changes: 2 additions & 3 deletions drivers/block/ataflop.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ static void fd_probe( int drive );
static int fd_test_drive_present( int drive );
static void config_types( void );
static int floppy_open(struct block_device *bdev, fmode_t mode);
static int floppy_release(struct gendisk *disk, fmode_t mode);
static void floppy_release(struct gendisk *disk, fmode_t mode);

/************************* End of Prototypes **************************/

Expand Down Expand Up @@ -1886,7 +1886,7 @@ static int floppy_unlocked_open(struct block_device *bdev, fmode_t mode)
return ret;
}

static int floppy_release(struct gendisk *disk, fmode_t mode)
static void floppy_release(struct gendisk *disk, fmode_t mode)
{
struct atari_floppy_struct *p = disk->private_data;
mutex_lock(&ataflop_mutex);
Expand All @@ -1897,7 +1897,6 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
p->ref = 0;
}
mutex_unlock(&ataflop_mutex);
return 0;
}

static const struct block_device_operations floppy_fops = {
Expand Down
5 changes: 2 additions & 3 deletions drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static irqreturn_t do_cciss_intx(int irq, void *dev_id);
static irqreturn_t do_cciss_msix_intr(int irq, void *dev_id);
static int cciss_open(struct block_device *bdev, fmode_t mode);
static int cciss_unlocked_open(struct block_device *bdev, fmode_t mode);
static int cciss_release(struct gendisk *disk, fmode_t mode);
static void cciss_release(struct gendisk *disk, fmode_t mode);
static int do_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg);
static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
Expand Down Expand Up @@ -1123,7 +1123,7 @@ static int cciss_unlocked_open(struct block_device *bdev, fmode_t mode)
/*
* Close. Sync first.
*/
static int cciss_release(struct gendisk *disk, fmode_t mode)
static void cciss_release(struct gendisk *disk, fmode_t mode)
{
ctlr_info_t *h;
drive_info_struct *drv;
Expand All @@ -1135,7 +1135,6 @@ static int cciss_release(struct gendisk *disk, fmode_t mode)
drv->usage_count--;
h->usage_count--;
mutex_unlock(&cciss_mutex);
return 0;
}

static int do_ioctl(struct block_device *bdev, fmode_t mode,
Expand Down
6 changes: 2 additions & 4 deletions drivers/block/cpqarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static int sendcmd(
unsigned int log_unit );

static int ida_unlocked_open(struct block_device *bdev, fmode_t mode);
static int ida_release(struct gendisk *disk, fmode_t mode);
static void ida_release(struct gendisk *disk, fmode_t mode);
static int ida_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg);
static int ida_getgeo(struct block_device *bdev, struct hd_geometry *geo);
static int ida_ctlr_ioctl(ctlr_info_t *h, int dsk, ida_ioctl_t *io);
Expand Down Expand Up @@ -856,16 +856,14 @@ static int ida_unlocked_open(struct block_device *bdev, fmode_t mode)
/*
* Close. Sync first.
*/
static int ida_release(struct gendisk *disk, fmode_t mode)
static void ida_release(struct gendisk *disk, fmode_t mode)
{
ctlr_info_t *host;

mutex_lock(&cpqarray_mutex);
host = get_host(disk);
host->usage_count--;
mutex_unlock(&cpqarray_mutex);

return 0;
}

/*
Expand Down
5 changes: 2 additions & 3 deletions drivers/block/drbd/drbd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int drbd_asender(struct drbd_thread *);

int drbd_init(void);
static int drbd_open(struct block_device *bdev, fmode_t mode);
static int drbd_release(struct gendisk *gd, fmode_t mode);
static void drbd_release(struct gendisk *gd, fmode_t mode);
static int w_md_sync(struct drbd_work *w, int unused);
static void md_sync_timer_fn(unsigned long data);
static int w_bitmap_io(struct drbd_work *w, int unused);
Expand Down Expand Up @@ -1849,13 +1849,12 @@ static int drbd_open(struct block_device *bdev, fmode_t mode)
return rv;
}

static int drbd_release(struct gendisk *gd, fmode_t mode)
static void drbd_release(struct gendisk *gd, fmode_t mode)
{
struct drbd_conf *mdev = gd->private_data;
mutex_lock(&drbd_main_mutex);
mdev->open_cnt--;
mutex_unlock(&drbd_main_mutex);
return 0;
}

static void drbd_set_defaults(struct drbd_conf *mdev)
Expand Down
4 changes: 1 addition & 3 deletions drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -3601,7 +3601,7 @@ static void __init config_types(void)
pr_cont("\n");
}

static int floppy_release(struct gendisk *disk, fmode_t mode)
static void floppy_release(struct gendisk *disk, fmode_t mode)
{
int drive = (long)disk->private_data;

Expand All @@ -3615,8 +3615,6 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
opened_bdev[drive] = NULL;
mutex_unlock(&open_lock);
mutex_unlock(&floppy_mutex);

return 0;
}

/*
Expand Down
6 changes: 2 additions & 4 deletions drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ static int lo_open(struct block_device *bdev, fmode_t mode)
return err;
}

static int lo_release(struct gendisk *disk, fmode_t mode)
static void lo_release(struct gendisk *disk, fmode_t mode)
{
struct loop_device *lo = disk->private_data;
int err;
Expand All @@ -1535,7 +1535,7 @@ static int lo_release(struct gendisk *disk, fmode_t mode)
*/
err = loop_clr_fd(lo);
if (!err)
goto out_unlocked;
return;
} else {
/*
* Otherwise keep thread (if running) and config,
Expand All @@ -1546,8 +1546,6 @@ static int lo_release(struct gendisk *disk, fmode_t mode)

out:
mutex_unlock(&lo->lo_ctl_mutex);
out_unlocked:
return 0;
}

static const struct block_device_operations lo_fops = {
Expand Down
3 changes: 1 addition & 2 deletions drivers/block/paride/pcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,12 @@ static int pcd_block_open(struct block_device *bdev, fmode_t mode)
return ret;
}

static int pcd_block_release(struct gendisk *disk, fmode_t mode)
static void pcd_block_release(struct gendisk *disk, fmode_t mode)
{
struct pcd_unit *cd = disk->private_data;
mutex_lock(&pcd_mutex);
cdrom_release(&cd->info, mode);
mutex_unlock(&pcd_mutex);
return 0;
}

static int pcd_block_ioctl(struct block_device *bdev, fmode_t mode,
Expand Down
4 changes: 1 addition & 3 deletions drivers/block/paride/pd.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,16 +783,14 @@ static int pd_ioctl(struct block_device *bdev, fmode_t mode,
}
}

static int pd_release(struct gendisk *p, fmode_t mode)
static void pd_release(struct gendisk *p, fmode_t mode)
{
struct pd_unit *disk = p->private_data;

mutex_lock(&pd_mutex);
if (!--disk->access && disk->removable)
pd_special_command(disk, pd_door_unlock);
mutex_unlock(&pd_mutex);

return 0;
}

static unsigned int pd_check_events(struct gendisk *p, unsigned int clearing)
Expand Down
9 changes: 4 additions & 5 deletions drivers/block/paride/pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static int pf_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg);
static int pf_getgeo(struct block_device *bdev, struct hd_geometry *geo);

static int pf_release(struct gendisk *disk, fmode_t mode);
static void pf_release(struct gendisk *disk, fmode_t mode);

static int pf_detect(void);
static void do_pf_read(void);
Expand Down Expand Up @@ -360,14 +360,15 @@ static int pf_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, u
return 0;
}

static int pf_release(struct gendisk *disk, fmode_t mode)
static void pf_release(struct gendisk *disk, fmode_t mode)
{
struct pf_unit *pf = disk->private_data;

mutex_lock(&pf_mutex);
if (pf->access <= 0) {
mutex_unlock(&pf_mutex);
return -EINVAL;
WARN_ON(1);
return;
}

pf->access--;
Expand All @@ -376,8 +377,6 @@ static int pf_release(struct gendisk *disk, fmode_t mode)
pf_lock(pf, 0);

mutex_unlock(&pf_mutex);
return 0;

}

static unsigned int pf_check_events(struct gendisk *disk, unsigned int clearing)
Expand Down
4 changes: 1 addition & 3 deletions drivers/block/pktcdvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2376,10 +2376,9 @@ static int pkt_open(struct block_device *bdev, fmode_t mode)
return ret;
}

static int pkt_close(struct gendisk *disk, fmode_t mode)
static void pkt_close(struct gendisk *disk, fmode_t mode)
{
struct pktcdvd_device *pd = disk->private_data;
int ret = 0;

mutex_lock(&pktcdvd_mutex);
mutex_lock(&ctl_mutex);
Expand All @@ -2391,7 +2390,6 @@ static int pkt_close(struct gendisk *disk, fmode_t mode)
}
mutex_unlock(&ctl_mutex);
mutex_unlock(&pktcdvd_mutex);
return ret;
}


Expand Down
4 changes: 1 addition & 3 deletions drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ static int rbd_open(struct block_device *bdev, fmode_t mode)
return 0;
}

static int rbd_release(struct gendisk *disk, fmode_t mode)
static void rbd_release(struct gendisk *disk, fmode_t mode)
{
struct rbd_device *rbd_dev = disk->private_data;
unsigned long open_count_before;
Expand All @@ -424,8 +424,6 @@ static int rbd_release(struct gendisk *disk, fmode_t mode)
mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
put_device(&rbd_dev->dev);
mutex_unlock(&ctl_mutex);

return 0;
}

static const struct block_device_operations rbd_bd_ops = {
Expand Down
4 changes: 1 addition & 3 deletions drivers/block/swim.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ static int floppy_unlocked_open(struct block_device *bdev, fmode_t mode)
return ret;
}

static int floppy_release(struct gendisk *disk, fmode_t mode)
static void floppy_release(struct gendisk *disk, fmode_t mode)
{
struct floppy_state *fs = disk->private_data;
struct swim __iomem *base = fs->swd->base;
Expand All @@ -687,8 +687,6 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
if (fs->ref_count == 0)
swim_motor(base, OFF);
mutex_unlock(&swim_mutex);

return 0;
}

static int floppy_ioctl(struct block_device *bdev, fmode_t mode,
Expand Down
5 changes: 2 additions & 3 deletions drivers/block/swim3.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static int fd_eject(struct floppy_state *fs);
static int floppy_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long param);
static int floppy_open(struct block_device *bdev, fmode_t mode);
static int floppy_release(struct gendisk *disk, fmode_t mode);
static void floppy_release(struct gendisk *disk, fmode_t mode);
static unsigned int floppy_check_events(struct gendisk *disk,
unsigned int clearing);
static int floppy_revalidate(struct gendisk *disk);
Expand Down Expand Up @@ -1017,7 +1017,7 @@ static int floppy_unlocked_open(struct block_device *bdev, fmode_t mode)
return ret;
}

static int floppy_release(struct gendisk *disk, fmode_t mode)
static void floppy_release(struct gendisk *disk, fmode_t mode)
{
struct floppy_state *fs = disk->private_data;
struct swim3 __iomem *sw = fs->swim3;
Expand All @@ -1029,7 +1029,6 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
swim3_select(fs, RELAX);
}
mutex_unlock(&swim3_mutex);
return 0;
}

static unsigned int floppy_check_events(struct gendisk *disk,
Expand Down
3 changes: 1 addition & 2 deletions drivers/block/xen-blkfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,7 @@ static int blkif_open(struct block_device *bdev, fmode_t mode)
return err;
}

static int blkif_release(struct gendisk *disk, fmode_t mode)
static void blkif_release(struct gendisk *disk, fmode_t mode)
{
struct blkfront_info *info = disk->private_data;
struct block_device *bdev;
Expand Down Expand Up @@ -1658,7 +1658,6 @@ static int blkif_release(struct gendisk *disk, fmode_t mode)
out:
bdput(bdev);
mutex_unlock(&blkfront_mutex);
return 0;
}

static const struct block_device_operations xlvbd_block_fops =
Expand Down
Loading

0 comments on commit db2a144

Please sign in to comment.