aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAlexander Gordeev <lasaine@lvk.cs.msu.su>2011-01-12 20:00:51 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 11:03:19 -0500
commit5e196d34a776420278e4117b4742cd9d3f2350ed (patch)
tree86187af6a600876506261758a00c7c42e6037283 /include/linux
parent6f4229b51106cbc859e9d8209b22c8a2ec749e64 (diff)
pps: access pps device by direct pointer
Using device index as a pointer needs some unnecessary work to be done every time the pointer is needed (in irq handler for example). Using a direct pointer is much more easy (and safe as well). Signed-off-by: Alexander Gordeev <lasaine@lvk.cs.msu.su> Acked-by: Rodolfo Giometti <giometti@linux.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/pps_kernel.h23
1 files changed, 9 insertions, 14 deletions
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 32aa6763ca1b..1aedf50088cf 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -31,13 +31,16 @@
31 * Global defines 31 * Global defines
32 */ 32 */
33 33
34struct pps_device;
35
34/* The specific PPS source info */ 36/* The specific PPS source info */
35struct pps_source_info { 37struct pps_source_info {
36 char name[PPS_MAX_NAME_LEN]; /* simbolic name */ 38 char name[PPS_MAX_NAME_LEN]; /* simbolic name */
37 char path[PPS_MAX_NAME_LEN]; /* path of connected device */ 39 char path[PPS_MAX_NAME_LEN]; /* path of connected device */
38 int mode; /* PPS's allowed mode */ 40 int mode; /* PPS's allowed mode */
39 41
40 void (*echo)(int source, int event, void *data); /* PPS echo function */ 42 void (*echo)(struct pps_device *pps,
43 int event, void *data); /* PPS echo function */
41 44
42 struct module *owner; 45 struct module *owner;
43 struct device *dev; 46 struct device *dev;
@@ -65,35 +68,27 @@ struct pps_device {
65 unsigned int id; /* PPS source unique ID */ 68 unsigned int id; /* PPS source unique ID */
66 struct cdev cdev; 69 struct cdev cdev;
67 struct device *dev; 70 struct device *dev;
68 int devno;
69 struct fasync_struct *async_queue; /* fasync method */ 71 struct fasync_struct *async_queue; /* fasync method */
70 spinlock_t lock; 72 spinlock_t lock;
71
72 atomic_t usage; /* usage count */
73}; 73};
74 74
75/* 75/*
76 * Global variables 76 * Global variables
77 */ 77 */
78 78
79extern spinlock_t pps_idr_lock;
80extern struct idr pps_idr;
81
82extern struct device_attribute pps_attrs[]; 79extern struct device_attribute pps_attrs[];
83 80
84/* 81/*
85 * Exported functions 82 * Exported functions
86 */ 83 */
87 84
88struct pps_device *pps_get_source(int source); 85extern struct pps_device *pps_register_source(
89extern void pps_put_source(struct pps_device *pps); 86 struct pps_source_info *info, int default_params);
90extern int pps_register_source(struct pps_source_info *info, 87extern void pps_unregister_source(struct pps_device *pps);
91 int default_params);
92extern void pps_unregister_source(int source);
93extern int pps_register_cdev(struct pps_device *pps); 88extern int pps_register_cdev(struct pps_device *pps);
94extern void pps_unregister_cdev(struct pps_device *pps); 89extern void pps_unregister_cdev(struct pps_device *pps);
95extern void pps_event(int source, struct pps_event_time *ts, int event, 90extern void pps_event(struct pps_device *pps,
96 void *data); 91 struct pps_event_time *ts, int event, void *data);
97 92
98static inline void timespec_to_pps_ktime(struct pps_ktime *kt, 93static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
99 struct timespec ts) 94 struct timespec ts)