aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/serial.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-01-30 18:21:33 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-01 17:35:07 -0500
commit41dceed51f0e6105ca2bf45c3835a7cd9eaa077b (patch)
tree99e6614643f12c126ff83720cc6b76012e44b3d2 /include/linux/usb/serial.h
parent969ab2ee9d68bd037e2db7ea12ff78baae5d2f94 (diff)
USB: fix codingstyle issues in include/linux/usb/
Fixes a number of coding style issues in the USB public header files. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb/serial.h')
-rw-r--r--include/linux/usb/serial.h157
1 files changed, 87 insertions, 70 deletions
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 63b29b5332e6..21b4a1c6f585 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -20,7 +20,8 @@
20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ 20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
21#define SERIAL_TTY_MINORS 255 /* loads of devices :) */ 21#define SERIAL_TTY_MINORS 255 /* loads of devices :) */
22 22
23#define MAX_NUM_PORTS 8 /* The maximum number of ports one device can grab at once */ 23/* The maximum number of ports one device can grab at once */
24#define MAX_NUM_PORTS 8
24 25
25/* parity check flag */ 26/* parity check flag */
26#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 27#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
@@ -61,29 +62,29 @@
61 * ports of a device. 62 * ports of a device.
62 */ 63 */
63struct usb_serial_port { 64struct usb_serial_port {
64 struct usb_serial * serial; 65 struct usb_serial *serial;
65 struct tty_struct * tty; 66 struct tty_struct *tty;
66 spinlock_t lock; 67 spinlock_t lock;
67 struct mutex mutex; 68 struct mutex mutex;
68 unsigned char number; 69 unsigned char number;
69 70
70 unsigned char * interrupt_in_buffer; 71 unsigned char *interrupt_in_buffer;
71 struct urb * interrupt_in_urb; 72 struct urb *interrupt_in_urb;
72 __u8 interrupt_in_endpointAddress; 73 __u8 interrupt_in_endpointAddress;
73 74
74 unsigned char * interrupt_out_buffer; 75 unsigned char *interrupt_out_buffer;
75 int interrupt_out_size; 76 int interrupt_out_size;
76 struct urb * interrupt_out_urb; 77 struct urb *interrupt_out_urb;
77 __u8 interrupt_out_endpointAddress; 78 __u8 interrupt_out_endpointAddress;
78 79
79 unsigned char * bulk_in_buffer; 80 unsigned char *bulk_in_buffer;
80 int bulk_in_size; 81 int bulk_in_size;
81 struct urb * read_urb; 82 struct urb *read_urb;
82 __u8 bulk_in_endpointAddress; 83 __u8 bulk_in_endpointAddress;
83 84
84 unsigned char * bulk_out_buffer; 85 unsigned char *bulk_out_buffer;
85 int bulk_out_size; 86 int bulk_out_size;
86 struct urb * write_urb; 87 struct urb *write_urb;
87 int write_urb_busy; 88 int write_urb_busy;
88 __u8 bulk_out_endpointAddress; 89 __u8 bulk_out_endpointAddress;
89 90
@@ -98,12 +99,13 @@ struct usb_serial_port {
98#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) 99#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
99 100
100/* get and set the port private data pointer helper functions */ 101/* get and set the port private data pointer helper functions */
101static inline void *usb_get_serial_port_data (struct usb_serial_port *port) 102static inline void *usb_get_serial_port_data(struct usb_serial_port *port)
102{ 103{
103 return dev_get_drvdata(&port->dev); 104 return dev_get_drvdata(&port->dev);
104} 105}
105 106
106static inline void usb_set_serial_port_data (struct usb_serial_port *port, void *data) 107static inline void usb_set_serial_port_data(struct usb_serial_port *port,
108 void *data)
107{ 109{
108 dev_set_drvdata(&port->dev, data); 110 dev_set_drvdata(&port->dev, data);
109} 111}
@@ -126,9 +128,9 @@ static inline void usb_set_serial_port_data (struct usb_serial_port *port, void
126 * usb_set_serial_data() to access this. 128 * usb_set_serial_data() to access this.
127 */ 129 */
128struct usb_serial { 130struct usb_serial {
129 struct usb_device * dev; 131 struct usb_device *dev;
130 struct usb_serial_driver * type; 132 struct usb_serial_driver *type;
131 struct usb_interface * interface; 133 struct usb_interface *interface;
132 unsigned char disconnected; 134 unsigned char disconnected;
133 unsigned char minor; 135 unsigned char minor;
134 unsigned char num_ports; 136 unsigned char num_ports;
@@ -137,30 +139,30 @@ struct usb_serial {
137 char num_interrupt_out; 139 char num_interrupt_out;
138 char num_bulk_in; 140 char num_bulk_in;
139 char num_bulk_out; 141 char num_bulk_out;
140 struct usb_serial_port * port[MAX_NUM_PORTS]; 142 struct usb_serial_port *port[MAX_NUM_PORTS];
141 struct kref kref; 143 struct kref kref;
142 struct mutex disc_mutex; 144 struct mutex disc_mutex;
143 void * private; 145 void *private;
144}; 146};
145#define to_usb_serial(d) container_of(d, struct usb_serial, kref) 147#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
146 148
147#define NUM_DONT_CARE 99 149#define NUM_DONT_CARE 99
148 150
149/* get and set the serial private data pointer helper functions */ 151/* get and set the serial private data pointer helper functions */
150static inline void *usb_get_serial_data (struct usb_serial *serial) 152static inline void *usb_get_serial_data(struct usb_serial *serial)
151{ 153{
152 return serial->private; 154 return serial->private;
153} 155}
154 156
155static inline void usb_set_serial_data (struct usb_serial *serial, void *data) 157static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
156{ 158{
157 serial->private = data; 159 serial->private = data;
158} 160}
159 161
160/** 162/**
161 * usb_serial_driver - describes a usb serial driver 163 * usb_serial_driver - describes a usb serial driver
162 * @description: pointer to a string that describes this driver. This string used 164 * @description: pointer to a string that describes this driver. This string
163 * in the syslog messages when a device is inserted or removed. 165 * used in the syslog messages when a device is inserted or removed.
164 * @id_table: pointer to a list of usb_device_id structures that define all 166 * @id_table: pointer to a list of usb_device_id structures that define all
165 * of the devices this structure can support. 167 * of the devices this structure can support.
166 * @num_interrupt_in: If a device doesn't have this many interrupt-in 168 * @num_interrupt_in: If a device doesn't have this many interrupt-in
@@ -221,82 +223,91 @@ struct usb_serial_driver {
221 struct usb_driver *usb_driver; 223 struct usb_driver *usb_driver;
222 struct usb_dynids dynids; 224 struct usb_dynids dynids;
223 225
224 int (*probe) (struct usb_serial *serial, const struct usb_device_id *id); 226 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
225 int (*attach) (struct usb_serial *serial); 227 int (*attach)(struct usb_serial *serial);
226 int (*calc_num_ports) (struct usb_serial *serial); 228 int (*calc_num_ports) (struct usb_serial *serial);
227 229
228 void (*shutdown) (struct usb_serial *serial); 230 void (*shutdown)(struct usb_serial *serial);
229 231
230 int (*port_probe) (struct usb_serial_port *port); 232 int (*port_probe)(struct usb_serial_port *port);
231 int (*port_remove) (struct usb_serial_port *port); 233 int (*port_remove)(struct usb_serial_port *port);
232 234
233 int (*suspend) (struct usb_serial *serial, pm_message_t message); 235 int (*suspend)(struct usb_serial *serial, pm_message_t message);
234 int (*resume) (struct usb_serial *serial); 236 int (*resume)(struct usb_serial *serial);
235 237
236 /* serial function calls */ 238 /* serial function calls */
237 int (*open) (struct usb_serial_port *port, struct file * filp); 239 int (*open)(struct usb_serial_port *port, struct file *filp);
238 void (*close) (struct usb_serial_port *port, struct file * filp); 240 void (*close)(struct usb_serial_port *port, struct file *filp);
239 int (*write) (struct usb_serial_port *port, const unsigned char *buf, int count); 241 int (*write)(struct usb_serial_port *port, const unsigned char *buf,
240 int (*write_room) (struct usb_serial_port *port); 242 int count);
241 int (*ioctl) (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); 243 int (*write_room)(struct usb_serial_port *port);
242 void (*set_termios) (struct usb_serial_port *port, struct ktermios * old); 244 int (*ioctl)(struct usb_serial_port *port, struct file *file,
243 void (*break_ctl) (struct usb_serial_port *port, int break_state); 245 unsigned int cmd, unsigned long arg);
244 int (*chars_in_buffer) (struct usb_serial_port *port); 246 void (*set_termios)(struct usb_serial_port *port, struct ktermios *old);
245 void (*throttle) (struct usb_serial_port *port); 247 void (*break_ctl)(struct usb_serial_port *port, int break_state);
246 void (*unthrottle) (struct usb_serial_port *port); 248 int (*chars_in_buffer)(struct usb_serial_port *port);
247 int (*tiocmget) (struct usb_serial_port *port, struct file *file); 249 void (*throttle)(struct usb_serial_port *port);
248 int (*tiocmset) (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear); 250 void (*unthrottle)(struct usb_serial_port *port);
251 int (*tiocmget)(struct usb_serial_port *port, struct file *file);
252 int (*tiocmset)(struct usb_serial_port *port, struct file *file,
253 unsigned int set, unsigned int clear);
249 254
250 void (*read_int_callback)(struct urb *urb); 255 void (*read_int_callback)(struct urb *urb);
251 void (*write_int_callback)(struct urb *urb); 256 void (*write_int_callback)(struct urb *urb);
252 void (*read_bulk_callback)(struct urb *urb); 257 void (*read_bulk_callback)(struct urb *urb);
253 void (*write_bulk_callback)(struct urb *urb); 258 void (*write_bulk_callback)(struct urb *urb);
254}; 259};
255#define to_usb_serial_driver(d) container_of(d, struct usb_serial_driver, driver) 260#define to_usb_serial_driver(d) \
261 container_of(d, struct usb_serial_driver, driver)
256 262
257extern int usb_serial_register(struct usb_serial_driver *driver); 263extern int usb_serial_register(struct usb_serial_driver *driver);
258extern void usb_serial_deregister(struct usb_serial_driver *driver); 264extern void usb_serial_deregister(struct usb_serial_driver *driver);
259extern void usb_serial_port_softint(struct usb_serial_port *port); 265extern void usb_serial_port_softint(struct usb_serial_port *port);
260 266
261extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id); 267extern int usb_serial_probe(struct usb_interface *iface,
268 const struct usb_device_id *id);
262extern void usb_serial_disconnect(struct usb_interface *iface); 269extern void usb_serial_disconnect(struct usb_interface *iface);
263 270
264extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); 271extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message);
265extern int usb_serial_resume(struct usb_interface *intf); 272extern int usb_serial_resume(struct usb_interface *intf);
266 273
267extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest); 274extern int ezusb_writememory(struct usb_serial *serial, int address,
268extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit); 275 unsigned char *data, int length, __u8 bRequest);
276extern int ezusb_set_reset(struct usb_serial *serial, unsigned char reset_bit);
269 277
270/* USB Serial console functions */ 278/* USB Serial console functions */
271#ifdef CONFIG_USB_SERIAL_CONSOLE 279#ifdef CONFIG_USB_SERIAL_CONSOLE
272extern void usb_serial_console_init (int debug, int minor); 280extern void usb_serial_console_init(int debug, int minor);
273extern void usb_serial_console_exit (void); 281extern void usb_serial_console_exit(void);
274extern void usb_serial_console_disconnect(struct usb_serial *serial); 282extern void usb_serial_console_disconnect(struct usb_serial *serial);
275#else 283#else
276static inline void usb_serial_console_init (int debug, int minor) { } 284static inline void usb_serial_console_init(int debug, int minor) { }
277static inline void usb_serial_console_exit (void) { } 285static inline void usb_serial_console_exit(void) { }
278static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} 286static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
279#endif 287#endif
280 288
281/* Functions needed by other parts of the usbserial core */ 289/* Functions needed by other parts of the usbserial core */
282extern struct usb_serial *usb_serial_get_by_index (unsigned int minor); 290extern struct usb_serial *usb_serial_get_by_index(unsigned int minor);
283extern void usb_serial_put(struct usb_serial *serial); 291extern void usb_serial_put(struct usb_serial *serial);
284extern int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp); 292extern int usb_serial_generic_open(struct usb_serial_port *port,
285extern int usb_serial_generic_write (struct usb_serial_port *port, const unsigned char *buf, int count); 293 struct file *filp);
286extern void usb_serial_generic_close (struct usb_serial_port *port, struct file *filp); 294extern int usb_serial_generic_write(struct usb_serial_port *port,
287extern int usb_serial_generic_resume (struct usb_serial *serial); 295 const unsigned char *buf, int count);
288extern int usb_serial_generic_write_room (struct usb_serial_port *port); 296extern void usb_serial_generic_close(struct usb_serial_port *port,
289extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port); 297 struct file *filp);
290extern void usb_serial_generic_read_bulk_callback (struct urb *urb); 298extern int usb_serial_generic_resume(struct usb_serial *serial);
291extern void usb_serial_generic_write_bulk_callback (struct urb *urb); 299extern int usb_serial_generic_write_room(struct usb_serial_port *port);
292extern void usb_serial_generic_throttle (struct usb_serial_port *port); 300extern int usb_serial_generic_chars_in_buffer(struct usb_serial_port *port);
293extern void usb_serial_generic_unthrottle (struct usb_serial_port *port); 301extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
294extern void usb_serial_generic_shutdown (struct usb_serial *serial); 302extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
295extern int usb_serial_generic_register (int debug); 303extern void usb_serial_generic_throttle(struct usb_serial_port *port);
296extern void usb_serial_generic_deregister (void); 304extern void usb_serial_generic_unthrottle(struct usb_serial_port *port);
297 305extern void usb_serial_generic_shutdown(struct usb_serial *serial);
298extern int usb_serial_bus_register (struct usb_serial_driver *device); 306extern int usb_serial_generic_register(int debug);
299extern void usb_serial_bus_deregister (struct usb_serial_driver *device); 307extern void usb_serial_generic_deregister(void);
308
309extern int usb_serial_bus_register(struct usb_serial_driver *device);
310extern void usb_serial_bus_deregister(struct usb_serial_driver *device);
300 311
301extern struct usb_serial_driver usb_serial_generic_device; 312extern struct usb_serial_driver usb_serial_generic_device;
302extern struct bus_type usb_serial_bus_type; 313extern struct bus_type usb_serial_bus_type;
@@ -310,16 +321,22 @@ static inline void usb_serial_debug_data(int debug,
310 int i; 321 int i;
311 322
312 if (debug) { 323 if (debug) {
313 dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size); 324 dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ",
325 function, size);
314 for (i = 0; i < size; ++i) 326 for (i = 0; i < size; ++i)
315 printk ("%.2x ", data[i]); 327 printk("%.2x ", data[i]);
316 printk ("\n"); 328 printk("\n");
317 } 329 }
318} 330}
319 331
320/* Use our own dbg macro */ 332/* Use our own dbg macro */
321#undef dbg 333#undef dbg
322#define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0) 334#define dbg(format, arg...) \
335 do { \
336 if (debug) \
337 printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , \
338 ## arg); \
339 } while (0)
323 340
324 341
325 342