[libata] conversion to new debug scheme, part 1 of $N
[powerpc.git] / drivers / ieee1394 / video1394.c
index 07050f0..295d0f8 100644 (file)
  *
  * NOTES:
  *
- * jds -- add private data to file to keep track of iso contexts associated
- * with each open -- so release won't kill all iso transfers.
- * 
- * Damien Douxchamps: Fix failure when the number of DMA pages per frame is
- * one.
- * 
  * ioctl return codes:
  * EFAULT is only for invalid address for the argp
  * EINVAL for out of range values
  * ENOTTY for unsupported ioctl request
  *
  */
-
-/* Markus Tavenrath <speedygoo@speedygoo.de> :
-   - fixed checks for valid buffer-numbers in video1394_icotl
-   - changed the ways the dma prg's are used, now it's possible to use
-     even a single dma buffer
-*/
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/poll.h>
 #include <linux/smp_lock.h>
 #include <linux/delay.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/vmalloc.h>
 #include <linux/timex.h>
 #include <linux/mm.h>
-#include <linux/ioctl32.h>
 #include <linux/compat.h>
 #include <linux/cdev.h>
 
@@ -345,7 +331,7 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci, int type, int num_desc,
 
         spin_lock_init(&d->lock);
 
-       PRINT(KERN_INFO, ohci->host->id, "Iso %s DMA: %d buffers "
+       DBGMSG(ohci->host->id, "Iso %s DMA: %d buffers "
              "of size %d allocated for a frame size %d, each with %d prgs",
              (type == OHCI_ISO_RECEIVE) ? "receive" : "transmit",
              d->num_desc - 1, d->buf_size, d->frame_size, d->nb_cmd);
@@ -503,7 +489,7 @@ static void wakeup_dma_ir_ctx(unsigned long l)
                if (d->ir_prg[i][d->nb_cmd-1].status & cpu_to_le32(0xFFFF0000)) {
                        reset_ir_status(d, i);
                        d->buffer_status[d->buffer_prg_assignment[i]] = VIDEO1394_BUFFER_READY;
-                       do_gettimeofday(&d->buffer_time[i]);
+                       do_gettimeofday(&d->buffer_time[d->buffer_prg_assignment[i]]);
                }
        }
 
