]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/misc/acer-wmi.c
Merge git://git.infradead.org/mtd-2.6
[linux-2.6-omap-h63xx.git] / drivers / misc / acer-wmi.c
index e3e11e88747ece3cdfb50ac755fd4bd7e80bbb2b..0532a2de2ce4decf8ef2744d5bfcaa4054b13597 100644 (file)
@@ -125,21 +125,15 @@ enum interface_flags {
 
 static int max_brightness = 0xF;
 
-static int wireless = -1;
-static int bluetooth = -1;
 static int mailled = -1;
 static int brightness = -1;
 static int threeg = -1;
 static int force_series;
 
 module_param(mailled, int, 0444);
-module_param(wireless, int, 0444);
-module_param(bluetooth, int, 0444);
 module_param(brightness, int, 0444);
 module_param(threeg, int, 0444);
 module_param(force_series, int, 0444);
-MODULE_PARM_DESC(wireless, "Set initial state of Wireless hardware");
-MODULE_PARM_DESC(bluetooth, "Set initial state of Bluetooth hardware");
 MODULE_PARM_DESC(mailled, "Set initial state of Mail LED");
 MODULE_PARM_DESC(brightness, "Set initial LCD backlight brightness");
 MODULE_PARM_DESC(threeg, "Set initial state of 3G hardware");
@@ -147,8 +141,6 @@ MODULE_PARM_DESC(force_series, "Force a different laptop series");
 
 struct acer_data {
        int mailled;
-       int wireless;
-       int bluetooth;
        int threeg;
        int brightness;
 };
@@ -481,7 +473,7 @@ struct wmi_interface *iface)
                }
                break;
        default:
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
        }
        return AE_OK;
 }
@@ -519,7 +511,7 @@ static acpi_status AMW0_set_u32(u32 value, u32 cap, struct wmi_interface *iface)
                        break;
                }
        default:
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
        }
 
        /* Actually do the set */
@@ -694,7 +686,7 @@ struct wmi_interface *iface)
                        return 0;
                }
        default:
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
        }
        status = WMI_execute_u32(method_id, 0, &result);
 
@@ -740,7 +732,7 @@ static acpi_status WMID_set_u32(u32 value, u32 cap, struct wmi_interface *iface)
                }
                break;
        default:
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
        }
        return WMI_execute_u32(method_id, (u32)value, NULL);
 }
@@ -790,7 +782,7 @@ static struct wmi_interface wmid_interface = {
 
 static acpi_status get_u32(u32 *value, u32 cap)
 {
-       acpi_status status = AE_BAD_ADDRESS;
+       acpi_status status = AE_ERROR;
 
        switch (interface->type) {
        case ACER_AMW0:
@@ -851,8 +843,6 @@ static void __init acer_commandline_init(void)
         * capability isn't available on the given interface
         */
        set_u32(mailled, ACER_CAP_MAILLED);
-       set_u32(wireless, ACER_CAP_WIRELESS);
-       set_u32(bluetooth, ACER_CAP_BLUETOOTH);
        set_u32(threeg, ACER_CAP_THREEG);
        set_u32(brightness, ACER_CAP_BRIGHTNESS);
 }
@@ -940,8 +930,6 @@ static void acer_backlight_exit(void)
 /*
  * Rfkill devices
  */
-static struct workqueue_struct *rfkill_workqueue;
-
 static void acer_rfkill_update(struct work_struct *ignored);
 static DECLARE_DELAYED_WORK(acer_rfkill_work, acer_rfkill_update);
 static void acer_rfkill_update(struct work_struct *ignored)
@@ -962,8 +950,7 @@ static void acer_rfkill_update(struct work_struct *ignored)
                                RFKILL_STATE_SOFT_BLOCKED);
        }
 
-       queue_delayed_work(rfkill_workqueue, &acer_rfkill_work,
-               round_jiffies_relative(HZ));
+       schedule_delayed_work(&acer_rfkill_work, round_jiffies_relative(HZ));
 }
 
 static int acer_rfkill_set(void *data, enum rfkill_state state)
@@ -1028,17 +1015,7 @@ static int acer_rfkill_init(struct device *dev)
                }
        }
 
-       rfkill_workqueue = create_singlethread_workqueue("rfkill_workqueue");
-       if (!rfkill_workqueue) {
-               if (has_cap(ACER_CAP_BLUETOOTH)) {
-                       kfree(bluetooth_rfkill->data);
-                       rfkill_unregister(bluetooth_rfkill);
-               }
-               kfree(wireless_rfkill->data);
-               rfkill_unregister(wireless_rfkill);
-               return -ENOMEM;
-       }
-       queue_delayed_work(rfkill_workqueue, &acer_rfkill_work, HZ);
+       schedule_delayed_work(&acer_rfkill_work, round_jiffies_relative(HZ));
 
        return 0;
 }
