Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360567
b: refs/heads/master
c: c165b80
h: refs/heads/master
i:
  360565: 437454a
  360563: eb1fa36
  360559: 24f1c79
v: v3
  • Loading branch information
Dmitry Torokhov authored and Matthew Garrett committed Feb 27, 2013
1 parent 6e6ceb2 commit fe0a75c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 40 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 34cf1df34aba1a6274deeef92ad6d02d5f52dab0
refs/heads/master: c165b80cfecc5f253e93ebd133f7c53cf81d82d5
69 changes: 30 additions & 39 deletions trunk/drivers/platform/x86/hp-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ enum hp_wmi_event_ids {
HPWMI_LOCK_SWITCH = 7,
};

static int hp_wmi_bios_setup(struct platform_device *device);
static int __exit hp_wmi_bios_remove(struct platform_device *device);
static int hp_wmi_resume_handler(struct device *device);

struct bios_args {
u32 signature;
u32 command;
Expand Down Expand Up @@ -160,21 +156,6 @@ struct rfkill2_device {
static int rfkill2_count;
static struct rfkill2_device rfkill2[HPWMI_MAX_RFKILL2_DEVICES];

static const struct dev_pm_ops hp_wmi_pm_ops = {
.resume = hp_wmi_resume_handler,
.restore = hp_wmi_resume_handler,
};

static struct platform_driver hp_wmi_driver = {
.driver = {
.name = "hp-wmi",
.owner = THIS_MODULE,
.pm = &hp_wmi_pm_ops,
},
.probe = hp_wmi_bios_setup,
.remove = hp_wmi_bios_remove,
};

/*
* hp_wmi_perform_query
*
Expand Down Expand Up @@ -812,7 +793,7 @@ static int hp_wmi_rfkill2_setup(struct platform_device *device)
return err;
}

static int hp_wmi_bios_setup(struct platform_device *device)
static int __init hp_wmi_bios_setup(struct platform_device *device)
{
int err;

Expand Down Expand Up @@ -917,12 +898,29 @@ static int hp_wmi_resume_handler(struct device *device)
return 0;
}

static const struct dev_pm_ops hp_wmi_pm_ops = {
.resume = hp_wmi_resume_handler,
.restore = hp_wmi_resume_handler,
};

static struct platform_driver hp_wmi_driver = {
.driver = {
.name = "hp-wmi",
.owner = THIS_MODULE,
.pm = &hp_wmi_pm_ops,
},
.remove = __exit_p(hp_wmi_bios_remove),
};

static int __init hp_wmi_init(void)
{
int err;
int event_capable = wmi_has_guid(HPWMI_EVENT_GUID);
int bios_capable = wmi_has_guid(HPWMI_BIOS_GUID);

if (!bios_capable && !event_capable)
return -ENODEV;

if (event_capable) {
err = hp_wmi_input_setup();
if (err)
Expand All @@ -933,34 +931,29 @@ static int __init hp_wmi_init(void)
}

if (bios_capable) {
err = platform_driver_register(&hp_wmi_driver);
if (err)
goto err_driver_reg;
hp_wmi_platform_dev = platform_device_alloc("hp-wmi", -1);
if (!hp_wmi_platform_dev) {
err = -ENOMEM;
goto err_device_alloc;
hp_wmi_platform_dev =
platform_device_register_simple("hp-wmi", -1, NULL, 0);
if (IS_ERR(hp_wmi_platform_dev)) {
err = PTR_ERR(hp_wmi_platform_dev);
goto err_destroy_input;
}
err = platform_device_add(hp_wmi_platform_dev);

err = platform_driver_probe(&hp_wmi_driver, hp_wmi_bios_setup);
if (err)
goto err_device_add;
goto err_unregister_device;
}

if (!bios_capable && !event_capable)
return -ENODEV;

return 0;

err_device_add:
platform_device_put(hp_wmi_platform_dev);
err_device_alloc:
platform_driver_unregister(&hp_wmi_driver);
err_driver_reg:
err_unregister_device:
platform_device_unregister(hp_wmi_platform_dev);
err_destroy_input:
if (event_capable)
hp_wmi_input_destroy();

return err;
}
module_init(hp_wmi_init);

static void __exit hp_wmi_exit(void)
{
Expand All @@ -972,6 +965,4 @@ static void __exit hp_wmi_exit(void)
platform_driver_unregister(&hp_wmi_driver);
}
}

module_init(hp_wmi_init);
module_exit(hp_wmi_exit);

0 comments on commit fe0a75c

Please sign in to comment.