Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
[safe/jmp/linux-2.6] / drivers / char / pc8736x_gpio.c
index 0b235a9..8ecbcc1 100644 (file)
@@ -40,7 +40,8 @@ static u8 pc8736x_gpio_shadow[4];
 #define SIO_BASE2       0x4E   /* alt command-reg to check */
 
 #define SIO_SID                0x20    /* SuperI/O ID Register */
-#define SIO_SID_VALUE  0xe9    /* Expected value in SuperI/O ID Register */
+#define SIO_SID_PC87365        0xe5    /* Expected value in ID Register for PC87365 */
+#define SIO_SID_PC87366        0xe9    /* Expected value in ID Register for PC87366 */
 
 #define SIO_CF1                0x21    /* chip config, bit0 is chip enable */
 
@@ -90,13 +91,17 @@ static inline int superio_inb(int addr)
 
 static int pc8736x_superio_present(void)
 {
+       int id;
+
        /* try the 2 possible values, read a hardware reg to verify */
        superio_cmd = SIO_BASE1;
-       if (superio_inb(SIO_SID) == SIO_SID_VALUE)
+       id = superio_inb(SIO_SID);
+       if (id == SIO_SID_PC87365 || id == SIO_SID_PC87366)
                return superio_cmd;
 
        superio_cmd = SIO_BASE2;
-       if (superio_inb(SIO_SID) == SIO_SID_VALUE)
+       id = superio_inb(SIO_SID);
+       if (id == SIO_SID_PC87365 || id == SIO_SID_PC87366)
                return superio_cmd;
 
        return 0;
@@ -188,16 +193,6 @@ static void pc8736x_gpio_set(unsigned minor, int val)
        pc8736x_gpio_shadow[port] = val;
 }
 
-static void pc8736x_gpio_set_high(unsigned index)
-{
-       pc8736x_gpio_set(index, 1);
-}
-
-static void pc8736x_gpio_set_low(unsigned index)
-{
-       pc8736x_gpio_set(index, 0);
-}
-
 static int pc8736x_gpio_current(unsigned minor)
 {
        int port, bit;
@@ -212,7 +207,7 @@ static void pc8736x_gpio_change(unsigned index)
        pc8736x_gpio_set(index, !pc8736x_gpio_current(index));
 }
 
-static struct nsc_gpio_ops pc8736x_access = {
+static struct nsc_gpio_ops pc8736x_gpio_ops = {
        .owner          = THIS_MODULE,
        .gpio_config    = pc8736x_gpio_configure,
        .gpio_dump      = nsc_gpio_dump,
@@ -225,7 +220,7 @@ static struct nsc_gpio_ops pc8736x_access = {
 static int pc8736x_gpio_open(struct inode *inode, struct file *file)
 {
        unsigned m = iminor(inode);
-       file->private_data = &pc8736x_access;
+       file->private_data = &pc8736x_gpio_ops;
 
        dev_dbg(&pdev->dev, "open %d\n", m);
 
@@ -234,7 +229,7 @@ static int pc8736x_gpio_open(struct inode *inode, struct file *file)
        return nonseekable_open(inode, file);
 }
 
-static const struct file_operations pc8736x_gpio_fops = {
+static const struct file_operations pc8736x_gpio_fileops = {
        .owner  = THIS_MODULE,
        .open   = pc8736x_gpio_open,
        .write  = nsc_gpio_write,
@@ -276,7 +271,7 @@ static int __init pc8736x_gpio_init(void)
                dev_err(&pdev->dev, "no device found\n");
                goto undo_platform_dev_add;
        }
-       pc8736x_access.dev = &pdev->dev;
+       pc8736x_gpio_ops.dev = &pdev->dev;
 
        /* Verify that chip and it's GPIO unit are both enabled.
           My BIOS does this, so I take minimum action here
@@ -326,7 +321,7 @@ static int __init pc8736x_gpio_init(void)
        pc8736x_init_shadow();
 
        /* ignore minor errs, and succeed */
-       cdev_init(&pc8736x_gpio_cdev, &pc8736x_gpio_fops);
+       cdev_init(&pc8736x_gpio_cdev, &pc8736x_gpio_fileops);
        cdev_add(&pc8736x_gpio_cdev, devid, PC8736X_GPIO_CT);
 
        return 0;
@@ -353,7 +348,5 @@ static void __exit pc8736x_gpio_cleanup(void)
        platform_device_put(pdev);
 }
 
-EXPORT_SYMBOL(pc8736x_access);
-
 module_init(pc8736x_gpio_init);
 module_exit(pc8736x_gpio_cleanup);