@@ -1046,7 +1023,6 @@ static int acer_rfkill_init(struct device *dev)
 static void acer_rfkill_exit(void)
 {
        cancel_delayed_work_sync(&acer_rfkill_work);
-       destroy_workqueue(rfkill_workqueue);
        kfree(wireless_rfkill->data);
        rfkill_unregister(wireless_rfkill);
        if (has_cap(ACER_CAP_BLUETOOTH)) {
@@ -1057,40 +1033,30 @@ static void acer_rfkill_exit(void)
 }
 
 /*
- * Read/ write bool sysfs macro
+ * sysfs interface
  */
-#define show_set_bool(value, cap) \
-static ssize_t \
-show_bool_##value(struct device *dev, struct device_attribute *attr, \
-       char *buf) \
-{ \
+static ssize_t show_bool_threeg(struct device *dev,
+       struct device_attribute *attr, char *buf)
+{
        u32 result; \
-       acpi_status status = get_u32(&result, cap); \
-       if (ACPI_SUCCESS(status)) \
-               return sprintf(buf, "%u\n", result); \
-       return sprintf(buf, "Read error\n"); \
-} \
-\
-static ssize_t \
-set_bool_##value(struct device *dev, struct device_attribute *attr, \
-       const char *buf, size_t count) \
-{ \
-       u32 tmp = simple_strtoul(buf, NULL, 10); \
-       acpi_status status = set_u32(tmp, cap); \
-               if (ACPI_FAILURE(status)) \
-                       return -EINVAL; \
-       return count; \
-} \
-static DEVICE_ATTR(value, S_IWUGO | S_IRUGO | S_IWUSR, \
-       show_bool_##value, set_bool_##value);
-
-show_set_bool(wireless, ACER_CAP_WIRELESS);
-show_set_bool(bluetooth, ACER_CAP_BLUETOOTH);
-show_set_bool(threeg, ACER_CAP_THREEG);
+       acpi_status status = get_u32(&result, ACER_CAP_THREEG);
+       if (ACPI_SUCCESS(status))
+               return sprintf(buf, "%u\n", result);
+       return sprintf(buf, "Read error\n");
+}
+
+static ssize_t set_bool_threeg(struct device *dev,
+       struct device_attribute *attr, const char *buf, size_t count)
+{
+       u32 tmp = simple_strtoul(buf, NULL, 10);
+       acpi_status status = set_u32(tmp, ACER_CAP_THREEG);
+               if (ACPI_FAILURE(status))
+                       return -EINVAL;
+       return count;
+}
+static DEVICE_ATTR(threeg, S_IWUGO | S_IRUGO | S_IWUSR, show_bool_threeg,
+       set_bool_threeg);
 
-/*
- * Read interface sysfs macro
- */
 static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
        char *buf)
 {
@@ -1180,16 +1146,6 @@ pm_message_t state)
        if (!data)
                return -ENOMEM;
 
-       if (has_cap(ACER_CAP_WIRELESS)) {
-               get_u32(&value, ACER_CAP_WIRELESS);
-               data->wireless = value;
-       }
-
-       if (has_cap(ACER_CAP_BLUETOOTH)) {
-               get_u32(&value, ACER_CAP_BLUETOOTH);
-               data->bluetooth = value;
-       }
-
        if (has_cap(ACER_CAP_MAILLED)) {
                get_u32(&value, ACER_CAP_MAILLED);
                data->mailled = value;
@@ -1210,15 +1166,6 @@ static int acer_platform_resume(struct platform_device *device)
        if (!data)
                return -ENOMEM;
 
-       if (has_cap(ACER_CAP_WIRELESS))
-               set_u32(data->wireless, ACER_CAP_WIRELESS);
-
-       if (has_cap(ACER_CAP_BLUETOOTH))
-               set_u32(data->bluetooth, ACER_CAP_BLUETOOTH);
-
-       if (has_cap(ACER_CAP_THREEG))
-               set_u32(data->threeg, ACER_CAP_THREEG);
-
        if (has_cap(ACER_CAP_MAILLED))
                set_u32(data->mailled, ACER_CAP_MAILLED);
 
@@ -1243,12 +1190,6 @@ static struct platform_device *acer_platform_device;
 
 static int remove_sysfs(struct platform_device *device)
 {
-       if (has_cap(ACER_CAP_WIRELESS))
-               device_remove_file(&device->dev, &dev_attr_wireless);
-
-       if (has_cap(ACER_CAP_BLUETOOTH))
-               device_remove_file(&device->dev, &dev_attr_bluetooth);
-
        if (has_cap(ACER_CAP_THREEG))
                device_remove_file(&device->dev, &dev_attr_threeg);
 
@@ -1261,20 +1202,6 @@ static int create_sysfs(void)
 {
        int retval = -ENOMEM;
 
-       if (has_cap(ACER_CAP_WIRELESS)) {
-               retval = device_create_file(&acer_platform_device->dev,
-                       &dev_attr_wireless);
-               if (retval)
-                       goto error_sysfs;
-       }
-
-       if (has_cap(ACER_CAP_BLUETOOTH)) {
-               retval = device_create_file(&acer_platform_device->dev,
-                       &dev_attr_bluetooth);
-               if (retval)
-                       goto error_sysfs;
-       }
-
        if (has_cap(ACER_CAP_THREEG)) {
                retval = device_create_file(&acer_platform_device->dev,
                        &dev_attr_threeg);