include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / arch / powerpc / platforms / ps3 / device-init.c
index dbc124e..b341018 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/kernel.h>
 #include <linux/kthread.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <linux/reboot.h>
 
 #include <asm/firmware.h>
@@ -82,7 +83,7 @@ static int __init ps3_register_lpm_devices(void)
                goto fail_rights;
        }
 
-       pr_debug("%s:%d: pu_id %lu, rights %lu(%lxh)\n",
+       pr_debug("%s:%d: pu_id %llu, rights %llu(%llxh)\n",
                __func__, __LINE__, dev->lpm.pu_id, dev->lpm.rights,
                dev->lpm.rights);
 
@@ -348,7 +349,7 @@ static int ps3_setup_storage_dev(const struct ps3_repository_device *repo,
                return -ENODEV;
        }
 
-       pr_debug("%s:%u: (%u:%u:%u): port %lu blk_size %lu num_blocks %lu "
+       pr_debug("%s:%u: (%u:%u:%u): port %llu blk_size %llu num_blocks %llu "
                 "num_regions %u\n", __func__, __LINE__, repo->bus_index,
                 repo->dev_index, repo->dev_type, port, blk_size, num_blocks,
                 num_regions);
@@ -394,7 +395,7 @@ static int ps3_setup_storage_dev(const struct ps3_repository_device *repo,
                        result = -ENODEV;
                        goto fail_read_region;
                }
-               pr_debug("%s:%u: region %u: id %u start %lu size %lu\n",
+               pr_debug("%s:%u: region %u: id %u start %llu size %llu\n",
                         __func__, __LINE__, i, id, start, size);
 
                p->regions[i].id = id;
@@ -518,6 +519,41 @@ fail_device_register:
        return result;
 }
 
+static int __init ps3_register_ramdisk_device(void)
+{
+       int result;
+       struct layout {
+               struct ps3_system_bus_device dev;
+       } *p;
+
+       pr_debug(" -> %s:%d\n", __func__, __LINE__);
+
+       p = kzalloc(sizeof(struct layout), GFP_KERNEL);
+
+       if (!p)
+               return -ENOMEM;
+
+       p->dev.match_id = PS3_MATCH_ID_GPU;
+       p->dev.match_sub_id = PS3_MATCH_SUB_ID_GPU_RAMDISK;
+       p->dev.dev_type = PS3_DEVICE_TYPE_IOC0;
+
+       result = ps3_system_bus_device_register(&p->dev);
+
+       if (result) {
+               pr_debug("%s:%d ps3_system_bus_device_register failed\n",
+                       __func__, __LINE__);
+               goto fail_device_register;
+       }
+
+       pr_debug(" <- %s:%d\n", __func__, __LINE__);
+       return 0;
+
+fail_device_register:
+       kfree(p);
+       pr_debug(" <- %s:%d failed\n", __func__, __LINE__);
+       return result;
+}
+
 /**
  * ps3_setup_dynamic_device - Setup a dynamic device from the repository
  */
@@ -627,13 +663,13 @@ static void ps3_find_and_add_device(u64 bus_id, u64 dev_id)
                if (rem)
                        break;
        }
-       pr_warning("%s:%u: device %lu:%lu not found\n", __func__, __LINE__,
+       pr_warning("%s:%u: device %llu:%llu not found\n", __func__, __LINE__,
                   bus_id, dev_id);
        return;
 
 found:
        if (retries)
-               pr_debug("%s:%u: device %lu:%lu found after %u retries\n",
+               pr_debug("%s:%u: device %llu:%llu found after %u retries\n",
                         __func__, __LINE__, bus_id, dev_id, retries);
 
        ps3_setup_dynamic_device(&repo);
@@ -680,14 +716,14 @@ static irqreturn_t ps3_notification_interrupt(int irq, void *data)
        res = lv1_storage_get_async_status(PS3_NOTIFICATION_DEV_ID, &tag,
                                           &status);
        if (tag != dev->tag)
-               pr_err("%s:%u: tag mismatch, got %lx, expected %lx\n",
+               pr_err("%s:%u: tag mismatch, got %llx, expected %llx\n",
                       __func__, __LINE__, tag, dev->tag);
 
        if (res) {
-               pr_err("%s:%u: res %d status 0x%lx\n", __func__, __LINE__, res,
+               pr_err("%s:%u: res %d status 0x%llx\n", __func__, __LINE__, res,
                       status);
        } else {
-               pr_debug("%s:%u: completed, status 0x%lx\n", __func__,
+               pr_debug("%s:%u: completed, status 0x%llx\n", __func__,
                         __LINE__, status);
                dev->lv1_status = status;
                complete(&dev->done);
@@ -726,7 +762,7 @@ static int ps3_notification_read_write(struct ps3_notification_device *dev,
        }
 
        if (dev->lv1_status) {
-               pr_err("%s:%u: %s not completed, status 0x%lx\n", __func__,
+               pr_err("%s:%u: %s not completed, status 0x%llx\n", __func__,
                       __LINE__, op, dev->lv1_status);
                return -EIO;
        }
@@ -815,16 +851,16 @@ static int ps3_probe_thread(void *data)
                if (res)
                        break;
 
-               pr_debug("%s:%u: notify event type 0x%lx bus id %lu dev id %lu"
-                        " type %lu port %lu\n", __func__, __LINE__,
+               pr_debug("%s:%u: notify event type 0x%llx bus id %llu dev id %llu"
+                        " type %llu port %llu\n", __func__, __LINE__,
                         notify_event->event_type, notify_event->bus_id,
                         notify_event->dev_id, notify_event->dev_type,
                         notify_event->dev_port);
 
                if (notify_event->event_type != notify_region_probe ||
                    notify_event->bus_id != dev.sbd.bus_id) {
-                       pr_warning("%s:%u: bad notify_event: event %lu, "
-                                  "dev_id %lu, dev_type %lu\n",
+                       pr_warning("%s:%u: bad notify_event: event %llu, "
+                                  "dev_id %llu, dev_type %llu\n",
                                   __func__, __LINE__, notify_event->event_type,
                                   notify_event->dev_id,
                                   notify_event->dev_type);
@@ -946,6 +982,8 @@ static int __init ps3_register_devices(void)
 
        ps3_register_lpm_devices();
 
+       ps3_register_ramdisk_device();
+
        pr_debug(" <- %s:%d\n", __func__, __LINE__);
        return 0;
 }