]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ps3/ps3-vuart.c
powerpc/ps3: Printing fixups for l64 to ll64 conversion drivers/ps3
[linux-2.6-omap-h63xx.git] / drivers / ps3 / ps3-vuart.c
index 9dea585ef8064f656ebeed605dc834179206ee2c..e4ad5ba5d0a3da7b4014c003f7582d9146323a44 100644 (file)
@@ -108,18 +108,18 @@ static struct ps3_vuart_port_priv *to_port_priv(
 struct ports_bmp {
        u64 status;
        u64 unused[3];
-} __attribute__ ((aligned (32)));
+} __attribute__((aligned(32)));
 
 #define dump_ports_bmp(_b) _dump_ports_bmp(_b, __func__, __LINE__)
 static void __maybe_unused _dump_ports_bmp(
-       const struct ports_bmp* bmp, const char* func, int line)
+       const struct ports_bmp *bmp, const char *func, int line)
 {
-       pr_debug("%s:%d: ports_bmp: %016lxh\n", func, line, bmp->status);
+       pr_debug("%s:%d: ports_bmp: %016llxh\n", func, line, bmp->status);
 }
 
 #define dump_port_params(_b) _dump_port_params(_b, __func__, __LINE__)
 static void __maybe_unused _dump_port_params(unsigned int port_number,
-       const charfunc, int line)
+       const char *func, int line)
 {
 #if defined(DEBUG)
        static const char *strings[] = {
@@ -159,11 +159,13 @@ int ps3_vuart_get_triggers(struct ps3_system_bus_device *dev,
        struct vuart_triggers *trig)
 {
        int result;
-       unsigned long size;
-       unsigned long val;
+       u64 size;
+       u64 val;
+       u64 tx;
 
        result = lv1_get_virtual_uart_param(dev->port_number,
-               PARAM_TX_TRIGGER, &trig->tx);
+               PARAM_TX_TRIGGER, &tx);
+       trig->tx = tx;
 
        if (result) {
                dev_dbg(&dev->core, "%s:%d: tx_trigger failed: %s\n",
@@ -201,7 +203,7 @@ int ps3_vuart_set_triggers(struct ps3_system_bus_device *dev, unsigned int tx,
        unsigned int rx)
 {
        int result;
-       unsigned long size;
+       u64 size;
 
        result = lv1_set_virtual_uart_param(dev->port_number,
                PARAM_TX_TRIGGER, tx);
@@ -248,7 +250,7 @@ static int ps3_vuart_get_rx_bytes_waiting(struct ps3_system_bus_device *dev,
                dev_dbg(&dev->core, "%s:%d: rx_bytes failed: %s\n",
                        __func__, __LINE__, ps3_result(result));
 
-       dev_dbg(&dev->core, "%s:%d: %lxh\n", __func__, __LINE__,
+       dev_dbg(&dev->core, "%s:%d: %llxh\n", __func__, __LINE__,
                *bytes_waiting);
        return result;
 }
@@ -295,7 +297,7 @@ static int ps3_vuart_get_interrupt_status(struct ps3_system_bus_device *dev,
 
        *status = tmp & priv->interrupt_mask;
 
-       dev_dbg(&dev->core, "%s:%d: m %lxh, s %lxh, m&s %lxh\n",
+       dev_dbg(&dev->core, "%s:%d: m %llxh, s %llxh, m&s %lxh\n",
                __func__, __LINE__, priv->interrupt_mask, tmp, *status);
 
        return result;
@@ -363,7 +365,7 @@ int ps3_vuart_disable_interrupt_disconnect(struct ps3_system_bus_device *dev)
  */
 
 static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev,
-       const void* buf, unsigned int bytes, unsigned long *bytes_written)
+       const void *buf, unsigned int bytes, u64 *bytes_written)
 {
        int result;
        struct ps3_vuart_port_priv *priv = to_port_priv(dev);
@@ -379,7 +381,7 @@ static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev,
 
        priv->stats.bytes_written += *bytes_written;
 
-       dev_dbg(&dev->core, "%s:%d: wrote %lxh/%xh=>%lxh\n", __func__, __LINE__,
+       dev_dbg(&dev->core, "%s:%d: wrote %llxh/%xh=>%lxh\n", __func__, __LINE__,
                *bytes_written, bytes, priv->stats.bytes_written);
 
        return result;
@@ -393,7 +395,7 @@ static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev,
  */
 
 static int ps3_vuart_raw_read(struct ps3_system_bus_device *dev, void *buf,
-       unsigned int bytes, unsigned long *bytes_read)
+       unsigned int bytes, u64 *bytes_read)
 {
        int result;
        struct ps3_vuart_port_priv *priv = to_port_priv(dev);
@@ -411,7 +413,7 @@ static int ps3_vuart_raw_read(struct ps3_system_bus_device *dev, void *buf,
 
        priv->stats.bytes_read += *bytes_read;
 
-       dev_dbg(&dev->core, "%s:%d: read %lxh/%xh=>%lxh\n", __func__, __LINE__,
+       dev_dbg(&dev->core, "%s:%d: read %llxh/%xh=>%lxh\n", __func__, __LINE__,
                *bytes_read, bytes, priv->stats.bytes_read);
 
        return result;
@@ -431,7 +433,7 @@ void ps3_vuart_clear_rx_bytes(struct ps3_system_bus_device *dev,
        int result;
        struct ps3_vuart_port_priv *priv = to_port_priv(dev);
        u64 bytes_waiting;
-       voidtmp;
+       void *tmp;
 
        result = ps3_vuart_get_rx_bytes_waiting(dev, &bytes_waiting);
 
@@ -500,7 +502,7 @@ int ps3_vuart_write(struct ps3_system_bus_device *dev, const void *buf,
        spin_lock_irqsave(&priv->tx_list.lock, flags);
 
        if (list_empty(&priv->tx_list.head)) {
-               unsigned long bytes_written;
+               u64 bytes_written;
 
                result = ps3_vuart_raw_write(dev, buf, bytes, &bytes_written);
 
@@ -526,9 +528,8 @@ int ps3_vuart_write(struct ps3_system_bus_device *dev, const void *buf,
 
        lb = kmalloc(sizeof(struct list_buffer) + bytes, GFP_KERNEL);
 
-       if (!lb) {
+       if (!lb)
                return -ENOMEM;
-       }
 
        memcpy(lb->data, buf, bytes);
        lb->head = lb->data;
@@ -593,7 +594,7 @@ static int ps3_vuart_queue_rx_bytes(struct ps3_system_bus_device *dev,
        list_add_tail(&lb->link, &priv->rx_list.head);
        priv->rx_list.bytes_held += bytes;
 
-       dev_dbg(&dev->core, "%s:%d: buf_%lu: queued %lxh bytes\n",
+       dev_dbg(&dev->core, "%s:%d: buf_%lu: queued %llxh bytes\n",
                __func__, __LINE__, lb->dbg_number, bytes);
 
        *bytes_queued = bytes;
@@ -746,7 +747,7 @@ static int ps3_vuart_handle_interrupt_tx(struct ps3_system_bus_device *dev)
 
        list_for_each_entry_safe(lb, n, &priv->tx_list.head, link) {
 
-               unsigned long bytes_written;
+               u64 bytes_written;
 
                result = ps3_vuart_raw_write(dev, lb->head, lb->tail - lb->head,
                        &bytes_written);
@@ -763,7 +764,7 @@ static int ps3_vuart_handle_interrupt_tx(struct ps3_system_bus_device *dev)
                if (bytes_written < lb->tail - lb->head) {
                        lb->head += bytes_written;
                        dev_dbg(&dev->core,
-                               "%s:%d cleared buf_%lu, %lxh bytes\n",
+                               "%s:%d cleared buf_%lu, %llxh bytes\n",
                                __func__, __LINE__, lb->dbg_number,
                                bytes_written);
                        goto port_full;
@@ -878,7 +879,7 @@ static int ps3_vuart_handle_port_interrupt(struct ps3_system_bus_device *dev)
 struct vuart_bus_priv {
        struct ports_bmp *bmp;
        unsigned int virq;
-       struct semaphore probe_mutex;
+       struct mutex probe_mutex;
        int use_count;
        struct ps3_system_bus_device *devices[PORT_COUNT];
 } static vuart_bus_priv;
@@ -926,9 +927,8 @@ static int ps3_vuart_bus_interrupt_get(void)
 
        BUG_ON(vuart_bus_priv.use_count > 2);
 
-       if (vuart_bus_priv.use_count != 1) {
+       if (vuart_bus_priv.use_count != 1)
                return 0;
-       }
 
        BUG_ON(vuart_bus_priv.bmp);
 
@@ -1017,7 +1017,7 @@ static int ps3_vuart_probe(struct ps3_system_bus_device *dev)
                return -EINVAL;
        }
 
-       down(&vuart_bus_priv.probe_mutex);
+       mutex_lock(&vuart_bus_priv.probe_mutex);
 
        result = ps3_vuart_bus_interrupt_get();
 
@@ -1074,11 +1074,10 @@ static int ps3_vuart_probe(struct ps3_system_bus_device *dev)
        if (result) {
                dev_dbg(&dev->core, "%s:%d: drv->probe failed\n",
                        __func__, __LINE__);
-               down(&vuart_bus_priv.probe_mutex);
                goto fail_probe;
        }
 
-       up(&vuart_bus_priv.probe_mutex);
+       mutex_unlock(&vuart_bus_priv.probe_mutex);
 
        return result;
 
@@ -1091,7 +1090,7 @@ fail_dev_malloc:
 fail_busy:
        ps3_vuart_bus_interrupt_put();
 fail_setup_interrupt:
-       up(&vuart_bus_priv.probe_mutex);
+       mutex_unlock(&vuart_bus_priv.probe_mutex);
        dev_dbg(&dev->core, "%s:%d: failed\n", __func__, __LINE__);
        return result;
 }
@@ -1130,7 +1129,7 @@ static int ps3_vuart_remove(struct ps3_system_bus_device *dev)
 
        BUG_ON(!dev);
 
-       down(&vuart_bus_priv.probe_mutex);
+       mutex_lock(&vuart_bus_priv.probe_mutex);
 
        dev_dbg(&dev->core, " -> %s:%d: match_id %d\n", __func__, __LINE__,
                dev->match_id);
@@ -1138,7 +1137,7 @@ static int ps3_vuart_remove(struct ps3_system_bus_device *dev)
        if (!dev->core.driver) {
                dev_dbg(&dev->core, "%s:%d: no driver bound\n", __func__,
                        __LINE__);
-               up(&vuart_bus_priv.probe_mutex);
+               mutex_unlock(&vuart_bus_priv.probe_mutex);
                return 0;
        }
 
@@ -1161,7 +1160,7 @@ static int ps3_vuart_remove(struct ps3_system_bus_device *dev)
        priv = NULL;
 
        dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);
-       up(&vuart_bus_priv.probe_mutex);
+       mutex_unlock(&vuart_bus_priv.probe_mutex);
        return 0;
 }
 
@@ -1181,7 +1180,7 @@ static int ps3_vuart_shutdown(struct ps3_system_bus_device *dev)
 
        BUG_ON(!dev);
 
-       down(&vuart_bus_priv.probe_mutex);
+       mutex_lock(&vuart_bus_priv.probe_mutex);
 
        dev_dbg(&dev->core, " -> %s:%d: match_id %d\n", __func__, __LINE__,
                dev->match_id);
@@ -1189,7 +1188,7 @@ static int ps3_vuart_shutdown(struct ps3_system_bus_device *dev)
        if (!dev->core.driver) {
                dev_dbg(&dev->core, "%s:%d: no driver bound\n", __func__,
                        __LINE__);
-               up(&vuart_bus_priv.probe_mutex);
+               mutex_unlock(&vuart_bus_priv.probe_mutex);
                return 0;
        }
 
@@ -1213,7 +1212,7 @@ static int ps3_vuart_shutdown(struct ps3_system_bus_device *dev)
 
        dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);
 
-       up(&vuart_bus_priv.probe_mutex);
+       mutex_unlock(&vuart_bus_priv.probe_mutex);
        return 0;
 }
 
@@ -1224,7 +1223,7 @@ static int __init ps3_vuart_bus_init(void)
        if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
                return -ENODEV;
 
-       init_MUTEX(&vuart_bus_priv.probe_mutex);
+       mutex_init(&vuart_bus_priv.probe_mutex);
 
        return 0;
 }