aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/tc1100-wmi.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/drivers/platform/x86/tc1100-wmi.c b/drivers/platform/x86/tc1100-wmi.c
index 0d53d5166574..fa2995bfa1d9 100644
--- a/drivers/platform/x86/tc1100-wmi.c
+++ b/drivers/platform/x86/tc1100-wmi.c
@@ -47,22 +47,6 @@ MODULE_DESCRIPTION("HP Compaq TC1100 Tablet WMI Extras");
47MODULE_LICENSE("GPL"); 47MODULE_LICENSE("GPL");
48MODULE_ALIAS("wmi:C364AC71-36DB-495A-8494-B439D472A505"); 48MODULE_ALIAS("wmi:C364AC71-36DB-495A-8494-B439D472A505");
49 49
50static int tc1100_probe(struct platform_device *device);
51static int tc1100_remove(struct platform_device *device);
52static int tc1100_suspend(struct platform_device *device, pm_message_t state);
53static int tc1100_resume(struct platform_device *device);
54
55static struct platform_driver tc1100_driver = {
56 .driver = {
57 .name = "tc1100-wmi",
58 .owner = THIS_MODULE,
59 },
60 .probe = tc1100_probe,
61 .remove = tc1100_remove,
62 .suspend = tc1100_suspend,
63 .resume = tc1100_resume,
64};
65
66static struct platform_device *tc1100_device; 50static struct platform_device *tc1100_device;
67 51
68struct tc1100_data { 52struct tc1100_data {
@@ -197,13 +181,13 @@ static struct attribute_group tc1100_attribute_group = {
197 Driver Model 181 Driver Model
198 -------------------------------------------------------------------------- */ 182 -------------------------------------------------------------------------- */
199 183
200static int tc1100_probe(struct platform_device *device) 184static int __init tc1100_probe(struct platform_device *device)
201{ 185{
202 return sysfs_create_group(&device->dev.kobj, &tc1100_attribute_group); 186 return sysfs_create_group(&device->dev.kobj, &tc1100_attribute_group);
203} 187}
204 188
205 189
206static int tc1100_remove(struct platform_device *device) 190static int __devexit tc1100_remove(struct platform_device *device)
207{ 191{
208 sysfs_remove_group(&device->dev.kobj, &tc1100_attribute_group); 192 sysfs_remove_group(&device->dev.kobj, &tc1100_attribute_group);
209 193
@@ -240,31 +224,49 @@ static int tc1100_resume(struct platform_device *dev)
240 return ret; 224 return ret;
241} 225}
242 226
227static struct platform_driver tc1100_driver = {
228 .driver = {
229 .name = "tc1100-wmi",
230 .owner = THIS_MODULE,
231 },
232 .remove = __devexit_p(tc1100_remove),
233 .suspend = tc1100_suspend,
234 .resume = tc1100_resume,
235};
236
243static int __init tc1100_init(void) 237static int __init tc1100_init(void)
244{ 238{
245 int result = 0; 239 int error;
246 240
247 if (!wmi_has_guid(GUID)) 241 if (!wmi_has_guid(GUID))
248 return -ENODEV; 242 return -ENODEV;
249 243
250 result = platform_driver_register(&tc1100_driver);
251 if (result)
252 return result;
253
254 tc1100_device = platform_device_alloc("tc1100-wmi", -1); 244 tc1100_device = platform_device_alloc("tc1100-wmi", -1);
255 platform_device_add(tc1100_device); 245 if (!tc1100_device)
246 return -ENOMEM;
247
248 error = platform_device_add(tc1100_device);
249 if (error)
250 goto err_device_put;
251
252 error = platform_driver_probe(&tc1100_driver, tc1100_probe);
253 if (error)
254 goto err_device_del;
256 255
257 printk(TC1100_INFO "HP Compaq TC1100 Tablet WMI Extras loaded\n"); 256 printk(TC1100_INFO "HP Compaq TC1100 Tablet WMI Extras loaded\n");
257 return 0;
258 258
259 return result; 259 err_device_del:
260 platform_device_del(tc1100_device);
261 err_device_put:
262 platform_device_put(tc1100_device);
263 return error;
260} 264}
261 265
262static void __exit tc1100_exit(void) 266static void __exit tc1100_exit(void)
263{ 267{
264 platform_device_del(tc1100_device); 268 platform_device_unregister(tc1100_device);
265 platform_driver_unregister(&tc1100_driver); 269 platform_driver_unregister(&tc1100_driver);
266
267 printk(TC1100_INFO "HP Compaq TC1100 Tablet WMI Extras unloaded\n");
268} 270}
269 271
270module_init(tc1100_init); 272module_init(tc1100_init);