Merge branch 'master' into for_paulus
[linux-drm-fsl-dcu.git] / drivers / macintosh / smu.c
index 00ef46898147524bfb11f4b8433eac19c712a742..3096836d8bd3309e35b459d2684b6688838ff58e 100644 (file)
@@ -46,6 +46,7 @@
 #include <asm/abs_addr.h>
 #include <asm/uaccess.h>
 #include <asm/of_device.h>
+#include <asm/of_platform.h>
 
 #define VERSION "0.7"
 #define AUTHOR  "(c) 2005 Benjamin Herrenschmidt, IBM Corp."
@@ -145,7 +146,7 @@ static void smu_start_cmd(void)
 }
 
 
-static irqreturn_t smu_db_intr(int irq, void *arg, struct pt_regs *regs)
+static irqreturn_t smu_db_intr(int irq, void *arg)
 {
        unsigned long flags;
        struct smu_cmd *cmd;
@@ -224,7 +225,7 @@ static irqreturn_t smu_db_intr(int irq, void *arg, struct pt_regs *regs)
 }
 
 
-static irqreturn_t smu_msg_intr(int irq, void *arg, struct pt_regs *regs)
+static irqreturn_t smu_msg_intr(int irq, void *arg)
 {
        /* I don't quite know what to do with this one, we seem to never
         * receive it, so I suspect we have to arm it someway in the SMU
@@ -309,7 +310,7 @@ void smu_poll(void)
 
        gpio = pmac_do_feature_call(PMAC_FTR_READ_GPIO, NULL, smu->doorbell);
        if ((gpio & 7) == 7)
-               smu_db_intr(smu->db_irq, smu, NULL);
+               smu_db_intr(smu->db_irq, smu);
 }
 EXPORT_SYMBOL(smu_poll);
 
@@ -454,7 +455,7 @@ EXPORT_SYMBOL(smu_present);
 int __init smu_init (void)
 {
        struct device_node *np;
-       u32 *data;
+       const u32 *data;
 
         np = of_find_node_by_type(NULL, "smu");
         if (np == NULL)
@@ -490,7 +491,7 @@ int __init smu_init (void)
                printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n");
                goto fail;
        }
-       data = (u32 *)get_property(smu->db_node, "reg", NULL);
+       data = get_property(smu->db_node, "reg", NULL);
        if (data == NULL) {
                of_node_put(smu->db_node);
                smu->db_node = NULL;
@@ -511,7 +512,7 @@ int __init smu_init (void)
                smu->msg_node = of_find_node_by_name(NULL, "smu-interrupt");
                if (smu->msg_node == NULL)
                        break;
-               data = (u32 *)get_property(smu->msg_node, "reg", NULL);
+               data = get_property(smu->msg_node, "reg", NULL);
                if (data == NULL) {
                        of_node_put(smu->msg_node);
                        smu->msg_node = NULL;
@@ -600,7 +601,7 @@ core_initcall(smu_late_init);
  * sysfs visibility
  */
 
-static void smu_expose_childs(void *unused)
+static void smu_expose_childs(struct work_struct *unused)
 {
        struct device_node *np;
 
@@ -610,7 +611,7 @@ static void smu_expose_childs(void *unused)
                                                  &smu->of_dev->dev);
 }
 
-static DECLARE_WORK(smu_expose_childs_work, smu_expose_childs, NULL);
+static DECLARE_WORK(smu_expose_childs_work, smu_expose_childs);
 
 static int smu_platform_probe(struct of_device* dev,
                              const struct of_device_id *match)
@@ -653,7 +654,7 @@ static int __init smu_init_sysfs(void)
         * I'm a bit too far from figuring out how that works with those
         * new chipsets, but that will come back and bite us
         */
-       of_register_driver(&smu_of_platform_driver);
+       of_register_platform_driver(&smu_of_platform_driver);
        return 0;
 }
 
@@ -870,7 +871,7 @@ int smu_queue_i2c(struct smu_i2c_cmd *cmd)
 
 static int smu_read_datablock(u8 *dest, unsigned int addr, unsigned int len)
 {
-       DECLARE_COMPLETION(comp);
+       DECLARE_COMPLETION_ONSTACK(comp);
        unsigned int chunk;
        struct smu_cmd cmd;
        int rc;
@@ -917,7 +918,7 @@ static int smu_read_datablock(u8 *dest, unsigned int addr, unsigned int len)
 
 static struct smu_sdbp_header *smu_create_sdb_partition(int id)
 {
-       DECLARE_COMPLETION(comp);
+       DECLARE_COMPLETION_ONSTACK(comp);
        struct smu_simple_cmd cmd;
        unsigned int addr, len, tlen;
        struct smu_sdbp_header *hdr;
@@ -944,7 +945,7 @@ static struct smu_sdbp_header *smu_create_sdb_partition(int id)
         */
        tlen = sizeof(struct property) + len + 18;
 
-       prop = kcalloc(tlen, 1, GFP_KERNEL);
+       prop = kzalloc(tlen, GFP_KERNEL);
        if (prop == NULL)
                return NULL;
        hdr = (struct smu_sdbp_header *)(prop + 1);
@@ -982,11 +983,11 @@ static struct smu_sdbp_header *smu_create_sdb_partition(int id)
 /* Note: Only allowed to return error code in pointers (using ERR_PTR)
  * when interruptible is 1
  */
-struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size,
-                                               int interruptible)
+const struct smu_sdbp_header *__smu_get_sdb_partition(int id,
+               unsigned int *size, int interruptible)
 {
        char pname[32];
-       struct smu_sdbp_header *part;
+       const struct smu_sdbp_header *part;
 
        if (!smu)
                return NULL;
@@ -1003,8 +1004,7 @@ struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size,
        } else
                mutex_lock(&smu_part_access);
 
-       part = (struct smu_sdbp_header *)get_property(smu->of_node,
-                                                     pname, size);
+       part = get_property(smu->of_node, pname, size);
        if (part == NULL) {
                DPRINTK("trying to extract from SMU ...\n");
                part = smu_create_sdb_partition(id);
@@ -1015,7 +1015,7 @@ struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size,
        return part;
 }
 
-struct smu_sdbp_header *smu_get_sdb_partition(int id, unsigned int *size)
+const struct smu_sdbp_header *smu_get_sdb_partition(int id, unsigned int *size)
 {
        return __smu_get_sdb_partition(id, size, 0);
 }
@@ -1094,7 +1094,7 @@ static ssize_t smu_write(struct file *file, const char __user *buf,
                pp->mode = smu_file_events;
                return 0;
        } else if (hdr.cmdtype == SMU_CMDTYPE_GET_PARTITION) {
-               struct smu_sdbp_header *part;
+               const struct smu_sdbp_header *part;
                part = __smu_get_sdb_partition(hdr.cmd, NULL, 1);
                if (part == NULL)
                        return -EINVAL;
@@ -1277,7 +1277,7 @@ static int smu_release(struct inode *inode, struct file *file)
 }
 
 
-static struct file_operations smu_device_fops = {
+static const struct file_operations smu_device_fops = {
        .llseek         = no_llseek,
        .read           = smu_read,
        .write          = smu_write,