aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2007-09-29 04:41:58 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-10-16 18:00:08 -0400
commita64408b96b5f67c2778958a230b5cfa3408a4a81 (patch)
tree5dbd798b626f3693fa9950fa2a3b37e489aa6bbd /drivers/firewire
parent02ff8f8ee151e880414b99a11f67cae0cecd4977 (diff)
firewire: adopt read cycle timer ABI from raw1394
This duplicates the read cycle timer feature of raw1394 (added in Linux 2.6.21) in firewire-core's userspace ABI. The argument to the ioctl is reordered though to ensure 32/64 bit compatibility. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/fw-cdev.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c
index b960fd996918..290d9f036199 100644
--- a/drivers/firewire/fw-cdev.c
+++ b/drivers/firewire/fw-cdev.c
@@ -25,11 +25,14 @@
25#include <linux/device.h> 25#include <linux/device.h>
26#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
27#include <linux/poll.h> 27#include <linux/poll.h>
28#include <linux/preempt.h>
29#include <linux/time.h>
28#include <linux/delay.h> 30#include <linux/delay.h>
29#include <linux/mm.h> 31#include <linux/mm.h>
30#include <linux/idr.h> 32#include <linux/idr.h>
31#include <linux/compat.h> 33#include <linux/compat.h>
32#include <linux/firewire-cdev.h> 34#include <linux/firewire-cdev.h>
35#include <asm/system.h>
33#include <asm/uaccess.h> 36#include <asm/uaccess.h>
34#include "fw-transaction.h" 37#include "fw-transaction.h"
35#include "fw-topology.h" 38#include "fw-topology.h"
@@ -811,6 +814,28 @@ static int ioctl_stop_iso(struct client *client, void *buffer)
811 return fw_iso_context_stop(client->iso_context); 814 return fw_iso_context_stop(client->iso_context);
812} 815}
813 816
817static int ioctl_get_cycle_timer(struct client *client, void *buffer)
818{
819 struct fw_cdev_get_cycle_timer *request = buffer;
820 struct fw_card *card = client->device->card;
821 unsigned long long bus_time;
822 struct timeval tv;
823 unsigned long flags;
824
825 preempt_disable();
826 local_irq_save(flags);
827
828 bus_time = card->driver->get_bus_time(card);
829 do_gettimeofday(&tv);
830
831 local_irq_restore(flags);
832 preempt_enable();
833
834 request->local_time = tv.tv_sec * 1000000ULL + tv.tv_usec;
835 request->cycle_timer = bus_time & 0xffffffff;
836 return 0;
837}
838
814static int (* const ioctl_handlers[])(struct client *client, void *buffer) = { 839static int (* const ioctl_handlers[])(struct client *client, void *buffer) = {
815 ioctl_get_info, 840 ioctl_get_info,
816 ioctl_send_request, 841 ioctl_send_request,
@@ -824,6 +849,7 @@ static int (* const ioctl_handlers[])(struct client *client, void *buffer) = {
824 ioctl_queue_iso, 849 ioctl_queue_iso,
825 ioctl_start_iso, 850 ioctl_start_iso,
826 ioctl_stop_iso, 851 ioctl_stop_iso,
852 ioctl_get_cycle_timer,
827}; 853};
828 854
829static int 855static int