powerpc/ps3: Printing fixups for l64 to ll64 conversion drivers/ps3
[linux-2.6.git] / drivers / ps3 / ps3-lpm.c
index 8a0b16b..fe96793 100644 (file)
@@ -22,6 +22,8 @@
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/uaccess.h>
+#include <asm/smp.h>
+#include <asm/time.h>
 #include <asm/ps3.h>
 #include <asm/lv1call.h>
 #include <asm/cell-pmu.h>
@@ -76,7 +78,6 @@
  *
  * @pm_control: Shadow of the processor's pm_control register.
  * @pm_start_stop: Shadow of the processor's pm_start_stop register.
- * @pm_interval: Shadow of the processor's pm_interval register.
  * @group_control: Shadow of the processor's group_control register.
  * @debug_bus_control: Shadow of the processor's debug_bus_control register.
  *
@@ -91,7 +92,6 @@
 struct ps3_lpm_shadow_regs {
        u64 pm_control;
        u64 pm_start_stop;
-       u64 pm_interval;
        u64 group_control;
        u64 debug_bus_control;
 };
@@ -408,7 +408,14 @@ u32 ps3_read_pm(u32 cpu, enum pm_reg_name reg)
        case pm_start_stop:
                return lpm_priv->shadow.pm_start_stop;
        case pm_interval:
-               return lpm_priv->shadow.pm_interval;
+               result = lv1_set_lpm_interval(lpm_priv->lpm_id, 0, 0, &val);
+               if (result) {
+                       val = 0;
+                       dev_dbg(sbd_core(), "%s:%u: lv1 set_inteval failed: "
+                               "reg %u, %s\n", __func__, __LINE__, reg,
+                               ps3_result(result));
+               }
+               return (u32)val;
        case group_control:
                return lpm_priv->shadow.group_control;
        case debug_bus_control:
@@ -475,10 +482,8 @@ void ps3_write_pm(u32 cpu, enum pm_reg_name reg, u32 val)
                lpm_priv->shadow.pm_control = val;
                break;
        case pm_interval:
-               if (val != lpm_priv->shadow.pm_interval)
-                       result = lv1_set_lpm_interval(lpm_priv->lpm_id, val,
-                                                  PS3_WRITE_PM_MASK, &dummy);
-               lpm_priv->shadow.pm_interval = val;
+               result = lv1_set_lpm_interval(lpm_priv->lpm_id, val,
+                                             PS3_WRITE_PM_MASK, &dummy);
                break;
        case pm_start_stop:
                if (val != lpm_priv->shadow.pm_start_stop)
@@ -727,7 +732,7 @@ static u64 pm_signal_group_to_ps3_lv1_signal_group(u64 group)
        case 8:
                return pm_translate_signal_group_number_on_island8(subgroup);
        default:
-               dev_dbg(sbd_core(), "%s:%u: island not found: %lu\n", __func__,
+               dev_dbg(sbd_core(), "%s:%u: island not found: %llu\n", __func__,
                        __LINE__, group);
                BUG();
                break;
@@ -760,7 +765,7 @@ static int __ps3_set_signal(u64 lv1_signal_group, u64 bus_select,
                                 signal_select, attr1, attr2, attr3);
        if (ret)
                dev_err(sbd_core(),
-                       "%s:%u: error:%d 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
+                       "%s:%u: error:%d 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx\n",
                        __func__, __LINE__, ret, lv1_signal_group, bus_select,
                        signal_select, attr1, attr2, attr3);
 
@@ -903,7 +908,7 @@ void ps3_disable_pm(u32 cpu)
 
        lpm_priv->tb_count = tmp;
 
-       dev_dbg(sbd_core(), "%s:%u: tb_count %lu (%lxh)\n", __func__, __LINE__,
+       dev_dbg(sbd_core(), "%s:%u: tb_count %llu (%llxh)\n", __func__, __LINE__,
                lpm_priv->tb_count, lpm_priv->tb_count);
 }
 EXPORT_SYMBOL_GPL(ps3_disable_pm);
@@ -933,7 +938,7 @@ int ps3_lpm_copy_tb(unsigned long offset, void *buf, unsigned long count,
        if (offset >= lpm_priv->tb_count)
                return 0;
 
-       count = min(count, lpm_priv->tb_count - offset);
+       count = min_t(u64, count, lpm_priv->tb_count - offset);
 
        while (*bytes_copied < count) {
                const unsigned long request = count - *bytes_copied;
@@ -988,7 +993,7 @@ int ps3_lpm_copy_tb_to_user(unsigned long offset, void __user *buf,
        if (offset >= lpm_priv->tb_count)
                return 0;
 
-       count = min(count, lpm_priv->tb_count - offset);
+       count = min_t(u64, count, lpm_priv->tb_count - offset);
 
        while (*bytes_copied < count) {
                const unsigned long request = count - *bytes_copied;
@@ -1008,7 +1013,7 @@ int ps3_lpm_copy_tb_to_user(unsigned long offset, void __user *buf,
                result = copy_to_user(buf, lpm_priv->tb_cache, tmp);
 
                if (result) {
-                       dev_dbg(sbd_core(), "%s:%u: 0x%lx bytes at 0x%p\n",
+                       dev_dbg(sbd_core(), "%s:%u: 0x%llx bytes at 0x%p\n",
                                __func__, __LINE__, tmp, buf);
                        dev_err(sbd_core(), "%s:%u: copy_to_user failed: %d\n",
                                __func__, __LINE__, result);
@@ -1140,12 +1145,11 @@ int ps3_lpm_open(enum ps3_lpm_tb_type tb_type, void *tb_cache,
 
        lpm_priv->shadow.pm_control = PS3_LPM_SHADOW_REG_INIT;
        lpm_priv->shadow.pm_start_stop = PS3_LPM_SHADOW_REG_INIT;
-       lpm_priv->shadow.pm_interval = PS3_LPM_SHADOW_REG_INIT;
        lpm_priv->shadow.group_control = PS3_LPM_SHADOW_REG_INIT;
        lpm_priv->shadow.debug_bus_control = PS3_LPM_SHADOW_REG_INIT;
 
-       dev_dbg(sbd_core(), "%s:%u: lpm_id 0x%lx, outlet_id 0x%lx, "
-               "tb_size 0x%lx\n", __func__, __LINE__, lpm_priv->lpm_id,
+       dev_dbg(sbd_core(), "%s:%u: lpm_id 0x%llx, outlet_id 0x%llx, "
+               "tb_size 0x%llx\n", __func__, __LINE__, lpm_priv->lpm_id,
                lpm_priv->outlet_id, tb_size);
 
        return 0;