diff options
Diffstat (limited to 'drivers/staging/dgap')
-rw-r--r-- | drivers/staging/dgap/Makefile | 2 | ||||
-rw-r--r-- | drivers/staging/dgap/dgap_downld.h | 2 | ||||
-rw-r--r-- | drivers/staging/dgap/dgap_driver.c | 13 | ||||
-rw-r--r-- | drivers/staging/dgap/dgap_driver.h | 5 | ||||
-rw-r--r-- | drivers/staging/dgap/dgap_fep5.c | 53 | ||||
-rw-r--r-- | drivers/staging/dgap/dgap_fep5.h | 2 | ||||
-rw-r--r-- | drivers/staging/dgap/dgap_kcompat.h | 29 | ||||
-rw-r--r-- | drivers/staging/dgap/dgap_parse.c | 10 | ||||
-rw-r--r-- | drivers/staging/dgap/dgap_sysfs.c | 22 | ||||
-rw-r--r-- | drivers/staging/dgap/dgap_tty.c | 41 | ||||
-rw-r--r-- | drivers/staging/dgap/digi.h | 4 | ||||
-rw-r--r-- | drivers/staging/dgap/downld.c | 4 |
12 files changed, 66 insertions, 121 deletions
diff --git a/drivers/staging/dgap/Makefile b/drivers/staging/dgap/Makefile index 9f1fce157c77..3abe8d2bb748 100644 --- a/drivers/staging/dgap/Makefile +++ b/drivers/staging/dgap/Makefile @@ -1,5 +1,3 @@ -EXTRA_CFLAGS += -DDG_NAME=\"dgap-1.3-16\" -DDG_PART=\"40002347_C\" - obj-$(CONFIG_DGAP) += dgap.o diff --git a/drivers/staging/dgap/dgap_downld.h b/drivers/staging/dgap/dgap_downld.h index f79e65cd1d51..271ac19257f9 100644 --- a/drivers/staging/dgap/dgap_downld.h +++ b/drivers/staging/dgap/dgap_downld.h @@ -35,7 +35,7 @@ struct fepimg { int type; /* board type */ int len; /* length of image */ - char fepimage[1]; /* begining of image */ + char fepimage[1]; /* beginning of image */ }; struct downldio { diff --git a/drivers/staging/dgap/dgap_driver.c b/drivers/staging/dgap/dgap_driver.c index 40ef785a0428..4c1515ee56e5 100644 --- a/drivers/staging/dgap/dgap_driver.c +++ b/drivers/staging/dgap/dgap_driver.c @@ -32,16 +32,12 @@ #include <linux/kernel.h> -#include <linux/version.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/delay.h> /* For udelay */ #include <linux/slab.h> #include <asm/uaccess.h> /* For copy_from_user/copy_to_user */ - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) #include <linux/sched.h> -#endif #include "dgap_driver.h" #include "dgap_pci.h" @@ -420,8 +416,7 @@ void dgap_cleanup_module(void) unregister_chrdev(DIGI_DGAP_MAJOR, "dgap"); } - if (dgap_config_buf) - kfree(dgap_config_buf); + kfree(dgap_config_buf); for (i = 0; i < dgap_NumBoards; ++i) { dgap_remove_ports_sysfiles(dgap_Board[i]); @@ -488,10 +483,8 @@ static void dgap_cleanup_board(struct board_t *brd) } } - if (brd->flipbuf) - kfree(brd->flipbuf); - if (brd->flipflagbuf) - kfree(brd->flipflagbuf); + kfree(brd->flipbuf); + kfree(brd->flipflagbuf); dgap_Board[brd->boardnum] = NULL; diff --git a/drivers/staging/dgap/dgap_driver.h b/drivers/staging/dgap/dgap_driver.h index b1cf489a729c..7d631e80c00e 100644 --- a/drivers/staging/dgap/dgap_driver.h +++ b/drivers/staging/dgap/dgap_driver.h @@ -46,13 +46,16 @@ /* * Driver identification, error and debugging statments * - * In theory, you can change all occurances of "digi" in the next + * 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 * DPR((fmt, args, ...)); Only prints if DGAP_TRACER is defined at * compile time and dgap_debug!=0 */ +#define DG_NAME "dgap-1.3-16" +#define DG_PART "40002347_C" + #define PROCSTR "dgap" /* /proc entries */ #define DEVSTR "/dev/dg/dgap" /* /dev entries */ #define DRVSTR "dgap" /* Driver name string diff --git a/drivers/staging/dgap/dgap_fep5.c b/drivers/staging/dgap/dgap_fep5.c index 4464f02c9575..794cf9db8b83 100644 --- a/drivers/staging/dgap/dgap_fep5.c +++ b/drivers/staging/dgap/dgap_fep5.c @@ -134,7 +134,7 @@ int dgap_after_config_loaded(void) dgap_Board[i]->flipflagbuf = dgap_driver_kzmalloc(MYFLIPLEN, GFP_ATOMIC); } - return (rc); + return rc; } @@ -150,14 +150,14 @@ static int dgap_usertoboard(struct board_t *brd, char *to_addr, char __user *fro int n = U2BSIZE; if (!brd || brd->magic != DGAP_BOARD_MAGIC) - return(-EFAULT); + return -EFAULT; while (len) { if (n > len) n = len; if (copy_from_user((char *) &buf, from_addr, n) == -1 ) { - return(-EFAULT); + return -EFAULT; } /* Copy data from buffer to card memory */ @@ -169,7 +169,7 @@ static int dgap_usertoboard(struct board_t *brd, char *to_addr, char __user *fro from_addr += n; n = U2BSIZE; } - return(0); + return 0; } @@ -1155,20 +1155,20 @@ uint dgap_get_custom_baud(struct channel_t *ch) uint value = 0; if (!ch || ch->magic != DGAP_CHANNEL_MAGIC) { - return (0); + return 0; } if (!ch->ch_bd || ch->ch_bd->magic != DGAP_BOARD_MAGIC) { - return (0); + return 0; } if (!(ch->ch_bd->bd_flags & BD_FEP5PLUS)) - return (0); + return 0; vaddr = ch->ch_bd->re_map_membase; if (!vaddr) - return (0); + return 0; /* * Go get from fep mem, what the fep @@ -1178,7 +1178,7 @@ uint dgap_get_custom_baud(struct channel_t *ch) (ch->ch_portnum * 0x28) + LINE_SPEED)); value = readw(vaddr + offset); - return (value); + return value; } @@ -1229,29 +1229,24 @@ int dgap_param(struct tty_struct *tty) uchar mval; uchar hflow; - if (!tty || tty->magic != TTY_MAGIC) { - return (-ENXIO); - } + if (!tty || tty->magic != TTY_MAGIC) + return -ENXIO; un = (struct un_t *) tty->driver_data; - if (!un || un->magic != DGAP_UNIT_MAGIC) { - return (-ENXIO); - } + if (!un || un->magic != DGAP_UNIT_MAGIC) + return -ENXIO; ch = un->un_ch; - if (!ch || ch->magic != DGAP_CHANNEL_MAGIC) { - return (-ENXIO); - } + if (!ch || ch->magic != DGAP_CHANNEL_MAGIC) + return -ENXIO; bd = ch->ch_bd; - if (!bd || bd->magic != DGAP_BOARD_MAGIC) { - return (-ENXIO); - } + if (!bd || bd->magic != DGAP_BOARD_MAGIC) + return -ENXIO; bs = ch->ch_bs; - if (bs == 0) { - return (-ENXIO); - } + if (!bs) + return -ENXIO; DPR_PARAM(("param start: tdev: %x cflags: %x oflags: %x iflags: %x\n", ch->ch_tun.un_dev, ch->ch_c_cflag, ch->ch_c_oflag, ch->ch_c_iflag)); @@ -1558,7 +1553,7 @@ int dgap_param(struct tty_struct *tty) DPR_PARAM(("param finish\n")); - return (0); + return 0; } @@ -1675,7 +1670,7 @@ static int dgap_event(struct board_t *bd) int b1; if (!bd || bd->magic != DGAP_BOARD_MAGIC) - return (-ENXIO); + return -ENXIO; DGAP_LOCK(bd->bd_lock, lock_flags); @@ -1683,7 +1678,7 @@ static int dgap_event(struct board_t *bd) if (!vaddr) { DGAP_UNLOCK(bd->bd_lock, lock_flags); - return (-ENXIO); + return -ENXIO; } eaddr = (struct ev_t *) (vaddr + EVBUF); @@ -1701,7 +1696,7 @@ static int dgap_event(struct board_t *bd) DPR_EVENT(("should be calling xxfail %d\n", __LINE__)); /* Let go of board lock */ DGAP_UNLOCK(bd->bd_lock, lock_flags); - return (-ENXIO); + return -ENXIO; } /* @@ -1949,5 +1944,5 @@ next: writew(tail, &(eaddr->ev_tail)); DGAP_UNLOCK(bd->bd_lock, lock_flags); - return (0); + return 0; } diff --git a/drivers/staging/dgap/dgap_fep5.h b/drivers/staging/dgap/dgap_fep5.h index 3a12ba5e3c2a..c9abc406a1e0 100644 --- a/drivers/staging/dgap/dgap_fep5.h +++ b/drivers/staging/dgap/dgap_fep5.h @@ -211,7 +211,7 @@ struct bs_t { #define SIFLAG 0xea /* Set UNIX iflags */ #define SFLOWC 0xeb /* Set flow control characters */ #define STLOW 0xec /* Set transmit low water mark */ -#define RPAUSE 0xee /* Pause recieve */ +#define RPAUSE 0xee /* Pause receive */ #define RRESUME 0xef /* Resume receive */ #define CHRESET 0xf0 /* Reset Channel */ #define BUFSETALL 0xf2 /* Set Tx & Rx buffer size avail*/ diff --git a/drivers/staging/dgap/dgap_kcompat.h b/drivers/staging/dgap/dgap_kcompat.h index 8ebf4b7373b7..0dc2404922ff 100644 --- a/drivers/staging/dgap/dgap_kcompat.h +++ b/drivers/staging/dgap/dgap_kcompat.h @@ -28,11 +28,6 @@ #ifndef __DGAP_KCOMPAT_H #define __DGAP_KCOMPAT_H -# ifndef KERNEL_VERSION -# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -# endif - - #if !defined(TTY_FLIPBUF_SIZE) # define TTY_FLIPBUF_SIZE 512 #endif @@ -66,28 +61,4 @@ module_param(VAR, long, PERM); \ MODULE_PARM_DESC(VAR, DESC); - - - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - - - - -/* NOTHING YET */ - - - - -# else - - - -# error "this driver does not support anything below the 2.6.27 kernel series." - - - -# endif - #endif /* ! __DGAP_KCOMPAT_H */ diff --git a/drivers/staging/dgap/dgap_parse.c b/drivers/staging/dgap/dgap_parse.c index 5497e6de0608..ff9d19449b43 100644 --- a/drivers/staging/dgap/dgap_parse.c +++ b/drivers/staging/dgap/dgap_parse.c @@ -904,7 +904,7 @@ int dgap_parsefile(char **in, int Remove) /* * dgap_sindex: much like index(), but it looks for a match of any character in * the group, and returns that position. If the first character is a ^, then - * this will match the first occurence not in that group. + * this will match the first occurrence not in that group. */ static char *dgap_sindex (char *string, char *group) { @@ -1013,8 +1013,10 @@ static void dgap_err(char *s) static struct cnode *dgap_newnode(int t) { struct cnode *n; - if ( (n = (struct cnode *) kmalloc(sizeof(struct cnode ), GFP_ATOMIC) ) != NULL) { - memset( (char *)n, 0, sizeof(struct cnode ) ); + + n = kmalloc(sizeof(struct cnode), GFP_ATOMIC); + if (n != NULL) { + memset((char *)n, 0, sizeof(struct cnode)); n->type = t; } return(n); @@ -1150,7 +1152,7 @@ uint dgap_config_get_altpin(struct board_t *bd) /* * Given a specific type of board, if found, detached link and - * returns the first occurance in the list. + * returns the first occurrence in the list. */ struct cnode *dgap_find_config(int type, int bus, int slot) { diff --git a/drivers/staging/dgap/dgap_sysfs.c b/drivers/staging/dgap/dgap_sysfs.c index 94da06fcf7e9..7f4ec9a18293 100644 --- a/drivers/staging/dgap/dgap_sysfs.c +++ b/drivers/staging/dgap/dgap_sysfs.c @@ -395,7 +395,7 @@ static ssize_t dgap_tty_state_show(struct device *d, struct device_attribute *at if (!d) return (0); - un = (struct un_t *) dev_get_drvdata(d); + un = dev_get_drvdata(d); if (!un || un->magic != DGAP_UNIT_MAGIC) return (0); ch = un->un_ch; @@ -420,7 +420,7 @@ static ssize_t dgap_tty_baud_show(struct device *d, struct device_attribute *att if (!d) return (0); - un = (struct un_t *) dev_get_drvdata(d); + un = dev_get_drvdata(d); if (!un || un->magic != DGAP_UNIT_MAGIC) return (0); ch = un->un_ch; @@ -445,7 +445,7 @@ static ssize_t dgap_tty_msignals_show(struct device *d, struct device_attribute if (!d) return (0); - un = (struct un_t *) dev_get_drvdata(d); + un = dev_get_drvdata(d); if (!un || un->magic != DGAP_UNIT_MAGIC) return (0); ch = un->un_ch; @@ -479,7 +479,7 @@ static ssize_t dgap_tty_iflag_show(struct device *d, struct device_attribute *at if (!d) return (0); - un = (struct un_t *) dev_get_drvdata(d); + un = dev_get_drvdata(d); if (!un || un->magic != DGAP_UNIT_MAGIC) return (0); ch = un->un_ch; @@ -504,7 +504,7 @@ static ssize_t dgap_tty_cflag_show(struct device *d, struct device_attribute *at if (!d) return (0); - un = (struct un_t *) dev_get_drvdata(d); + un = dev_get_drvdata(d); if (!un || un->magic != DGAP_UNIT_MAGIC) return (0); ch = un->un_ch; @@ -529,7 +529,7 @@ static ssize_t dgap_tty_oflag_show(struct device *d, struct device_attribute *at if (!d) return (0); - un = (struct un_t *) dev_get_drvdata(d); + un = dev_get_drvdata(d); if (!un || un->magic != DGAP_UNIT_MAGIC) return (0); ch = un->un_ch; @@ -554,7 +554,7 @@ static ssize_t dgap_tty_lflag_show(struct device *d, struct device_attribute *at if (!d) return (0); - un = (struct un_t *) dev_get_drvdata(d); + un = dev_get_drvdata(d); if (!un || un->magic != DGAP_UNIT_MAGIC) return (0); ch = un->un_ch; @@ -579,7 +579,7 @@ static ssize_t dgap_tty_digi_flag_show(struct device *d, struct device_attribute if (!d) return (0); - un = (struct un_t *) dev_get_drvdata(d); + un = dev_get_drvdata(d); if (!un || un->magic != DGAP_UNIT_MAGIC) return (0); ch = un->un_ch; @@ -604,7 +604,7 @@ static ssize_t dgap_tty_rxcount_show(struct device *d, struct device_attribute * if (!d) return (0); - un = (struct un_t *) dev_get_drvdata(d); + un = dev_get_drvdata(d); if (!un || un->magic != DGAP_UNIT_MAGIC) return (0); ch = un->un_ch; @@ -629,7 +629,7 @@ static ssize_t dgap_tty_txcount_show(struct device *d, struct device_attribute * if (!d) return (0); - un = (struct un_t *) dev_get_drvdata(d); + un = dev_get_drvdata(d); if (!un || un->magic != DGAP_UNIT_MAGIC) return (0); ch = un->un_ch; @@ -661,7 +661,7 @@ static ssize_t dgap_tty_name_show(struct device *d, struct device_attribute *att if (!d) return (0); - un = (struct un_t *) dev_get_drvdata(d); + un = dev_get_drvdata(d); if (!un || un->magic != DGAP_UNIT_MAGIC) return (0); ch = un->un_ch; diff --git a/drivers/staging/dgap/dgap_tty.c b/drivers/staging/dgap/dgap_tty.c index b906db30b617..2a7a37298da4 100644 --- a/drivers/staging/dgap/dgap_tty.c +++ b/drivers/staging/dgap/dgap_tty.c @@ -249,7 +249,7 @@ int dgap_tty_register(struct board_t *brd) /* * If we're doing transparent print, we have to do all of the above - * again, seperately so we don't get the LD confused about what major + * again, separately so we don't get the LD confused about what major * we are when we get into the dgap_tty_open() routine. */ brd->PrintDriver = alloc_tty_driver(MAXPORTS); @@ -497,10 +497,8 @@ int dgap_tty_init(struct board_t *brd) */ void dgap_tty_post_uninit(void) { - if (dgap_TmpWriteBuf) { - kfree(dgap_TmpWriteBuf); - dgap_TmpWriteBuf = NULL; - } + kfree(dgap_TmpWriteBuf); + dgap_TmpWriteBuf = NULL; } @@ -522,10 +520,8 @@ void dgap_tty_uninit(struct board_t *brd) tty_unregister_device(brd->SerialDriver, i); } tty_unregister_driver(brd->SerialDriver); - if (brd->SerialDriver->ttys) { - kfree(brd->SerialDriver->ttys); - brd->SerialDriver->ttys = NULL; - } + kfree(brd->SerialDriver->ttys); + brd->SerialDriver->ttys = NULL; put_tty_driver(brd->SerialDriver); brd->dgap_Major_Serial_Registered = FALSE; } @@ -538,10 +534,8 @@ void dgap_tty_uninit(struct board_t *brd) tty_unregister_device(brd->PrintDriver, i); } tty_unregister_driver(brd->PrintDriver); - if (brd->PrintDriver->ttys) { - kfree(brd->PrintDriver->ttys); - brd->PrintDriver->ttys = NULL; - } + kfree(brd->PrintDriver->ttys); + brd->PrintDriver->ttys = NULL; put_tty_driver(brd->PrintDriver); brd->dgap_Major_TransparentPrint_Registered = FALSE; } @@ -601,7 +595,7 @@ static void dgap_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *b /* * Loop while data remains. */ - while (nbuf > 0 && ch->ch_sniff_buf != 0) { + 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. @@ -1069,7 +1063,7 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file) DGAP_LOCK(brd->bd_lock, lock_flags); - /* The wait above should guarentee this cannot happen */ + /* The wait above should guarantee this cannot happen */ if (brd->state != BOARD_READY) { DGAP_UNLOCK(brd->bd_lock, lock_flags); return -ENXIO; @@ -1113,9 +1107,10 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file) MAJOR(tty_devnum(tty)), MINOR(tty_devnum(tty)), un, brd->name)); /* - * Error if channel info pointer is 0. + * Error if channel info pointer is NULL. */ - if ((bs = ch->ch_bs) == 0) { + bs = ch->ch_bs; + if (!bs) { DGAP_UNLOCK(ch->ch_lock, lock_flags2); DGAP_UNLOCK(brd->bd_lock, lock_flags); DPR_OPEN(("%d BS is 0!\n", __LINE__)); @@ -3513,10 +3508,6 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, return(-EINVAL); } - DGAP_UNLOCK(ch->ch_lock, lock_flags2); - DGAP_UNLOCK(bd->bd_lock, lock_flags); - return(-ENOIOCTLCMD); - case DIGI_GETA: /* get information for ditty */ DGAP_UNLOCK(ch->ch_lock, lock_flags2); @@ -3586,12 +3577,4 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, return(-ENOIOCTLCMD); } - - DGAP_UNLOCK(ch->ch_lock, lock_flags2); - DGAP_UNLOCK(bd->bd_lock, lock_flags); - - DPR_IOCTL(("dgap_tty_ioctl end - cmd %s (%x), arg %lx\n", - dgap_ioctl_name(cmd), cmd, arg)); - - return(0); } diff --git a/drivers/staging/dgap/digi.h b/drivers/staging/dgap/digi.h index 651e2e5e93c7..bcea4f734a32 100644 --- a/drivers/staging/dgap/digi.h +++ b/drivers/staging/dgap/digi.h @@ -203,9 +203,9 @@ struct shrink_buf_struct { unsigned long shrink_buf_vaddr; /* Virtual address of board */ unsigned long shrink_buf_phys; /* Physical address of board */ unsigned long shrink_buf_bseg; /* Amount of board memory */ - unsigned long shrink_buf_hseg; /* '186 Begining of Dual-Port */ + unsigned long shrink_buf_hseg; /* '186 Beginning of Dual-Port */ - unsigned long shrink_buf_lseg; /* '186 Begining of freed memory */ + unsigned long shrink_buf_lseg; /* '186 Beginning of freed memory */ unsigned long shrink_buf_mseg; /* Linear address from start of dual-port were freed memory begins, host viewpoint. */ diff --git a/drivers/staging/dgap/downld.c b/drivers/staging/dgap/downld.c index 57dfd6bafcf6..638c5da43c85 100644 --- a/drivers/staging/dgap/downld.c +++ b/drivers/staging/dgap/downld.c @@ -52,7 +52,7 @@ char *pgm; void myperror(); /* -** This structure is used to keep track of the diferent images available +** This structure is used to keep track of the different images available ** to give to the driver. It is arranged so that the things that are ** constants or that have defaults are first inthe strucutre to simplify ** the table of initializers. @@ -789,7 +789,7 @@ int main(int argc, char **argv) /* ** myperror() ** -** Same as normal perror(), but places the program name at the begining +** Same as normal perror(), but places the program name at the beginning ** of the message. */ void myperror(char *s) |