From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
Zwane Mwaikambo <zwane@arm.linux.org.uk>,
"Theodore Ts'o" <tytso@mit.edu>,
Randy Dunlap <rdunlap@xenotime.net>,
Dave Jones <davej@redhat.com>,
Chuck Wolber <chuckw@quantumlinux.com>,
Chris Wedgwood <reviews@ml.cw.f00f.org>,
Michael Krufky <mkrufky@linuxtv.org>,
Chuck Ebbert <cebbert@redhat.com>,
Domenico Andreoli <cavokz@gmail.com>,
torvalds@linux-foundation.org, akpm@linux-foundation.org,
alan@lxorguk.ukuu.org.uk, Oliver Neukum <oneukum@suse.de>
Subject: [2.6.22.2 review 82/84] USB: fix for ftdi_sio quirk handling
Date: Tue, 7 Aug 2007 13:49:39 -0700 [thread overview]
Message-ID: <20070807204939.GF23028@kroah.com> (raw)
In-Reply-To: <20070807204157.GA23028@kroah.com>
[-- Attachment #1: usb-fix-for-ftdi_sio-quirk-handling.patch --]
[-- Type: text/plain, Size: 7219 bytes --]
From: Oliver Neukum <oliver@neukum.org>
this one fixes an oops with quirky ftdi_sio devices. As it fixes a
regression, I propose that it be included in 2.6.22
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/usb/serial/ftdi_sio.c | 104 +++++++++++++++++-------------------------
1 file changed, 44 insertions(+), 60 deletions(-)
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -271,26 +271,58 @@ static int debug;
static __u16 vendor = FTDI_VID;
static __u16 product;
+struct ftdi_private {
+ ftdi_chip_type_t chip_type;
+ /* type of the device, either SIO or FT8U232AM */
+ int baud_base; /* baud base clock for divisor setting */
+ int custom_divisor; /* custom_divisor kludge, this is for baud_base (different from what goes to the chip!) */
+ __u16 last_set_data_urb_value ;
+ /* the last data state set - needed for doing a break */
+ int write_offset; /* This is the offset in the usb data block to write the serial data -
+ * it is different between devices
+ */
+ int flags; /* some ASYNC_xxxx flags are supported */
+ unsigned long last_dtr_rts; /* saved modem control outputs */
+ wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
+ char prev_status, diff_status; /* Used for TIOCMIWAIT */
+ __u8 rx_flags; /* receive state flags (throttling) */
+ spinlock_t rx_lock; /* spinlock for receive state */
+ struct delayed_work rx_work;
+ struct usb_serial_port *port;
+ int rx_processed;
+ unsigned long rx_bytes;
+
+ __u16 interface; /* FT2232C port interface (0 for FT232/245) */
+
+ int force_baud; /* if non-zero, force the baud rate to this value */
+ int force_rtscts; /* if non-zero, force RTS-CTS to always be enabled */
+
+ spinlock_t tx_lock; /* spinlock for transmit state */
+ unsigned long tx_bytes;
+ unsigned long tx_outstanding_bytes;
+ unsigned long tx_outstanding_urbs;
+};
+
/* struct ftdi_sio_quirk is used by devices requiring special attention. */
struct ftdi_sio_quirk {
int (*probe)(struct usb_serial *);
- void (*setup)(struct usb_serial *); /* Special settings during startup. */
+ void (*port_probe)(struct ftdi_private *); /* Special settings for probed ports. */
};
static int ftdi_olimex_probe (struct usb_serial *serial);
-static void ftdi_USB_UIRT_setup (struct usb_serial *serial);
-static void ftdi_HE_TIRA1_setup (struct usb_serial *serial);
+static void ftdi_USB_UIRT_setup (struct ftdi_private *priv);
+static void ftdi_HE_TIRA1_setup (struct ftdi_private *priv);
static struct ftdi_sio_quirk ftdi_olimex_quirk = {
.probe = ftdi_olimex_probe,
};
static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = {
- .setup = ftdi_USB_UIRT_setup,
+ .port_probe = ftdi_USB_UIRT_setup,
};
static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = {
- .setup = ftdi_HE_TIRA1_setup,
+ .port_probe = ftdi_HE_TIRA1_setup,
};
/*
@@ -567,38 +599,6 @@ static const char *ftdi_chip_name[] = {
#define THROTTLED 0x01
#define ACTUALLY_THROTTLED 0x02
-struct ftdi_private {
- ftdi_chip_type_t chip_type;
- /* type of the device, either SIO or FT8U232AM */
- int baud_base; /* baud base clock for divisor setting */
- int custom_divisor; /* custom_divisor kludge, this is for baud_base (different from what goes to the chip!) */
- __u16 last_set_data_urb_value ;
- /* the last data state set - needed for doing a break */
- int write_offset; /* This is the offset in the usb data block to write the serial data -
- * it is different between devices
- */
- int flags; /* some ASYNC_xxxx flags are supported */
- unsigned long last_dtr_rts; /* saved modem control outputs */
- wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
- char prev_status, diff_status; /* Used for TIOCMIWAIT */
- __u8 rx_flags; /* receive state flags (throttling) */
- spinlock_t rx_lock; /* spinlock for receive state */
- struct delayed_work rx_work;
- struct usb_serial_port *port;
- int rx_processed;
- unsigned long rx_bytes;
-
- __u16 interface; /* FT2232C port interface (0 for FT232/245) */
-
- int force_baud; /* if non-zero, force the baud rate to this value */
- int force_rtscts; /* if non-zero, force RTS-CTS to always be enabled */
-
- spinlock_t tx_lock; /* spinlock for transmit state */
- unsigned long tx_bytes;
- unsigned long tx_outstanding_bytes;
- unsigned long tx_outstanding_urbs;
-};
-
/* Used for TIOCMIWAIT */
#define FTDI_STATUS_B0_MASK (FTDI_RS0_CTS | FTDI_RS0_DSR | FTDI_RS0_RI | FTDI_RS0_RLSD)
#define FTDI_STATUS_B1_MASK (FTDI_RS_BI)
@@ -609,7 +609,6 @@ struct ftdi_private {
/* function prototypes for a FTDI serial converter */
static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id);
-static int ftdi_sio_attach (struct usb_serial *serial);
static void ftdi_shutdown (struct usb_serial *serial);
static int ftdi_sio_port_probe (struct usb_serial_port *port);
static int ftdi_sio_port_remove (struct usb_serial_port *port);
@@ -663,7 +662,6 @@ static struct usb_serial_driver ftdi_sio
.ioctl = ftdi_ioctl,
.set_termios = ftdi_set_termios,
.break_ctl = ftdi_break_ctl,
- .attach = ftdi_sio_attach,
.shutdown = ftdi_shutdown,
};
@@ -1198,6 +1196,8 @@ static int ftdi_sio_probe (struct usb_se
static int ftdi_sio_port_probe(struct usb_serial_port *port)
{
struct ftdi_private *priv;
+ struct ftdi_sio_quirk *quirk = usb_get_serial_data(port->serial);
+
dbg("%s",__FUNCTION__);
@@ -1214,6 +1214,9 @@ static int ftdi_sio_port_probe(struct us
than queue a task to deliver them */
priv->flags = ASYNC_LOW_LATENCY;
+ if (quirk && quirk->port_probe)
+ quirk->port_probe(priv);
+
/* Increase the size of read buffers */
kfree(port->bulk_in_buffer);
port->bulk_in_buffer = kmalloc (BUFSZ, GFP_KERNEL);
@@ -1244,29 +1247,13 @@ static int ftdi_sio_port_probe(struct us
return 0;
}
-/* attach subroutine */
-static int ftdi_sio_attach (struct usb_serial *serial)
-{
- /* Check for device requiring special set up. */
- struct ftdi_sio_quirk *quirk = usb_get_serial_data(serial);
-
- if (quirk && quirk->setup)
- quirk->setup(serial);
-
- return 0;
-} /* ftdi_sio_attach */
-
-
/* Setup for the USB-UIRT device, which requires hardwired
* baudrate (38400 gets mapped to 312500) */
/* Called from usbserial:serial_probe */
-static void ftdi_USB_UIRT_setup (struct usb_serial *serial)
+static void ftdi_USB_UIRT_setup (struct ftdi_private *priv)
{
- struct ftdi_private *priv;
-
dbg("%s",__FUNCTION__);
- priv = usb_get_serial_port_data(serial->port[0]);
priv->flags |= ASYNC_SPD_CUST;
priv->custom_divisor = 77;
priv->force_baud = B38400;
@@ -1274,13 +1261,10 @@ static void ftdi_USB_UIRT_setup (struct
/* Setup for the HE-TIRA1 device, which requires hardwired
* baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */
-static void ftdi_HE_TIRA1_setup (struct usb_serial *serial)
+static void ftdi_HE_TIRA1_setup (struct ftdi_private *priv)
{
- struct ftdi_private *priv;
-
dbg("%s",__FUNCTION__);
- priv = usb_get_serial_port_data(serial->port[0]);
priv->flags |= ASYNC_SPD_CUST;
priv->custom_divisor = 240;
priv->force_baud = B38400;
--
next prev parent reply other threads:[~2007-08-07 21:31 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070807204034.882009319@mini.kroah.org>
2007-08-07 20:41 ` [2.6.22.2 review 00/84] 2.6.22.2 -stable review Greg KH
2007-08-07 20:42 ` [2.6.22.2 review 01/84] USB: cdc-acm: fix sysfs attribute registration bug Greg KH
2007-08-07 20:42 ` [2.6.22.2 review 02/84] TCP FRTO retransmit bug fix Greg KH
2007-08-07 20:42 ` [2.6.22.2 review 03/84] Fix TC deadlock Greg KH
2007-08-07 20:42 ` [2.6.22.2 review 04/84] Fix IPCOMP crashes Greg KH
2007-08-07 20:42 ` [2.6.22.2 review 05/84] Fix deadlocks in sparc serial console Greg KH
2007-08-07 20:42 ` [2.6.22.2 review 06/84] Add a PCI ID for santa rosas PATA controller Greg KH
2007-08-07 23:39 ` Chr
2007-08-09 19:39 ` Andrew Morton
2007-08-07 20:43 ` [2.6.22.2 review 07/84] Missing header include in ipt_iprange.h Greg KH
2007-08-07 20:43 ` [2.6.22.2 review 08/84] SCTP scope_id handling fix Greg KH
2007-08-07 20:43 ` [2.6.22.2 review 09/84] Fix rfkill IRQ flags Greg KH
2007-08-07 21:37 ` Jan Engelhardt
2007-08-09 5:24 ` Alexey Dobriyan
2007-08-07 20:43 ` [2.6.22.2 review 10/84] gen estimator timer unload race Greg KH
2007-08-07 20:43 ` [2.6.22.2 review 11/84] gen estimator deadlock fix Greg KH
2007-08-07 20:43 ` [2.6.22.2 review 12/84] Fix error queue socket lookup in ipv6 Greg KH
2007-08-07 20:43 ` [2.6.22.2 review 13/84] Fix ipv6 link down handling Greg KH
2007-08-07 20:44 ` [2.6.22.2 review 14/84] Netpoll leak Greg KH
2007-08-07 20:44 ` [2.6.22.2 review 15/84] Sparc64 bootup assembler bug Greg KH
2007-08-07 20:44 ` [2.6.22.2 review 16/84] Fix ipv6 tunnel endianness bug Greg KH
2007-08-07 20:44 ` [2.6.22.2 review 17/84] Fix sparc32 memset() Greg KH
2007-08-07 20:44 ` [2.6.22.2 review 18/84] Fix sparc32 udelay() rounding errors Greg KH
2007-08-07 21:41 ` Jan Engelhardt
2007-08-07 20:44 ` [2.6.22.2 review 19/84] Fix TCP IPV6 MD5 bug Greg KH
2007-08-07 20:44 ` [2.6.22.2 review 20/84] KVM: SVM: Reliably detect if SVM was disabled by BIOS Greg KH
2007-08-07 20:44 ` [2.6.22.2 review 21/84] USB: fix warning caused by autosuspend counter going negative Greg KH
2007-08-07 20:44 ` [2.6.22.2 review 22/84] usb-serial: Fix edgeport regression on non-EPiC devices Greg KH
2007-08-07 20:44 ` [2.6.22.2 review 23/84] Fix reported task file values in sense data Greg KH
2007-08-07 20:44 ` [2.6.22.2 review 24/84] aacraid: fix security hole Greg KH
2007-08-07 20:44 ` [2.6.22.2 review 25/84] firewire: fw-sbp2: set correct maximum payload (fixes CardBus adapters) Greg KH
2007-08-07 20:44 ` [2.6.22.2 review 26/84] make timerfd return a u64 and fix the __put_user Greg KH
2007-08-07 21:44 ` Jan Engelhardt
2007-08-07 20:45 ` [2.6.22.2 review 27/84] V4L: Add check for valid control ID to v4l2_ctrl_next Greg KH
2007-08-07 20:45 ` [2.6.22.2 review 28/84] V4L: ivtv: fix broken VBI output support Greg KH
2007-08-07 20:45 ` [2.6.22.2 review 29/84] V4L: ivtv: fix DMA timeout when capturing VBI + another stream Greg KH
2007-08-07 20:45 ` [2.6.22.2 review 30/84] V4L: ivtv: Add locking to ensure stream setup is atomic Greg KH
2007-08-07 20:45 ` [2.6.22.2 review 31/84] V4L: wm8775/wm8739: Fix memory leak when unloading module Greg KH
2007-08-07 20:45 ` [2.6.22.2 review 32/84] Input: lifebook - fix an oops on Panasonic CF-18 Greg KH
2007-08-07 20:45 ` [2.6.22.2 review 33/84] splice: fix double page unlock Greg KH
2007-08-07 20:45 ` [2.6.22.2 review 34/84] drm/i915: Fix i965 secured batchbuffer usage (CVE-2007-3851) Greg KH
2007-08-07 20:45 ` [2.6.22.2 review 35/84] Fix leak on /proc/lockdep_stats Greg KH
2007-08-07 20:45 ` Greg KH
2007-08-07 20:45 ` [2.6.22.2 review 36/84] CPU online file permission Greg KH
2007-08-07 20:45 ` [2.6.22.2 review 37/84] Fix user struct leakage with locked IPC shem segment Greg KH
2007-08-07 20:46 ` [2.6.22.2 review 38/84] md: handle writes to broken raid10 arrays gracefully Greg KH
2007-08-07 20:46 ` [2.6.22.2 review 39/84] md: raid10: fix use-after-free of bio Greg KH
2007-08-07 20:46 ` [2.6.22.2 review 40/84] pcmcia: give socket time to power down Greg KH
2007-08-07 20:46 ` [2.6.22.2 review 41/84] Fix leaks on /proc/{*/sched, sched_debug, timer_list, timer_stats} Greg KH
2007-08-07 20:46 ` [2.6.22.2 review 42/84] futex: pass nr_wake2 to futex_wake_op Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 43/84] "ext4_ext_put_in_cache" uses __u32 to receive physical block number Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 44/84] Include serial_reg.h with userspace headers Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 45/84] dm io: fix panic on large request Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 46/84] i386: HPET, check if the counter works Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 47/84] fw-ohci: fix "scheduling while atomic" Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 48/84] firewire: fix memory leak of fw_request instances Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 49/84] softmac: Fix ESSID problem Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 50/84] eCryptfs: ecryptfs_setattr() bugfix Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 51/84] nfsd: fix possible read-ahead cache and export table corruption Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 52/84] readahead: MIN_RA_PAGES/MAX_RA_PAGES macros Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 53/84] fs: 9p/conv.c error path fix Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 54/84] forcedeth bug fix: cicada phy Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 55/84] forcedeth bug fix: vitesse phy Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 56/84] forcedeth bug fix: realtek phy Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 57/84] acpi-cpufreq: Proper ReadModifyWrite of PERF_CTL MSR Greg KH
2007-08-07 20:47 ` [2.6.22.2 review 58/84] jbd commit: fix transaction dropping Greg KH
2007-08-07 20:48 ` [2.6.22.2 review 59/84] jbd2 " Greg KH
2007-08-07 20:48 ` [2.6.22.2 review 60/84] hugetlb: fix race in alloc_fresh_huge_page() Greg KH
2007-08-07 20:48 ` [2.6.22.2 review 61/84] do not limit locked memory when RLIMIT_MEMLOCK is RLIM_INFINITY Greg KH
2007-08-07 20:48 ` [2.6.22.2 review 62/84] uml: limit request size on COWed devices Greg KH
2007-08-07 20:48 ` [2.6.22.2 review 63/84] sony-laptop: fix bug in event handling Greg KH
2007-08-07 20:48 ` [2.6.22.2 review 64/84] destroy_workqueue() can livelock Greg KH
2007-08-07 20:48 ` [2.6.22.2 review 65/84] drivers/video/macmodes.c:mac_find_mode() mustnt be __devinit Greg KH
2007-08-07 20:48 ` [2.6.22.2 review 66/84] cfq-iosched: fix async queue behaviour Greg KH
2007-08-07 20:48 ` [2.6.22.2 review 67/84] libata: add FUJITSU MHV2080BH to NCQ blacklist Greg KH
2007-08-07 20:48 ` [2.6.22.2 review 68/84] ieee1394: revert "sbp2: enforce 32bit DMA mapping" Greg KH
2007-08-07 20:48 ` [2.6.22.2 review 69/84] nfsd: fix possible oops on re-insertion of rpcsec_gss modules Greg KH
2007-08-07 20:48 ` [2.6.22.2 review 70/84] dm raid1: fix status Greg KH
2007-08-07 20:49 ` [2.6.22.2 review 71/84] dm io: fix another panic on large request Greg KH
2007-08-07 20:49 ` [2.6.22.2 review 72/84] dm snapshot: permit invalid activation Greg KH
2007-08-07 20:49 ` [2.6.22.2 review 73/84] dm: disable barriers Greg KH
2007-08-07 20:49 ` [2.6.22.2 review 74/84] cr_backlight_probe() allocates too little storage for struct cr_panel Greg KH
2007-08-07 20:49 ` [2.6.22.2 review 75/84] ACPI: dock: fix opps after dock driver fails to initialize Greg KH
2007-08-07 20:49 ` [2.6.22.2 review 76/84] Hangup TTY before releasing rfcomm_dev Greg KH
2007-08-07 20:49 ` [2.6.22.2 review 77/84] Keep rfcomm_dev on the list until it is freed Greg KH
2007-08-07 20:49 ` [2.6.22.2 review 78/84] nf_conntrack: dont track locally generated special ICMP error Greg KH
2007-08-07 20:49 ` [2.6.22.2 review 79/84] IPV6: /proc/net/anycast6 unbalanced inet6_dev refcnt Greg KH
2007-08-07 20:49 ` [2.6.22.2 review 80/84] sysfs: release mutex when kmalloc() failed in sysfs_open_file() Greg KH
2007-08-07 20:49 ` [2.6.22.2 review 81/84] Netfilter: Fix logging regression Greg KH
2007-08-07 20:49 ` Greg KH [this message]
2007-08-07 20:49 ` [2.6.22.2 review 83/84] sx: switch subven and subid values Greg KH
2007-08-07 20:49 ` [2.6.22.2 review 84/84] UML: exports for hostfs Greg KH
2007-08-07 21:11 ` [2.6.22.2 review 00/84] 2.6.22.2 -stable review 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=20070807204939.GF23028@kroah.com \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=cavokz@gmail.com \
--cc=cebbert@redhat.com \
--cc=chuckw@quantumlinux.com \
--cc=davej@redhat.com \
--cc=jmforbes@linuxtx.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkrufky@linuxtv.org \
--cc=oneukum@suse.de \
--cc=rdunlap@xenotime.net \
--cc=reviews@ml.cw.f00f.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=zwane@arm.linux.org.uk \
/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
all inboxes | Powered by JetHome®