@@ -757,7 +743,7 @@ static int __video1394_ioctl(struct file *file,
                        if (i == ISO_CHANNELS) {
                            PRINT(KERN_ERR, ohci->host->id, 
                                  "No free channel found");
-                           return EAGAIN;
+                           return -EAGAIN;
                        }
                        if (!(ohci->ISO_channel_usage & mask)) {
                            v.channel = i;
@@ -773,7 +759,7 @@ static int __video1394_ioctl(struct file *file,
                } else {
                        mask = (u64)0x1<<v.channel;
                }
-               PRINT(KERN_INFO, ohci->host->id, "mask: %08X%08X usage: %08X%08X\n",
+               DBGMSG(ohci->host->id, "mask: %08X%08X usage: %08X%08X\n",
                        (u32)(mask>>32),(u32)(mask&0xffffffff),
                        (u32)(ohci->ISO_channel_usage>>32),
                        (u32)(ohci->ISO_channel_usage&0xffffffff));
@@ -819,7 +805,7 @@ static int __video1394_ioctl(struct file *file,
                        v.buf_size = d->buf_size;
                        list_add_tail(&d->link, &ctx->context_list);
 
-                       PRINT(KERN_INFO, ohci->host->id,
+                       DBGMSG(ohci->host->id,
                              "iso context %d listen on channel %d",
                              d->ctx, v.channel);
                }
@@ -842,7 +828,7 @@ static int __video1394_ioctl(struct file *file,
 
                        list_add_tail(&d->link, &ctx->context_list);
 
-                       PRINT(KERN_INFO, ohci->host->id,
+                       DBGMSG(ohci->host->id,
                              "Iso context %d talk on channel %d", d->ctx,
                              v.channel);
                }
@@ -887,7 +873,7 @@ static int __video1394_ioctl(struct file *file,
                        d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, channel);
 
                if (d == NULL) return -ESRCH;
-               PRINT(KERN_INFO, ohci->host->id, "Iso context %d "
+               DBGMSG(ohci->host->id, "Iso context %d "
                      "stop talking on channel %d", d->ctx, channel);
                free_dma_iso_ctx(d);
 
@@ -949,7 +935,7 @@ static int __video1394_ioctl(struct file *file,
                else {
                        /* Wake up dma context if necessary */
                        if (!(reg_read(ohci, d->ctrlSet) & 0x400)) {
-                               PRINT(KERN_INFO, ohci->host->id,
+                               DBGMSG(ohci->host->id,
                                      "Waking up iso dma ctx=%d", d->ctx);
                                reg_write(ohci, d->ctrlSet, 0x1000);
                        }
@@ -1010,7 +996,6 @@ static int __video1394_ioctl(struct file *file,
 
                /* set time of buffer */
                v.filltime = d->buffer_time[v.buffer];
-//             printk("Buffer %d time %d\n", v.buffer, (d->buffer_time[v.buffer]).tv_usec);
 
                /*
                 * Look ahead to see how many more buffers have been received
@@ -1068,7 +1053,7 @@ static int __video1394_ioctl(struct file *file,
 
                spin_lock_irqsave(&d->lock,flags);
 
-               // last_buffer is last_prg
+               /* last_buffer is last_prg */
                next_prg = (d->last_buffer + 1) % d->num_desc;
                if (d->buffer_status[v.buffer]!=VIDEO1394_BUFFER_FREE) {
                        PRINT(KERN_ERR, ohci->host->id,
@@ -1121,7 +1106,7 @@ static int __video1394_ioctl(struct file *file,
                else {
                        /* Wake up dma context if necessary */
                        if (!(reg_read(ohci, d->ctrlSet) & 0x400)) {
-                               PRINT(KERN_INFO, ohci->host->id,
+                               DBGMSG(ohci->host->id,
                                      "Waking up iso transmit dma ctx=%d",
                                      d->ctx);
                                put_timestamp(ohci, d, d->last_buffer);
@@ -1247,7 +1232,7 @@ static int video1394_release(struct inode *inode, struct file *file)
                              "is not being used", d->channel);
                else
                        ohci->ISO_channel_usage &= ~mask;
-               PRINT(KERN_INFO, ohci->host->id, "On release: Iso %s context "
+               DBGMSG(ohci->host->id, "On release: Iso %s context "
                      "%d stop listening on channel %d",
                      d->type == OHCI_ISO_RECEIVE ? "receive" : "transmit",
                      d->ctx, d->channel);
@@ -1336,9 +1321,6 @@ static void video1394_add_host (struct hpsb_host *host)
        class_device_create(hpsb_protocol_class, NULL, MKDEV(
                IEEE1394_MAJOR, minor), 
                NULL, "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
-       devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, minor),
-                      S_IFCHR | S_IRUSR | S_IWUSR,
-                      "%s/%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
 }
 
 
@@ -1346,12 +1328,9 @@ static void video1394_remove_host (struct hpsb_host *host)
 {
        struct ti_ohci *ohci = hpsb_get_hostinfo(&video1394_highlevel, host);
 
-       if (ohci) {
+       if (ohci)
                class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR,
                        IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id));
-               devfs_remove("%s/%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
-       }
-       
        return;
 }
 
@@ -1492,12 +1471,8 @@ static long video1394_compat_ioctl(struct file *f, unsigned cmd, unsigned long a
 static void __exit video1394_exit_module (void)
 {
        hpsb_unregister_protocol(&video1394_driver);
-
        hpsb_unregister_highlevel(&video1394_highlevel);
-
-       devfs_remove(VIDEO1394_DRIVER_NAME);
        cdev_del(&video1394_cdev);
-
        PRINT_G(KERN_INFO, "Removed " VIDEO1394_DRIVER_NAME " module");
 }
 
@@ -1514,15 +1489,12 @@ static int __init video1394_init_module (void)
                return ret;
         }
 
-       devfs_mk_dir(VIDEO1394_DRIVER_NAME);
-
        hpsb_register_highlevel(&video1394_highlevel);
 
        ret = hpsb_register_protocol(&video1394_driver);
        if (ret) {
                PRINT_G(KERN_ERR, "video1394: failed to register protocol");
                hpsb_unregister_highlevel(&video1394_highlevel);
-               devfs_remove(VIDEO1394_DRIVER_NAME);
                cdev_del(&video1394_cdev);
                return ret;
        }