diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-15 18:06:13 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-15 18:06:13 -0800 |
| commit | dab363f938a53ddaee60bfecc1aebdbb3d3af5f0 (patch) | |
| tree | ccdb11a6e6191ba71fbc7716714c47b79172070d /drivers/staging/dgnc | |
| parent | a68db9cb858d10820add66682ad4d412f9914288 (diff) | |
| parent | 17d2c6439be65777245914be354c5a97c76ad246 (diff) | |
| download | linux-dab363f938a53ddaee60bfecc1aebdbb3d3af5f0.tar.gz linux-dab363f938a53ddaee60bfecc1aebdbb3d3af5f0.tar.bz2 linux-dab363f938a53ddaee60bfecc1aebdbb3d3af5f0.zip | |
Merge tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver updates from Greg KH:
"Here's the big staging tree pull request for 3.19-rc1.
We continued to delete more lines than were added, always a good
thing, but not at a huge rate this release, only about 70k lines
removed overall mostly from removing the horrid bcm driver.
Lots of normal staging driver cleanups and fixes all over the place,
well over a thousand of them, the shortlog shows all the horrid
details.
The "contentious" thing here is the movement of the Android binder
code out of staging into the "real" part of the kernel. This is code
that has been stable for a few years now and is working as-is in the
tens of millions of devices with no issues. Yes, the code is horrid,
and the userspace api leaves a lot to be desired, but it's not going
to change due to legacy issues that we have no control over. Because
so many devices and companies rely on this, and the code is stable,
might as well promote it out of staging.
This was all discussed at the Linux Plumbers conference, and everyone
participating agreed that this was the best way forward.
There is work happening to replace the binder code with something new
that is happening right now, but I don't expect to see the results of
that work for another year at the earliest. If that ever happens, and
Android switches over to it, I'll gladly remove this version.
As for maintainers, I'll be glad to maintain this code, I've been
doing it for the past few years with no problems. I'll send a
MAINTAINERS entry for it before 3.19-final is out, still need to talk
to the Google developers about if they are willing to help with it or
not, last I checked they were, which was good.
All of these patches have been in linux-next for a while with no
reported issues"
* tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1382 commits)
Staging: slicoss: Fix long line issues in slicoss.c
staging: rtl8712: remove unnecessary else after return
staging: comedi: change some printk calls to pr_err
staging: rtl8723au: hal: Removed the extra semicolon
lustre: Deletion of unnecessary checks before three function calls
staging: lustre: fix sparse warnings: static function declaration
staging: lustre: fixed sparse warnings related to static declarations
staging: unisys: remove duplicate header
staging: unisys: remove unneeded structure
staging: ft1000 : replace __attribute ((__packed__) with __packed
drivers: staging: rtl8192e: Include "asm/unaligned.h" instead of "access_ok.h" in "rtl819x_BAProc.c"
Drivers:staging:rtl8192e: Fixed checkpatch warning
Drivers:staging:clocking-wizard: Added a newline
staging: clocking-wizard: check for a valid clk_name pointer
staging: rtl8723au: Hal_InitPGData() avoid unnecessary typecasts
staging: rtl8723au: _DisableAnalog(): Avoid zero-init variables unnecessarily
staging: rtl8723au: Remove unnecessary wrapper _ResetDigitalProcedure1()
staging: rtl8723au: _ResetDigitalProcedure1_92C() reduce code obfuscation
staging: rtl8723au: Remove unnecessary wrapper _DisableRFAFEAndResetBB()
staging: rtl8723au: _DisableRFAFEAndResetBB8192C(): Reduce code obfuscation
...
Diffstat (limited to 'drivers/staging/dgnc')
| -rw-r--r-- | drivers/staging/dgnc/dgnc_cls.c | 30 | ||||
| -rw-r--r-- | drivers/staging/dgnc/dgnc_driver.c | 33 | ||||
| -rw-r--r-- | drivers/staging/dgnc/dgnc_driver.h | 61 | ||||
| -rw-r--r-- | drivers/staging/dgnc/dgnc_kcompat.h | 18 | ||||
| -rw-r--r-- | drivers/staging/dgnc/dgnc_neo.c | 30 | ||||
| -rw-r--r-- | drivers/staging/dgnc/dgnc_sysfs.c | 37 | ||||
| -rw-r--r-- | drivers/staging/dgnc/dgnc_tty.c | 146 | ||||
| -rw-r--r-- | drivers/staging/dgnc/dgnc_tty.h | 2 |
8 files changed, 40 insertions, 317 deletions
diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index a17f4f6095c8..bedc5221b6fc 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -724,10 +724,8 @@ static void cls_tasklet(unsigned long data) int state = 0; int ports = 0; - if (!bd || bd->magic != DGNC_BOARD_MAGIC) { - APR(("poll_tasklet() - NULL or bad bd.\n")); + if (!bd || bd->magic != DGNC_BOARD_MAGIC) return; - } /* Cache a couple board values */ spin_lock_irqsave(&bd->bd_lock, flags); @@ -794,25 +792,17 @@ static void cls_tasklet(unsigned long data) */ static irqreturn_t cls_intr(int irq, void *voidbrd) { - struct dgnc_board *brd = (struct dgnc_board *) voidbrd; + struct dgnc_board *brd = voidbrd; uint i = 0; unsigned char poll_reg; unsigned long flags; - if (!brd) { - APR(("Received interrupt (%d) with null board associated\n", - irq)); - return IRQ_NONE; - } - /* - * Check to make sure its for us. + * Check to make sure it didn't receive interrupt with a null board + * associated or a board pointer that wasn't ours. */ - if (brd->magic != DGNC_BOARD_MAGIC) { - APR(("Received interrupt (%d) with a board pointer that wasn't ours!\n", - irq)); + if (!brd || brd->magic != DGNC_BOARD_MAGIC) return IRQ_NONE; - } spin_lock_irqsave(&brd->bd_intr_lock, flags); @@ -928,8 +918,6 @@ static void cls_copy_data_from_uart_to_queue(struct channel_t *ch) ch->ch_equeue[head] = linestatus & (UART_LSR_BI | UART_LSR_PE | UART_LSR_FE); ch->ch_rqueue[head] = readb(&ch->ch_cls_uart->txrx); - dgnc_sniff_nowait_nolock(ch, "UART READ", - ch->ch_rqueue + head, 1); qleft--; @@ -964,7 +952,6 @@ static int cls_drain(struct tty_struct *tty, uint seconds) unsigned long flags; struct channel_t *ch; struct un_t *un; - int rc = 0; if (!tty || tty->magic != TTY_MAGIC) return -ENXIO; @@ -984,12 +971,11 @@ static int cls_drain(struct tty_struct *tty, uint seconds) /* * NOTE: Do something with time passed in. */ - rc = wait_event_interruptible(un->un_flags_wait, - ((un->un_flags & UN_EMPTY) == 0)); /* If ret is non-zero, user ctrl-c'ed us */ - return rc; + return wait_event_interruptible(un->un_flags_wait, + ((un->un_flags & UN_EMPTY) == 0)); } @@ -1098,8 +1084,6 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) ch->ch_tun.un_flags |= (UN_EMPTY); } writeb(ch->ch_wqueue[ch->ch_w_tail], &ch->ch_cls_uart->txrx); - dgnc_sniff_nowait_nolock(ch, "UART WRITE", - ch->ch_wqueue + ch->ch_w_tail, 1); ch->ch_w_tail++; ch->ch_w_tail &= WQUEUEMASK; ch->ch_txcount++; diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index 21546659ff07..ba98ff348112 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -49,16 +49,6 @@ MODULE_AUTHOR("Digi International, http://www.digi.com"); MODULE_DESCRIPTION("Driver for the Digi International Neo and Classic PCI based product line"); MODULE_SUPPORTED_DEVICE("dgnc"); -/* - * insmod command line overrideable parameters - * - * NOTE: we use a set of macros to create the variables, which allows - * us to specify the variable type, name, initial value, and description. - */ -PARM_INT(debug, 0x00, 0644, "Driver debugging level"); -PARM_INT(rawreadok, 1, 0644, "Bypass flip buffers on input"); -PARM_INT(trcbuf_size, 0x100000, 0644, "Debugging trace buffer size."); - /************************************************************************** * * protos for this file @@ -207,8 +197,6 @@ static int __init dgnc_init_module(void) { int rc = 0; - APR(("%s, Digi International Part Number %s\n", DG_NAME, DG_PART)); - /* * Initialize global stuff */ @@ -254,8 +242,6 @@ static int dgnc_start(void) /* make sure that the globals are init'd before we do anything else */ dgnc_init_globals(); - APR(("For the tools package or updated drivers please visit http://www.digi.com\n")); - /* * Register our base character device into the kernel. * This allows the download daemon to connect to the downld device @@ -265,7 +251,7 @@ static int dgnc_start(void) */ rc = register_chrdev(0, "dgnc", &dgnc_BoardFops); if (rc <= 0) { - APR(("Can't register dgnc driver device (%d)\n", rc)); + pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc); return -ENXIO; } dgnc_Major = rc; @@ -281,7 +267,7 @@ static int dgnc_start(void) rc = dgnc_tty_preinit(); if (rc < 0) { - APR(("tty preinit - not enough memory (%d)\n", rc)); + pr_err(DRVSTR ": tty preinit - not enough memory (%d)\n", rc); return rc; } @@ -468,7 +454,8 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) brd->membase = pci_resource_start(pdev, 4); if (!brd->membase) { - APR(("card has no PCI IO resources, failing board.\n")); + dev_err(&brd->pdev->dev, + "Card has no PCI IO resources, failing.\n"); return -ENODEV; } @@ -555,7 +542,8 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) break; default: - APR(("Did not find any compatible Neo or Classic PCI boards in system.\n")); + dev_err(&brd->pdev->dev, + "Didn't find any compatible Neo/Classic PCI boards.\n"); return -ENXIO; } @@ -567,7 +555,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) rc = dgnc_tty_register(brd); if (rc < 0) { dgnc_tty_uninit(brd); - APR(("Can't register tty devices (%d)\n", rc)); + pr_err(DRVSTR ": Can't register tty devices (%d)\n", rc); brd->state = BOARD_FAILED; brd->dpastatus = BD_NOFEP; goto failed; @@ -575,7 +563,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) rc = dgnc_finalize_board_init(brd); if (rc < 0) { - APR(("Can't finalize board init (%d)\n", rc)); + pr_err(DRVSTR ": Can't finalize board init (%d)\n", rc); brd->state = BOARD_FAILED; brd->dpastatus = BD_NOFEP; @@ -585,7 +573,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) rc = dgnc_tty_init(brd); if (rc < 0) { dgnc_tty_uninit(brd); - APR(("Can't init tty devices (%d)\n", rc)); + pr_err(DRVSTR ": Can't init tty devices (%d)\n", rc); brd->state = BOARD_FAILED; brd->dpastatus = BD_NOFEP; @@ -744,9 +732,6 @@ static void dgnc_init_globals(void) { int i = 0; - dgnc_rawreadok = rawreadok; - dgnc_trcbuf_size = trcbuf_size; - dgnc_debug = debug; dgnc_NumBoards = 0; for (i = 0; i < MAXBOARDS; i++) diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index f901957c757f..a8157eba28da 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -42,53 +42,13 @@ * *************************************************************************/ -/* - * Driver identification, error and debugging statments - * - * In theory, you can change all occurrences of "digi" in the next - * three lines, and the driver printk's will all automagically change. - * - * APR((fmt, args, ...)); Always prints message - */ +/* Driver identification and error statments */ #define PROCSTR "dgnc" /* /proc entries */ #define DEVSTR "/dev/dg/dgnc" /* /dev entries */ -#define DRVSTR "dgnc" /* Driver name string - * displayed by APR */ -#define APR(args) do { printk(DRVSTR": "); printk args; \ - } while (0) -#define RAPR(args) do { printk args; } while (0) +#define DRVSTR "dgnc" /* Driver name string */ #define TRC_TO_CONSOLE 1 -/* - * Debugging levels can be set using debug insmod variable - * They can also be compiled out completely. - */ - -#define DBG_INIT (dgnc_debug & 0x01) -#define DBG_BASIC (dgnc_debug & 0x02) -#define DBG_CORE (dgnc_debug & 0x04) - -#define DBG_OPEN (dgnc_debug & 0x08) -#define DBG_CLOSE (dgnc_debug & 0x10) -#define DBG_READ (dgnc_debug & 0x20) -#define DBG_WRITE (dgnc_debug & 0x40) - -#define DBG_IOCTL (dgnc_debug & 0x80) - -#define DBG_PROC (dgnc_debug & 0x100) -#define DBG_PARAM (dgnc_debug & 0x200) -#define DBG_PSCAN (dgnc_debug & 0x400) -#define DBG_EVENT (dgnc_debug & 0x800) - -#define DBG_DRAIN (dgnc_debug & 0x1000) -#define DBG_MSIGS (dgnc_debug & 0x2000) - -#define DBG_MGMT (dgnc_debug & 0x4000) -#define DBG_INTR (dgnc_debug & 0x8000) - -#define DBG_CARR (dgnc_debug & 0x10000) - /* Number of boards we support at once. */ #define MAXBOARDS 20 #define MAXPORTS 8 @@ -134,8 +94,6 @@ #define _POSIX_VDISABLE '\0' #endif -#define SNIFF_MAX 65536 /* Sniff buffer size (2^n) */ -#define SNIFF_MASK (SNIFF_MAX - 1) /* Sniff wrap mask */ /* * All the possible states the driver can be while being loaded. @@ -342,13 +300,6 @@ struct un_t { #define CH_FORCED_STOP 0x20000 /* Output is forcibly stopped */ #define CH_FORCED_STOPI 0x40000 /* Input is forcibly stopped */ -/* - * Definitions for ch_sniff_flags - */ -#define SNIFF_OPEN 0x1 -#define SNIFF_WAIT_DATA 0x2 -#define SNIFF_WAIT_SPACE 0x4 - /* Our Read/Error/Write queue sizes */ #define RQUEUEMASK 0x1FFF /* 8 K - 1 */ @@ -442,21 +393,13 @@ struct channel_t { struct proc_dir_entry *proc_entry_pointer; struct dgnc_proc_entry *dgnc_channel_table; - uint ch_sniff_in; - uint ch_sniff_out; - char *ch_sniff_buf; /* Sniff buffer for proc */ - ulong ch_sniff_flags; /* Channel flags */ - wait_queue_head_t ch_sniff_wait; }; /* * Our Global Variables. */ extern uint dgnc_Major; /* Our driver/mgmt major */ -extern int dgnc_debug; /* Debug variable */ -extern int dgnc_rawreadok; /* Set if user wants rawreads */ extern int dgnc_poll_tick; /* Poll interval - 20 ms */ -extern int dgnc_trcbuf_size; /* Size of the ringbuffer */ extern spinlock_t dgnc_global_lock; /* Driver global spinlock */ extern uint dgnc_NumBoards; /* Total number of boards */ extern struct dgnc_board *dgnc_Board[MAXBOARDS]; /* Array of board structs */ diff --git a/drivers/staging/dgnc/dgnc_kcompat.h b/drivers/staging/dgnc/dgnc_kcompat.h index eaec7e6a28e1..566cad0d33e7 100644 --- a/drivers/staging/dgnc/dgnc_kcompat.h +++ b/drivers/staging/dgnc/dgnc_kcompat.h @@ -43,22 +43,4 @@ # endif -# define PARM_STR(VAR, INIT, PERM, DESC) \ - static char *VAR = INIT; \ - char *dgnc_##VAR; \ - module_param(VAR, charp, PERM); \ - MODULE_PARM_DESC(VAR, DESC); - -# define PARM_INT(VAR, INIT, PERM, DESC) \ - static int VAR = INIT; \ - int dgnc_##VAR; \ - module_param(VAR, int, PERM); \ - MODULE_PARM_DESC(VAR, DESC); - -# define PARM_ULONG(VAR, INIT, PERM, DESC) \ - static ulong VAR = INIT; \ - ulong dgnc_##VAR; \ - module_param(VAR, long, PERM); \ - MODULE_PARM_DESC(VAR, DESC); - #endif /* ! __DGNC_KCOMPAT_H */ diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index a5bd08fef270..c9a8a9825cfb 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -530,10 +530,11 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port) int linestatus; unsigned long flags; - if (!brd) - return; - - if (brd->magic != DGNC_BOARD_MAGIC) + /* + * Check to make sure it didn't receive interrupt with a null board + * associated or a board pointer that wasn't ours. + */ + if (!brd || brd->magic != DGNC_BOARD_MAGIC) return; if (port > brd->maxports) @@ -869,10 +870,8 @@ static void neo_tasklet(unsigned long data) int state = 0; int ports = 0; - if (!bd || bd->magic != DGNC_BOARD_MAGIC) { - APR(("poll_tasklet() - NULL or bad bd.\n")); + if (!bd || bd->magic != DGNC_BOARD_MAGIC) return; - } /* Cache a couple board values */ spin_lock_irqsave(&bd->bd_lock, flags); @@ -945,7 +944,7 @@ static void neo_tasklet(unsigned long data) */ static irqreturn_t neo_intr(int irq, void *voidbrd) { - struct dgnc_board *brd = (struct dgnc_board *) voidbrd; + struct dgnc_board *brd = voidbrd; struct channel_t *ch; int port = 0; int type = 0; @@ -955,18 +954,12 @@ static irqreturn_t neo_intr(int irq, void *voidbrd) unsigned long flags; unsigned long flags2; - if (!brd) { - APR(("Received interrupt (%d) with null board associated\n", irq)); - return IRQ_NONE; - } - /* - * Check to make sure its for us. + * Check to make sure it didn't receive interrupt with a null board + * associated or a board pointer that wasn't ours. */ - if (brd->magic != DGNC_BOARD_MAGIC) { - APR(("Received interrupt (%d) with a board pointer that wasn't ours!\n", irq)); + if (!brd || brd->magic != DGNC_BOARD_MAGIC) return IRQ_NONE; - } brd->intr_count++; @@ -1224,7 +1217,6 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch) /* Copy data from uart to the queue */ memcpy_fromio(ch->ch_rqueue + head, &ch->ch_neo_uart->txrxburst, n); - dgnc_sniff_nowait_nolock(ch, "UART READ", ch->ch_rqueue + head, n); /* * Since RX_FIFO_DATA_ERROR was 0, we are guarenteed @@ -1310,7 +1302,6 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch) memcpy_fromio(ch->ch_rqueue + head, &ch->ch_neo_uart->txrxburst, 1); ch->ch_equeue[head] = (unsigned char) linestatus; - dgnc_sniff_nowait_nolock(ch, "UART READ", ch->ch_rqueue + head, 1); /* Ditch any remaining linestatus value. */ linestatus = 0; @@ -1563,7 +1554,6 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch) } memcpy_toio(&ch->ch_neo_uart->txrxburst, ch->ch_wqueue + tail, s); - dgnc_sniff_nowait_nolock(ch, "UART WRITE", ch->ch_wqueue + tail, s); /* Add and flip queue if needed */ tail = (tail + s) & WQUEUEMASK; diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c index 6c3b387622e9..2fd34ca70c59 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.c +++ b/drivers/staging/dgnc/dgnc_sysfs.c @@ -63,39 +63,6 @@ static ssize_t dgnc_driver_maxboards_show(struct device_driver *ddp, char *buf) } static DRIVER_ATTR(maxboards, S_IRUSR, dgnc_driver_maxboards_show, NULL); -static ssize_t dgnc_driver_debug_show(struct device_driver *ddp, char *buf) -{ - return snprintf(buf, PAGE_SIZE, "0x%x\n", dgnc_debug); -} - -static ssize_t dgnc_driver_debug_store(struct device_driver *ddp, const char *buf, size_t count) -{ - int ret; - - ret = sscanf(buf, "0x%x\n", &dgnc_debug); - if (ret != 1) - return -EINVAL; - return count; -} -static DRIVER_ATTR(debug, (S_IRUSR | S_IWUSR), dgnc_driver_debug_show, dgnc_driver_debug_store); - - -static ssize_t dgnc_driver_rawreadok_show(struct device_driver *ddp, char *buf) -{ - return snprintf(buf, PAGE_SIZE, "0x%x\n", dgnc_rawreadok); -} - -static ssize_t dgnc_driver_rawreadok_store(struct device_driver *ddp, const char *buf, size_t count) -{ - int ret; - - ret = sscanf(buf, "0x%x\n", &dgnc_rawreadok); - if (ret != 1) - return -EINVAL; - return count; -} -static DRIVER_ATTR(rawreadok, (S_IRUSR | S_IWUSR), dgnc_driver_rawreadok_show, dgnc_driver_rawreadok_store); - static ssize_t dgnc_driver_pollrate_show(struct device_driver *ddp, char *buf) { @@ -122,8 +89,6 @@ void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver) rc |= driver_create_file(driverfs, &driver_attr_version); rc |= driver_create_file(driverfs, &driver_attr_boards); rc |= driver_create_file(driverfs, &driver_attr_maxboards); - rc |= driver_create_file(driverfs, &driver_attr_debug); - rc |= driver_create_file(driverfs, &driver_attr_rawreadok); rc |= driver_create_file(driverfs, &driver_attr_pollrate); if (rc) printk(KERN_ERR "DGNC: sysfs driver_create_file failed!\n"); @@ -137,8 +102,6 @@ void dgnc_remove_driver_sysfiles(struct pci_driver *dgnc_driver) driver_remove_file(driverfs, &driver_attr_version); driver_remove_file(driverfs, &driver_attr_boards); driver_remove_file(driverfs, &driver_attr_maxboards); - driver_remove_file(driverfs, &driver_attr_debug); - driver_remove_file(driverfs, &driver_attr_rawreadok); driver_remove_file(driverfs, &driver_attr_pollrate); } diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index 03c15069731f..f81a375f8bc1 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -49,7 +49,6 @@ #include <linux/delay.h> /* For udelay */ #include <linux/uaccess.h> /* For copy_from_user/copy_to_user */ #include <linux/pci.h> - #include "dgnc_driver.h" #include "dgnc_tty.h" #include "dgnc_types.h" @@ -233,7 +232,8 @@ int dgnc_tty_register(struct dgnc_board *brd) /* Register tty devices */ rc = tty_register_driver(&brd->SerialDriver); if (rc < 0) { - APR(("Can't register tty device (%d)\n", rc)); + dev_dbg(&brd->pdev->dev, + "Can't register tty device (%d)\n", rc); return rc; } brd->dgnc_Major_Serial_Registered = TRUE; @@ -281,7 +281,9 @@ int dgnc_tty_register(struct dgnc_board *brd) /* Register Transparent Print devices */ rc = tty_register_driver(&brd->PrintDriver); if (rc < 0) { - APR(("Can't register Transparent Print device (%d)\n", rc)); + dev_dbg(&brd->pdev->dev, + "Can't register Transparent Print device(%d)\n", + rc); return rc; } brd->dgnc_Major_TransparentPrint_Registered = TRUE; @@ -371,7 +373,6 @@ int dgnc_tty_init(struct dgnc_board *brd) init_waitqueue_head(&ch->ch_flags_wait); init_waitqueue_head(&ch->ch_tun.un_flags_wait); init_waitqueue_head(&ch->ch_pun.un_flags_wait); - init_waitqueue_head(&ch->ch_sniff_wait); { struct device *classp; @@ -446,127 +447,6 @@ void dgnc_tty_uninit(struct dgnc_board *brd) #define TMPBUFLEN (1024) -/* - * dgnc_sniff - Dump data out to the "sniff" buffer if the - * proc sniff file is opened... - */ -void dgnc_sniff_nowait_nolock(struct channel_t *ch, unsigned char *text, unsigned char *buf, int len) -{ - struct timeval tv; - int n; - int r; - int nbuf; - int i; - int tmpbuflen; - char *tmpbuf; - char *p; - int too_much_data; - - tmpbuf = kzalloc(TMPBUFLEN, GFP_ATOMIC); - if (!tmpbuf) - return; - p = tmpbuf; - - /* Leave if sniff not open */ - if (!(ch->ch_sniff_flags & SNIFF_OPEN)) - goto exit; - - do_gettimeofday(&tv); - - /* Create our header for data dump */ - p += sprintf(p, "<%ld %ld><%s><", tv.tv_sec, tv.tv_usec, text); - tmpbuflen = p - tmpbuf; - - do { - too_much_data = 0; - - for (i = 0; i < len && tmpbuflen < (TMPBUFLEN - 4); i++) { - p += sprintf(p, "%02x ", *buf); - buf++; - tmpbuflen = p - tmpbuf; - } - - if (tmpbuflen < (TMPBUFLEN - 4)) { - if (i > 0) - p += sprintf(p - 1, "%s\n", ">"); - else - p += sprintf(p, "%s\n", ">"); - } else { - too_much_data = 1; - len -= i; - } - - nbuf = strlen(tmpbuf); - p = tmpbuf; - - /* - * Loop while data remains. - */ - while (nbuf > 0 && ch->ch_sniff_buf) { - /* - * Determine the amount of available space left in the - * buffer. If there's none, wait until some appears. - */ - n = (ch->ch_sniff_out - ch->ch_sniff_in - 1) & SNIFF_MASK; - - /* - * If there is no space left to write to in our sniff buffer, - * we have no choice but to drop the data. - * We *cannot* sleep here waiting for space, because this - * function was probably called by the interrupt/timer routines! - */ - if (n == 0) - goto exit; - - /* - * Copy as much data as will fit. - */ - - if (n > nbuf) - n = nbuf; - - r = SNIFF_MAX - ch->ch_sniff_in; - - if (r <= n) { - memcpy(ch->ch_sniff_buf + ch->ch_sniff_in, p, r); - - n -= r; - ch->ch_sniff_in = 0; - p += r; - nbuf -= r; - } - - memcpy(ch->ch_sniff_buf + ch->ch_sniff_in, p, n); - - ch->ch_sniff_in += n; - p += n; - nbuf -= n; - - /* - * Wakeup any thread waiting for data - */ - if (ch->ch_sniff_flags & SNIFF_WAIT_DATA) { - ch->ch_sniff_flags &= ~SNIFF_WAIT_DATA; - wake_up_interruptible(&ch->ch_sniff_wait); - } - } - - /* - * If the user sent us too much data to push into our tmpbuf, - * we need to keep looping around on all the data. - */ - if (too_much_data) { - p = tmpbuf; - tmpbuflen = 0; - } - - } while (too_much_data); - -exit: - kfree(tmpbuf); -} - - /*======================================================================= * * dgnc_wmove - Write data to transmit queue. @@ -781,8 +661,6 @@ void dgnc_input(struct channel_t *ch) tty_insert_flip_string(tp->port, ch->ch_rqueue + tail, s); } - dgnc_sniff_nowait_nolock(ch, "USER READ", ch->ch_rqueue + tail, s); - tail += s; n -= s; /* Flip queue if needed */ @@ -1546,14 +1424,18 @@ static void dgnc_tty_close(struct tty_struct *tty, struct file *file) * one, we've got real problems, since it means the * serial port won't be shutdown. */ - APR(("tty->count is 1, un open count is %d\n", un->un_open_count)); + dev_dbg(tty->dev, + "tty->count is 1, un open count is %d\n", + un->un_open_count); un->un_open_count = 1; } if (un->un_open_count) un->un_open_count--; else - APR(("bad serial port open count of %d\n", un->un_open_count)); + dev_dbg(tty->dev, + "bad serial port open count of %d\n", + un->un_open_count); ch->ch_open_count--; @@ -1974,7 +1856,6 @@ static int dgnc_tty_write(struct tty_struct *tty, if (n >= remain) { n -= remain; memcpy(ch->ch_wqueue + head, buf, remain); - dgnc_sniff_nowait_nolock(ch, "USER WRITE", ch->ch_wqueue + head, remain); head = 0; buf += remain; } @@ -1985,7 +1866,6 @@ static int dgnc_tty_write(struct tty_struct *tty, */ remain = n; memcpy(ch->ch_wqueue + head, buf, remain); - dgnc_sniff_nowait_nolock(ch, "USER WRITE", ch->ch_wqueue + head, remain); head += remain; } @@ -2325,8 +2205,6 @@ static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command, uns if (!bd || bd->magic != DGNC_BOARD_MAGIC) return ret; - ret = 0; - ret = get_user(arg, value); if (ret) return ret; @@ -3089,7 +2967,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd, struct digi_getcounter buf; buf.norun = ch->ch_err_overrun; - buf.noflow = 0; /* The driver doesn't keep this stat */ + buf.noflow = 0; /* The driver doesn't keep this stat */ buf.nframe = ch->ch_err_frame; buf.nparity = ch->ch_err_parity; buf.nbreak = ch->ch_err_break; diff --git a/drivers/staging/dgnc/dgnc_tty.h b/drivers/staging/dgnc/dgnc_tty.h index 58eef257c2ec..3975f0407143 100644 --- a/drivers/staging/dgnc/dgnc_tty.h +++ b/drivers/staging/dgnc/dgnc_tty.h @@ -37,6 +37,4 @@ void dgnc_carrier(struct channel_t *ch); void dgnc_wakeup_writes(struct channel_t *ch); void dgnc_check_queue_flow_control(struct channel_t *ch); -void dgnc_sniff_nowait_nolock(struct channel_t *ch, unsigned char *text, unsigned char *buf, int nbuf); - #endif |
