aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Täht <d@teklibre.com>2009-01-20 09:33:25 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-03 17:53:32 -0400
commitdab8c35990692026fca989c3449fd67a59275c6a (patch)
tree8c00a1d946410afe4568c99e701e877107a590d0
parenta07998529bb6c4a4df97013d791a592c2b60ec78 (diff)
Staging: frontier: Remove unused components of the alphatrack/tranzport sysfs interface.
Signed-off-by: David Täht <d@teklibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/frontier/alphatrack.c2
-rw-r--r--drivers/staging/frontier/surface_sysfs.h100
-rw-r--r--drivers/staging/frontier/tranzport.c128
3 files changed, 10 insertions, 220 deletions
diff --git a/drivers/staging/frontier/alphatrack.c b/drivers/staging/frontier/alphatrack.c
index 97d28ce45f12..bcba17eae926 100644
--- a/drivers/staging/frontier/alphatrack.c
+++ b/drivers/staging/frontier/alphatrack.c
@@ -46,8 +46,6 @@
46#include <linux/usb.h> 46#include <linux/usb.h>
47#include <linux/poll.h> 47#include <linux/poll.h>
48 48
49#include "surface_sysfs.h"
50
51#include "alphatrack.h" 49#include "alphatrack.h"
52 50
53#define VENDOR_ID 0x165b 51#define VENDOR_ID 0x165b
diff --git a/drivers/staging/frontier/surface_sysfs.h b/drivers/staging/frontier/surface_sysfs.h
deleted file mode 100644
index d50a562d658a..000000000000
--- a/drivers/staging/frontier/surface_sysfs.h
+++ /dev/null
@@ -1,100 +0,0 @@
1/* If you are going to abuse the preprocessor, why not ABUSE the preprocessor?
2 I stuck this header in a separate file so I don't have to look at it */
3
4// FIXME Need locking or atomic ops
5
6#define show_set_mbit(dname,value,bit) \
7static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \
8{ \
9 struct usb_interface *intf = to_usb_interface(dev); \
10 struct usb_##dname *t = usb_get_intfdata(intf); \
11 int temp = (1 && (t->value & (1 << bit))); \
12 return sprintf(buf, "%d\n", temp); \
13} \
14static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
15{ \
16 struct usb_interface *intf = to_usb_interface(dev); \
17 struct usb_##dname *t = usb_get_intfdata(intf); \
18 int temp = simple_strtoul(buf, NULL, 10); \
19 if(temp > 0) { long b = 1 << bit; t->value |= b; } \
20 else { long b = ~(1 << bit); t->value &= b ; \
21 return count; \
22} \
23static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value);
24
25#define show_set_ebit(dname,enumname,value,bit) \
26static ssize_t show_##bit(struct device *dev, struct device_attribute *attr, char *buf) \
27{ \
28 struct usb_interface *intf = to_usb_interface(dev); \
29 struct usb_##dname *t = usb_get_intfdata(intf); \
30 enum enumname l = bit; \
31 int temp = t->value & (1 << l); \
32 return sprintf(buf, "%d\n", temp); \
33} \
34static ssize_t set_##bit(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
35{ \
36 struct usb_interface *intf = to_usb_interface(dev); \
37 struct usb_##dname *t = usb_get_intfdata(intf); \
38 int temp = simple_strtoul(buf, NULL, 10); \
39 enum enumname l = bit;\
40 long b = 1 << l; \
41 if(temp > 0) { t->value |= b; } \
42 else { t->value &= ~b ; \
43 return count; \
44} \
45static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value);
46
47// FIXME FOR CORRECTLY SETTING HEX from a string
48#define show_set_mcmd(dname,value) \
49static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \
50{ \
51 struct usb_interface *intf = to_usb_interface(dev); \
52 struct usb_##dname *t = usb_get_intfdata(intf); \
53 int count = 0;\
54 int i; \
55 for (i = 0,i<sizeof(dname); i++) count += snprintf(buf, "%02x",t->dname[i]); \
56 return(count);\
57} \
58static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
59{ \
60 struct usb_interface *intf = to_usb_interface(dev); \
61 struct usb_##dname *t = usb_get_intfdata(intf); \
62 int temp = simple_strtoul(buf, NULL, 10); \
63 t->value = temp; \
64 return count; \
65} \
66static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value);
67
68#define show_set_mint(dname,value) \
69static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \
70{ \
71 struct usb_interface *intf = to_usb_interface(dev); \
72 struct usb_##dname *t = usb_get_intfdata(intf); \
73 return sprintf(buf, "%d\n", t->value); \
74} \
75static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
76{ \
77 struct usb_interface *intf = to_usb_interface(dev); \
78 struct usb_##dname *t = usb_get_intfdata(intf); \
79 int temp = simple_strtoul(buf, NULL, 10); \
80 t->value = temp; \
81 return count; \
82} \
83static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value);
84
85#define show_set_mchar(dname,value) \
86static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \
87{ \
88 struct usb_interface *intf = to_usb_interface(dev); \
89 struct usb_##dname *t = usb_get_intfdata(intf); \
90 return sprintf(buf, "%c\n", t->value); \
91} \
92static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
93{ \
94 struct usb_interface *intf = to_usb_interface(dev); \
95 struct usb_##dname *t = usb_get_intfdata(intf); \
96 int temp = simple_strtoul(buf, NULL, 10); \
97 t->value = temp; \
98 return count; \
99} \
100static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value);
diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c
index 4ed8ac8b6430..274b82bd7863 100644
--- a/drivers/staging/frontier/tranzport.c
+++ b/drivers/staging/frontier/tranzport.c
@@ -51,7 +51,7 @@
51 51
52#ifdef CONFIG_USB_DYNAMIC_MINORS 52#ifdef CONFIG_USB_DYNAMIC_MINORS
53#define USB_TRANZPORT_MINOR_BASE 0 53#define USB_TRANZPORT_MINOR_BASE 0
54#else /* FIXME 176 - is the ldusb driver's minor - apply for a minor soon */ 54#else /* FIXME 177- is the another driver's minor - apply for a minor soon */
55#define USB_TRANZPORT_MINOR_BASE 177 55#define USB_TRANZPORT_MINOR_BASE 177
56#endif 56#endif
57 57
@@ -62,7 +62,7 @@ static struct usb_device_id usb_tranzport_table[] = {
62}; 62};
63 63
64MODULE_DEVICE_TABLE(usb, usb_tranzport_table); 64MODULE_DEVICE_TABLE(usb, usb_tranzport_table);
65MODULE_VERSION("0.34"); 65MODULE_VERSION("0.35");
66MODULE_AUTHOR("Mike Taht <m@taht.net>"); 66MODULE_AUTHOR("Mike Taht <m@taht.net>");
67MODULE_DESCRIPTION("Tranzport USB Driver"); 67MODULE_DESCRIPTION("Tranzport USB Driver");
68MODULE_LICENSE("GPL"); 68MODULE_LICENSE("GPL");
@@ -121,16 +121,6 @@ struct tranzport_cmd {
121 unsigned char cmd[8]; 121 unsigned char cmd[8];
122}; 122};
123 123
124enum LightID {
125 LightRecord = 0,
126 LightTrackrec,
127 LightTrackmute,
128 LightTracksolo,
129 LightAnysolo,
130 LightLoop,
131 LightPunch
132};
133
134/* Structure to hold all of our device specific stuff */ 124/* Structure to hold all of our device specific stuff */
135 125
136struct usb_tranzport { 126struct usb_tranzport {
@@ -156,19 +146,11 @@ struct usb_tranzport {
156 size_t interrupt_out_endpoint_size; 146 size_t interrupt_out_endpoint_size;
157 int interrupt_out_busy; 147 int interrupt_out_busy;
158 148
159 /* Sysfs and translation support */ 149 /* Sysfs support */
160 150
161 int event; /* alternate interface to events */
162 int wheel; /* - for negative, 0 for none, + for positive */
163 unsigned char dump_state; /* 0 if disabled 1 if enabled */
164 unsigned char enable; /* 0 if disabled 1 if enabled */ 151 unsigned char enable; /* 0 if disabled 1 if enabled */
165 unsigned char offline; /* if the device is out of range or asleep */ 152 unsigned char offline; /* if the device is out of range or asleep */
166 unsigned char compress_wheel; /* flag to compress wheel events */ 153 unsigned char compress_wheel; /* flag to compress wheel events */
167 unsigned char light; /* 7 bits used */
168 unsigned char last_cmd[8];
169 unsigned char last_input[8];
170 unsigned char screen[40]; /* We'll also have cells */
171
172}; 154};
173 155
174/* prevent races between open() and disconnect() */ 156/* prevent races between open() and disconnect() */
@@ -193,38 +175,15 @@ static void usb_tranzport_abort_transfers(struct usb_tranzport *dev)
193 usb_kill_urb(dev->interrupt_out_urb); 175 usb_kill_urb(dev->interrupt_out_urb);
194} 176}
195 177
196/* FIXME ~light not good enough or correct - need atomic set_bit */ 178#define show_int(value) \
197 179 static ssize_t show_##value(struct device *dev, \
198#define show_set_light(value) \ 180 struct device_attribute *attr, char *buf) \
199 static ssize_t show_##value( \
200 struct device *dev, struct device_attribute *attr, char *buf) \
201 { \
202 struct usb_interface *intf = to_usb_interface(dev); \
203 struct usb_tranzport *t = usb_get_intfdata(intf); \
204 enum LightID light = value; \
205 int temp = (1 && (t->light & (1 << light))); \
206 return sprintf(buf, "%d\n", temp); \
207 } \
208 static ssize_t set_##value( \
209 struct device *dev, struct device_attribute *attr, \
210 const char *buf, size_t count) \
211 { \ 181 { \
212 struct usb_interface *intf = to_usb_interface(dev); \ 182 struct usb_interface *intf = to_usb_interface(dev); \
213 struct usb_tranzport *t = usb_get_intfdata(intf); \ 183 struct usb_tranzport *t = usb_get_intfdata(intf); \
214 int temp = simple_strtoul(buf, NULL, 10); \ 184 return sprintf(buf, "%d\n", t->value); \
215 enum LightID light = (temp << value) & (t->light << value); \
216 t->light = (t->light & ~light) ; \
217 return count; \
218 } \ 185 } \
219 static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); 186 static DEVICE_ATTR(value, S_IRUGO, show_##value, NULL);
220
221show_set_light(LightRecord);
222show_set_light(LightTrackrec);
223show_set_light(LightTrackmute);
224show_set_light(LightTracksolo);
225show_set_light(LightAnysolo);
226show_set_light(LightLoop);
227show_set_light(LightPunch);
228 187
229#define show_set_int(value) \ 188#define show_set_int(value) \
230 static ssize_t show_##value(struct device *dev, \ 189 static ssize_t show_##value(struct device *dev, \
@@ -246,34 +205,9 @@ show_set_light(LightPunch);
246 } \ 205 } \
247 static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); 206 static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value);
248 207
249show_set_int(enable); 208show_int(enable);
250show_set_int(offline); 209show_int(offline);
251show_set_int(compress_wheel); 210show_set_int(compress_wheel);
252show_set_int(dump_state);
253show_set_int(wheel);
254show_set_int(event);
255
256#define show_set_cmd(value) \
257 static ssize_t show_##value(struct device *dev, \
258 struct device_attribute *attr, char *buf) \
259 { \
260 struct usb_interface *intf = to_usb_interface(dev); \
261 struct usb_tranzport *t = usb_get_intfdata(intf); \
262 \
263 return sprintf(buf, "%d\n", t->value); \
264 } \
265 static ssize_t set_##value(struct device *dev, \
266 struct device_attribute *attr, \
267 const char *buf, size_t count) \
268 { \
269 struct usb_interface *intf = to_usb_interface(dev); \
270 struct usb_tranzport *t = usb_get_intfdata(intf); \
271 int temp = simple_strtoul(buf, NULL, 10); \
272 \
273 t->value = temp; \
274 return count; \
275 } \
276 static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value);
277 211
278/** 212/**
279 * usb_tranzport_delete 213 * usb_tranzport_delete
@@ -281,22 +215,10 @@ show_set_int(event);
281static void usb_tranzport_delete(struct usb_tranzport *dev) 215static void usb_tranzport_delete(struct usb_tranzport *dev)
282{ 216{
283 usb_tranzport_abort_transfers(dev); 217 usb_tranzport_abort_transfers(dev);
284 /* This is just too twisted to be correct */
285 if (dev->intf != NULL) { 218 if (dev->intf != NULL) {
286 device_remove_file(&dev->intf->dev, &dev_attr_LightRecord);
287 device_remove_file(&dev->intf->dev, &dev_attr_LightTrackrec);
288 device_remove_file(&dev->intf->dev, &dev_attr_LightTrackmute);
289 device_remove_file(&dev->intf->dev, &dev_attr_LightTracksolo);
290 device_remove_file(&dev->intf->dev, &dev_attr_LightTrackmute);
291 device_remove_file(&dev->intf->dev, &dev_attr_LightAnysolo);
292 device_remove_file(&dev->intf->dev, &dev_attr_LightLoop);
293 device_remove_file(&dev->intf->dev, &dev_attr_LightPunch);
294 device_remove_file(&dev->intf->dev, &dev_attr_wheel);
295 device_remove_file(&dev->intf->dev, &dev_attr_enable); 219 device_remove_file(&dev->intf->dev, &dev_attr_enable);
296 device_remove_file(&dev->intf->dev, &dev_attr_event);
297 device_remove_file(&dev->intf->dev, &dev_attr_offline); 220 device_remove_file(&dev->intf->dev, &dev_attr_offline);
298 device_remove_file(&dev->intf->dev, &dev_attr_compress_wheel); 221 device_remove_file(&dev->intf->dev, &dev_attr_compress_wheel);
299 device_remove_file(&dev->intf->dev, &dev_attr_dump_state);
300 } 222 }
301 223
302 /* free data structures */ 224 /* free data structures */
@@ -983,36 +905,6 @@ static int usb_tranzport_probe(struct usb_interface *intf,
983 goto error; 905 goto error;
984 } 906 }
985 907
986 retval = device_create_file(&intf->dev, &dev_attr_LightRecord);
987 if (retval)
988 goto error;
989 retval = device_create_file(&intf->dev, &dev_attr_LightTrackrec);
990 if (retval)
991 goto error;
992 retval = device_create_file(&intf->dev, &dev_attr_LightTrackmute);
993 if (retval)
994 goto error;
995 retval = device_create_file(&intf->dev, &dev_attr_LightTracksolo);
996 if (retval)
997 goto error;
998 retval = device_create_file(&intf->dev, &dev_attr_LightAnysolo);
999 if (retval)
1000 goto error;
1001 retval = device_create_file(&intf->dev, &dev_attr_LightLoop);
1002 if (retval)
1003 goto error;
1004 retval = device_create_file(&intf->dev, &dev_attr_LightPunch);
1005 if (retval)
1006 goto error;
1007 retval = device_create_file(&intf->dev, &dev_attr_wheel);
1008 if (retval)
1009 goto error;
1010 retval = device_create_file(&intf->dev, &dev_attr_event);
1011 if (retval)
1012 goto error;
1013 retval = device_create_file(&intf->dev, &dev_attr_dump_state);
1014 if (retval)
1015 goto error;
1016 retval = device_create_file(&intf->dev, &dev_attr_compress_wheel); 908 retval = device_create_file(&intf->dev, &dev_attr_compress_wheel);
1017 if (retval) 909 if (retval)
1018 goto error; 910 goto error;