mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Alan Cox <alan@linux.intel.com>
Subject: [040/119] tty: cp210x: Fix carrier handling
Date: Sun, 06 Dec 2009 16:00:16 -0800	[thread overview]
Message-ID: <20091207000646.768823232@mini.kroah.org> (raw)
In-Reply-To: <20091207000938.GA24743@kroah.com>

[-- Attachment #1: tty-cp210x-fix-carrier-handling.patch --]
[-- Type: text/plain, Size: 2666 bytes --]

2.6.31-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Alan Cox <alan@linux.intel.com>

commit d94c7bd4c1361cab58a21d530078c5673863dcc2 upstream.

Original discussion:
http://thread.gmane.org/gmane.linux.usb.general/23217/focus=23248
or
http://marc.info/?l=linux-usb&m=125553790714133&w=2

9a68e39d4a701fb3be03cae9b462408664ebd205 broke carrier handling so that a
cp210x setup which needed the carrier lines set up (non CLOCAL) which did
not make a call which set the termios bits left the lines down even if
CLOCAL was not asserted.

Fix this not by reverting but by adding the proper dtr_rts and
carrier_raised methods. This both sets the modem lines properly and also
implements the correct blocking semantics for the port as required by
POSIX.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Reported-by: Karl Hiramoto <karl@hiramoto.org>
Tested-by:  Karl Hiramoto <karl@hiramoto.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/usb/serial/cp210x.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -51,6 +51,8 @@ static int cp210x_tiocmset_port(struct u
 static void cp210x_break_ctl(struct tty_struct *, int);
 static int cp210x_startup(struct usb_serial *);
 static void cp210x_disconnect(struct usb_serial *);
+static void cp210x_dtr_rts(struct usb_serial_port *p, int on);
+static int cp210x_carrier_raised(struct usb_serial_port *p);
 
 static int debug;
 
@@ -144,6 +146,8 @@ static struct usb_serial_driver cp210x_d
 	.tiocmset		= cp210x_tiocmset,
 	.attach			= cp210x_startup,
 	.disconnect		= cp210x_disconnect,
+	.dtr_rts		= cp210x_dtr_rts,
+	.carrier_raised		= cp210x_carrier_raised
 };
 
 /* Config request types */
@@ -748,6 +752,14 @@ static int cp210x_tiocmset_port(struct u
 	return cp210x_set_config(port, CP210X_SET_MHS, &control, 2);
 }
 
+static void cp210x_dtr_rts(struct usb_serial_port *p, int on)
+{
+	if (on)
+		cp210x_tiocmset_port(p, NULL,  TIOCM_DTR|TIOCM_RTS, 0);
+	else
+		cp210x_tiocmset_port(p, NULL,  0, TIOCM_DTR|TIOCM_RTS);
+}
+
 static int cp210x_tiocmget (struct tty_struct *tty, struct file *file)
 {
 	struct usb_serial_port *port = tty->driver_data;
@@ -770,6 +782,15 @@ static int cp210x_tiocmget (struct tty_s
 	return result;
 }
 
+static int cp210x_carrier_raised(struct usb_serial_port *p)
+{
+	unsigned int control;
+	cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1);
+	if (control & CONTROL_DCD)
+		return 1;
+	return 0;
+}
+
 static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
 {
 	struct usb_serial_port *port = tty->driver_data;



  parent reply	other threads:[~2009-12-07  0:29 UTC|newest]

Thread overview: 133+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20091206235936.208334321@mini.kroah.org>
2009-12-07  0:09 ` [000/119] 2.6.31.7-stable review Greg KH
2009-12-06 23:59   ` [001/119] nilfs2: fix kernel oops in error case of nilfs_ioctl_move_blocks Greg KH
2009-12-06 23:59   ` [002/119] cifs: dont use CIFSGetSrvInodeNumber in is_path_accessible Greg KH
2009-12-06 23:59   ` [003/119] cifs: clean up handling when server doesnt consistently support inode numbers Greg KH
2009-12-06 23:59   ` [004/119] cifs: clear server inode number flag while autodisabling Greg KH
2009-12-06 23:59   ` [005/119] CIFS: fix oops in cifs_lookup during net boot Greg KH
2009-12-06 23:59   ` [006/119] CIFS: Duplicate data on appending to some Samba servers Greg KH
2009-12-06 23:59   ` [007/119] [SCSI] gdth: Prevent negative offsets in ioctl CVE-2009-3080 Greg KH
2009-12-06 23:59   ` [008/119] rtl8187: Fix kernel oops when device is removed when LEDS enabled Greg KH
2009-12-06 23:59   ` [009/119] md: dont clear endpoint for resync when resync is interrupted Greg KH
2009-12-06 23:59   ` [010/119] md/raid5: make sure curr_sync_completes is uptodate when reshape starts Greg KH
2009-12-06 23:59   ` [011/119] md/raid1/raid10: add a cond_resched Greg KH
2009-12-06 23:59   ` [012/119] ALSA: usb-audio: fix combine_word problem Greg KH
2009-12-06 23:59   ` [013/119] ALSA: hda - Dell Studio 1557 hd-audio quirk Greg KH
2009-12-06 23:59   ` [014/119] ALSA: AACI: fix AC97 multiple-open bug Greg KH
2009-12-06 23:59   ` [015/119] ALSA: AACI: fix recording bug Greg KH
2009-12-06 23:59   ` [016/119] jffs2: Fix memory corruption in jffs2_read_inode_range() Greg KH
2009-12-06 23:59   ` [017/119] sound: rawmidi: disable active-sensing-on-close by default Greg KH
2009-12-06 23:59   ` [018/119] sound: rawmidi: fix checking of O_APPEND when opening MIDI device Greg KH
2009-12-06 23:59   ` [019/119] sound: rawmidi: fix double init when opening MIDI device with O_APPEND Greg KH
2009-12-06 23:59   ` [020/119] sound: rawmidi: fix MIDI device O_APPEND error handling Greg KH
2009-12-06 23:59   ` [021/119] highmem: Fix race in debug_kmap_atomic() which could cause warn_count to underflow Greg KH
2009-12-06 23:59   ` [022/119] highmem: Fix debug_kmap_atomic() to also handle KM_IRQ_PTE, KM_NMI, and KM_NMI_PTE Greg KH
2009-12-07  1:11     ` Hugh Dickins
2009-12-07  9:50       ` Florian Mickler
2009-12-06 23:59   ` [023/119] V4L/DVB (13169): bttv: Fix potential out-of-order field processing Greg KH
2009-12-07  0:00   ` [024/119] V4L/DVB (13170): bttv: Fix reversed polarity error when switching video standard Greg KH
2009-12-07  0:00   ` [025/119] V4L/DVB (13109): tda18271: fix signedness issue in tda18271_rf_tracking_filters_init Greg KH
2009-12-07  0:00   ` [026/119] V4L/DVB (13107): tda18271: fix overflow in FM radio frequency calculation Greg KH
2009-12-07  0:00   ` [027/119] V4L/DVB (13190): em28xx: fix panic that can occur when starting audio streaming Greg KH
2009-12-07  0:00   ` [028/119] V4L/DVB (13079): dib0700: fixed xc2028 firmware loading kernel oops Greg KH
2009-12-07  0:00   ` [029/119] V4L/DVB (13230): s2255drv: Dont conditionalize video buffer completion on waiting processes Greg KH
2009-12-07  0:00   ` [030/119] uids: Prevent tear down race Greg KH
2009-12-07  0:00   ` [031/119] pps: events reporting fix up Greg KH
2009-12-07  0:00   ` [032/119] pps: locking scheme fix up for PPS_GETPARAMS Greg KH
2009-12-07  0:00   ` [033/119] rtc: v3020: fix v3020_mmio_read_bit() Greg KH
2009-12-07  0:00   ` [034/119] fs: add missing compat_ptr handling for FS_IOC_RESVSP ioctl Greg KH
2009-12-07  0:00   ` [035/119] memcg: fix wrong pointer initialization at page migration when memcg is disabled Greg KH
2009-12-07  0:00   ` [036/119] pidns: fix a leak in /proc dentries and inodes with pid namespaces Greg KH
2009-12-07  0:00   ` [037/119] page allocator: Do not allow interrupts to use ALLOC_HARDER Greg KH
2009-12-07  0:00   ` [038/119] page allocator: always wake kswapd when restarting an allocation attempt after direct reclaim failed Greg KH
2009-12-07  0:00   ` [039/119] tty_port: If we are opened non blocking we still need to raise the carrier Greg KH
2009-12-07  0:00   ` Greg KH [this message]
2009-12-07  0:00   ` [041/119] USB: ohci: quirk AMD prefetch for USB 1.1 ISO transfer Greg KH
2009-12-07 16:04     ` [Stable-review] " Stefan Bader
2009-12-07 16:48       ` Greg KH
2009-12-07 20:19         ` Stefan Bader
2009-12-07  0:00   ` [042/119] USB: usbmon: fix bug in mon_buff_area_shrink Greg KH
2009-12-07  0:00   ` [043/119] USB: option.c: add support for D-Link DWM-162-U5 Greg KH
2009-12-07  0:00   ` [044/119] USB: cdc_acm: Fix race condition when opening tty Greg KH
2009-12-07  0:00   ` [045/119] USB: xhci: Fix bug memory free after failed initialization Greg KH
2009-12-07  0:00   ` [046/119] USB: xhci: Fix TRB physical to virtual address translation Greg KH
2009-12-07  0:00   ` [047/119] USB: xhci: Fix scratchpad deallocation Greg KH
2009-12-07  0:00   ` [048/119] iwlwifi: Use RTS/CTS as the preferred protection mechanism for 6000 series Greg KH
2009-12-07  0:00   ` [049/119] iwlwifi: Fix issue on file transfer stalled in HT mode Greg KH
2009-12-07  0:00   ` [050/119] ima: replace GFP_KERNEL with GFP_NOFS Greg KH
2009-12-07  0:00   ` [051/119] NFSv4: Fix a cache validation bug which causes getcwd() to return ENOENT Greg KH
2009-12-07  0:00   ` [052/119] fuse: reject O_DIRECT flag also in fuse_create Greg KH
2009-12-07  0:00   ` [053/119] ASoC: Fix suspend with active audio streams Greg KH
2009-12-07  0:00   ` [054/119] ASoC: AIC23: Fixing infinite loop in resume path Greg KH
2009-12-07  0:00   ` [055/119] mac80211: fix two remote exploits Greg KH
2009-12-07  0:00   ` [056/119] mac80211: fix spurious delBA handling Greg KH
2009-12-07  0:00   ` [057/119] b43: Work around mac80211 race condition Greg KH
2009-12-07  0:00   ` [058/119] rfkill: fix miscdev ops Greg KH
2009-12-07  0:00   ` [059/119] thinkpad-acpi: fix sign of ERESTARTSYS return Greg KH
2009-12-07  0:00   ` [060/119] [CPUFREQ] Enable ACPI PDC handshake for VIA/Centaur CPUs Greg KH
2009-12-07  0:00   ` [061/119] V4L/DVB (13436): cxusb: Fix hang on DViCO FusionHDTV DVB-T Dual Digital 4 (rev 1) Greg KH
2009-12-07  0:00   ` [062/119] V4L/DVB (13321): radio-gemtek-pci: fix double mutex_lock Greg KH
2009-12-07  0:00   ` [063/119] V4L/DVB (12948): v4l1-compat: fix VIDIOC_G_STD handling Greg KH
2009-12-07  0:00   ` [064/119] V4L/DVB (12280): gspca - sonixj: Remove auto gain/wb/expo for the ov7660 sensor Greg KH
2009-12-07  0:00   ` [065/119] V4L/DVB (12356): gspca - sonixj: Webcam 0c45:6148 added Greg KH
2009-12-07 15:59     ` [Stable-review] " Stefan Bader
2009-12-07 16:48       ` Greg KH
2009-12-07 20:19         ` Stefan Bader
2009-12-07  0:00   ` [066/119] V4L/DVB (12501): gspca - sonixj: Do the ov7660 sensor work again Greg KH
2009-12-07  0:00   ` [067/119] V4L/DVB (12691): gspca - sonixj: Dont use mdelay() Greg KH
2009-12-07  0:00   ` [068/119] V4L/DVB (12696): gspca - sonixj / sn9c102: Two drivers for 0c45:60fc and 0c45:613e Greg KH
2009-12-07  0:00   ` [069/119] drm/i915: Select CONFIG_SHMEM Greg KH
2009-12-07  0:00   ` [070/119] drm: work around EDIDs with bad htotal/vtotal values Greg KH
2009-12-07  0:00   ` [071/119] drm/i915: Fix IRQ stall issue on Ironlake Greg KH
2009-12-07  0:00   ` [072/119] udp: Fix udp_poll() and ioctl() Greg KH
2009-12-07  0:00   ` [073/119] acenic: Pass up error code from ace_load_firmware() Greg KH
2009-12-07  0:00   ` [074/119] pkt_sched: pedit use proper struct Greg KH
2009-12-07  0:00   ` [075/119] net: fix sk_forward_alloc corruption Greg KH
2009-12-07  0:00   ` [076/119] bonding: Modify hash transmit policies to use the packets source MAC address Greg KH
2009-12-07  0:00   ` [077/119] sfc: Set ip_summed correctly for page buffers passed to GRO Greg KH
2009-12-07  0:00   ` [078/119] sparc64: replace parentheses in pmul() Greg KH
2009-12-07  0:00   ` [079/119] sparc: Move of_set_property_mutex acquisition outside of devtree_lock grab Greg KH
2009-12-07  0:00   ` [080/119] sched: Fix boot crash by zalloc()ing most of the cpu masks Greg KH
2009-12-08  1:39     ` Rusty Russell
2009-12-08 17:54       ` Greg KH
2009-12-07  0:00   ` [081/119] V4L/DVB (13202): smsusb: add autodetection support for three additional Hauppauge USB IDs Greg KH
2009-12-07  0:00   ` [082/119] V4L/DVB (13313): saa7134: add support for FORCE_TS_VALID mode for mpeg ts input Greg KH
2009-12-07  0:00   ` [083/119] V4L/DVB (13314): saa7134: set ts_force_val for the Hauppauge WinTV HVR-1150 Greg KH
2009-12-07  0:01   ` [084/119] ipv4: additional update of dev_net(dev) to struct *net in ip_fragment.c, NULL ptr OOPS Greg KH
2009-12-07  0:01   ` [085/119] [CPUFREQ] speedstep-ich: fix error caused by 394122ab144dae4b276d74644a2f11c44a60ac5c Greg KH
2009-12-07  0:01   ` [086/119] USB: EHCI: dont send Clear-TT-Buffer following a STALL Greg KH
2009-12-07  0:01   ` [087/119] USB: musb_gadget: fix STALL handling Greg KH
2009-12-07  0:01   ` [088/119] usb: amd5536udc: fixed shared interrupt bug and warning oops Greg KH
2009-12-07  0:01   ` [089/119] USB: ftdi_sio: Keep going when write errors are encountered Greg KH
2009-12-07  0:01   ` [090/119] USB: work around for EHCI with quirky periodic schedules Greg KH
2009-12-07  0:01   ` [091/119] tty_port: handle the nonblocking open of a dead port corner case Greg KH
2009-12-07  0:01   ` [092/119] [ARM] pxamci: call mmc_remove_host() before freeing resources Greg KH
2009-12-07  0:01   ` [093/119] param: dont complain about unused module parameters Greg KH
2009-12-07  0:01   ` [094/119] modules: dont export section names of empty sections via sysfs Greg KH
2009-12-07  0:01   ` [095/119] md: revert incorrect fix for read error handling in raid1 Greg KH
2009-12-07  0:01   ` [096/119] perf_event: Adjust frequency and unthrottle for non-group-leader events Greg KH
2009-12-07  0:01   ` [097/119] hso: fix soft-lockup Greg KH
2009-12-07  0:01   ` [098/119] block: use after free bug in __blkdev_get Greg KH
2009-12-07  0:01   ` [099/119] hwmon: (adt7475) Fix temperature fault flags Greg KH
2009-12-07  0:01   ` [100/119] hwmon: (adt7475) Cache limits for 60 seconds Greg KH
2009-12-07  0:01   ` [101/119] agp/intel: new host bridge support Greg KH
2009-12-07  0:01   ` [102/119] netfilter: nf_nat: fix NAT issue in 2.6.30.4+ Greg KH
2009-12-07  0:01   ` [103/119] netfilter: xt_connlimit: fix regression caused by zero family value Greg KH
2009-12-07  0:01   ` [104/119] b43: Fix DMA TX bounce buffer copying Greg KH
2009-12-07  0:01   ` [105/119] crypto: padlock-aes - Use the correct mask when checking whether copying is required Greg KH
2009-12-07  0:01   ` [106/119] sky2: set carrier off in probe Greg KH
2009-12-07  0:01   ` [107/119] ath5k: Linear PCDAC code fixes Greg KH
2009-12-07  0:01   ` [108/119] i2c: Fix userspace_device list corruption Greg KH
2009-12-07  0:01   ` [109/119] acerhdf: fix fan control for AOA150 model Greg KH
2009-12-07  0:01   ` [110/119] drm/fb: fix FBIOGET/PUT_VSCREENINFO pixel clock handling Greg KH
2009-12-07  0:01   ` [111/119] tty/of_serial: add missing ns16550a id Greg KH
2009-12-07  0:01   ` [112/119] V4L/DVB (13255): gspca - m5602-s5k4aa: Add vflip quirk for the Bruneinit laptop Greg KH
2009-12-07  0:01   ` [113/119] V4L/DVB (13256): gspca - m5602-s5k4aa: Add another MSI GX700 vflip quirk Greg KH
2009-12-07  0:01   ` [114/119] V4L/DVB (13257): gspca - m5602-s5k4aa: Add vflip for Fujitsu Amilo Xi 2528 Greg KH
2009-12-07  0:01   ` [115/119] PCI: Prevent AER driver from being loaded on non-root port PCIE devices Greg KH
2009-12-07  0:01   ` [116/119] acerhdf: additional BIOS versions Greg KH
2009-12-07  0:01   ` [117/119] acerhdf: return temperature in milidegree instead of degree Greg KH
2009-12-07  0:01   ` [118/119] Input: keyboard - fix braille keyboard keysym generation Greg KH
2009-12-07  0:01   ` [119/119] isdn: hfc_usb: Fix read buffer overflow Greg KH
2009-12-07  0:10   ` [000/119] 2.6.31.7-stable review Greg KH
2009-12-07  0:33     ` Alexander Beregalov
2009-12-07  0:37       ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091207000646.768823232@mini.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome