[PATCH] Staging: Skein: Moved macros from skein_block.c to header
Staging: Skein: Moved macros from skein_block.c to header file. The original code defined macros in the source code, making it harder to read. Moved them to the header file, as per the TODO file. Signed-off-by: Sanidhya Solanki --- drivers/staging/skein/skein_block.c | 473 +--- drivers/staging/skein/skein_block.h | 454 ++ 2 files changed, 466 insertions(+), 461 deletions(-) diff --git a/drivers/staging/skein/skein_block.c b/drivers/staging/skein/skein_block.c index 45b4732..ec8292d 100644 --- a/drivers/staging/skein/skein_block.c +++ b/drivers/staging/skein/skein_block.c @@ -18,458 +18,6 @@ #include "skein_base.h" #include "skein_block.h" -#ifndef SKEIN_USE_ASM -#define SKEIN_USE_ASM (0) /* default is all C code (no ASM) */ -#endif - -#ifndef SKEIN_LOOP -#define SKEIN_LOOP 001 /* default: unroll 256 and 512, but not 1024 */ -#endif - -#define BLK_BITS(WCNT * 64) /* some useful definitions for code here */ -#define KW_TWK_BASE (0) -#define KW_KEY_BASE (3) -#define ks (kw + KW_KEY_BASE) -#define ts (kw + KW_TWK_BASE) - -#ifdef SKEIN_DEBUG -#define debug_save_tweak(ctx) \ -{ \ - ctx->h.tweak[0] = ts[0];\ - ctx->h.tweak[1] = ts[1];\ -} -#else -#define debug_save_tweak(ctx) -#endif - -#if !(SKEIN_USE_ASM & 256) -#undef RCNT -#define RCNT (SKEIN_256_ROUNDS_TOTAL / 8) -#ifdef SKEIN_LOOP /* configure how much to unroll the loop */ -#define SKEIN_UNROLL_256 (((SKEIN_LOOP) / 100) % 10) -#else -#define SKEIN_UNROLL_256 (0) -#endif - -#if SKEIN_UNROLL_256 -#if (RCNT % SKEIN_UNROLL_256) -#error "Invalid SKEIN_UNROLL_256" /* sanity check on unroll count */ -#endif -#endif -#define ROUND256(p0, p1, p2, p3, ROT, r_num) \ - do { \ - X##p0 += X##p1; \ - X##p1 = rotl_64(X##p1, ROT##_0); \ - X##p1 ^= X##p0; \ - X##p2 += X##p3; \ - X##p3 = rotl_64(X##p3, ROT##_1); \ - X##p3 ^= X##p2; \ - } while (0) - -#if SKEIN_UNROLL_256 == 0 -#define R256(p0, p1, p2, p3, ROT, r_num) /* fully unrolled */ \ - ROUND256(p0, p1, p2, p3, ROT, r_num) - -#define I256(R) \ - do {\ - /* inject the key schedule value */ \ - X0 += ks[((R) + 1) % 5]; \ - X1 += ks[((R) + 2) % 5] + ts[((R) + 1) % 3]; \ - X2 += ks[((R) + 3) % 5] + ts[((R) + 2) % 3]; \ - X3 += ks[((R) + 4) % 5] + (R) + 1;\ - } while (0) -#else -/* looping version */ -#define R256(p0, p1, p2, p3, ROT, r_num) ROUND256(p0, p1, p2, p3, ROT, r_num) - -#define I256(R) \ - do {\ - /* inject the key schedule value */ \ - X0 += ks[r + (R) + 0]; \ - X1 += ks[r + (R) + 1] + ts[r + (R) + 0];\ - X2 += ks[r + (R) + 2] + ts[r + (R) + 1];\ - X3 += ks[r + (R) + 3] + r + (R);\ - /* rotate key schedule */ \ - ks[r + (R) + 4] = ks[r + (R) - 1]; \ - ts[r + (R) + 2] = ts[r + (R) - 1]; \ - } while (0) -#endif -#define R256_8_ROUNDS(R)\ - do {\ - R256(0, 1, 2, 3, R_256_0, 8 * (R) + 1); \ - R256(0, 3, 2, 1, R_256_1, 8 * (R) + 2); \ - R256(0, 1, 2, 3, R_256_2, 8 * (R) + 3); \ - R256(0, 3, 2, 1, R_256_3, 8 * (R) + 4); \ - I256(2 * (R)); \ - R256(0, 1, 2, 3, R_256_4, 8 * (R) + 5); \ - R256(0, 3, 2, 1, R_256_5, 8 * (R) + 6); \ - R256(0, 1, 2, 3, R_256_6, 8 * (R) + 7); \ - R256(0, 3, 2, 1, R_256_7, 8 * (R) + 8); \ - I256(2 * (R) + 1); \ - } while (0) - -#define R256_UNROLL_R(NN) \ - ((SKEIN_UNROLL_256 == 0 &&\ - SKEIN_256_ROUNDS_TOTAL / 8 > (NN)) || \ - (SKEIN_UNROLL_256 > (NN))) - -#if (SKEIN_UNROLL_256 > 14) -#error "need more unrolling in skein_256_process_block" -#endif -#endif - -#if !(SKEIN_USE_ASM & 512) -#undef RCNT -#define RCNT (SKEIN_512_ROUNDS_TOTAL/8) - -#ifdef SKEIN_LOOP /* configure how much to unroll the loop */ -#define SKEIN_UNROLL_512 (((SKEIN_LOOP)/10)%10) -#else -#define SKEIN_UNROLL_512 (0) -#endif - -#if SKEIN_UNROLL_512 -#if (RCNT % SKEIN_U
[PATCH] Staging: Skein: Patch adds the test vectors
The patch is included below. I would like to apologize for the past few emails. It turns out the documentation included in the eMail clients file is woefully out of date. I have checked the patches for errors using the scripts provided. However, it turns out that the scripts are slightly incorrect, as you can see when it keeps asking to align the statements with the brackets. Another issue has turned out to be that you cannot follow the scripts completely without altering the code in a significant way, as it suggests changing the deterministic portions of the hash, changing certain functions, reducing line length, etc. I have sent the patch to myself, applied it, as well as compared sha512 hashes of both the original and the mailed copy. For the rest of the work on this patch and the skein subsystem, I defer to someone with the expertise and experience of making Linux modules and the skein hash families. I believe that if I continue to make further changes to these files, I might make a mistake which alters functionality of the hash function. I will continue to contribute to the other kernel branches. I will submit a patch to correct the email documentation tomorrow. Thanks for you patience everyone. --- [PATCH] Staging: Skein: Patch adds the test vectors This patch adds the test vectors, and cleans up most of the syntactical and formatting errors. It also updates the TODO for the remaining tasks. Signed-off-by: Sanidhya Solanki --- drivers/staging/skein/TODO | 8 +- drivers/staging/skein/skein_test.c | 831 + drivers/staging/skein/skein_test.h | 516 +++ 3 files changed, 1351 insertions(+), 4 deletions(-) create mode 100644 drivers/staging/skein/skein_test.c create mode 100644 drivers/staging/skein/skein_test.h diff --git a/drivers/staging/skein/TODO b/drivers/staging/skein/TODO index cd3508d..10a4b6cf 100644 --- a/drivers/staging/skein/TODO +++ b/drivers/staging/skein/TODO @@ -1,8 +1,8 @@ skein/threefish TODO - - move macros into appropriate header files - - add / pass test vectors + - clean up skein_test.c and skein_test.h + - pass test vectors - module support -Please send patches to Jason Cooper in addition to the -staging tree mailinglist. +Please send patches to Jason Cooper in addition +to the staging tree mailinglist. diff --git a/drivers/staging/skein/skein_test.c b/drivers/staging/skein/skein_test.c new file mode 100644 index 000..9c1a794 --- /dev/null +++ b/drivers/staging/skein/skein_test.c @@ -0,0 +1,831 @@ +/*** +** +** Test/verification code for the Skein block functions. +** +** Source code author: Doug Whiting, 2008. +** +** This algorithm and source code is released to the public domain. +** +** Testing: +** - buffering of incremental calls (random cnt steps) +** - partial input byte handling +** - output sample hash results (for comparison of ref vs. optimized) +** - performance +** +***/ + +#include +#include +#include +#include +#include +#include +#include + +#include "skein.h" +#include "SHA3api_ref.h" + +static const uint_t hash_bits[] = /* list of hash hash lengths to test */ + { 160, 224, 256, 384, 512, 1024, 256 + 8, 512 + 8, 1024 + 8, 2048 + 8 }; + +/* External function to process blkcnt (nonzero) full block(s) of data. */ +void skein_256_process_block(skein_256_ctxt_t *ctx, const u08b_t *blkptr, size_t blkcnt, size_t bytecntadd); +void skein_512_process_block(skein_512_ctxt_t *ctx, const u08b_t *blkptr, size_t blkcnt, size_t bytecntadd); +void skein_1024_process_block(skein_1024_ctxt_t *ctx, const u08b_t *blkptr, size_t blkcnt, size_t bytecntadd); + +/** debug i/o helper routines **/ +void fatalerror(const char *s, ...) +{ + /* print out a msg and exit with an error code */ + va_list ap; + + va_start(ap, s); + vprintf(s, ap); + va_end(ap); + printf("\n"); + exit(2); +} + +static uint_t _quiet_ = 0; /* quiet processing? */ +static uint_t verbose = 0; /* verbose flag bits */ +static uint_t kathash = ~0u; /* use as a quick check on KAT results */ + +void show_bytes(uint_t cnt, const u08b_t *b) +{ + /* formatted output of byte array */ + uint_t i; + + for (i = 0; i < cnt; i++) { + if (i % 16 == 0) + printf(""); + else if (i % 4 == 0) + printf(" "); + printf(" %02X", b[i]); + kathash = (kathash ^ b[i]) * 0xDEADBEEF; + kathash = (kathash ^ (kathash >> 23) ^ (kathash >> 17) ^ (kathash >> 9)) * 0xCAFEF00D; +
Re: [PATCH] Staging: Skein: Moved macros from skein_block.c to header
I disagree with the output of the automaton. Included below are my compile checks before and after the patch. The output has been scrubbed to remove information about my file layout. -- [~ linux]$ git branch -v master 31ade3b Linux 4.4-rc3 * pat31ade3b Linux 4.4-rc3 [~ linux]$ make -j5 drivers/staging/skein/skein_block.o CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CHK include/generated/timeconst.h CHK include/generated/bounds.h CHK include/generated/asm-offsets.h CALLscripts/checksyscalls.sh CC drivers/staging/skein/skein_block.o [~ linux]$ pwd ~/linux [~ linux]$ git branch -v master 31ade3b Linux 4.4-rc3 * pat31ade3b Linux 4.4-rc3 [~ linux]$ git branch -v master 31ade3b Linux 4.4-rc3 * pat4d2271c Staging: Skein: Moved macros from skein_block.c to header file. [~ linux]$ pwd ~/linux [~ linux]$ make -j5 drivers/staging/skein/skein_block.o CHK include/config/kernel.release UPD include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h UPD include/generated/utsrelease.h CHK include/generated/timeconst.h CHK include/generated/bounds.h CHK include/generated/asm-offsets.h CALLscripts/checksyscalls.sh CC drivers/staging/skein/skein_block.o ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: Skein: Moved macros from skein_block.c to header
On Mon, 7 Dec 2015 11:37:31 +0530 Sudip Mukherjee wrote: > And you moved skein_256_process_block() from skein_block.c to a header > file. Is skein_256_process_block() a macro? No, it is not a macro, it is a conditional. But as other conditionals was already included in the header file, I felt that it was appropriate to move other conditionals as well. However, I will undo that and test a patch, which I can send to you after making sure it does not get mangled. Thanks ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: Skein: Moved macros from skein_block.c to header file.
The original code defined macros in the source code, making it harder to read. Moved them to the header file, as per the TODO file. Upadated the TODO file. Signed-off-by: Sanidhya Solanki --- drivers/staging/skein/TODO | 1 - drivers/staging/skein/skein_block.c | 6 -- drivers/staging/skein/skein_block.h | 7 +++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/skein/TODO b/drivers/staging/skein/TODO index cd3508d..e3de0c7 100644 --- a/drivers/staging/skein/TODO +++ b/drivers/staging/skein/TODO @@ -1,6 +1,5 @@ skein/threefish TODO - - move macros into appropriate header files - add / pass test vectors - module support diff --git a/drivers/staging/skein/skein_block.c b/drivers/staging/skein/skein_block.c index 45b4732..2120392 100644 --- a/drivers/staging/skein/skein_block.c +++ b/drivers/staging/skein/skein_block.c @@ -26,12 +26,6 @@ #define SKEIN_LOOP 001 /* default: unroll 256 and 512, but not 1024 */ #endif -#define BLK_BITS(WCNT * 64) /* some useful definitions for code here */ -#define KW_TWK_BASE (0) -#define KW_KEY_BASE (3) -#define ks (kw + KW_KEY_BASE) -#define ts (kw + KW_TWK_BASE) - #ifdef SKEIN_DEBUG #define debug_save_tweak(ctx) \ { \ diff --git a/drivers/staging/skein/skein_block.h b/drivers/staging/skein/skein_block.h index 9d40f4a..0fd4bfe 100644 --- a/drivers/staging/skein/skein_block.h +++ b/drivers/staging/skein/skein_block.h @@ -7,6 +7,13 @@ ** This algorithm and source code is released to the public domain. ** / + +#define BLK_BITS(WCNT * 64) /* some useful definitions for code here */ +#define KW_TWK_BASE (0) +#define KW_KEY_BASE (3) +#define ks (kw + KW_KEY_BASE) +#define ts (kw + KW_TWK_BASE) + #ifndef _SKEIN_BLOCK_H_ #define _SKEIN_BLOCK_H_ -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: gdm72xx: Code cleanups
>From c07c57f3e045865b0acae498c631189f24aeda0b Mon Sep 17 00:00:00 2001 From: Sanidhya Solanki Date: Thu, 10 Dec 2015 21:13:10 -0500 Subject: [PATCH] staging: gdm72xx: Code cleanups Code cleanups as per the TODO file. Signed-off-by: Sanidhya Solanki --- drivers/staging/gdm72xx/gdm_qos.c | 54 +++ drivers/staging/gdm72xx/gdm_sdio.c | 4 +-- drivers/staging/gdm72xx/gdm_usb.c | 3 +- drivers/staging/gdm72xx/gdm_usb.h | 4 +-- drivers/staging/gdm72xx/gdm_wimax.c | 18 +-- drivers/staging/gdm72xx/hci.h | 11 +++ drivers/staging/gdm72xx/netlink_k.c | 8 ++--- drivers/staging/gdm72xx/sdio_boot.c | 2 +- drivers/staging/gdm72xx/usb_boot.c | 10 +++--- drivers/staging/gdm72xx/usb_ids.h | 64 ++--- 10 files changed, 88 insertions(+), 90 deletions(-) diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c index 81feffa..c03204b 100644 --- a/drivers/staging/gdm72xx/gdm_qos.c +++ b/drivers/staging/gdm72xx/gdm_qos.c @@ -101,7 +101,7 @@ void gdm_qos_init(void *nic_ptr) } qcb->qos_list_cnt = 0; - qcb->qos_null_idx = QOS_MAX-1; + qcb->qos_null_idx = QOS_MAX - 1; qcb->qos_limit_size = 255; spin_lock_init(&qcb->qos_lock); @@ -128,7 +128,7 @@ void gdm_qos_release_list(void *nic_ptr) } qcb->qos_list_cnt = 0; - qcb->qos_null_idx = QOS_MAX-1; + qcb->qos_null_idx = QOS_MAX - 1; for (i = 0; i < QOS_MAX; i++) { list_for_each_entry_safe(entry, n, &qcb->qos_list[i], list) { @@ -143,18 +143,18 @@ static int chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port) { int i; - if (csr->classifier_rule_en&IPTYPEOFSERVICE) { + if (csr->classifier_rule_en & IPTYPEOFSERVICE) { if (((stream[1] & csr->ip2s_mask) < csr->ip2s_lo) || ((stream[1] & csr->ip2s_mask) > csr->ip2s_hi)) return 1; } - if (csr->classifier_rule_en&PROTOCOL) { + if (csr->classifier_rule_en & PROTOCOL) { if (stream[9] != csr->protocol) return 1; } - if (csr->classifier_rule_en&IPMASKEDSRCADDRESS) { + if (csr->classifier_rule_en & IPMASKEDSRCADDRESS) { for (i = 0; i < 4; i++) { if ((stream[12 + i] & csr->ipsrc_addrmask[i]) != (csr->ipsrc_addr[i] & csr->ipsrc_addrmask[i])) @@ -162,7 +162,7 @@ static int chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port) } } - if (csr->classifier_rule_en&IPMASKEDDSTADDRESS) { + if (csr->classifier_rule_en & IPMASKEDDSTADDRESS) { for (i = 0; i < 4; i++) { if ((stream[16 + i] & csr->ipdst_addrmask[i]) != (csr->ipdst_addr[i] & csr->ipdst_addrmask[i])) @@ -170,14 +170,14 @@ static int chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port) } } - if (csr->classifier_rule_en&PROTOCOLSRCPORTRANGE) { - i = ((port[0]<<8)&0xff00)+port[1]; + if (csr->classifier_rule_en & PROTOCOLSRCPORTRANGE) { + i = ((port[0] << 8) & 0xff00) + port[1]; if ((i < csr->srcport_lo) || (i > csr->srcport_hi)) return 1; } - if (csr->classifier_rule_en&PROTOCOLDSTPORTRANGE) { - i = ((port[2]<<8)&0xff00)+port[3]; + if (csr->classifier_rule_en & PROTOCOLDSTPORTRANGE) { + i = ((port[2] << 8) & 0xff00) + port[3]; if ((i < csr->dstport_lo) || (i > csr->dstport_hi)) return 1; } @@ -193,7 +193,7 @@ static int get_qos_index(struct nic *nic, u8 *iph, u8 *tcpudph) if (!iph || !tcpudph) return -1; - ip_ver = (iph[0]>>4)&0xf; + ip_ver = (iph[0] >> 4) & 0xf; if (ip_ver != 4) return -1; @@ -261,7 +261,7 @@ int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct net_device *dev) struct list_head send_list; int ret = 0; - tcph = (struct tcphdr *)iph + iph->ihl*4; + tcph = (struct tcphdr *)iph + iph->ihl * 4; if (ethh->h_proto == cpu_to_be16(ETH_P_IP)) { if (qcb->qos_list_cnt && !qos_free_list.cnt) { @@ -342,17 +342,17 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) if (sub_cmd_evt == QOS_REPORT) { spin_lock_irqsave(&qcb->qos_lock, flags); for (i = 0; i < qcb->qos_list_cnt; i++) { - sfid = ((buf[(i*5)+6]
[PATCH] staging: dgnc: Patch includes the checkpatch fixes
>From 1dbe78ce98037da5467d817a9db838d678b338ae Mon Sep 17 00:00:00 2001 From: Sanidhya Solanki Date: Fri, 11 Dec 2015 03:08:53 -0500 Subject: [PATCH] staging: dgnc: Patch includes the checkpatch fixes Patch contains the checkpatch fixes as asked by the TODO. TODO file is updated as well. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/TODO | 1 - drivers/staging/dgnc/dgnc_cls.c| 4 +- drivers/staging/dgnc/dgnc_driver.c | 56 - drivers/staging/dgnc/dgnc_driver.h | 33 +++--- drivers/staging/dgnc/dgnc_mgmt.c | 28 ++--- drivers/staging/dgnc/dgnc_neo.c| 229 ++--- drivers/staging/dgnc/dgnc_neo.h| 22 ++-- drivers/staging/dgnc/dgnc_pci.h| 1 - drivers/staging/dgnc/dgnc_sysfs.c | 163 +- drivers/staging/dgnc/dgnc_tty.c| 197 +++ drivers/staging/dgnc/digi.h| 44 +++ 11 files changed, 464 insertions(+), 314 deletions(-) diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO index 0e0825b..0bdfd26 100644 --- a/drivers/staging/dgnc/TODO +++ b/drivers/staging/dgnc/TODO @@ -1,4 +1,3 @@ -* checkpatch fixes * remove unnecessary comments * remove unnecessary error messages. Example kzalloc() has its own error message. Adding an extra one is useless. diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 75040da..d312d35 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -1168,8 +1168,8 @@ static void cls_uart_init(struct channel_t *ch) /* Clear out UART and FIFO */ readb(&ch->ch_cls_uart->txrx); - writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT), - &ch->ch_cls_uart->isr_fcr); + writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | + UART_FCR_CLEAR_XMIT), &ch->ch_cls_uart->isr_fcr); udelay(10); ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index fc6d298..37fb8f9 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -48,7 +48,7 @@ static void dgnc_do_remap(struct dgnc_board *brd); /* * File operations permitted on Control/Management major. */ -static const struct file_operations dgnc_BoardFops = { +static const struct file_operations dgnc_board_fops = { .owner = THIS_MODULE, .unlocked_ioctl = dgnc_mgmt_ioctl, .open = dgnc_mgmt_open, @@ -58,11 +58,11 @@ static const struct file_operations dgnc_BoardFops = { /* * Globals */ -uint dgnc_NumBoards; -struct dgnc_board *dgnc_Board[MAXBOARDS]; +uint dgnc_num_boards; +struct dgnc_board *dgnc_board[MAXBOARDS]; DEFINE_SPINLOCK(dgnc_global_lock); DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */ -uint dgnc_Major; +uint dgnc_major; intdgnc_poll_tick = 20;/* Poll interval - 20 ms */ /* @@ -92,7 +92,7 @@ struct board_id { unsigned int is_pci_express; }; -static struct board_id dgnc_Ids[] = { +static struct board_id dgnc_ids[] = { { PCI_DEVICE_CLASSIC_4_PCI_NAME, 4, 0 }, { PCI_DEVICE_CLASSIC_4_422_PCI_NAME, 4, 0 }, { PCI_DEVICE_CLASSIC_8_PCI_NAME, 8, 0 }, @@ -144,19 +144,19 @@ static void dgnc_cleanup_module(void) dgnc_remove_driver_sysfiles(&dgnc_driver); - device_destroy(dgnc_class, MKDEV(dgnc_Major, 0)); + device_destroy(dgnc_class, MKDEV(dgnc_major, 0)); class_destroy(dgnc_class); - unregister_chrdev(dgnc_Major, "dgnc"); + unregister_chrdev(dgnc_major, "dgnc"); - for (i = 0; i < dgnc_NumBoards; ++i) { - dgnc_remove_ports_sysfiles(dgnc_Board[i]); - dgnc_tty_uninit(dgnc_Board[i]); - dgnc_cleanup_board(dgnc_Board[i]); + for (i = 0; i < dgnc_num_boards; ++i) { + dgnc_remove_ports_sysfiles(dgnc_board[i]); + dgnc_tty_uninit(dgnc_board[i]); + dgnc_cleanup_board(dgnc_board[i]); } dgnc_tty_post_uninit(); - if (dgnc_NumBoards) + if (dgnc_num_boards) pci_unregister_driver(&dgnc_driver); } @@ -187,7 +187,7 @@ static int __init dgnc_init_module(void) */ if (rc < 0) { /* Only unregister if it was actually registered. */ - if (dgnc_NumBoards) + if (dgnc_num_boards) pci_unregister_driver(&dgnc_driver); else pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n"); @@ -
Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes
On Fri, 11 Dec 2015 16:02:33 +0300 Dan Carpenter wrote: > > Signed-off-by: Sanidhya Solanki > > @@ -110,7 +98,16 @@ static ssize_t dgnc_vpd_show(struct device *p, struct > > device_attribute *attr, > > int count = 0; > > int i = 0; > > > > - DGNC_VERIFY_BOARD(p, bd); > > + do { > > + if (!p) > > + return 0; > > + > > + bd = dev_get_drvdata(p); > > + if (!bd || bd->magic != DGNC_BOARD_MAGIC) > > + return 0; > > + if (bd->state != BOARD_READY) > > + return 0; > > + } while (0); > > Google about why do while(0) loops are used in macros and then redo > this. Mostly the patch isn't bad, but I suspect I'm going to complain > about how you split up some of the long lines. Let me just be completely sure that you and I are on the same page here. The macro was used to replace the do-while loop, I replaced all instances of the macro with the the actual loop. Both pieces were originally part of the code, just using macros in place of do-while statements. Do you still want me to change it? Maybe the original author did it for a specific reason. Thanks ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH: FIXED} staging: dgnc: Patch includes the checkpatch fixes
>From fa54ad27ad5ba8c90e0b42901af09423b1b3d0c7 Mon Sep 17 00:00:00 2001 From: Sanidhya Solanki Date: Fri, 11 Dec 2015 21:08:06 -0500 Subject: [PATCH] staging: dgnc: Patch includes the checkpatch fixes Patch contains the checkpatch fixes as asked by the TODO. Unnecessary do-while() loops are removed as well. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/dgnc_cls.c| 4 +- drivers/staging/dgnc/dgnc_driver.c | 56 - drivers/staging/dgnc/dgnc_driver.h | 33 +++--- drivers/staging/dgnc/dgnc_mgmt.c | 28 ++--- drivers/staging/dgnc/dgnc_neo.c| 229 ++--- drivers/staging/dgnc/dgnc_neo.h| 22 ++-- drivers/staging/dgnc/dgnc_pci.h| 1 - drivers/staging/dgnc/dgnc_sysfs.c | 140 ++- drivers/staging/dgnc/dgnc_tty.c| 197 +++ drivers/staging/dgnc/digi.h| 44 +++ 10 files changed, 441 insertions(+), 313 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 75040da..d312d35 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -1168,8 +1168,8 @@ static void cls_uart_init(struct channel_t *ch) /* Clear out UART and FIFO */ readb(&ch->ch_cls_uart->txrx); - writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT), - &ch->ch_cls_uart->isr_fcr); + writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | + UART_FCR_CLEAR_XMIT), &ch->ch_cls_uart->isr_fcr); udelay(10); ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index fc6d298..37fb8f9 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -48,7 +48,7 @@ static void dgnc_do_remap(struct dgnc_board *brd); /* * File operations permitted on Control/Management major. */ -static const struct file_operations dgnc_BoardFops = { +static const struct file_operations dgnc_board_fops = { .owner = THIS_MODULE, .unlocked_ioctl = dgnc_mgmt_ioctl, .open = dgnc_mgmt_open, @@ -58,11 +58,11 @@ static const struct file_operations dgnc_BoardFops = { /* * Globals */ -uint dgnc_NumBoards; -struct dgnc_board *dgnc_Board[MAXBOARDS]; +uint dgnc_num_boards; +struct dgnc_board *dgnc_board[MAXBOARDS]; DEFINE_SPINLOCK(dgnc_global_lock); DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */ -uint dgnc_Major; +uint dgnc_major; intdgnc_poll_tick = 20;/* Poll interval - 20 ms */ /* @@ -92,7 +92,7 @@ struct board_id { unsigned int is_pci_express; }; -static struct board_id dgnc_Ids[] = { +static struct board_id dgnc_ids[] = { { PCI_DEVICE_CLASSIC_4_PCI_NAME, 4, 0 }, { PCI_DEVICE_CLASSIC_4_422_PCI_NAME, 4, 0 }, { PCI_DEVICE_CLASSIC_8_PCI_NAME, 8, 0 }, @@ -144,19 +144,19 @@ static void dgnc_cleanup_module(void) dgnc_remove_driver_sysfiles(&dgnc_driver); - device_destroy(dgnc_class, MKDEV(dgnc_Major, 0)); + device_destroy(dgnc_class, MKDEV(dgnc_major, 0)); class_destroy(dgnc_class); - unregister_chrdev(dgnc_Major, "dgnc"); + unregister_chrdev(dgnc_major, "dgnc"); - for (i = 0; i < dgnc_NumBoards; ++i) { - dgnc_remove_ports_sysfiles(dgnc_Board[i]); - dgnc_tty_uninit(dgnc_Board[i]); - dgnc_cleanup_board(dgnc_Board[i]); + for (i = 0; i < dgnc_num_boards; ++i) { + dgnc_remove_ports_sysfiles(dgnc_board[i]); + dgnc_tty_uninit(dgnc_board[i]); + dgnc_cleanup_board(dgnc_board[i]); } dgnc_tty_post_uninit(); - if (dgnc_NumBoards) + if (dgnc_num_boards) pci_unregister_driver(&dgnc_driver); } @@ -187,7 +187,7 @@ static int __init dgnc_init_module(void) */ if (rc < 0) { /* Only unregister if it was actually registered. */ - if (dgnc_NumBoards) + if (dgnc_num_boards) pci_unregister_driver(&dgnc_driver); else pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n"); @@ -222,12 +222,12 @@ static int dgnc_start(void) * * Register management/dpa devices */ - rc = register_chrdev(0, "dgnc", &dgnc_BoardFops); + rc = register_chrdev(0, "dgnc", &dgnc_board_fops); if (rc < 0) { pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n&q
Re: [PATCH] staging: dgnc: Update the TODO file
>From ae99848ed2c054e3ec031b3014f4727f6ff94ea3 Mon Sep 17 00:00:00 2001 From: Sanidhya Solanki Date: Fri, 11 Dec 2015 21:12:35 -0500 Subject: [PATCH 2/2] staging: dgnc: Update the TODO file Patch updates the TODO file. Line regarding checkpatch changes removed. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/TODO | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO index 0e0825b..0bdfd26 100644 --- a/drivers/staging/dgnc/TODO +++ b/drivers/staging/dgnc/TODO @@ -1,4 +1,3 @@ -* checkpatch fixes * remove unnecessary comments * remove unnecessary error messages. Example kzalloc() has its own error message. Adding an extra one is useless. -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes
On Fri, 11 Dec 2015 16:02:33 +0300 Dan Carpenter wrote: > On Fri, Dec 11, 2015 at 03:21:49AM -0500, Sanidhya Solanki wrote: > > >From 1dbe78ce98037da5467d817a9db838d678b338ae Mon Sep 17 00:00:00 2001 > > From: Sanidhya Solanki > > Date: Fri, 11 Dec 2015 03:08:53 -0500 > > Subject: [PATCH] staging: dgnc: Patch includes the checkpatch fixes > > > Don't include this stuff. Whenever I remove that part, the "git am" command gives me an error that it cannot detect patch format and the patch application fails. Thanks for the macro information. I misunderstood initially and thought you wanted me to get rid of the entire code block included in the do-while, rather than just replacing the do-while loop with the code. I sent you an update patch that does just that and a separate patch that includes the TODO file update. Any more errors in the code regarding parenthesis alignment are a checkpatch bug, which you can visually reconfirm. Also, any more requests by checkpatch to further breakup the remaining long lines may further degrade readablility due to presence of arrow pointers. Thanks ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes
Thank you everyone for your concern regarding my email client. Unfortunately, there is a bug in "git send-email" that leads to the gmail SMTP server rejecting certain patches sent by the git command. If I can replicate and fix the issue for " git am" (which I do apply after emailing to myself) I will not send the git header anymore. This bug is well documented. It presents itself as an error in line 1351/1320 in a gitconfig file. Rest assured you will not see the git header again. Thanks ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes
>From a1635ea5e75cb2f10728ae4ddf3a21567958e98f Mon Sep 17 00:00:00 2001 From: Sanidhya Solanki Date: Sat, 12 Dec 2015 02:20:03 -0500 Subject: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes Patch contains the spacing fixes that checkpatch prompted for, as asked by the TODO. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/dgnc_cls.c| 4 +- drivers/staging/dgnc/dgnc_driver.h | 8 -- drivers/staging/dgnc/dgnc_neo.c| 235 - drivers/staging/dgnc/dgnc_neo.h| 22 ++-- drivers/staging/dgnc/dgnc_pci.h| 1 - drivers/staging/dgnc/dgnc_sysfs.c | 18 ++- drivers/staging/dgnc/dgnc_tty.c| 46 +--- drivers/staging/dgnc/digi.h| 32 ++--- 8 files changed, 223 insertions(+), 143 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 75040da..d312d35 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -1168,8 +1168,8 @@ static void cls_uart_init(struct channel_t *ch) /* Clear out UART and FIFO */ readb(&ch->ch_cls_uart->txrx); - writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT), - &ch->ch_cls_uart->isr_fcr); + writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | + UART_FCR_CLEAR_XMIT), &ch->ch_cls_uart->isr_fcr); udelay(10); ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index ce7cd9b..e4be81b 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -88,7 +88,6 @@ #define _POSIX_VDISABLE '\0' #endif - /* * All the possible states the driver can be while being loaded. */ @@ -106,7 +105,6 @@ enum { BOARD_READY }; - /* * * Structures and closely related defines. @@ -145,7 +143,6 @@ struct board_ops { / #define BD_IS_PCI_EXPRESS 0x0001 /* Is a PCI Express board */ - /* * Per-board information */ @@ -241,7 +238,6 @@ struct dgnc_board { }; - / * Unit flag definitions for un_flags. / @@ -277,7 +273,6 @@ struct un_t { struct device *un_sysfs; }; - / * Device flag definitions for ch_flags. / @@ -300,7 +295,6 @@ struct un_t { #define CH_FORCED_STOP 0x2/* Output is forcibly stopped */ #define CH_FORCED_STOPI 0x4/* Input is forcibly stopped */ - /* Our Read/Error/Write queue sizes */ #define RQUEUEMASK 0x1FFF /* 8 K - 1 */ #define EQUEUEMASK 0x1FFF /* 8 K - 1 */ @@ -309,7 +303,6 @@ struct un_t { #define EQUEUESIZE RQUEUESIZE #define WQUEUESIZE (WQUEUEMASK + 1) - / * Channel information structure. / @@ -397,7 +390,6 @@ struct channel_t { ulong ch_intr_tx; /* Count of interrupts */ ulong ch_intr_rx; /* Count of interrupts */ - /* /proc// entries */ struct proc_dir_entry *proc_entry_pointer; struct dgnc_proc_entry *dgnc_channel_table; diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index 8106f52..2b94b75 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -77,7 +77,8 @@ struct board_ops dgnc_neo_ops = { .send_immediate_char = neo_send_immediate_char }; -static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, + 0x10, 0x20, 0x40, 0x80 }; /* * This function allows calls to ensure that all outstanding @@ -109,14 +110,17 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch) /* Turn off auto Xon flow control */ efr &= ~UART_17158_EFR_IXON; - /* Why? Becuz Exar's spec says we have to zero it out before setting it */ + /* Why? Becuz Exar's spec says we have to +* zero it out before setting it. +*/ writeb(0, &ch->ch_neo_uart->efr); /* Turn on UART enhanced bits */ writeb(efr, &ch->ch_neo_uart->efr); /* Turn on table D, with 8 char hi/low watermarks */ - writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), &ch-&g
Re: [PATCH 2/3] staging: dgnc: Patch includes the checkpatch fixes
Patch contains the CamelCase fixes & Macro fixes that checkpatch prompted for, as asked by the TODO. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/dgnc_driver.c | 56 - drivers/staging/dgnc/dgnc_driver.h | 25 ++-- drivers/staging/dgnc/dgnc_mgmt.c | 28 ++--- drivers/staging/dgnc/dgnc_neo.c| 226 + drivers/staging/dgnc/dgnc_sysfs.c | 134 +- drivers/staging/dgnc/dgnc_tty.c| 197 drivers/staging/dgnc/digi.h| 20 ++-- 7 files changed, 367 insertions(+), 319 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index fc6d298..37fb8f9 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -48,7 +48,7 @@ static void dgnc_do_remap(struct dgnc_board *brd); /* * File operations permitted on Control/Management major. */ -static const struct file_operations dgnc_BoardFops = { +static const struct file_operations dgnc_board_fops = { .owner = THIS_MODULE, .unlocked_ioctl = dgnc_mgmt_ioctl, .open = dgnc_mgmt_open, @@ -58,11 +58,11 @@ static const struct file_operations dgnc_BoardFops = { /* * Globals */ -uint dgnc_NumBoards; -struct dgnc_board *dgnc_Board[MAXBOARDS]; +uint dgnc_num_boards; +struct dgnc_board *dgnc_board[MAXBOARDS]; DEFINE_SPINLOCK(dgnc_global_lock); DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */ -uint dgnc_Major; +uint dgnc_major; intdgnc_poll_tick = 20;/* Poll interval - 20 ms */ /* @@ -92,7 +92,7 @@ struct board_id { unsigned int is_pci_express; }; -static struct board_id dgnc_Ids[] = { +static struct board_id dgnc_ids[] = { { PCI_DEVICE_CLASSIC_4_PCI_NAME, 4, 0 }, { PCI_DEVICE_CLASSIC_4_422_PCI_NAME, 4, 0 }, { PCI_DEVICE_CLASSIC_8_PCI_NAME, 8, 0 }, @@ -144,19 +144,19 @@ static void dgnc_cleanup_module(void) dgnc_remove_driver_sysfiles(&dgnc_driver); - device_destroy(dgnc_class, MKDEV(dgnc_Major, 0)); + device_destroy(dgnc_class, MKDEV(dgnc_major, 0)); class_destroy(dgnc_class); - unregister_chrdev(dgnc_Major, "dgnc"); + unregister_chrdev(dgnc_major, "dgnc"); - for (i = 0; i < dgnc_NumBoards; ++i) { - dgnc_remove_ports_sysfiles(dgnc_Board[i]); - dgnc_tty_uninit(dgnc_Board[i]); - dgnc_cleanup_board(dgnc_Board[i]); + for (i = 0; i < dgnc_num_boards; ++i) { + dgnc_remove_ports_sysfiles(dgnc_board[i]); + dgnc_tty_uninit(dgnc_board[i]); + dgnc_cleanup_board(dgnc_board[i]); } dgnc_tty_post_uninit(); - if (dgnc_NumBoards) + if (dgnc_num_boards) pci_unregister_driver(&dgnc_driver); } @@ -187,7 +187,7 @@ static int __init dgnc_init_module(void) */ if (rc < 0) { /* Only unregister if it was actually registered. */ - if (dgnc_NumBoards) + if (dgnc_num_boards) pci_unregister_driver(&dgnc_driver); else pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n"); @@ -222,12 +222,12 @@ static int dgnc_start(void) * * Register management/dpa devices */ - rc = register_chrdev(0, "dgnc", &dgnc_BoardFops); + rc = register_chrdev(0, "dgnc", &dgnc_board_fops); if (rc < 0) { pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc); return rc; } - dgnc_Major = rc; + dgnc_major = rc; dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt"); if (IS_ERR(dgnc_class)) { @@ -237,7 +237,7 @@ static int dgnc_start(void) } dev = device_create(dgnc_class, NULL, - MKDEV(dgnc_Major, 0), + MKDEV(dgnc_major, 0), NULL, "dgnc_mgmt"); if (IS_ERR(dev)) { rc = PTR_ERR(dev); @@ -267,11 +267,11 @@ static int dgnc_start(void) return 0; failed_tty: - device_destroy(dgnc_class, MKDEV(dgnc_Major, 0)); + device_destroy(dgnc_class, MKDEV(dgnc_major, 0)); failed_device: class_destroy(dgnc_class); failed_class: - unregister_chrdev(dgnc_Major, "dgnc"); + unregister_chrdev(dgnc_major, "dgnc"); return rc; } @@ -288,7 +288,7 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
Re: [PATCH 3/3] staging: dgnc: Patch includes the checkpatch fixes
Patch updates the TODO file. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/TODO | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO index 0e0825b..0bdfd26 100644 --- a/drivers/staging/dgnc/TODO +++ b/drivers/staging/dgnc/TODO @@ -1,4 +1,3 @@ -* checkpatch fixes * remove unnecessary comments * remove unnecessary error messages. Example kzalloc() has its own error message. Adding an extra one is useless. -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: dgnc: Patch includes the checkpatch fixes
Sorry about Patch 1/3 having the header information. The rest should be fine. I broke up the patches as you requested. I can also confirm that git am gives me an error if the patch to be applied does not contain the header information. Specifically, "Patch format detection failed.". Yes, this is only after I email myself the patch, reset to the cloned git directory, and then apply the patch. "git apply --check" returns no error in this scenario. Thanks ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes
Patch contains the spacing fixes that checkpatch prompted for, as asked by the TODO. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/dgnc_cls.c| 4 +- drivers/staging/dgnc/dgnc_driver.h | 8 -- drivers/staging/dgnc/dgnc_neo.c| 235 - drivers/staging/dgnc/dgnc_neo.h| 22 ++-- drivers/staging/dgnc/dgnc_pci.h| 1 - drivers/staging/dgnc/dgnc_sysfs.c | 18 ++- drivers/staging/dgnc/dgnc_tty.c| 46 +--- drivers/staging/dgnc/digi.h| 32 ++--- 8 files changed, 223 insertions(+), 143 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 75040da..d312d35 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -1168,8 +1168,8 @@ static void cls_uart_init(struct channel_t *ch) /* Clear out UART and FIFO */ readb(&ch->ch_cls_uart->txrx); - writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT), - &ch->ch_cls_uart->isr_fcr); + writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | + UART_FCR_CLEAR_XMIT), &ch->ch_cls_uart->isr_fcr); udelay(10); ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index ce7cd9b..e4be81b 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -88,7 +88,6 @@ #define _POSIX_VDISABLE '\0' #endif - /* * All the possible states the driver can be while being loaded. */ @@ -106,7 +105,6 @@ enum { BOARD_READY }; - /* * * Structures and closely related defines. @@ -145,7 +143,6 @@ struct board_ops { / #define BD_IS_PCI_EXPRESS 0x0001 /* Is a PCI Express board */ - /* * Per-board information */ @@ -241,7 +238,6 @@ struct dgnc_board { }; - / * Unit flag definitions for un_flags. / @@ -277,7 +273,6 @@ struct un_t { struct device *un_sysfs; }; - / * Device flag definitions for ch_flags. / @@ -300,7 +295,6 @@ struct un_t { #define CH_FORCED_STOP 0x2/* Output is forcibly stopped */ #define CH_FORCED_STOPI 0x4/* Input is forcibly stopped */ - /* Our Read/Error/Write queue sizes */ #define RQUEUEMASK 0x1FFF /* 8 K - 1 */ #define EQUEUEMASK 0x1FFF /* 8 K - 1 */ @@ -309,7 +303,6 @@ struct un_t { #define EQUEUESIZE RQUEUESIZE #define WQUEUESIZE (WQUEUEMASK + 1) - / * Channel information structure. / @@ -397,7 +390,6 @@ struct channel_t { ulong ch_intr_tx; /* Count of interrupts */ ulong ch_intr_rx; /* Count of interrupts */ - /* /proc// entries */ struct proc_dir_entry *proc_entry_pointer; struct dgnc_proc_entry *dgnc_channel_table; diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index 8106f52..2b94b75 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -77,7 +77,8 @@ struct board_ops dgnc_neo_ops = { .send_immediate_char = neo_send_immediate_char }; -static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, + 0x10, 0x20, 0x40, 0x80 }; /* * This function allows calls to ensure that all outstanding @@ -109,14 +110,17 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch) /* Turn off auto Xon flow control */ efr &= ~UART_17158_EFR_IXON; - /* Why? Becuz Exar's spec says we have to zero it out before setting it */ + /* Why? Becuz Exar's spec says we have to +* zero it out before setting it. +*/ writeb(0, &ch->ch_neo_uart->efr); /* Turn on UART enhanced bits */ writeb(efr, &ch->ch_neo_uart->efr); /* Turn on table D, with 8 char hi/low watermarks */ - writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), &ch->ch_neo_uart->fctr); + writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), + &ch->ch_neo_uart->fctr); /* Feed the UART our trigger levels */ writeb(8, &ch->
Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes
Patch contains the CamelCase fixes & Macro fixes that checkpatch prompted for, as asked by the TODO. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/dgnc_driver.c | 56 - drivers/staging/dgnc/dgnc_driver.h | 25 ++-- drivers/staging/dgnc/dgnc_mgmt.c | 28 ++--- drivers/staging/dgnc/dgnc_neo.c| 226 + drivers/staging/dgnc/dgnc_sysfs.c | 134 +- drivers/staging/dgnc/dgnc_tty.c| 197 drivers/staging/dgnc/digi.h| 20 ++-- 7 files changed, 367 insertions(+), 319 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index fc6d298..37fb8f9 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -48,7 +48,7 @@ static void dgnc_do_remap(struct dgnc_board *brd); /* * File operations permitted on Control/Management major. */ -static const struct file_operations dgnc_BoardFops = { +static const struct file_operations dgnc_board_fops = { .owner = THIS_MODULE, .unlocked_ioctl = dgnc_mgmt_ioctl, .open = dgnc_mgmt_open, @@ -58,11 +58,11 @@ static const struct file_operations dgnc_BoardFops = { /* * Globals */ -uint dgnc_NumBoards; -struct dgnc_board *dgnc_Board[MAXBOARDS]; +uint dgnc_num_boards; +struct dgnc_board *dgnc_board[MAXBOARDS]; DEFINE_SPINLOCK(dgnc_global_lock); DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */ -uint dgnc_Major; +uint dgnc_major; intdgnc_poll_tick = 20;/* Poll interval - 20 ms */ /* @@ -92,7 +92,7 @@ struct board_id { unsigned int is_pci_express; }; -static struct board_id dgnc_Ids[] = { +static struct board_id dgnc_ids[] = { { PCI_DEVICE_CLASSIC_4_PCI_NAME, 4, 0 }, { PCI_DEVICE_CLASSIC_4_422_PCI_NAME, 4, 0 }, { PCI_DEVICE_CLASSIC_8_PCI_NAME, 8, 0 }, @@ -144,19 +144,19 @@ static void dgnc_cleanup_module(void) dgnc_remove_driver_sysfiles(&dgnc_driver); - device_destroy(dgnc_class, MKDEV(dgnc_Major, 0)); + device_destroy(dgnc_class, MKDEV(dgnc_major, 0)); class_destroy(dgnc_class); - unregister_chrdev(dgnc_Major, "dgnc"); + unregister_chrdev(dgnc_major, "dgnc"); - for (i = 0; i < dgnc_NumBoards; ++i) { - dgnc_remove_ports_sysfiles(dgnc_Board[i]); - dgnc_tty_uninit(dgnc_Board[i]); - dgnc_cleanup_board(dgnc_Board[i]); + for (i = 0; i < dgnc_num_boards; ++i) { + dgnc_remove_ports_sysfiles(dgnc_board[i]); + dgnc_tty_uninit(dgnc_board[i]); + dgnc_cleanup_board(dgnc_board[i]); } dgnc_tty_post_uninit(); - if (dgnc_NumBoards) + if (dgnc_num_boards) pci_unregister_driver(&dgnc_driver); } @@ -187,7 +187,7 @@ static int __init dgnc_init_module(void) */ if (rc < 0) { /* Only unregister if it was actually registered. */ - if (dgnc_NumBoards) + if (dgnc_num_boards) pci_unregister_driver(&dgnc_driver); else pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n"); @@ -222,12 +222,12 @@ static int dgnc_start(void) * * Register management/dpa devices */ - rc = register_chrdev(0, "dgnc", &dgnc_BoardFops); + rc = register_chrdev(0, "dgnc", &dgnc_board_fops); if (rc < 0) { pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc); return rc; } - dgnc_Major = rc; + dgnc_major = rc; dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt"); if (IS_ERR(dgnc_class)) { @@ -237,7 +237,7 @@ static int dgnc_start(void) } dev = device_create(dgnc_class, NULL, - MKDEV(dgnc_Major, 0), + MKDEV(dgnc_major, 0), NULL, "dgnc_mgmt"); if (IS_ERR(dev)) { rc = PTR_ERR(dev); @@ -267,11 +267,11 @@ static int dgnc_start(void) return 0; failed_tty: - device_destroy(dgnc_class, MKDEV(dgnc_Major, 0)); + device_destroy(dgnc_class, MKDEV(dgnc_major, 0)); failed_device: class_destroy(dgnc_class); failed_class: - unregister_chrdev(dgnc_Major, "dgnc"); + unregister_chrdev(dgnc_major, "dgnc"); return rc; } @@ -288,7 +288,7 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes
Patch updates the TODO file. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/TODO | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO index 0e0825b..0bdfd26 100644 --- a/drivers/staging/dgnc/TODO +++ b/drivers/staging/dgnc/TODO @@ -1,4 +1,3 @@ -* checkpatch fixes * remove unnecessary comments * remove unnecessary error messages. Example kzalloc() has its own error message. Adding an extra one is useless. -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: Skein: Moved macros from skein_block.c to header file.
The original code defined macros in the source code, making it harder to read. Moved them to the header file, as per the TODO file. Updated the TODO file. Signed-off-by: Sanidhya Solanki --- drivers/staging/skein/TODO | 1 - drivers/staging/skein/skein_block.c | 6 -- drivers/staging/skein/skein_block.h | 7 +++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/skein/TODO b/drivers/staging/skein/TODO index cd3508d..e3de0c7 100644 --- a/drivers/staging/skein/TODO +++ b/drivers/staging/skein/TODO @@ -1,6 +1,5 @@ skein/threefish TODO - - move macros into appropriate header files - add / pass test vectors - module support diff --git a/drivers/staging/skein/skein_block.c b/drivers/staging/skein/skein_block.c index 45b4732..2120392 100644 --- a/drivers/staging/skein/skein_block.c +++ b/drivers/staging/skein/skein_block.c @@ -26,12 +26,6 @@ #define SKEIN_LOOP 001 /* default: unroll 256 and 512, but not 1024 */ #endif -#define BLK_BITS(WCNT * 64) /* some useful definitions for code here */ -#define KW_TWK_BASE (0) -#define KW_KEY_BASE (3) -#define ks (kw + KW_KEY_BASE) -#define ts (kw + KW_TWK_BASE) - #ifdef SKEIN_DEBUG #define debug_save_tweak(ctx) \ { \ diff --git a/drivers/staging/skein/skein_block.h b/drivers/staging/skein/skein_block.h index 9d40f4a..0fd4bfe 100644 --- a/drivers/staging/skein/skein_block.h +++ b/drivers/staging/skein/skein_block.h @@ -7,6 +7,13 @@ ** This algorithm and source code is released to the public domain. ** / + +#define BLK_BITS(WCNT * 64) /* some useful definitions for code here */ +#define KW_TWK_BASE (0) +#define KW_KEY_BASE (3) +#define ks (kw + KW_KEY_BASE) +#define ts (kw + KW_TWK_BASE) + #ifndef _SKEIN_BLOCK_H_ #define _SKEIN_BLOCK_H_ -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes
Can you tell me what was incorrect about them? I thought you requested the dgnc patches to be resent without the headers. There are 3 of them because Dan Carpenter asked my patch to be broken up so each one does only one thing. I also resent you the skein subsystem patches, as I did not hear anything from you for almost a week. Thanks ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH FIXED 1/3] staging: dgnc: Patch includes the checkpatch fixes
Patch contains the spacing fixes that checkpatch prompted for, as asked by the TODO. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/dgnc_cls.c| 4 +- drivers/staging/dgnc/dgnc_driver.h | 8 -- drivers/staging/dgnc/dgnc_neo.c| 235 - drivers/staging/dgnc/dgnc_neo.h| 22 ++-- drivers/staging/dgnc/dgnc_pci.h| 1 - drivers/staging/dgnc/dgnc_sysfs.c | 18 ++- drivers/staging/dgnc/dgnc_tty.c| 46 +--- drivers/staging/dgnc/digi.h| 32 ++--- 8 files changed, 223 insertions(+), 143 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 75040da..d312d35 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -1168,8 +1168,8 @@ static void cls_uart_init(struct channel_t *ch) /* Clear out UART and FIFO */ readb(&ch->ch_cls_uart->txrx); - writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT), - &ch->ch_cls_uart->isr_fcr); + writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | + UART_FCR_CLEAR_XMIT), &ch->ch_cls_uart->isr_fcr); udelay(10); ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index ce7cd9b..e4be81b 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -88,7 +88,6 @@ #define _POSIX_VDISABLE '\0' #endif - /* * All the possible states the driver can be while being loaded. */ @@ -106,7 +105,6 @@ enum { BOARD_READY }; - /* * * Structures and closely related defines. @@ -145,7 +143,6 @@ struct board_ops { / #define BD_IS_PCI_EXPRESS 0x0001 /* Is a PCI Express board */ - /* * Per-board information */ @@ -241,7 +238,6 @@ struct dgnc_board { }; - / * Unit flag definitions for un_flags. / @@ -277,7 +273,6 @@ struct un_t { struct device *un_sysfs; }; - / * Device flag definitions for ch_flags. / @@ -300,7 +295,6 @@ struct un_t { #define CH_FORCED_STOP 0x2/* Output is forcibly stopped */ #define CH_FORCED_STOPI 0x4/* Input is forcibly stopped */ - /* Our Read/Error/Write queue sizes */ #define RQUEUEMASK 0x1FFF /* 8 K - 1 */ #define EQUEUEMASK 0x1FFF /* 8 K - 1 */ @@ -309,7 +303,6 @@ struct un_t { #define EQUEUESIZE RQUEUESIZE #define WQUEUESIZE (WQUEUEMASK + 1) - / * Channel information structure. / @@ -397,7 +390,6 @@ struct channel_t { ulong ch_intr_tx; /* Count of interrupts */ ulong ch_intr_rx; /* Count of interrupts */ - /* /proc// entries */ struct proc_dir_entry *proc_entry_pointer; struct dgnc_proc_entry *dgnc_channel_table; diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index 8106f52..2b94b75 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -77,7 +77,8 @@ struct board_ops dgnc_neo_ops = { .send_immediate_char = neo_send_immediate_char }; -static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, + 0x10, 0x20, 0x40, 0x80 }; /* * This function allows calls to ensure that all outstanding @@ -109,14 +110,17 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch) /* Turn off auto Xon flow control */ efr &= ~UART_17158_EFR_IXON; - /* Why? Becuz Exar's spec says we have to zero it out before setting it */ + /* Why? Becuz Exar's spec says we have to +* zero it out before setting it. +*/ writeb(0, &ch->ch_neo_uart->efr); /* Turn on UART enhanced bits */ writeb(efr, &ch->ch_neo_uart->efr); /* Turn on table D, with 8 char hi/low watermarks */ - writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), &ch->ch_neo_uart->fctr); + writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), + &ch->ch_neo_uart->fctr); /* Feed the UART our trigger levels */ writeb(8, &ch->
Re: [PATCH FIXED 2/3] staging: dgnc: Patch for CamelCase fixes
Patch contains the CamelCase fixes & Macro fixes that checkpatch prompted for, as asked by the TODO. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/dgnc_driver.c | 56 - drivers/staging/dgnc/dgnc_driver.h | 25 ++-- drivers/staging/dgnc/dgnc_mgmt.c | 28 ++--- drivers/staging/dgnc/dgnc_neo.c| 226 + drivers/staging/dgnc/dgnc_sysfs.c | 134 +- drivers/staging/dgnc/dgnc_tty.c| 197 drivers/staging/dgnc/digi.h| 20 ++-- 7 files changed, 367 insertions(+), 319 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index fc6d298..37fb8f9 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -48,7 +48,7 @@ static void dgnc_do_remap(struct dgnc_board *brd); /* * File operations permitted on Control/Management major. */ -static const struct file_operations dgnc_BoardFops = { +static const struct file_operations dgnc_board_fops = { .owner = THIS_MODULE, .unlocked_ioctl = dgnc_mgmt_ioctl, .open = dgnc_mgmt_open, @@ -58,11 +58,11 @@ static const struct file_operations dgnc_BoardFops = { /* * Globals */ -uint dgnc_NumBoards; -struct dgnc_board *dgnc_Board[MAXBOARDS]; +uint dgnc_num_boards; +struct dgnc_board *dgnc_board[MAXBOARDS]; DEFINE_SPINLOCK(dgnc_global_lock); DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */ -uint dgnc_Major; +uint dgnc_major; intdgnc_poll_tick = 20;/* Poll interval - 20 ms */ /* @@ -92,7 +92,7 @@ struct board_id { unsigned int is_pci_express; }; -static struct board_id dgnc_Ids[] = { +static struct board_id dgnc_ids[] = { { PCI_DEVICE_CLASSIC_4_PCI_NAME, 4, 0 }, { PCI_DEVICE_CLASSIC_4_422_PCI_NAME, 4, 0 }, { PCI_DEVICE_CLASSIC_8_PCI_NAME, 8, 0 }, @@ -144,19 +144,19 @@ static void dgnc_cleanup_module(void) dgnc_remove_driver_sysfiles(&dgnc_driver); - device_destroy(dgnc_class, MKDEV(dgnc_Major, 0)); + device_destroy(dgnc_class, MKDEV(dgnc_major, 0)); class_destroy(dgnc_class); - unregister_chrdev(dgnc_Major, "dgnc"); + unregister_chrdev(dgnc_major, "dgnc"); - for (i = 0; i < dgnc_NumBoards; ++i) { - dgnc_remove_ports_sysfiles(dgnc_Board[i]); - dgnc_tty_uninit(dgnc_Board[i]); - dgnc_cleanup_board(dgnc_Board[i]); + for (i = 0; i < dgnc_num_boards; ++i) { + dgnc_remove_ports_sysfiles(dgnc_board[i]); + dgnc_tty_uninit(dgnc_board[i]); + dgnc_cleanup_board(dgnc_board[i]); } dgnc_tty_post_uninit(); - if (dgnc_NumBoards) + if (dgnc_num_boards) pci_unregister_driver(&dgnc_driver); } @@ -187,7 +187,7 @@ static int __init dgnc_init_module(void) */ if (rc < 0) { /* Only unregister if it was actually registered. */ - if (dgnc_NumBoards) + if (dgnc_num_boards) pci_unregister_driver(&dgnc_driver); else pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n"); @@ -222,12 +222,12 @@ static int dgnc_start(void) * * Register management/dpa devices */ - rc = register_chrdev(0, "dgnc", &dgnc_BoardFops); + rc = register_chrdev(0, "dgnc", &dgnc_board_fops); if (rc < 0) { pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc); return rc; } - dgnc_Major = rc; + dgnc_major = rc; dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt"); if (IS_ERR(dgnc_class)) { @@ -237,7 +237,7 @@ static int dgnc_start(void) } dev = device_create(dgnc_class, NULL, - MKDEV(dgnc_Major, 0), + MKDEV(dgnc_major, 0), NULL, "dgnc_mgmt"); if (IS_ERR(dev)) { rc = PTR_ERR(dev); @@ -267,11 +267,11 @@ static int dgnc_start(void) return 0; failed_tty: - device_destroy(dgnc_class, MKDEV(dgnc_Major, 0)); + device_destroy(dgnc_class, MKDEV(dgnc_major, 0)); failed_device: class_destroy(dgnc_class); failed_class: - unregister_chrdev(dgnc_Major, "dgnc"); + unregister_chrdev(dgnc_major, "dgnc"); return rc; } @@ -288,7 +288,7 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
Re: [PATCH FIXED 3/3] staging: dgnc: Patch updates the TODO file
Patch updates the TODO file. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/TODO | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO index 0e0825b..0bdfd26 100644 --- a/drivers/staging/dgnc/TODO +++ b/drivers/staging/dgnc/TODO @@ -1,4 +1,3 @@ -* checkpatch fixes * remove unnecessary comments * remove unnecessary error messages. Example kzalloc() has its own error message. Adding an extra one is useless. -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH FIXED 1/3] staging: dgnc: Patch includes spacing fixes
Patch contains the spacing fixes that led to checkpatch.pl warnings. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/dgnc_cls.c| 4 +- drivers/staging/dgnc/dgnc_driver.h | 8 -- drivers/staging/dgnc/dgnc_neo.c| 235 - drivers/staging/dgnc/dgnc_neo.h| 22 ++-- drivers/staging/dgnc/dgnc_pci.h| 1 - drivers/staging/dgnc/dgnc_sysfs.c | 18 ++- drivers/staging/dgnc/dgnc_tty.c| 46 +--- drivers/staging/dgnc/digi.h| 32 ++--- 8 files changed, 223 insertions(+), 143 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 75040da..d312d35 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -1168,8 +1168,8 @@ static void cls_uart_init(struct channel_t *ch) /* Clear out UART and FIFO */ readb(&ch->ch_cls_uart->txrx); - writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT), - &ch->ch_cls_uart->isr_fcr); + writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | + UART_FCR_CLEAR_XMIT), &ch->ch_cls_uart->isr_fcr); udelay(10); ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index ce7cd9b..e4be81b 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -88,7 +88,6 @@ #define _POSIX_VDISABLE '\0' #endif - /* * All the possible states the driver can be while being loaded. */ @@ -106,7 +105,6 @@ enum { BOARD_READY }; - /* * * Structures and closely related defines. @@ -145,7 +143,6 @@ struct board_ops { / #define BD_IS_PCI_EXPRESS 0x0001 /* Is a PCI Express board */ - /* * Per-board information */ @@ -241,7 +238,6 @@ struct dgnc_board { }; - / * Unit flag definitions for un_flags. / @@ -277,7 +273,6 @@ struct un_t { struct device *un_sysfs; }; - / * Device flag definitions for ch_flags. / @@ -300,7 +295,6 @@ struct un_t { #define CH_FORCED_STOP 0x2/* Output is forcibly stopped */ #define CH_FORCED_STOPI 0x4/* Input is forcibly stopped */ - /* Our Read/Error/Write queue sizes */ #define RQUEUEMASK 0x1FFF /* 8 K - 1 */ #define EQUEUEMASK 0x1FFF /* 8 K - 1 */ @@ -309,7 +303,6 @@ struct un_t { #define EQUEUESIZE RQUEUESIZE #define WQUEUESIZE (WQUEUEMASK + 1) - / * Channel information structure. / @@ -397,7 +390,6 @@ struct channel_t { ulong ch_intr_tx; /* Count of interrupts */ ulong ch_intr_rx; /* Count of interrupts */ - /* /proc// entries */ struct proc_dir_entry *proc_entry_pointer; struct dgnc_proc_entry *dgnc_channel_table; diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index 8106f52..2b94b75 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -77,7 +77,8 @@ struct board_ops dgnc_neo_ops = { .send_immediate_char = neo_send_immediate_char }; -static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, + 0x10, 0x20, 0x40, 0x80 }; /* * This function allows calls to ensure that all outstanding @@ -109,14 +110,17 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch) /* Turn off auto Xon flow control */ efr &= ~UART_17158_EFR_IXON; - /* Why? Becuz Exar's spec says we have to zero it out before setting it */ + /* Why? Becuz Exar's spec says we have to +* zero it out before setting it. +*/ writeb(0, &ch->ch_neo_uart->efr); /* Turn on UART enhanced bits */ writeb(efr, &ch->ch_neo_uart->efr); /* Turn on table D, with 8 char hi/low watermarks */ - writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), &ch->ch_neo_uart->fctr); + writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), + &ch->ch_neo_uart->fctr); /* Feed the UART our trigger levels */ writeb(8, &ch->ch_neo_uart->t
Re: [PATCH 1/3] staging: dgnc: Patch includes the checkpatch fixes
Patch contains the spacing fixes that led to checkpatch.pl warnings. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/dgnc_cls.c| 4 +- drivers/staging/dgnc/dgnc_driver.h | 8 -- drivers/staging/dgnc/dgnc_neo.c| 235 - drivers/staging/dgnc/dgnc_neo.h| 22 ++-- drivers/staging/dgnc/dgnc_pci.h| 1 - drivers/staging/dgnc/dgnc_sysfs.c | 18 ++- drivers/staging/dgnc/dgnc_tty.c| 46 +--- drivers/staging/dgnc/digi.h| 32 ++--- 8 files changed, 223 insertions(+), 143 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 75040da..d312d35 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -1168,8 +1168,8 @@ static void cls_uart_init(struct channel_t *ch) /* Clear out UART and FIFO */ readb(&ch->ch_cls_uart->txrx); - writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT), - &ch->ch_cls_uart->isr_fcr); + writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | + UART_FCR_CLEAR_XMIT), &ch->ch_cls_uart->isr_fcr); udelay(10); ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index ce7cd9b..e4be81b 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -88,7 +88,6 @@ #define _POSIX_VDISABLE '\0' #endif - /* * All the possible states the driver can be while being loaded. */ @@ -106,7 +105,6 @@ enum { BOARD_READY }; - /* * * Structures and closely related defines. @@ -145,7 +143,6 @@ struct board_ops { / #define BD_IS_PCI_EXPRESS 0x0001 /* Is a PCI Express board */ - /* * Per-board information */ @@ -241,7 +238,6 @@ struct dgnc_board { }; - / * Unit flag definitions for un_flags. / @@ -277,7 +273,6 @@ struct un_t { struct device *un_sysfs; }; - / * Device flag definitions for ch_flags. / @@ -300,7 +295,6 @@ struct un_t { #define CH_FORCED_STOP 0x2/* Output is forcibly stopped */ #define CH_FORCED_STOPI 0x4 /* Input is forcibly stopped */ - /* Our Read/Error/Write queue sizes */ #define RQUEUEMASK 0x1FFF /* 8 K - 1 */ #define EQUEUEMASK 0x1FFF /* 8 K - 1 */ @@ -309,7 +303,6 @@ struct un_t { #define EQUEUESIZE RQUEUESIZE #define WQUEUESIZE (WQUEUEMASK + 1) - / * Channel information structure. / @@ -397,7 +390,6 @@ struct channel_t { ulong ch_intr_tx; /* Count of interrupts */ ulongch_intr_rx; /* Count of interrupts */ - /* /proc// entries */ struct proc_dir_entry *proc_entry_pointer; struct dgnc_proc_entry *dgnc_channel_table; diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index 8106f52..2b94b75 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -77,7 +77,8 @@ struct board_ops dgnc_neo_ops = { .send_immediate_char = neo_send_immediate_char }; -static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, + 0x10, 0x20, 0x40, 0x80 }; /* * This function allows calls to ensure that all outstanding @@ -109,14 +110,17 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch) /* Turn off auto Xon flow control */ efr &= ~UART_17158_EFR_IXON; - /* Why? Becuz Exar's spec says we have to zero it out before setting it */ + /* Why? Becuz Exar's spec says we have to +* zero it out before setting it. +*/ writeb(0, &ch->ch_neo_uart->efr); /* Turn on UART enhanced bits */ writeb(efr, &ch->ch_neo_uart->efr); /* Turn on table D, with 8 char hi/low watermarks */ - writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), &ch->ch_neo_uart->fctr); + writeb((UART_17158_FCTR_TRGD | UART_17158_FCTR_RTS_4DELAY), + &ch->ch_neo_uart->fctr); /* Feed the UART our trigger levels */ writeb(8, &ch->ch_neo_uart->tfifo); @@ -144,13 +1
Re: [PATCH 2/3] staging: dgnc: Patch includes CamelCase & Macro fixes
Patch contains the CamelCase fixes & Macro fixes that led to checkpatch.pl errors. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/dgnc_driver.c | 56 - drivers/staging/dgnc/dgnc_driver.h | 25 ++-- drivers/staging/dgnc/dgnc_mgmt.c | 28 ++--- drivers/staging/dgnc/dgnc_neo.c| 226 + drivers/staging/dgnc/dgnc_sysfs.c | 134 +- drivers/staging/dgnc/dgnc_tty.c| 197 drivers/staging/dgnc/digi.h| 20 ++-- 7 files changed, 367 insertions(+), 319 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index fc6d298..37fb8f9 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -48,7 +48,7 @@ static void dgnc_do_remap(struct dgnc_board *brd); /* * File operations permitted on Control/Management major. */ -static const struct file_operations dgnc_BoardFops = { +static const struct file_operations dgnc_board_fops = { .owner = THIS_MODULE, .unlocked_ioctl = dgnc_mgmt_ioctl, .open = dgnc_mgmt_open, @@ -58,11 +58,11 @@ static const struct file_operations dgnc_BoardFops = { /* * Globals */ -uint dgnc_NumBoards; -struct dgnc_board *dgnc_Board[MAXBOARDS]; +uint dgnc_num_boards; +struct dgnc_board *dgnc_board[MAXBOARDS]; DEFINE_SPINLOCK(dgnc_global_lock); DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */ -uint dgnc_Major; +uint dgnc_major; intdgnc_poll_tick = 20;/* Poll interval - 20 ms */ /* @@ -92,7 +92,7 @@ struct board_id { unsigned int is_pci_express; }; -static struct board_id dgnc_Ids[] = { +static struct board_id dgnc_ids[] = { { PCI_DEVICE_CLASSIC_4_PCI_NAME, 4, 0 }, { PCI_DEVICE_CLASSIC_4_422_PCI_NAME, 4, 0 }, { PCI_DEVICE_CLASSIC_8_PCI_NAME, 8, 0 }, @@ -144,19 +144,19 @@ static void dgnc_cleanup_module(void) dgnc_remove_driver_sysfiles(&dgnc_driver); - device_destroy(dgnc_class, MKDEV(dgnc_Major, 0)); + device_destroy(dgnc_class, MKDEV(dgnc_major, 0)); class_destroy(dgnc_class); - unregister_chrdev(dgnc_Major, "dgnc"); + unregister_chrdev(dgnc_major, "dgnc"); - for (i = 0; i < dgnc_NumBoards; ++i) { - dgnc_remove_ports_sysfiles(dgnc_Board[i]); - dgnc_tty_uninit(dgnc_Board[i]); - dgnc_cleanup_board(dgnc_Board[i]); + for (i = 0; i < dgnc_num_boards; ++i) { + dgnc_remove_ports_sysfiles(dgnc_board[i]); + dgnc_tty_uninit(dgnc_board[i]); + dgnc_cleanup_board(dgnc_board[i]); } dgnc_tty_post_uninit(); - if (dgnc_NumBoards) + if (dgnc_num_boards) pci_unregister_driver(&dgnc_driver); } @@ -187,7 +187,7 @@ static int __init dgnc_init_module(void) */ if (rc < 0) { /* Only unregister if it was actually registered. */ - if (dgnc_NumBoards) + if (dgnc_num_boards) pci_unregister_driver(&dgnc_driver); else pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n"); @@ -222,12 +222,12 @@ static int dgnc_start(void) * * Register management/dpa devices */ - rc = register_chrdev(0, "dgnc", &dgnc_BoardFops); + rc = register_chrdev(0, "dgnc", &dgnc_board_fops); if (rc < 0) { pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc); return rc; } - dgnc_Major = rc; + dgnc_major = rc; dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt"); if (IS_ERR(dgnc_class)) { @@ -237,7 +237,7 @@ static int dgnc_start(void) } dev = device_create(dgnc_class, NULL, - MKDEV(dgnc_Major, 0), + MKDEV(dgnc_major, 0), NULL, "dgnc_mgmt"); if (IS_ERR(dev)) { rc = PTR_ERR(dev); @@ -267,11 +267,11 @@ static int dgnc_start(void) return 0; failed_tty: - device_destroy(dgnc_class, MKDEV(dgnc_Major, 0)); + device_destroy(dgnc_class, MKDEV(dgnc_major, 0)); failed_device: class_destroy(dgnc_class); failed_class: - unregister_chrdev(dgnc_Major, "dgnc"); + unregister_chrdev(dgnc_major, "dgnc"); return rc; } @@ -288,7 +288,7 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) } else { rc = dgnc_found_
Re: [PATCH 3/3] staging: dgnc: Patch updates the TODO file
Patch updates the TODO file. Signed-off-by: Sanidhya Solanki --- drivers/staging/dgnc/TODO | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO index 0e0825b..0bdfd26 100644 --- a/drivers/staging/dgnc/TODO +++ b/drivers/staging/dgnc/TODO @@ -1,4 +1,3 @@ -* checkpatch fixes * remove unnecessary comments * remove unnecessary error messages. Example kzalloc() has its own error message. Adding an extra one is useless. -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: Skein: Moved macros from skein_block.c to header file.
On Tue, 15 Dec 2015 07:55:15 -0700 Mathieu Poirier wrote: > I must admit you lost me here - what is this new version about? I > suggest you used the [PATCH v#] convention along with a log of > modifications from one version to another when sending new revisions. > That way people know what to look for. It moves the macros that were not nested inside functions to the header file. See how all the "defines" in the code are moved to skein_block.h? The patch just changes 7 lines. The change was on the TODO list, under the heading "Move macros to header files." ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel