From e9a20171dfa0aa134d2211126d1310f2daea52cf Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Thu, 17 Dec 2009 13:01:36 +0200 Subject: USB: otg: add notifier support The notifier will be used to communicate usb events to other drivers like the charger chip. This can be used as source of information to kick usb charger detection as described by the USB Battery Charging Specification 1.1 and/or to pass bMaxPower field of selected usb_configuration to charger chip in order to use that information as input current on the charging profile setup. Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/otg.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include') diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 52bb917641f..6c0b676b27d 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h @@ -9,6 +9,8 @@ #ifndef __LINUX_USB_OTG_H #define __LINUX_USB_OTG_H +#include + /* OTG defines lots of enumeration states before device reset */ enum usb_otg_state { OTG_STATE_UNDEFINED = 0, @@ -33,6 +35,14 @@ enum usb_otg_state { OTG_STATE_A_VBUS_ERR, }; +enum usb_xceiv_events { + USB_EVENT_NONE, /* no events or cable disconnected */ + USB_EVENT_VBUS, /* vbus valid event */ + USB_EVENT_ID, /* id was grounded */ + USB_EVENT_CHARGER, /* usb dedicated charger */ + USB_EVENT_ENUMERATED, /* gadget driver enumerated */ +}; + #define USB_OTG_PULLUP_ID (1 << 0) #define USB_OTG_PULLDOWN_DP (1 << 1) #define USB_OTG_PULLDOWN_DM (1 << 2) @@ -70,6 +80,9 @@ struct otg_transceiver { struct otg_io_access_ops *io_ops; void __iomem *io_priv; + /* for notification of usb_xceiv_events */ + struct blocking_notifier_head notifier; + /* to pass extra port status to the root hub */ u16 port_status; u16 port_change; @@ -203,6 +216,18 @@ otg_start_srp(struct otg_transceiver *otg) return otg->start_srp(otg); } +/* notifiers */ +static inline int +otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) +{ + return blocking_notifier_chain_register(&otg->notifier, nb); +} + +static inline void +otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) +{ + blocking_notifier_chain_unregister(&otg->notifier, nb); +} /* for OTG controller drivers (and maybe other stuff) */ extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); -- cgit v1.2.3 From 5d3987796c7a747e5ed3ded1eb64a9632d52a1a4 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Fri, 18 Dec 2009 12:14:21 +0100 Subject: USB: storage: Never reset devices that will morph to an old mode Some devices must be switched to a new mode to fully use them. A reset would make them revert to the old mode. Therefore a reset must not be used for error handling with such devices. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/quirks.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h index 2526f3bbd27..0a555dd131f 100644 --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h @@ -19,4 +19,7 @@ /* device can't handle its Configuration or Interface strings */ #define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 +/*device will morph if reset, don't use reset for handling errors */ +#define USB_QUIRK_RESET_MORPHS 0x00000010 + #endif /* __LINUX_USB_QUIRKS_H */ -- cgit v1.2.3 From 551cdbbeb118bd5ed301f8749aef69219284399b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 14 Jan 2010 11:08:04 -0800 Subject: USB: rename USB_SPEED_VARIABLE to USB_SPEED_WIRELESS It's really the wireless speed, so rename the thing to make more sense. Based on a recommendation from David Vrabel Cc: David Vrabel Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/ch9.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 94012e649d8..e58369ff816 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -775,7 +775,7 @@ enum usb_device_speed { USB_SPEED_UNKNOWN = 0, /* enumerating */ USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ USB_SPEED_HIGH, /* usb 2.0 */ - USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ + USB_SPEED_WIRELESS, /* wireless (usb 2.5) */ USB_SPEED_SUPER, /* usb 3.0 */ }; -- cgit v1.2.3 From 5fc4e77911f457b6aa910c704eebe3a58d334116 Mon Sep 17 00:00:00 2001 From: Ajay Kumar Gupta Date: Mon, 28 Dec 2009 13:40:42 +0200 Subject: usb: musb: Add 'extvbus' in musb_hdrc_platform_data Some of the board might use external Vbus power supply on musb interface which would require to program ULPI_BUSCONTROL register. Adding 'extvbus' flag which can be set from such boards which will be checked at musb driver files before programming ULPI_BUSCONTROL. Signed-off-by: Ajay Kumar Gupta Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/musb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index d4375566926..4b7f8fa252f 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h @@ -76,6 +76,9 @@ struct musb_hdrc_platform_data { /* (HOST or OTG) msec/2 after VBUS on till power good */ u8 potpgt; + /* (HOST or OTG) program PHY for external Vbus */ + unsigned extvbus:1; + /* Power the device on or off */ int (*set_power)(int state); -- cgit v1.2.3 From 088f7fec8a0e683db72fd8826c5d3ab914e197b1 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Fri, 8 Jan 2010 12:56:54 -0500 Subject: USB: implement usb_enable_autosuspend This patch (as1326) adds usb_enable_autosuspend() and usb_disable_autosuspend() routines for use by drivers. If a driver knows that its device can handle suspends and resumes correctly, it can enable autosuspend all by itself. This is equivalent to the user writing "auto" to the device's power/level attribute. The implementation differs slightly from what it used to be. Now autosuspend is disabled simply by doing usb_autoresume_device() (to increment the usage counter) and enabled by doing usb_autosuspend_device() (to decrement the usage counter). The set_level() attribute method is updated to use the new routines, and the USB Power-Management documentation is updated. The patch adds a usb_enable_autosuspend() call to the hub driver's probe routine, allowing the special-case code for hubs in quirks.c to be removed. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- include/linux/usb.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/linux/usb.h b/include/linux/usb.h index 332eaea6102..e6419ac89ea 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -542,6 +542,9 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); /* USB autosuspend and autoresume */ #ifdef CONFIG_USB_SUSPEND +extern int usb_enable_autosuspend(struct usb_device *udev); +extern int usb_disable_autosuspend(struct usb_device *udev); + extern int usb_autopm_get_interface(struct usb_interface *intf); extern void usb_autopm_put_interface(struct usb_interface *intf); extern int usb_autopm_get_interface_async(struct usb_interface *intf); @@ -565,6 +568,11 @@ static inline void usb_mark_last_busy(struct usb_device *udev) #else +static inline int usb_enable_autosuspend(struct usb_device *udev) +{ return 0; } +static inline int usb_disable_autosuspend(struct usb_device *udev) +{ return 0; } + static inline int usb_autopm_get_interface(struct usb_interface *intf) { return 0; } static inline int usb_autopm_get_interface_async(struct usb_interface *intf) -- cgit v1.2.3 From 9bbdf1e0afe771ca7650f9f476769310bee9d8f3 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Fri, 8 Jan 2010 12:57:28 -0500 Subject: USB: convert to the runtime PM framework This patch (as1329) converts the USB stack over to the PM core's runtime PM framework. This involves numerous changes throughout usbcore, especially to hub.c and driver.c. Perhaps the most notable change is that CONFIG_USB_SUSPEND now depends on CONFIG_PM_RUNTIME instead of CONFIG_PM. Several fields in the usb_device and usb_interface structures are no longer needed. Some code which used to depend on CONFIG_USB_PM now depends on CONFIG_USB_SUSPEND (requiring some rearrangement of header files). The only visible change in behavior should be that following a system sleep (resume from RAM or resume from hibernation), autosuspended USB devices will be resumed just like everything else. They won't remain suspended. But if they aren't in use then they will naturally autosuspend again in a few seconds. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- include/linux/usb.h | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) (limited to 'include') diff --git a/include/linux/usb.h b/include/linux/usb.h index e6419ac89ea..ad50fc8a7ad 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -122,7 +122,6 @@ enum usb_interface_condition { * number from the USB core by calling usb_register_dev(). * @condition: binding state of the interface: not bound, binding * (in probe()), bound to a driver, or unbinding (in disconnect()) - * @is_active: flag set when the interface is bound and not suspended. * @sysfs_files_created: sysfs attributes exist * @ep_devs_created: endpoint child pseudo-devices exist * @unregistering: flag set when the interface is being unregistered @@ -135,8 +134,7 @@ enum usb_interface_condition { * @dev: driver model's view of this device * @usb_dev: if an interface is bound to the USB major, this will point * to the sysfs representation for that device. - * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not - * allowed unless the counter is 0. + * @pm_usage_cnt: PM usage counter for this interface * @reset_ws: Used for scheduling resets from atomic context. * @reset_running: set to 1 if the interface is currently running a * queued reset so that usb_cancel_queued_reset() doesn't try to @@ -184,7 +182,6 @@ struct usb_interface { int minor; /* minor number this interface is * bound to */ enum usb_interface_condition condition; /* state of binding */ - unsigned is_active:1; /* the interface is not suspended */ unsigned sysfs_files_created:1; /* the sysfs attributes exist */ unsigned ep_devs_created:1; /* endpoint "devices" exist */ unsigned unregistering:1; /* unregistration is in progress */ @@ -401,7 +398,6 @@ struct usb_tt; * @portnum: parent port number (origin 1) * @level: number of USB hub ancestors * @can_submit: URBs may be submitted - * @discon_suspended: disconnected while suspended * @persist_enabled: USB_PERSIST enabled for this device * @have_langid: whether string_langid is valid * @authorized: policy has said we can use it; @@ -421,20 +417,15 @@ struct usb_tt; * @usbfs_dentry: usbfs dentry entry for the device * @maxchild: number of ports if hub * @children: child devices - USB devices that are attached to this hub - * @pm_usage_cnt: usage counter for autosuspend * @quirks: quirks of the whole device * @urbnum: number of URBs submitted for the whole device * @active_duration: total time device is not suspended - * @autosuspend: for delayed autosuspends - * @autoresume: for autoresumes requested while in_interrupt - * @pm_mutex: protects PM operations * @last_busy: time of last use * @autosuspend_delay: in jiffies * @connect_time: time device was first connected * @do_remote_wakeup: remote wakeup should be enabled * @reset_resume: needs reset instead of resume * @autosuspend_disabled: autosuspend disabled by the user - * @skip_sys_resume: skip the next system resume * @wusb_dev: if this is a Wireless USB device, link to the WUSB * specific data for the device. * @slot_id: Slot ID assigned by xHCI @@ -475,7 +466,6 @@ struct usb_device { u8 level; unsigned can_submit:1; - unsigned discon_suspended:1; unsigned persist_enabled:1; unsigned have_langid:1; unsigned authorized:1; @@ -499,17 +489,12 @@ struct usb_device { int maxchild; struct usb_device *children[USB_MAXCHILDREN]; - int pm_usage_cnt; u32 quirks; atomic_t urbnum; unsigned long active_duration; #ifdef CONFIG_PM - struct delayed_work autosuspend; - struct work_struct autoresume; - struct mutex pm_mutex; - unsigned long last_busy; int autosuspend_delay; unsigned long connect_time; @@ -517,7 +502,6 @@ struct usb_device { unsigned do_remote_wakeup:1; unsigned reset_resume:1; unsigned autosuspend_disabled:1; - unsigned skip_sys_resume:1; #endif struct wusb_dev *wusb_dev; int slot_id; @@ -549,17 +533,8 @@ extern int usb_autopm_get_interface(struct usb_interface *intf); extern void usb_autopm_put_interface(struct usb_interface *intf); extern int usb_autopm_get_interface_async(struct usb_interface *intf); extern void usb_autopm_put_interface_async(struct usb_interface *intf); - -static inline void usb_autopm_get_interface_no_resume( - struct usb_interface *intf) -{ - atomic_inc(&intf->pm_usage_cnt); -} -static inline void usb_autopm_put_interface_no_suspend( - struct usb_interface *intf) -{ - atomic_dec(&intf->pm_usage_cnt); -} +extern void usb_autopm_get_interface_no_resume(struct usb_interface *intf); +extern void usb_autopm_put_interface_no_suspend(struct usb_interface *intf); static inline void usb_mark_last_busy(struct usb_device *udev) { -- cgit v1.2.3 From c58bfa6b97731590e42cba6bd13829c4e480992f Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Thu, 21 Jan 2010 15:33:55 +0200 Subject: USB: musb: deprecate what we don't use after 2.6.34, those fields will be removed from struct musb_hdrc_platform_data, it's expected that other architectures are fixed by then. Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/musb.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index 4b7f8fa252f..8e0f2bc8d8c 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h @@ -30,26 +30,26 @@ struct musb_hdrc_eps_bits { struct musb_hdrc_config { /* MUSB configuration-specific details */ unsigned multipoint:1; /* multipoint device */ - unsigned dyn_fifo:1; /* supports dynamic fifo sizing */ - unsigned soft_con:1; /* soft connect required */ - unsigned utm_16:1; /* utm data witdh is 16 bits */ + unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */ + unsigned soft_con:1 __deprecated; /* soft connect required */ + unsigned utm_16:1 __deprecated; /* utm data witdh is 16 bits */ unsigned big_endian:1; /* true if CPU uses big-endian */ unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */ unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */ unsigned high_iso_tx:1; /* Tx ep required for HB iso */ unsigned high_iso_rx:1; /* Rx ep required for HD iso */ - unsigned dma:1; /* supports DMA */ - unsigned vendor_req:1; /* vendor registers required */ + unsigned dma:1 __deprecated; /* supports DMA */ + unsigned vendor_req:1 __deprecated; /* vendor registers required */ u8 num_eps; /* number of endpoints _with_ ep0 */ - u8 dma_channels; /* number of dma channels */ + u8 dma_channels __deprecated; /* number of dma channels */ u8 dyn_fifo_size; /* dynamic size in bytes */ - u8 vendor_ctrl; /* vendor control reg width */ - u8 vendor_stat; /* vendor status reg witdh */ - u8 dma_req_chan; /* bitmask for required dma channels */ + u8 vendor_ctrl __deprecated; /* vendor control reg width */ + u8 vendor_stat __deprecated; /* vendor status reg witdh */ + u8 dma_req_chan __deprecated; /* bitmask for required dma channels */ u8 ram_bits; /* ram address size */ - struct musb_hdrc_eps_bits *eps_bits; + struct musb_hdrc_eps_bits *eps_bits __deprecated; #ifdef CONFIG_BLACKFIN /* A GPIO controlling VRSEL in Blackfin */ unsigned int gpio_vrsel; -- cgit v1.2.3 From 640e95abdfae9fef5949084c92e80c8f2f8b5ec5 Mon Sep 17 00:00:00 2001 From: Eirik Aanonsen Date: Fri, 5 Feb 2010 09:49:25 +0100 Subject: USB: atmel uaba: Adding invert vbus_pin Adding vbus_pin_inverted so that the usb detect pin can be active high or low depending on HW implementation also replaced the gpio_get_value(udc->vbus_pin); with a call to vbus_is_present(udc); This allows the driver to be loaded and save about 0,15W on the consumption. Signed-off-by: Eirik Aanonsen Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/atmel_usba_udc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h index 6311fa2d9f8..baf41c8616e 100644 --- a/include/linux/usb/atmel_usba_udc.h +++ b/include/linux/usb/atmel_usba_udc.h @@ -15,6 +15,7 @@ struct usba_ep_data { struct usba_platform_data { int vbus_pin; + int vbus_pin_inverted; int num_ep; struct usba_ep_data ep[0]; }; -- cgit v1.2.3 From efcbd3df079a6f8a8a2d5207c4e8429e02356c79 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Fri, 5 Feb 2010 18:09:49 -0800 Subject: USB: Extend and neaten dbg macros Add format/argument validation for #ifndef DEBUG dbg macro Neaten dbg macro definitions Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- include/linux/usb.h | 14 +++++++++----- include/linux/usb/serial.h | 13 +++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/linux/usb.h b/include/linux/usb.h index ad50fc8a7ad..3492abf82e7 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1566,14 +1566,18 @@ extern void usb_register_notify(struct notifier_block *nb); extern void usb_unregister_notify(struct notifier_block *nb); #ifdef DEBUG -#define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , \ - __FILE__ , ## arg) +#define dbg(format, arg...) \ + printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg) #else -#define dbg(format, arg...) do {} while (0) +#define dbg(format, arg...) \ +do { \ + if (0) \ + printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ +} while (0) #endif -#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ - format "\n" , ## arg) +#define err(format, arg...) \ + printk(KERN_ERR KBUILD_MODNAME ": " format "\n", ##arg) /* debugfs stuff */ extern struct dentry *usb_debug_root; diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 1819396ed50..0a458b86193 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -351,14 +351,11 @@ static inline void usb_serial_debug_data(int debug, /* Use our own dbg macro */ #undef dbg -#define dbg(format, arg...) \ - do { \ - if (debug) \ - printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , \ - ## arg); \ - } while (0) - - +#define dbg(format, arg...) \ +do { \ + if (debug) \ + printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ +} while (0) #endif /* __LINUX_USB_SERIAL_H */ -- cgit v1.2.3 From 6d61ae9112960a2b3ed3360602dfb3bfd357954f Mon Sep 17 00:00:00 2001 From: Dennis O'Brien Date: Mon, 15 Feb 2010 08:50:38 -0800 Subject: USB: vstusb.c: removal of driver for Vernier Software & Technology, Inc., devices and spectrometers This patch removes the vstusb driver and support from the Linux tree. This driver provided support for Vernier Software & Technology devices and spectrometers (Ocean Optics). This driver is being replaced by a user space - libusb - implementation. Signed-off-by: Jim Collar Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/Kbuild | 1 - include/linux/usb/vstusb.h | 71 ---------------------------------------------- 2 files changed, 72 deletions(-) delete mode 100644 include/linux/usb/vstusb.h (limited to 'include') diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild index 54c446309a2..29fd73b0bff 100644 --- a/include/linux/usb/Kbuild +++ b/include/linux/usb/Kbuild @@ -5,4 +5,3 @@ header-y += gadgetfs.h header-y += midi.h header-y += g_printer.h header-y += tmc.h -header-y += vstusb.h diff --git a/include/linux/usb/vstusb.h b/include/linux/usb/vstusb.h deleted file mode 100644 index 1cfac67191f..00000000000 --- a/include/linux/usb/vstusb.h +++ /dev/null @@ -1,71 +0,0 @@ -/***************************************************************************** - * File: drivers/usb/misc/vstusb.h - * - * Purpose: Support for the bulk USB Vernier Spectrophotometers - * - * Author: EQware Engineering, Inc. - * Oregon City, OR, USA 97045 - * - * Copyright: 2007, 2008 - * Vernier Software & Technology - * Beaverton, OR, USA 97005 - * - * Web: www.vernier.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - *****************************************************************************/ -/***************************************************************************** - * - * The vstusb module is a standard usb 'client' driver running on top of the - * standard usb host controller stack. - * - * In general, vstusb supports standard bulk usb pipes. It supports multiple - * devices and multiple pipes per device. - * - * The vstusb driver supports two interfaces: - * 1 - ioctl SEND_PIPE/RECV_PIPE - a general bulk write/read msg - * interface to any pipe with timeout support; - * 2 - standard read/write with ioctl config - offers standard read/write - * interface with ioctl configured pipes and timeouts. - * - * Both interfaces can be signal from other process and will abort its i/o - * operation. - * - * A timeout of 0 means NO timeout. The user can still terminate the read via - * signal. - * - * If using multiple threads with this driver, the user should ensure that - * any reads, writes, or ioctls are complete before closing the device. - * Changing read/write timeouts or pipes takes effect on next read/write. - * - *****************************************************************************/ - -struct vstusb_args { - union { - /* this struct is used for IOCTL_VSTUSB_SEND_PIPE, * - * IOCTL_VSTUSB_RECV_PIPE, and read()/write() fops */ - struct { - void __user *buffer; - size_t count; - unsigned int timeout_ms; - int pipe; - }; - - /* this one is used for IOCTL_VSTUSB_CONFIG_RW */ - struct { - int rd_pipe; - int rd_timeout_ms; - int wr_pipe; - int wr_timeout_ms; - }; - }; -}; - -#define VST_IOC_MAGIC 'L' -#define VST_IOC_FIRST 0x20 -#define IOCTL_VSTUSB_SEND_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST) -#define IOCTL_VSTUSB_RECV_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 1) -#define IOCTL_VSTUSB_CONFIG_RW _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 2) -- cgit v1.2.3 From 2832fc11f1360668482beec06dbcd631ae5f0cf1 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 18 Feb 2010 16:43:54 +0000 Subject: USB: tty: Add a function to insert a string of characters with the same flag The USB drivers often want to insert a series of bytes all with the same flag set - provide a helper for this case. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- include/linux/tty_flip.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index eb677cf5610..9239d033a0a 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h @@ -2,8 +2,8 @@ #define _LINUX_TTY_FLIP_H extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); -extern int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size); extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size); +extern int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, const unsigned char *chars, char flag, size_t size); extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); void tty_schedule_flip(struct tty_struct *tty); @@ -20,4 +20,9 @@ static inline int tty_insert_flip_char(struct tty_struct *tty, return tty_insert_flip_string_flags(tty, &ch, &flag, 1); } +static inline int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size) +{ + return tty_insert_flip_string_fixed_flag(tty, chars, TTY_NORMAL, size); +} + #endif /* _LINUX_TTY_FLIP_H */ -- cgit v1.2.3