Merge branch 'torvalds/master'
[firefly-linux-kernel-4.4.55.git] / drivers / input / keyboard / bf54x-keys.c
index 20b9fa91fb9e615ac918d020c99ec6e4c1b6aad9..81b07dddae86e93dbbf46a7c6af9c05ad66a1c94 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <linux/module.h>
 
-#include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
@@ -180,7 +179,7 @@ static irqreturn_t bfin_kpad_isr(int irq, void *dev_id)
 static int bfin_kpad_probe(struct platform_device *pdev)
 {
        struct bf54x_kpad *bf54x_kpad;
-       struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data;
+       struct bfin_kpad_platform_data *pdata = dev_get_platdata(&pdev->dev);
        struct input_dev *input;
        int i, error;
 
@@ -289,7 +288,8 @@ static int bfin_kpad_probe(struct platform_device *pdev)
                __set_bit(EV_REP, input->evbit);
 
        for (i = 0; i < input->keycodemax; i++)
-               __set_bit(bf54x_kpad->keycode[i] & KEY_MAX, input->keybit);
+               if (bf54x_kpad->keycode[i] <= KEY_MAX)
+                       __set_bit(bf54x_kpad->keycode[i], input->keybit);
        __clear_bit(KEY_RESERVED, input->keybit);
 
        error = input_register_device(input);
@@ -326,14 +326,13 @@ out0:
        kfree(bf54x_kpad->keycode);
 out:
        kfree(bf54x_kpad);
-       platform_set_drvdata(pdev, NULL);
 
        return error;
 }
 
 static int bfin_kpad_remove(struct platform_device *pdev)
 {
-       struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data;
+       struct bfin_kpad_platform_data *pdata = dev_get_platdata(&pdev->dev);
        struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
 
        del_timer_sync(&bf54x_kpad->timer);
@@ -346,7 +345,6 @@ static int bfin_kpad_remove(struct platform_device *pdev)
 
        kfree(bf54x_kpad->keycode);
        kfree(bf54x_kpad);
-       platform_set_drvdata(pdev, NULL);
 
        return 0;
 }
@@ -387,7 +385,6 @@ static int bfin_kpad_resume(struct platform_device *pdev)
 static struct platform_driver bfin_kpad_device_driver = {
        .driver         = {
                .name   = DRV_NAME,
-               .owner  = THIS_MODULE,
        },
        .probe          = bfin_kpad_probe,
        .remove         = bfin_kpad_remove,