Commit 4c800eed authored by Stephen M. Cameron's avatar Stephen M. Cameron Committed by Jens Axboe

cciss: factor out cciss_setintinfo

Signed-off-by: default avatarStephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
parent 576e661c
...@@ -1260,56 +1260,54 @@ static int cciss_getintinfo(ctlr_info_t *h, void __user *argp) ...@@ -1260,56 +1260,54 @@ static int cciss_getintinfo(ctlr_info_t *h, void __user *argp)
return 0; return 0;
} }
static int cciss_ioctl(struct block_device *bdev, fmode_t mode, static int cciss_setintinfo(ctlr_info_t *h, void __user *argp)
unsigned int cmd, unsigned long arg)
{ {
struct gendisk *disk = bdev->bd_disk;
ctlr_info_t *h = get_host(disk);
drive_info_struct *drv = get_drv(disk);
void __user *argp = (void __user *)arg;
dev_dbg(&h->pdev->dev, "cciss_ioctl: Called with cmd=%x %lx\n",
cmd, arg);
switch (cmd) {
case CCISS_GETPCIINFO:
return cciss_getpciinfo(h, argp);
case CCISS_GETINTINFO:
return cciss_getintinfo(h, argp);
case CCISS_SETINTINFO:
{
cciss_coalint_struct intinfo; cciss_coalint_struct intinfo;
unsigned long flags; unsigned long flags;
int i; int i;
if (!arg) if (!argp)
return -EINVAL; return -EINVAL;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user if (copy_from_user(&intinfo, argp, sizeof(intinfo)))
(&intinfo, argp, sizeof(cciss_coalint_struct)))
return -EFAULT; return -EFAULT;
if ((intinfo.delay == 0) && (intinfo.count == 0)) if ((intinfo.delay == 0) && (intinfo.count == 0))
return -EINVAL; return -EINVAL;
spin_lock_irqsave(&h->lock, flags); spin_lock_irqsave(&h->lock, flags);
/* Update the field, and then ring the doorbell */ /* Update the field, and then ring the doorbell */
writel(intinfo.delay, writel(intinfo.delay, &(h->cfgtable->HostWrite.CoalIntDelay));
&(h->cfgtable->HostWrite.CoalIntDelay)); writel(intinfo.count, &(h->cfgtable->HostWrite.CoalIntCount));
writel(intinfo.count,
&(h->cfgtable->HostWrite.CoalIntCount));
writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL); writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL);
for (i = 0; i < MAX_IOCTL_CONFIG_WAIT; i++) { for (i = 0; i < MAX_IOCTL_CONFIG_WAIT; i++) {
if (!(readl(h->vaddr + SA5_DOORBELL) if (!(readl(h->vaddr + SA5_DOORBELL) & CFGTBL_ChangeReq))
& CFGTBL_ChangeReq))
break; break;
/* delay and try again */ udelay(1000); /* delay and try again */
udelay(1000);
} }
spin_unlock_irqrestore(&h->lock, flags); spin_unlock_irqrestore(&h->lock, flags);
if (i >= MAX_IOCTL_CONFIG_WAIT) if (i >= MAX_IOCTL_CONFIG_WAIT)
return -EAGAIN; return -EAGAIN;
return 0; return 0;
} }
static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
struct gendisk *disk = bdev->bd_disk;
ctlr_info_t *h = get_host(disk);
drive_info_struct *drv = get_drv(disk);
void __user *argp = (void __user *)arg;
dev_dbg(&h->pdev->dev, "cciss_ioctl: Called with cmd=%x %lx\n",
cmd, arg);
switch (cmd) {
case CCISS_GETPCIINFO:
return cciss_getpciinfo(h, argp);
case CCISS_GETINTINFO:
return cciss_getintinfo(h, argp);
case CCISS_SETINTINFO:
return cciss_setintinfo(h, argp);
case CCISS_GETNODENAME: case CCISS_GETNODENAME:
{ {
NodeName_type NodeName; NodeName_type NodeName;
......
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