"[PATCH] Fix leaks on /proc/{*/sched,sched_debug,timer_list,timer_stats}" and
[mmotm.git] / include / linux / pps_kernel.h
blobe0a193f830efb825fd7bb33ec35164d38118ca55
1 /*
2 * PPS API kernel header
4 * Copyright (C) 2009 Rodolfo Giometti <giometti@linux.it>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <linux/pps.h>
23 #include <linux/cdev.h>
24 #include <linux/device.h>
25 #include <linux/time.h>
28 * Global defines
31 /* The specific PPS source info */
32 struct pps_source_info {
33 char name[PPS_MAX_NAME_LEN]; /* simbolic name */
34 char path[PPS_MAX_NAME_LEN]; /* path of connected device */
35 int mode; /* PPS's allowed mode */
37 void (*echo)(int source, int event, void *data); /* PPS echo function */
39 struct module *owner;
40 struct device *dev;
43 /* The main struct */
44 struct pps_device {
45 struct pps_source_info info; /* PSS source info */
47 struct pps_kparams params; /* PPS's current params */
49 __u32 assert_sequence; /* PPS' assert event seq # */
50 __u32 clear_sequence; /* PPS' clear event seq # */
51 struct pps_ktime assert_tu;
52 struct pps_ktime clear_tu;
53 int current_mode; /* PPS mode at event time */
55 int go; /* PPS event is arrived? */
56 wait_queue_head_t queue; /* PPS event queue */
58 unsigned int id; /* PPS source unique ID */
59 struct cdev cdev;
60 struct device *dev;
61 int devno;
62 struct fasync_struct *async_queue; /* fasync method */
63 spinlock_t lock;
65 atomic_t usage; /* usage count */
69 * Global variables
72 extern spinlock_t pps_idr_lock;
73 extern struct idr pps_idr;
74 extern struct timespec pps_irq_ts[];
76 extern struct device_attribute pps_attrs[];
79 * Exported functions
82 struct pps_device *pps_get_source(int source);
83 extern void pps_put_source(struct pps_device *pps);
84 extern int pps_register_source(struct pps_source_info *info,
85 int default_params);
86 extern void pps_unregister_source(int source);
87 extern int pps_register_cdev(struct pps_device *pps);
88 extern void pps_unregister_cdev(struct pps_device *pps);
89 extern void pps_event(int source, struct pps_ktime *ts, int event, void *data);