aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/lp.c115
-rw-r--r--drivers/mmc/host/msm_sdcc.c5
-rw-r--r--drivers/usb/core/devio.c110
-rw-r--r--drivers/video/Kconfig2
4 files changed, 190 insertions, 42 deletions
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index e444c2dba160..938a3a273886 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -127,6 +127,7 @@
127#include <linux/wait.h> 127#include <linux/wait.h>
128#include <linux/jiffies.h> 128#include <linux/jiffies.h>
129#include <linux/smp_lock.h> 129#include <linux/smp_lock.h>
130#include <linux/compat.h>
130 131
131#include <linux/parport.h> 132#include <linux/parport.h>
132#undef LP_STATS 133#undef LP_STATS
@@ -571,13 +572,11 @@ static int lp_release(struct inode * inode, struct file * file)
571 return 0; 572 return 0;
572} 573}
573 574
574static int lp_ioctl(struct inode *inode, struct file *file, 575static int lp_do_ioctl(unsigned int minor, unsigned int cmd,
575 unsigned int cmd, unsigned long arg) 576 unsigned long arg, void __user *argp)
576{ 577{
577 unsigned int minor = iminor(inode);
578 int status; 578 int status;
579 int retval = 0; 579 int retval = 0;
580 void __user *argp = (void __user *)arg;
581 580
582#ifdef LP_DEBUG 581#ifdef LP_DEBUG
583 printk(KERN_DEBUG "lp%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg); 582 printk(KERN_DEBUG "lp%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg);
@@ -587,9 +586,6 @@ static int lp_ioctl(struct inode *inode, struct file *file,
587 if ((LP_F(minor) & LP_EXIST) == 0) 586 if ((LP_F(minor) & LP_EXIST) == 0)
588 return -ENODEV; 587 return -ENODEV;
589 switch ( cmd ) { 588 switch ( cmd ) {
590 struct timeval par_timeout;
591 long to_jiffies;
592
593 case LPTIME: 589 case LPTIME:
594 LP_TIME(minor) = arg * HZ/100; 590 LP_TIME(minor) = arg * HZ/100;
595 break; 591 break;
@@ -652,34 +648,101 @@ static int lp_ioctl(struct inode *inode, struct file *file,
652 return -EFAULT; 648 return -EFAULT;
653 break; 649 break;
654 650
655 case LPSETTIMEOUT:
656 if (copy_from_user (&par_timeout, argp,
657 sizeof (struct timeval))) {
658 return -EFAULT;
659 }
660 /* Convert to jiffies, place in lp_table */
661 if ((par_timeout.tv_sec < 0) ||
662 (par_timeout.tv_usec < 0)) {
663 return -EINVAL;
664 }
665 to_jiffies = DIV_ROUND_UP(par_timeout.tv_usec, 1000000/HZ);
666 to_jiffies += par_timeout.tv_sec * (long) HZ;
667 if (to_jiffies <= 0) {
668 return -EINVAL;
669 }
670 lp_table[minor].timeout = to_jiffies;
671 break;
672
673 default: 651 default:
674 retval = -EINVAL; 652 retval = -EINVAL;
675 } 653 }
676 return retval; 654 return retval;
677} 655}
678 656
657static int lp_set_timeout(unsigned int minor, struct timeval *par_timeout)
658{
659 long to_jiffies;
660
661 /* Convert to jiffies, place in lp_table */
662 if ((par_timeout->tv_sec < 0) ||
663 (par_timeout->tv_usec < 0)) {
664 return -EINVAL;
665 }
666 to_jiffies = DIV_ROUND_UP(par_timeout->tv_usec, 1000000/HZ);
667 to_jiffies += par_timeout->tv_sec * (long) HZ;
668 if (to_jiffies <= 0) {
669 return -EINVAL;
670 }
671 lp_table[minor].timeout = to_jiffies;
672 return 0;
673}
674
675static long lp_ioctl(struct file *file, unsigned int cmd,
676 unsigned long arg)
677{
678 unsigned int minor;
679 struct timeval par_timeout;
680 int ret;
681
682 minor = iminor(file->f_path.dentry->d_inode);
683 lock_kernel();
684 switch (cmd) {
685 case LPSETTIMEOUT:
686 if (copy_from_user(&par_timeout, (void __user *)arg,
687 sizeof (struct timeval))) {
688 ret = -EFAULT;
689 break;
690 }
691 ret = lp_set_timeout(minor, &par_timeout);
692 break;
693 default:
694 ret = lp_do_ioctl(minor, cmd, arg, (void __user *)arg);
695 break;
696 }
697 unlock_kernel();
698
699 return ret;
700}
701
702#ifdef CONFIG_COMPAT
703static long lp_compat_ioctl(struct file *file, unsigned int cmd,
704 unsigned long arg)
705{
706 unsigned int minor;
707 struct timeval par_timeout;
708 struct compat_timeval __user *tc;
709 int ret;
710
711 minor = iminor(file->f_path.dentry->d_inode);
712 lock_kernel();
713 switch (cmd) {
714 case LPSETTIMEOUT:
715 tc = compat_ptr(arg);
716 if (get_user(par_timeout.tv_sec, &tc->tv_sec) ||
717 get_user(par_timeout.tv_usec, &tc->tv_usec)) {
718 ret = -EFAULT;
719 break;
720 }
721 ret = lp_set_timeout(minor, &par_timeout);
722 break;
723#ifdef LP_STATS
724 case LPGETSTATS:
725 /* FIXME: add an implementation if you set LP_STATS */
726 ret = -EINVAL;
727 break;
728#endif
729 default:
730 ret = lp_do_ioctl(minor, cmd, arg, compat_ptr(arg));
731 break;
732 }
733 unlock_kernel();
734
735 return ret;
736}
737#endif
738
679static const struct file_operations lp_fops = { 739static const struct file_operations lp_fops = {
680 .owner = THIS_MODULE, 740 .owner = THIS_MODULE,
681 .write = lp_write, 741 .write = lp_write,
682 .ioctl = lp_ioctl, 742 .unlocked_ioctl = lp_ioctl,
743#ifdef CONFIG_COMPAT
744 .compat_ioctl = lp_compat_ioctl,
745#endif
683 .open = lp_open, 746 .open = lp_open,
684 .release = lp_release, 747 .release = lp_release,
685#ifdef CONFIG_PARPORT_1284 748#ifdef CONFIG_PARPORT_1284
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index dba4600bcdb4..b31946e0b4ca 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -38,10 +38,9 @@
38#include <asm/div64.h> 38#include <asm/div64.h>
39#include <asm/sizes.h> 39#include <asm/sizes.h>
40 40
41#include <asm/mach/mmc.h> 41#include <mach/mmc.h>
42#include <mach/msm_iomap.h> 42#include <mach/msm_iomap.h>
43#include <mach/dma.h> 43#include <mach/dma.h>
44#include <mach/htc_pwrsink.h>
45 44
46#include "msm_sdcc.h" 45#include "msm_sdcc.h"
47 46
@@ -775,13 +774,11 @@ msmsdcc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
775 774
776 switch (ios->power_mode) { 775 switch (ios->power_mode) {
777 case MMC_POWER_OFF: 776 case MMC_POWER_OFF:
778 htc_pwrsink_set(PWRSINK_SDCARD, 0);
779 break; 777 break;
780 case MMC_POWER_UP: 778 case MMC_POWER_UP:
781 pwr |= MCI_PWR_UP; 779 pwr |= MCI_PWR_UP;
782 break; 780 break;
783 case MMC_POWER_ON: 781 case MMC_POWER_ON:
784 htc_pwrsink_set(PWRSINK_SDCARD, 100);
785 pwr |= MCI_PWR_ON; 782 pwr |= MCI_PWR_ON;
786 break; 783 break;
787 } 784 }
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 181f78c84105..6e8bcdfd23b4 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1388,6 +1388,46 @@ static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg)
1388} 1388}
1389 1389
1390#ifdef CONFIG_COMPAT 1390#ifdef CONFIG_COMPAT
1391static int proc_control_compat(struct dev_state *ps,
1392 struct usbdevfs_ctrltransfer32 __user *p32)
1393{
1394 struct usbdevfs_ctrltransfer __user *p;
1395 __u32 udata;
1396 p = compat_alloc_user_space(sizeof(*p));
1397 if (copy_in_user(p, p32, (sizeof(*p32) - sizeof(compat_caddr_t))) ||
1398 get_user(udata, &p32->data) ||
1399 put_user(compat_ptr(udata), &p->data))
1400 return -EFAULT;
1401 return proc_control(ps, p);
1402}
1403
1404static int proc_bulk_compat(struct dev_state *ps,
1405 struct usbdevfs_bulktransfer32 __user *p32)
1406{
1407 struct usbdevfs_bulktransfer __user *p;
1408 compat_uint_t n;
1409 compat_caddr_t addr;
1410
1411 p = compat_alloc_user_space(sizeof(*p));
1412
1413 if (get_user(n, &p32->ep) || put_user(n, &p->ep) ||
1414 get_user(n, &p32->len) || put_user(n, &p->len) ||
1415 get_user(n, &p32->timeout) || put_user(n, &p->timeout) ||
1416 get_user(addr, &p32->data) || put_user(compat_ptr(addr), &p->data))
1417 return -EFAULT;
1418
1419 return proc_bulk(ps, p);
1420}
1421static int proc_disconnectsignal_compat(struct dev_state *ps, void __user *arg)
1422{
1423 struct usbdevfs_disconnectsignal32 ds;
1424
1425 if (copy_from_user(&ds, arg, sizeof(ds)))
1426 return -EFAULT;
1427 ps->discsignr = ds.signr;
1428 ps->disccontext = compat_ptr(ds.context);
1429 return 0;
1430}
1391 1431
1392static int get_urb32(struct usbdevfs_urb *kurb, 1432static int get_urb32(struct usbdevfs_urb *kurb,
1393 struct usbdevfs_urb32 __user *uurb) 1433 struct usbdevfs_urb32 __user *uurb)
@@ -1482,6 +1522,7 @@ static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg)
1482 return processcompl_compat(as, (void __user * __user *)arg); 1522 return processcompl_compat(as, (void __user * __user *)arg);
1483} 1523}
1484 1524
1525
1485#endif 1526#endif
1486 1527
1487static int proc_disconnectsignal(struct dev_state *ps, void __user *arg) 1528static int proc_disconnectsignal(struct dev_state *ps, void __user *arg)
@@ -1648,12 +1689,12 @@ static int proc_release_port(struct dev_state *ps, void __user *arg)
1648 * are assuming that somehow the configuration has been prevented from 1689 * are assuming that somehow the configuration has been prevented from
1649 * changing. But there's no mechanism to ensure that... 1690 * changing. But there's no mechanism to ensure that...
1650 */ 1691 */
1651static int usbdev_ioctl(struct inode *inode, struct file *file, 1692static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
1652 unsigned int cmd, unsigned long arg) 1693 void __user *p)
1653{ 1694{
1654 struct dev_state *ps = file->private_data; 1695 struct dev_state *ps = file->private_data;
1696 struct inode *inode = file->f_path.dentry->d_inode;
1655 struct usb_device *dev = ps->dev; 1697 struct usb_device *dev = ps->dev;
1656 void __user *p = (void __user *)arg;
1657 int ret = -ENOTTY; 1698 int ret = -ENOTTY;
1658 1699
1659 if (!(file->f_mode & FMODE_WRITE)) 1700 if (!(file->f_mode & FMODE_WRITE))
@@ -1726,6 +1767,24 @@ static int usbdev_ioctl(struct inode *inode, struct file *file,
1726 break; 1767 break;
1727 1768
1728#ifdef CONFIG_COMPAT 1769#ifdef CONFIG_COMPAT
1770 case USBDEVFS_CONTROL32:
1771 snoop(&dev->dev, "%s: CONTROL32\n", __func__);
1772 ret = proc_control_compat(ps, p);
1773 if (ret >= 0)
1774 inode->i_mtime = CURRENT_TIME;
1775 break;
1776
1777 case USBDEVFS_BULK32:
1778 snoop(&dev->dev, "%s: BULK32\n", __func__);
1779 ret = proc_bulk_compat(ps, p);
1780 if (ret >= 0)
1781 inode->i_mtime = CURRENT_TIME;
1782 break;
1783
1784 case USBDEVFS_DISCSIGNAL32:
1785 snoop(&dev->dev, "%s: DISCSIGNAL32\n", __func__);
1786 ret = proc_disconnectsignal_compat(ps, p);
1787 break;
1729 1788
1730 case USBDEVFS_SUBMITURB32: 1789 case USBDEVFS_SUBMITURB32:
1731 snoop(&dev->dev, "%s: SUBMITURB32\n", __func__); 1790 snoop(&dev->dev, "%s: SUBMITURB32\n", __func__);
@@ -1745,7 +1804,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file,
1745 break; 1804 break;
1746 1805
1747 case USBDEVFS_IOCTL32: 1806 case USBDEVFS_IOCTL32:
1748 snoop(&dev->dev, "%s: IOCTL\n", __func__); 1807 snoop(&dev->dev, "%s: IOCTL32\n", __func__);
1749 ret = proc_ioctl_compat(ps, ptr_to_compat(p)); 1808 ret = proc_ioctl_compat(ps, ptr_to_compat(p));
1750 break; 1809 break;
1751#endif 1810#endif
@@ -1801,6 +1860,32 @@ static int usbdev_ioctl(struct inode *inode, struct file *file,
1801 return ret; 1860 return ret;
1802} 1861}
1803 1862
1863static long usbdev_ioctl(struct file *file, unsigned int cmd,
1864 unsigned long arg)
1865{
1866 int ret;
1867
1868 lock_kernel();
1869 ret = usbdev_do_ioctl(file, cmd, (void __user *)arg);
1870 unlock_kernel();
1871
1872 return ret;
1873}
1874
1875#ifdef CONFIG_COMPAT
1876static long usbdev_compat_ioctl(struct file *file, unsigned int cmd,
1877 unsigned long arg)
1878{
1879 int ret;
1880
1881 lock_kernel();
1882 ret = usbdev_do_ioctl(file, cmd, compat_ptr(arg));
1883 unlock_kernel();
1884
1885 return ret;
1886}
1887#endif
1888
1804/* No kernel lock - fine */ 1889/* No kernel lock - fine */
1805static unsigned int usbdev_poll(struct file *file, 1890static unsigned int usbdev_poll(struct file *file,
1806 struct poll_table_struct *wait) 1891 struct poll_table_struct *wait)
@@ -1817,13 +1902,16 @@ static unsigned int usbdev_poll(struct file *file,
1817} 1902}
1818 1903
1819const struct file_operations usbdev_file_operations = { 1904const struct file_operations usbdev_file_operations = {
1820 .owner = THIS_MODULE, 1905 .owner = THIS_MODULE,
1821 .llseek = usbdev_lseek, 1906 .llseek = usbdev_lseek,
1822 .read = usbdev_read, 1907 .read = usbdev_read,
1823 .poll = usbdev_poll, 1908 .poll = usbdev_poll,
1824 .ioctl = usbdev_ioctl, 1909 .unlocked_ioctl = usbdev_ioctl,
1825 .open = usbdev_open, 1910#ifdef CONFIG_COMPAT
1826 .release = usbdev_release, 1911 .compat_ioctl = usbdev_compat_ioctl,
1912#endif
1913 .open = usbdev_open,
1914 .release = usbdev_release,
1827}; 1915};
1828 1916
1829static void usbdev_remove(struct usb_device *udev) 1917static void usbdev_remove(struct usb_device *udev)
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index bb5fbed89e7f..99c0df1c7ebf 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2131,7 +2131,7 @@ config FB_PRE_INIT_FB
2131 the bootloader. 2131 the bootloader.
2132 2132
2133config FB_MSM 2133config FB_MSM
2134 tristate 2134 tristate "MSM Framebuffer support"
2135 depends on FB && ARCH_MSM 2135 depends on FB && ARCH_MSM
2136 select FB_CFB_FILLRECT 2136 select FB_CFB_FILLRECT
2137 select FB_CFB_COPYAREA 2137 select FB_CFB_COPYAREA