ACPI: Remove unnecessary from/to-void* and to-void casts in drivers/acpi
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / acpi / ibm_acpi.c
index 262b1f41335ab1db8943e75bcf0d3f4616285c88..6fbb42048890287cc1c00484fcad7b6adfae57c3 100644 (file)
@@ -567,6 +567,69 @@ static int bluetooth_write(char *buf)
        return 0;
 }
 
+static int wan_supported;
+
+static int wan_init(void)
+{
+       wan_supported = hkey_handle &&
+           acpi_evalf(hkey_handle, NULL, "GWAN", "qv");
+
+       return 0;
+}
+
+static int wan_status(void)
+{
+       int status;
+
+       if (!wan_supported ||
+           !acpi_evalf(hkey_handle, &status, "GWAN", "d"))
+               status = 0;
+
+       return status;
+}
+
+static int wan_read(char *p)
+{
+       int len = 0;
+       int status = wan_status();
+
+       if (!wan_supported)
+               len += sprintf(p + len, "status:\t\tnot supported\n");
+       else if (!(status & 1))
+               len += sprintf(p + len, "status:\t\tnot installed\n");
+       else {
+               len += sprintf(p + len, "status:\t\t%s\n", enabled(status, 1));
+               len += sprintf(p + len, "commands:\tenable, disable\n");
+       }
+
+       return len;
+}
+
+static int wan_write(char *buf)
+{
+       int status = wan_status();
+       char *cmd;
+       int do_cmd = 0;
+
+       if (!wan_supported)
+               return -ENODEV;
+
+       while ((cmd = next_cmd(&buf))) {
+               if (strlencmp(cmd, "enable") == 0) {
+                       status |= 2;
+               } else if (strlencmp(cmd, "disable") == 0) {
+                       status &= ~2;
+               } else
+                       return -EINVAL;
+               do_cmd = 1;
+       }
+
+       if (do_cmd && !acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status))
+               return -EIO;
+
+       return 0;
+}
+
 static int video_supported;
 static int video_orig_autosw;
 
@@ -1562,6 +1625,13 @@ static struct ibm_struct ibms[] = {
         .read = bluetooth_read,
         .write = bluetooth_write,
         },
+       {
+        .name = "wan",
+        .init = wan_init,
+        .read = wan_read,
+        .write = wan_write,
+        .experimental = 1,
+        },
        {
         .name = "video",
         .init = video_init,
@@ -1651,7 +1721,7 @@ static struct ibm_struct ibms[] = {
 static int dispatch_read(char *page, char **start, off_t off, int count,
                         int *eof, void *data)
 {
-       struct ibm_struct *ibm = (struct ibm_struct *)data;
+       struct ibm_struct *ibm = data;
        int len;
 
        if (!ibm || !ibm->read)
@@ -1676,7 +1746,7 @@ static int dispatch_read(char *page, char **start, off_t off, int count,
 static int dispatch_write(struct file *file, const char __user * userbuf,
                          unsigned long count, void *data)
 {
-       struct ibm_struct *ibm = (struct ibm_struct *)data;
+       struct ibm_struct *ibm = data;
        char *kernbuf;
        int ret;
 
@@ -1705,7 +1775,7 @@ static int dispatch_write(struct file *file, const char __user * userbuf,
 
 static void dispatch_notify(acpi_handle handle, u32 event, void *data)
 {
-       struct ibm_struct *ibm = (struct ibm_struct *)data;
+       struct ibm_struct *ibm = data;
 
        if (!ibm || !ibm->notify)
                return;