Merge git://git.kvack.org/~bcrl/aio-next
[cascardo/linux.git] / drivers / sbus / char / display7seg.c
index 7c71e7b..2b0ce7c 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 Eric Brower (ebrower@usa.net)
  */
 
+#include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/fs.h>
@@ -143,10 +144,7 @@ static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
        case D7SIOCTM:
                /* toggle device mode-- flip display orientation */
-               if (regs & D7S_FLIP)
-                       regs &= ~D7S_FLIP;
-               else
-                       regs |= D7S_FLIP;
+               regs ^= D7S_FLIP;
                writeb(regs, p->regs);
                break;
        }
@@ -180,7 +178,7 @@ static int d7s_probe(struct platform_device *op)
        if (d7s_device)
                goto out;
 
-       p = kzalloc(sizeof(*p), GFP_KERNEL);
+       p = devm_kzalloc(&op->dev, sizeof(*p), GFP_KERNEL);
        err = -ENOMEM;
        if (!p)
                goto out;
@@ -231,7 +229,6 @@ out_iounmap:
        of_iounmap(&op->resource[0], p->regs, sizeof(u8));
 
 out_free:
-       kfree(p);
        goto out;
 }
 
@@ -251,7 +248,6 @@ static int d7s_remove(struct platform_device *op)
 
        misc_deregister(&d7s_miscdev);
        of_iounmap(&op->resource[0], p->regs, sizeof(u8));
-       kfree(p);
 
        return 0;
 }