static int __init cbe_powerbutton_init(void) { int ret = 0; struct input_dev *dev; if (!machine_is_compatible("IBM,CBPLUS-1.0")) { printk(KERN_ERR "%s: Not a cell blade.\n", __func__); ret = -ENODEV; goto out; } dev = input_allocate_device(); if (!dev) { ret = -ENOMEM; printk(KERN_ERR "%s: Not enough memory.\n", __func__); goto out; } set_bit(EV_KEY, dev->evbit); set_bit(KEY_POWER, dev->keybit); dev->name = "Power Button"; dev->id.bustype = BUS_HOST; /* this makes the button look like an acpi power button * no clue whether anyone relies on that though */ dev->id.product = 0x02; dev->phys = "LNXPWRBN/button/input0"; button_pdev = platform_device_register_simple("power_button", 0, NULL, 0); if (IS_ERR(button_pdev)) { ret = PTR_ERR(button_pdev); goto out_free_input; } dev->dev.parent = &button_pdev->dev; ret = input_register_device(dev); if (ret) { printk(KERN_ERR "%s: Failed to register device\n", __func__); goto out_free_pdev; } button_dev = dev; ret = pmi_register_handler(&cbe_pmi_handler); if (ret) { printk(KERN_ERR "%s: Failed to register with pmi.\n", __func__); goto out_free_pdev; } goto out; out_free_pdev: platform_device_unregister(button_pdev); out_free_input: input_free_device(dev); out: return ret; }
static int __init cbe_cpufreq_pmi_init(void) { cbe_cpufreq_has_pmi = pmi_register_handler(&cbe_pmi_handler) == 0; if (!cbe_cpufreq_has_pmi) return -ENODEV; cpufreq_register_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER); return 0; }