diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2010-08-26 13:55:34 -0500 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-09-10 12:12:28 +0200 |
commit | 0a25a5aee727c4a56c7d39e0e595947b02ee2696 (patch) | |
tree | 61262c46f4547de8b87c4a91df5e195f7fe4e76c /drivers/block/cciss.c | |
parent | ee86273062cbb310665fe49e1f1937d2cf85b0b9 (diff) | |
download | lwn-0a25a5aee727c4a56c7d39e0e595947b02ee2696.tar.gz lwn-0a25a5aee727c4a56c7d39e0e595947b02ee2696.zip |
cciss: factor out cciss_getpciinfo
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r-- | drivers/block/cciss.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 31064df1370a..4fe5e427c480 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -1230,9 +1230,22 @@ static void check_ioctl_unit_attention(ctlr_info_t *h, CommandList_struct *c) c->err_info->ScsiStatus != SAM_STAT_CHECK_CONDITION) (void)check_for_unit_attention(h, c); } -/* - * ioctl - */ + +static int cciss_getpciinfo(ctlr_info_t *h, void __user *argp) +{ + cciss_pci_info_struct pciinfo; + + if (!argp) + return -EINVAL; + pciinfo.domain = pci_domain_nr(h->pdev->bus); + pciinfo.bus = h->pdev->bus->number; + pciinfo.dev_fn = h->pdev->devfn; + pciinfo.board_id = h->board_id; + if (copy_to_user(argp, &pciinfo, sizeof(cciss_pci_info_struct))) + return -EFAULT; + return 0; +} + static int cciss_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { @@ -1245,20 +1258,7 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode, cmd, arg); switch (cmd) { case CCISS_GETPCIINFO: - { - cciss_pci_info_struct pciinfo; - - if (!arg) - return -EINVAL; - pciinfo.domain = pci_domain_nr(h->pdev->bus); - pciinfo.bus = h->pdev->bus->number; - pciinfo.dev_fn = h->pdev->devfn; - pciinfo.board_id = h->board_id; - if (copy_to_user - (argp, &pciinfo, sizeof(cciss_pci_info_struct))) - return -EFAULT; - return 0; - } + return cciss_getpciinfo(h, argp); case CCISS_GETINTINFO: { cciss_coalint_struct intinfo; |