aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sbus/char/openprom.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-04-26 18:24:05 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2010-05-16 23:27:41 -0400
commit55929332c92e5d34d65a8f784604c92677ea3e15 (patch)
tree555e922d470336d07ace32bb564ac5358379a3c4 /drivers/sbus/char/openprom.c
parent703c631ebbcadcfd861d01e697fdda7c388fec9a (diff)
drivers: Push down BKL into various drivers
These are the last remaining device drivers using the ->ioctl file operation in the drivers directory (except from v4l drivers). [fweisbec: drop i8k pushdown as it has been done from procfs pushdown branch already] Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'drivers/sbus/char/openprom.c')
-rw-r--r--drivers/sbus/char/openprom.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index fc2f676e984d..d53e62ab09da 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -298,9 +298,9 @@ static int opromgetbootargs(void __user *argp, struct openpromio *op, int bufsiz
298/* 298/*
299 * SunOS and Solaris /dev/openprom ioctl calls. 299 * SunOS and Solaris /dev/openprom ioctl calls.
300 */ 300 */
301static int openprom_sunos_ioctl(struct inode * inode, struct file * file, 301static long openprom_sunos_ioctl(struct file * file,
302 unsigned int cmd, unsigned long arg, 302 unsigned int cmd, unsigned long arg,
303 struct device_node *dp) 303 struct device_node *dp)
304{ 304{
305 DATA *data = file->private_data; 305 DATA *data = file->private_data;
306 struct openpromio *opp = NULL; 306 struct openpromio *opp = NULL;
@@ -316,6 +316,8 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
316 if (bufsize < 0) 316 if (bufsize < 0)
317 return bufsize; 317 return bufsize;
318 318
319 lock_kernel();
320
319 switch (cmd) { 321 switch (cmd) {
320 case OPROMGETOPT: 322 case OPROMGETOPT:
321 case OPROMGETPROP: 323 case OPROMGETPROP:
@@ -365,6 +367,8 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
365 } 367 }
366 368
367 kfree(opp); 369 kfree(opp);
370 unlock_kernel();
371
368 return error; 372 return error;
369} 373}
370 374
@@ -547,13 +551,14 @@ static int opiocgetnext(unsigned int cmd, void __user *argp)
547 return 0; 551 return 0;
548} 552}
549 553
550static int openprom_bsd_ioctl(struct inode * inode, struct file * file, 554static int openprom_bsd_ioctl(struct file * file,
551 unsigned int cmd, unsigned long arg) 555 unsigned int cmd, unsigned long arg)
552{ 556{
553 DATA *data = (DATA *) file->private_data; 557 DATA *data = (DATA *) file->private_data;
554 void __user *argp = (void __user *)arg; 558 void __user *argp = (void __user *)arg;
555 int err; 559 int err;
556 560
561 lock_kernel();
557 switch (cmd) { 562 switch (cmd) {
558 case OPIOCGET: 563 case OPIOCGET:
559 err = opiocget(argp, data); 564 err = opiocget(argp, data);
@@ -570,10 +575,10 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
570 case OPIOCGETOPTNODE: 575 case OPIOCGETOPTNODE:
571 BUILD_BUG_ON(sizeof(phandle) != sizeof(int)); 576 BUILD_BUG_ON(sizeof(phandle) != sizeof(int));
572 577
578 err = 0;
573 if (copy_to_user(argp, &options_node->phandle, sizeof(phandle))) 579 if (copy_to_user(argp, &options_node->phandle, sizeof(phandle)))
574 return -EFAULT; 580 err = -EFAULT;
575 581 break;
576 return 0;
577 582
578 case OPIOCGETNEXT: 583 case OPIOCGETNEXT:
579 case OPIOCGETCHILD: 584 case OPIOCGETCHILD:
@@ -581,9 +586,10 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
581 break; 586 break;
582 587
583 default: 588 default:
584 return -EINVAL; 589 err = -EINVAL;
585 590 break;
586 }; 591 };
592 unlock_kernel();
587 593
588 return err; 594 return err;
589} 595}
@@ -592,8 +598,8 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
592/* 598/*
593 * Handoff control to the correct ioctl handler. 599 * Handoff control to the correct ioctl handler.
594 */ 600 */
595static int openprom_ioctl(struct inode * inode, struct file * file, 601static long openprom_ioctl(struct file * file,
596 unsigned int cmd, unsigned long arg) 602 unsigned int cmd, unsigned long arg)
597{ 603{
598 DATA *data = (DATA *) file->private_data; 604 DATA *data = (DATA *) file->private_data;
599 605
@@ -602,14 +608,14 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
602 case OPROMNXTOPT: 608 case OPROMNXTOPT:
603 if ((file->f_mode & FMODE_READ) == 0) 609 if ((file->f_mode & FMODE_READ) == 0)
604 return -EPERM; 610 return -EPERM;
605 return openprom_sunos_ioctl(inode, file, cmd, arg, 611 return openprom_sunos_ioctl(file, cmd, arg,
606 options_node); 612 options_node);
607 613
608 case OPROMSETOPT: 614 case OPROMSETOPT:
609 case OPROMSETOPT2: 615 case OPROMSETOPT2:
610 if ((file->f_mode & FMODE_WRITE) == 0) 616 if ((file->f_mode & FMODE_WRITE) == 0)
611 return -EPERM; 617 return -EPERM;
612 return openprom_sunos_ioctl(inode, file, cmd, arg, 618 return openprom_sunos_ioctl(file, cmd, arg,
613 options_node); 619 options_node);
614 620
615 case OPROMNEXT: 621 case OPROMNEXT:
@@ -618,7 +624,7 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
618 case OPROMNXTPROP: 624 case OPROMNXTPROP:
619 if ((file->f_mode & FMODE_READ) == 0) 625 if ((file->f_mode & FMODE_READ) == 0)
620 return -EPERM; 626 return -EPERM;
621 return openprom_sunos_ioctl(inode, file, cmd, arg, 627 return openprom_sunos_ioctl(file, cmd, arg,
622 data->current_node); 628 data->current_node);
623 629
624 case OPROMU2P: 630 case OPROMU2P:
@@ -630,7 +636,7 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
630 case OPROMPATH2NODE: 636 case OPROMPATH2NODE:
631 if ((file->f_mode & FMODE_READ) == 0) 637 if ((file->f_mode & FMODE_READ) == 0)
632 return -EPERM; 638 return -EPERM;
633 return openprom_sunos_ioctl(inode, file, cmd, arg, NULL); 639 return openprom_sunos_ioctl(file, cmd, arg, NULL);
634 640
635 case OPIOCGET: 641 case OPIOCGET:
636 case OPIOCNEXTPROP: 642 case OPIOCNEXTPROP:
@@ -639,12 +645,12 @@ static int openprom_ioctl(struct inode * inode, struct file * file,
639 case OPIOCGETCHILD: 645 case OPIOCGETCHILD:
640 if ((file->f_mode & FMODE_READ) == 0) 646 if ((file->f_mode & FMODE_READ) == 0)
641 return -EBADF; 647 return -EBADF;
642 return openprom_bsd_ioctl(inode,file,cmd,arg); 648 return openprom_bsd_ioctl(file,cmd,arg);
643 649
644 case OPIOCSET: 650 case OPIOCSET:
645 if ((file->f_mode & FMODE_WRITE) == 0) 651 if ((file->f_mode & FMODE_WRITE) == 0)
646 return -EBADF; 652 return -EBADF;
647 return openprom_bsd_ioctl(inode,file,cmd,arg); 653 return openprom_bsd_ioctl(file,cmd,arg);
648 654
649 default: 655 default:
650 return -EINVAL; 656 return -EINVAL;
@@ -676,7 +682,7 @@ static long openprom_compat_ioctl(struct file *file, unsigned int cmd,
676 case OPROMSETCUR: 682 case OPROMSETCUR:
677 case OPROMPCI2NODE: 683 case OPROMPCI2NODE:
678 case OPROMPATH2NODE: 684 case OPROMPATH2NODE:
679 rval = openprom_ioctl(file->f_path.dentry->d_inode, file, cmd, arg); 685 rval = openprom_ioctl(file, cmd, arg);
680 break; 686 break;
681 } 687 }
682 688
@@ -709,7 +715,7 @@ static int openprom_release(struct inode * inode, struct file * file)
709static const struct file_operations openprom_fops = { 715static const struct file_operations openprom_fops = {
710 .owner = THIS_MODULE, 716 .owner = THIS_MODULE,
711 .llseek = no_llseek, 717 .llseek = no_llseek,
712 .ioctl = openprom_ioctl, 718 .unlocked_ioctl = openprom_ioctl,
713 .compat_ioctl = openprom_compat_ioctl, 719 .compat_ioctl = openprom_compat_ioctl,
714 .open = openprom_open, 720 .open = openprom_open,
715 .release = openprom_release, 721 .release = openprom_release,