perf callchain: Remove unnecessary validation
[linux-2.6/btrfs-unstable.git] / drivers / staging / dgrp / dgrp_common.h
blob23aba6c4d22c77c02e941d3918261882dc51a40a
1 /*
3 * Copyright 1999 Digi International (www.digi.com)
4 * James Puzzo <jamesp at digi dot com>
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, or (at your option)
9 * any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
13 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
18 #ifndef __DGRP_COMMON_H
19 #define __DGRP_COMMON_H
21 #define DIGI_VERSION "1.9-29"
23 #include <linux/fs.h>
24 #include <linux/timer.h>
25 #include "drp.h"
27 #define DGRP_TTIME 100
28 #define DGRP_RTIME 100
30 /************************************************************************
31 * All global storage allocation.
32 ************************************************************************/
34 extern int dgrp_register_cudevices; /* enable legacy cu devices */
35 extern int dgrp_register_prdevices; /* enable transparent print devices */
36 extern int dgrp_poll_tick; /* Poll interval - in ms */
38 extern struct list_head nd_struct_list;
40 struct dgrp_poll_data {
41 spinlock_t poll_lock;
42 struct timer_list timer;
43 int poll_tick;
44 ulong poll_round; /* Timer rouding factor */
45 long node_active_count;
48 extern struct dgrp_poll_data dgrp_poll_data;
49 extern void dgrp_poll_handler(unsigned long arg);
51 /* from dgrp_mon_ops.c */
52 extern const struct file_operations dgrp_mon_ops;
54 /* from dgrp_tty.c */
55 extern int dgrp_tty_init(struct nd_struct *nd);
56 extern void dgrp_tty_uninit(struct nd_struct *nd);
58 /* from dgrp_ports_ops.c */
59 extern const struct file_operations dgrp_ports_ops;
61 /* from dgrp_net_ops.c */
62 extern const struct file_operations dgrp_net_ops;
64 /* from dgrp_dpa_ops.c */
65 extern const struct file_operations dgrp_dpa_ops;
66 extern void dgrp_dpa_data(struct nd_struct *, int, u8 *, int);
68 /* from dgrp_sysfs.c */
69 extern int dgrp_create_class_sysfs_files(void);
70 extern void dgrp_remove_class_sysfs_files(void);
72 extern void dgrp_create_node_class_sysfs_files(struct nd_struct *nd);
73 extern void dgrp_remove_node_class_sysfs_files(struct nd_struct *nd);
75 extern void dgrp_create_tty_sysfs(struct un_struct *un, struct device *c);
76 extern void dgrp_remove_tty_sysfs(struct device *c);
78 /* from dgrp_specproc.c */
79 extern void dgrp_unregister_proc(void);
80 extern void dgrp_register_proc(void);
82 /*-----------------------------------------------------------------------*
84 * Declarations for common operations:
86 * (either used by more than one of net, mon, or tty,
87 * or in interrupt context (i.e. the poller))
89 *-----------------------------------------------------------------------*/
91 void dgrp_carrier(struct ch_struct *ch);
95 * ID manipulation macros (where c1 & c2 are characters, i is
96 * a long integer, and s is a character array of at least three members
99 static inline void ID_TO_CHAR(long i, char *s)
101 s[0] = ((i & 0xff00)>>8);
102 s[1] = (i & 0xff);
103 s[2] = 0;
106 static inline long CHAR_TO_ID(char *s)
108 return ((s[0] & 0xff) << 8) | (s[1] & 0xff);
111 static inline struct nd_struct *nd_struct_get(long major)
113 struct nd_struct *nd;
115 list_for_each_entry(nd, &nd_struct_list, list) {
116 if (major == nd->nd_major)
117 return nd;
120 return NULL;
123 static inline int nd_struct_add(struct nd_struct *entry)
125 struct nd_struct *ptr;
127 ptr = nd_struct_get(entry->nd_major);
129 if (ptr)
130 return -EBUSY;
132 list_add_tail(&entry->list, &nd_struct_list);
134 return 0;
137 static inline int nd_struct_del(struct nd_struct *entry)
139 struct nd_struct *nd;
141 nd = nd_struct_get(entry->nd_major);
143 if (!nd)
144 return -ENODEV;
146 list_del(&nd->list);
147 return 0;
150 #endif /* __DGRP_COMMON_H */