diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-05-29 03:29:01 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-05-29 03:29:01 -0400 |
commit | 05f091ab4c8c1f12f8dd38ee789489904fea327d (patch) | |
tree | 6ad1f600921354b3ea834b84f33ce9397f6818a5 /drivers/usb/input/xpad.c | |
parent | ab0c3443ad2de03383f2549195badf64779d08a1 (diff) |
Input: whitespace fixes in drivers/usb/input
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/usb/input/xpad.c')
-rw-r--r-- | drivers/usb/input/xpad.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c index d65edb22e545..a8076ccc0b2e 100644 --- a/drivers/usb/input/xpad.c +++ b/drivers/usb/input/xpad.c | |||
@@ -104,11 +104,11 @@ MODULE_DEVICE_TABLE (usb, xpad_table); | |||
104 | struct usb_xpad { | 104 | struct usb_xpad { |
105 | struct input_dev dev; /* input device interface */ | 105 | struct input_dev dev; /* input device interface */ |
106 | struct usb_device *udev; /* usb device */ | 106 | struct usb_device *udev; /* usb device */ |
107 | 107 | ||
108 | struct urb *irq_in; /* urb for interrupt in report */ | 108 | struct urb *irq_in; /* urb for interrupt in report */ |
109 | unsigned char *idata; /* input data */ | 109 | unsigned char *idata; /* input data */ |
110 | dma_addr_t idata_dma; | 110 | dma_addr_t idata_dma; |
111 | 111 | ||
112 | char phys[65]; /* physical device path */ | 112 | char phys[65]; /* physical device path */ |
113 | int open_count; /* reference count */ | 113 | int open_count; /* reference count */ |
114 | }; | 114 | }; |
@@ -128,35 +128,35 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d | |||
128 | struct input_dev *dev = &xpad->dev; | 128 | struct input_dev *dev = &xpad->dev; |
129 | 129 | ||
130 | input_regs(dev, regs); | 130 | input_regs(dev, regs); |
131 | 131 | ||
132 | /* left stick */ | 132 | /* left stick */ |
133 | input_report_abs(dev, ABS_X, (__s16) (((__s16)data[13] << 8) | data[12])); | 133 | input_report_abs(dev, ABS_X, (__s16) (((__s16)data[13] << 8) | data[12])); |
134 | input_report_abs(dev, ABS_Y, (__s16) (((__s16)data[15] << 8) | data[14])); | 134 | input_report_abs(dev, ABS_Y, (__s16) (((__s16)data[15] << 8) | data[14])); |
135 | 135 | ||
136 | /* right stick */ | 136 | /* right stick */ |
137 | input_report_abs(dev, ABS_RX, (__s16) (((__s16)data[17] << 8) | data[16])); | 137 | input_report_abs(dev, ABS_RX, (__s16) (((__s16)data[17] << 8) | data[16])); |
138 | input_report_abs(dev, ABS_RY, (__s16) (((__s16)data[19] << 8) | data[18])); | 138 | input_report_abs(dev, ABS_RY, (__s16) (((__s16)data[19] << 8) | data[18])); |
139 | 139 | ||
140 | /* triggers left/right */ | 140 | /* triggers left/right */ |
141 | input_report_abs(dev, ABS_Z, data[10]); | 141 | input_report_abs(dev, ABS_Z, data[10]); |
142 | input_report_abs(dev, ABS_RZ, data[11]); | 142 | input_report_abs(dev, ABS_RZ, data[11]); |
143 | 143 | ||
144 | /* digital pad */ | 144 | /* digital pad */ |
145 | input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04)); | 145 | input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04)); |
146 | input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01)); | 146 | input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01)); |
147 | 147 | ||
148 | /* start/back buttons and stick press left/right */ | 148 | /* start/back buttons and stick press left/right */ |
149 | input_report_key(dev, BTN_START, (data[2] & 0x10) >> 4); | 149 | input_report_key(dev, BTN_START, (data[2] & 0x10) >> 4); |
150 | input_report_key(dev, BTN_BACK, (data[2] & 0x20) >> 5); | 150 | input_report_key(dev, BTN_BACK, (data[2] & 0x20) >> 5); |
151 | input_report_key(dev, BTN_THUMBL, (data[2] & 0x40) >> 6); | 151 | input_report_key(dev, BTN_THUMBL, (data[2] & 0x40) >> 6); |
152 | input_report_key(dev, BTN_THUMBR, data[2] >> 7); | 152 | input_report_key(dev, BTN_THUMBR, data[2] >> 7); |
153 | 153 | ||
154 | /* "analog" buttons A, B, X, Y */ | 154 | /* "analog" buttons A, B, X, Y */ |
155 | input_report_key(dev, BTN_A, data[4]); | 155 | input_report_key(dev, BTN_A, data[4]); |
156 | input_report_key(dev, BTN_B, data[5]); | 156 | input_report_key(dev, BTN_B, data[5]); |
157 | input_report_key(dev, BTN_X, data[6]); | 157 | input_report_key(dev, BTN_X, data[6]); |
158 | input_report_key(dev, BTN_Y, data[7]); | 158 | input_report_key(dev, BTN_Y, data[7]); |
159 | 159 | ||
160 | /* "analog" buttons black, white */ | 160 | /* "analog" buttons black, white */ |
161 | input_report_key(dev, BTN_C, data[8]); | 161 | input_report_key(dev, BTN_C, data[8]); |
162 | input_report_key(dev, BTN_Z, data[9]); | 162 | input_report_key(dev, BTN_Z, data[9]); |
@@ -168,7 +168,7 @@ static void xpad_irq_in(struct urb *urb, struct pt_regs *regs) | |||
168 | { | 168 | { |
169 | struct usb_xpad *xpad = urb->context; | 169 | struct usb_xpad *xpad = urb->context; |
170 | int retval; | 170 | int retval; |
171 | 171 | ||
172 | switch (urb->status) { | 172 | switch (urb->status) { |
173 | case 0: | 173 | case 0: |
174 | /* success */ | 174 | /* success */ |
@@ -183,7 +183,7 @@ static void xpad_irq_in(struct urb *urb, struct pt_regs *regs) | |||
183 | dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); | 183 | dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); |
184 | goto exit; | 184 | goto exit; |
185 | } | 185 | } |
186 | 186 | ||
187 | xpad_process_packet(xpad, 0, xpad->idata, regs); | 187 | xpad_process_packet(xpad, 0, xpad->idata, regs); |
188 | 188 | ||
189 | exit: | 189 | exit: |
@@ -196,23 +196,23 @@ exit: | |||
196 | static int xpad_open (struct input_dev *dev) | 196 | static int xpad_open (struct input_dev *dev) |
197 | { | 197 | { |
198 | struct usb_xpad *xpad = dev->private; | 198 | struct usb_xpad *xpad = dev->private; |
199 | 199 | ||
200 | if (xpad->open_count++) | 200 | if (xpad->open_count++) |
201 | return 0; | 201 | return 0; |
202 | 202 | ||
203 | xpad->irq_in->dev = xpad->udev; | 203 | xpad->irq_in->dev = xpad->udev; |
204 | if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) { | 204 | if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) { |
205 | xpad->open_count--; | 205 | xpad->open_count--; |
206 | return -EIO; | 206 | return -EIO; |
207 | } | 207 | } |
208 | 208 | ||
209 | return 0; | 209 | return 0; |
210 | } | 210 | } |
211 | 211 | ||
212 | static void xpad_close (struct input_dev *dev) | 212 | static void xpad_close (struct input_dev *dev) |
213 | { | 213 | { |
214 | struct usb_xpad *xpad = dev->private; | 214 | struct usb_xpad *xpad = dev->private; |
215 | 215 | ||
216 | if (!--xpad->open_count) | 216 | if (!--xpad->open_count) |
217 | usb_kill_urb(xpad->irq_in); | 217 | usb_kill_urb(xpad->irq_in); |
218 | } | 218 | } |
@@ -224,19 +224,19 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
224 | struct usb_endpoint_descriptor *ep_irq_in; | 224 | struct usb_endpoint_descriptor *ep_irq_in; |
225 | char path[64]; | 225 | char path[64]; |
226 | int i; | 226 | int i; |
227 | 227 | ||
228 | for (i = 0; xpad_device[i].idVendor; i++) { | 228 | for (i = 0; xpad_device[i].idVendor; i++) { |
229 | if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && | 229 | if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && |
230 | (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct)) | 230 | (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct)) |
231 | break; | 231 | break; |
232 | } | 232 | } |
233 | 233 | ||
234 | if ((xpad = kmalloc (sizeof(struct usb_xpad), GFP_KERNEL)) == NULL) { | 234 | if ((xpad = kmalloc (sizeof(struct usb_xpad), GFP_KERNEL)) == NULL) { |
235 | err("cannot allocate memory for new pad"); | 235 | err("cannot allocate memory for new pad"); |
236 | return -ENOMEM; | 236 | return -ENOMEM; |
237 | } | 237 | } |
238 | memset(xpad, 0, sizeof(struct usb_xpad)); | 238 | memset(xpad, 0, sizeof(struct usb_xpad)); |
239 | 239 | ||
240 | xpad->idata = usb_buffer_alloc(udev, XPAD_PKT_LEN, | 240 | xpad->idata = usb_buffer_alloc(udev, XPAD_PKT_LEN, |
241 | SLAB_ATOMIC, &xpad->idata_dma); | 241 | SLAB_ATOMIC, &xpad->idata_dma); |
242 | if (!xpad->idata) { | 242 | if (!xpad->idata) { |
@@ -251,18 +251,18 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
251 | kfree(xpad); | 251 | kfree(xpad); |
252 | return -ENOMEM; | 252 | return -ENOMEM; |
253 | } | 253 | } |
254 | 254 | ||
255 | ep_irq_in = &intf->cur_altsetting->endpoint[0].desc; | 255 | ep_irq_in = &intf->cur_altsetting->endpoint[0].desc; |
256 | 256 | ||
257 | usb_fill_int_urb(xpad->irq_in, udev, | 257 | usb_fill_int_urb(xpad->irq_in, udev, |
258 | usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress), | 258 | usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress), |
259 | xpad->idata, XPAD_PKT_LEN, xpad_irq_in, | 259 | xpad->idata, XPAD_PKT_LEN, xpad_irq_in, |
260 | xpad, ep_irq_in->bInterval); | 260 | xpad, ep_irq_in->bInterval); |
261 | xpad->irq_in->transfer_dma = xpad->idata_dma; | 261 | xpad->irq_in->transfer_dma = xpad->idata_dma; |
262 | xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 262 | xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
263 | 263 | ||
264 | xpad->udev = udev; | 264 | xpad->udev = udev; |
265 | 265 | ||
266 | xpad->dev.id.bustype = BUS_USB; | 266 | xpad->dev.id.bustype = BUS_USB; |
267 | xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor); | 267 | xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor); |
268 | xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct); | 268 | xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct); |
@@ -273,21 +273,21 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
273 | xpad->dev.phys = xpad->phys; | 273 | xpad->dev.phys = xpad->phys; |
274 | xpad->dev.open = xpad_open; | 274 | xpad->dev.open = xpad_open; |
275 | xpad->dev.close = xpad_close; | 275 | xpad->dev.close = xpad_close; |
276 | 276 | ||
277 | usb_make_path(udev, path, 64); | 277 | usb_make_path(udev, path, 64); |
278 | snprintf(xpad->phys, 64, "%s/input0", path); | 278 | snprintf(xpad->phys, 64, "%s/input0", path); |
279 | 279 | ||
280 | xpad->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | 280 | xpad->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); |
281 | 281 | ||
282 | for (i = 0; xpad_btn[i] >= 0; i++) | 282 | for (i = 0; xpad_btn[i] >= 0; i++) |
283 | set_bit(xpad_btn[i], xpad->dev.keybit); | 283 | set_bit(xpad_btn[i], xpad->dev.keybit); |
284 | 284 | ||
285 | for (i = 0; xpad_abs[i] >= 0; i++) { | 285 | for (i = 0; xpad_abs[i] >= 0; i++) { |
286 | 286 | ||
287 | signed short t = xpad_abs[i]; | 287 | signed short t = xpad_abs[i]; |
288 | 288 | ||
289 | set_bit(t, xpad->dev.absbit); | 289 | set_bit(t, xpad->dev.absbit); |
290 | 290 | ||
291 | switch (t) { | 291 | switch (t) { |
292 | case ABS_X: | 292 | case ABS_X: |
293 | case ABS_Y: | 293 | case ABS_Y: |
@@ -310,11 +310,11 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
310 | break; | 310 | break; |
311 | } | 311 | } |
312 | } | 312 | } |
313 | 313 | ||
314 | input_register_device(&xpad->dev); | 314 | input_register_device(&xpad->dev); |
315 | 315 | ||
316 | printk(KERN_INFO "input: %s on %s", xpad->dev.name, path); | 316 | printk(KERN_INFO "input: %s on %s", xpad->dev.name, path); |
317 | 317 | ||
318 | usb_set_intfdata(intf, xpad); | 318 | usb_set_intfdata(intf, xpad); |
319 | return 0; | 319 | return 0; |
320 | } | 320 | } |
@@ -322,7 +322,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
322 | static void xpad_disconnect(struct usb_interface *intf) | 322 | static void xpad_disconnect(struct usb_interface *intf) |
323 | { | 323 | { |
324 | struct usb_xpad *xpad = usb_get_intfdata (intf); | 324 | struct usb_xpad *xpad = usb_get_intfdata (intf); |
325 | 325 | ||
326 | usb_set_intfdata(intf, NULL); | 326 | usb_set_intfdata(intf, NULL); |
327 | if (xpad) { | 327 | if (xpad) { |
328 | usb_kill_urb(xpad->irq_in); | 328 | usb_kill_urb(xpad->irq_in); |