]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/hwmon/hdaps.c
[PATCH] hdaps: use ENODEV
[linux-2.6-omap-h63xx.git] / drivers / hwmon / hdaps.c
index c8c84e0819fbbc2e3a4e0cd55472933836a5e108..1659f6c414581c9ad737b161edb575073dcd98c6 100644 (file)
@@ -286,7 +286,7 @@ out:
 
 /* Device model stuff */
 
-static int hdaps_probe(struct device *dev)
+static int hdaps_probe(struct platform_device *dev)
 {
        int ret;
 
@@ -298,17 +298,18 @@ static int hdaps_probe(struct device *dev)
        return 0;
 }
 
-static int hdaps_resume(struct device *dev)
+static int hdaps_resume(struct platform_device *dev)
 {
        return hdaps_device_init();
 }
 
-static struct device_driver hdaps_driver = {
-       .name = "hdaps",
-       .bus = &platform_bus_type,
-       .owner = THIS_MODULE,
+static struct platform_driver hdaps_driver = {
        .probe = hdaps_probe,
-       .resume = hdaps_resume
+       .resume = hdaps_resume,
+       .driver = {
+               .name = "hdaps",
+               .owner = THIS_MODULE,
+       },
 };
 
 /*
@@ -508,12 +509,22 @@ static int hdaps_dmi_match_invert(struct dmi_system_id *id)
        }                                               \
 }
 
+#define HDAPS_DMI_MATCH_LENOVO(model)   {               \
+        .ident = "Lenovo " model,                       \
+        .callback = hdaps_dmi_match_invert,             \
+        .matches = {                                    \
+                DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),  \
+                DMI_MATCH(DMI_PRODUCT_VERSION, model)   \
+        }                                               \
+}
+
 static int __init hdaps_init(void)
 {
        int ret;
 
        /* Note that DMI_MATCH(...,"ThinkPad T42") will match "ThinkPad T42p" */
        struct dmi_system_id hdaps_whitelist[] = {
+               HDAPS_DMI_MATCH_NORMAL("ThinkPad H"),
                HDAPS_DMI_MATCH_INVERT("ThinkPad R50p"),
                HDAPS_DMI_MATCH_NORMAL("ThinkPad R50"),
                HDAPS_DMI_MATCH_NORMAL("ThinkPad R51"),
@@ -523,15 +534,17 @@ static int __init hdaps_init(void)
                HDAPS_DMI_MATCH_INVERT("ThinkPad T42p"),
                HDAPS_DMI_MATCH_NORMAL("ThinkPad T42"),
                HDAPS_DMI_MATCH_NORMAL("ThinkPad T43"),
+               HDAPS_DMI_MATCH_LENOVO("ThinkPad T60p"),
                HDAPS_DMI_MATCH_NORMAL("ThinkPad X40"),
                HDAPS_DMI_MATCH_NORMAL("ThinkPad X41 Tablet"),
                HDAPS_DMI_MATCH_NORMAL("ThinkPad X41"),
+               HDAPS_DMI_MATCH_LENOVO("ThinkPad X60"),
                { .ident = NULL }
        };
 
        if (!dmi_check_system(hdaps_whitelist)) {
                printk(KERN_WARNING "hdaps: supported laptop not found!\n");
-               ret = -ENXIO;
+               ret = -ENODEV;
                goto out;
        }
 
@@ -540,7 +553,7 @@ static int __init hdaps_init(void)
                goto out;
        }
 
-       ret = driver_register(&hdaps_driver);
+       ret = platform_driver_register(&hdaps_driver);
        if (ret)
                goto out_region;
 
@@ -569,7 +582,7 @@ static int __init hdaps_init(void)
        hdaps_idev->evbit[0] = BIT(EV_ABS);
        input_set_abs_params(hdaps_idev, ABS_X,
                        -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT);
-       input_set_abs_params(hdaps_idev, ABS_X,
+       input_set_abs_params(hdaps_idev, ABS_Y,
                        -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT);
 
        input_register_device(hdaps_idev);
@@ -588,7 +601,7 @@ out_group:
 out_device:
        platform_device_unregister(pdev);
 out_driver:
-       driver_unregister(&hdaps_driver);
+       platform_driver_unregister(&hdaps_driver);
 out_region:
        release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS);
 out:
@@ -602,7 +615,7 @@ static void __exit hdaps_exit(void)
        input_unregister_device(hdaps_idev);
        sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group);
        platform_device_unregister(pdev);
-       driver_unregister(&hdaps_driver);
+       platform_driver_unregister(&hdaps_driver);
        release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS);
 
        printk(KERN_INFO "hdaps: driver unloaded.\n");