Skip to content

Commit

Permalink
cciss: factor out cciss_getfirmver
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
  • Loading branch information
Stephen M. Cameron authored and Jens Axboe committed Sep 10, 2010
1 parent d18dfad commit 8a4f7fb
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,20 @@ static int cciss_getbustypes(ctlr_info_t *h, void __user *argp)
return 0;
}

static int cciss_getfirmver(ctlr_info_t *h, void __user *argp)
{
FirmwareVer_type firmware;

if (!argp)
return -EINVAL;
memcpy(firmware, h->firm_ver, 4);

if (copy_to_user
(argp, firmware, sizeof(FirmwareVer_type)))
return -EFAULT;
return 0;
}

static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
Expand All @@ -1383,18 +1397,7 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
case CCISS_GETBUSTYPES:
return cciss_getbustypes(h, argp);
case CCISS_GETFIRMVER:
{
FirmwareVer_type firmware;

if (!arg)
return -EINVAL;
memcpy(firmware, h->firm_ver, 4);

if (copy_to_user
(argp, firmware, sizeof(FirmwareVer_type)))
return -EFAULT;
return 0;
}
return cciss_getfirmver(h, argp);
case CCISS_GETDRIVVER:
{
DriverVer_type DriverVer = DRIVER_VERSION;
Expand Down

0 comments on commit 8a4f7fb

Please sign in to comment.