From 340bb3df6d967193a09cc42afd18585d89ff9ba9 Mon Sep 17 00:00:00 2001 From: Dominique van den Broeck Date: Sat, 12 Apr 2014 15:18:12 +0200 Subject: fwserial: (coding style) open parenthesis alignments Style-only modifications to make checkpatch.pl --file --strict a bit happier. Open parenthesis alignments. Signed-off-by: Dominique van den Broeck Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fwserial/fwserial.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging/fwserial/fwserial.c') diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index b22142ee5262..db3d6c7ff219 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c @@ -530,7 +530,7 @@ static void fwtty_emit_breaks(struct work_struct *work) while (n) { t = min(n, 16); c = tty_insert_flip_string_fixed_flag(&port->port, buf, - TTY_BREAK, t); + TTY_BREAK, t); n -= c; brk += c; if (c < t) @@ -741,7 +741,7 @@ static int fwtty_tx(struct fwtty_port *port, bool drain) /* try to write as many dma transactions out as possible */ n = -EAGAIN; while (!tty->stopped && !tty->hw_stopped && - !test_bit(STOP_TX, &port->flags)) { + !test_bit(STOP_TX, &port->flags)) { txn = kmem_cache_alloc(fwtty_txn_cache, GFP_ATOMIC); if (!txn) { n = -ENOMEM; @@ -884,7 +884,7 @@ static void fwserial_destroy(struct kref *kref) for (j = 0; j < num_ports; ++i, ++j) { port_table_corrupt |= port_table[i] != ports[j]; WARN_ONCE(port_table_corrupt, "port_table[%d]: %p != ports[%d]: %p", - i, port_table[i], j, ports[j]); + i, port_table[i], j, ports[j]); port_table[i] = NULL; } @@ -1257,7 +1257,7 @@ static int set_serial_info(struct fwtty_port *port, return -EFAULT; if (tmp.irq != 0 || tmp.port != 0 || tmp.custom_divisor != 0 || - tmp.baud_base != 400000000) + tmp.baud_base != 400000000) return -EPERM; if (!capable(CAP_SYS_ADMIN)) { -- cgit v1.2.3-55-g7522 From ea595e76c02a71d34c5536be1c64de114a5ac598 Mon Sep 17 00:00:00 2001 From: Dominique van den Broeck Date: Sat, 12 Apr 2014 15:18:13 +0200 Subject: fwserial: (coding style) if/else bracket matching Style-only modifications to make checkpatch.pl --file --strict a bit happier. if/else bracket matching (either none or both options should be bracketed). Signed-off-by: Dominique van den Broeck Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fwserial/fwserial.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'drivers/staging/fwserial/fwserial.c') diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index db3d6c7ff219..3862ddf29891 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c @@ -638,9 +638,9 @@ static void fwtty_port_handler(struct fw_card *card, switch (tcode) { case TCODE_WRITE_QUADLET_REQUEST: - if (addr != port->rx_handler.offset || len != 4) + if (addr != port->rx_handler.offset || len != 4) { rcode = RCODE_ADDRESS_ERROR; - else { + } else { fwtty_update_port_status(port, *(unsigned *)data); rcode = RCODE_COMPLETE; } @@ -756,11 +756,11 @@ static int fwtty_tx(struct fwtty_port *port, bool drain) if (n < 0) { kmem_cache_free(fwtty_txn_cache, txn); - if (n == -EAGAIN) + if (n == -EAGAIN) { ++port->stats.tx_stall; - else if (n == -ENODATA) + } else if (n == -ENODATA) { fwtty_profile_data(port->stats.txns, 0); - else { + } else { ++port->stats.fifo_errs; fwtty_err_ratelimited(port, "fifo err: %d\n", n); @@ -1264,8 +1264,9 @@ static int set_serial_info(struct fwtty_port *port, if (((tmp.flags & ~ASYNC_USR_MASK) != (port->port.flags & ~ASYNC_USR_MASK))) return -EPERM; - } else + } else { port->port.close_delay = tmp.close_delay * HZ / 100; + } return 0; } @@ -1308,9 +1309,9 @@ static void fwtty_set_termios(struct tty_struct *tty, struct ktermios *old) spin_lock_bh(&port->lock); baud = set_termios(port, tty); - if ((baud == 0) && (old->c_cflag & CBAUD)) + if ((baud == 0) && (old->c_cflag & CBAUD)) { port->mctrl &= ~(TIOCM_DTR | TIOCM_RTS); - else if ((baud != 0) && !(old->c_cflag & CBAUD)) { + } else if ((baud != 0) && !(old->c_cflag & CBAUD)) { if (C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags)) port->mctrl |= TIOCM_DTR | TIOCM_RTS; else @@ -1733,8 +1734,9 @@ static inline int fwserial_send_mgmt_sync(struct fwtty_peer *peer, rcode == RCODE_GENERATION) { fwtty_dbg(&peer->unit, "mgmt write error: %d\n", rcode); continue; - } else + } else { break; + } } while (--tries > 0); return rcode; } @@ -2744,9 +2746,9 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer, break; case FWSC_VIRT_CABLE_UNPLUG_RSP: - if (peer->state != FWPS_UNPLUG_PENDING) + if (peer->state != FWPS_UNPLUG_PENDING) { rcode = RCODE_CONFLICT_ERROR; - else { + } else { if (be16_to_cpu(pkt->hdr.code) & FWSC_RSP_NACK) fwtty_notice(&peer->unit, "NACK unplug?\n"); port = peer_revert_state(peer); -- cgit v1.2.3-55-g7522 From d949210a6cb2a03c4480d3f1bdf70eb2eaa42989 Mon Sep 17 00:00:00 2001 From: Dominique van den Broeck Date: Sat, 12 Apr 2014 15:18:14 +0200 Subject: fwserial: (coding style) useless "extern" & space Style-only modifications to make checkpatch.pl --file --strict a bit happier. Removed useless "extern" in dma_fifo.h ; Removed one supernumerary space. Signed-off-by: Dominique van den Broeck Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fwserial/dma_fifo.h | 18 +++++++++--------- drivers/staging/fwserial/fwserial.c | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging/fwserial/fwserial.c') diff --git a/drivers/staging/fwserial/dma_fifo.h b/drivers/staging/fwserial/dma_fifo.h index a113fe1e6f19..1dfe75daba41 100644 --- a/drivers/staging/fwserial/dma_fifo.h +++ b/drivers/staging/fwserial/dma_fifo.h @@ -85,15 +85,15 @@ static inline bool dp_is_completed(struct dma_pending *dp) return (unsigned long)dp->data & 1UL; } -extern void dma_fifo_init(struct dma_fifo *fifo); -extern int dma_fifo_alloc(struct dma_fifo *fifo, int size, unsigned align, - int tx_limit, int open_limit, gfp_t gfp_mask); -extern void dma_fifo_free(struct dma_fifo *fifo); -extern void dma_fifo_reset(struct dma_fifo *fifo); -extern int dma_fifo_in(struct dma_fifo *fifo, const void *src, int n); -extern int dma_fifo_out_pend(struct dma_fifo *fifo, struct dma_pending *pended); -extern int dma_fifo_out_complete(struct dma_fifo *fifo, - struct dma_pending *complete); +void dma_fifo_init(struct dma_fifo *fifo); +int dma_fifo_alloc(struct dma_fifo *fifo, int size, unsigned align, + int tx_limit, int open_limit, gfp_t gfp_mask); +void dma_fifo_free(struct dma_fifo *fifo); +void dma_fifo_reset(struct dma_fifo *fifo); +int dma_fifo_in(struct dma_fifo *fifo, const void *src, int n); +int dma_fifo_out_pend(struct dma_fifo *fifo, struct dma_pending *pended); +int dma_fifo_out_complete(struct dma_fifo *fifo, + struct dma_pending *complete); /* returns the # of used bytes in the fifo */ static inline int dma_fifo_level(struct dma_fifo *fifo) diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index 3862ddf29891..ebe3259ac4b7 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c @@ -1820,7 +1820,7 @@ static void fwserial_release_port(struct fwtty_port *port, bool reset) static void fwserial_plug_timeout(unsigned long data) { - struct fwtty_peer *peer = (struct fwtty_peer *) data; + struct fwtty_peer *peer = (struct fwtty_peer *)data; struct fwtty_port *port; spin_lock_bh(&peer->lock); -- cgit v1.2.3-55-g7522 From cb790747383ddcebf3791219356701a40383a3a9 Mon Sep 17 00:00:00 2001 From: Dominique van den Broeck Date: Sat, 12 Apr 2014 15:18:15 +0200 Subject: fwserial: (coding style) removing FSF postal address Style-only modifications to make checkpatch.pl --file --strict a bit happier. Removing FSF postal address from file top comment since it has changed in the past, as stated by checkpatch.pl. Signed-off-by: Dominique van den Broeck Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fwserial/dma_fifo.c | 4 ---- drivers/staging/fwserial/dma_fifo.h | 4 ---- drivers/staging/fwserial/fwserial.c | 4 ---- 3 files changed, 12 deletions(-) (limited to 'drivers/staging/fwserial/fwserial.c') diff --git a/drivers/staging/fwserial/dma_fifo.c b/drivers/staging/fwserial/dma_fifo.c index 528d0b9e7849..027906249598 100644 --- a/drivers/staging/fwserial/dma_fifo.c +++ b/drivers/staging/fwserial/dma_fifo.c @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include diff --git a/drivers/staging/fwserial/dma_fifo.h b/drivers/staging/fwserial/dma_fifo.h index 1dfe75daba41..410988224f89 100644 --- a/drivers/staging/fwserial/dma_fifo.h +++ b/drivers/staging/fwserial/dma_fifo.h @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _DMA_FIFO_H_ diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index ebe3259ac4b7..9758c351026f 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -- cgit v1.2.3-55-g7522 From e8429b0913a08d5779b93f5dc5e017cd48026b8b Mon Sep 17 00:00:00 2001 From: Monam Agarwal Date: Mon, 24 Mar 2014 00:08:22 +0530 Subject: drivers/staging: Use RCU_INIT_POINTER(x, NULL) in fwserial/fwserial.c This patch replaces rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL) The rcu_assign_pointer() ensures that the initialization of a structure is carried out before storing a pointer to that structure. And in the case of the NULL pointer, there is no structure to initialize. So, rcu_assign_pointer(p, NULL) can be safely converted to RCU_INIT_POINTER(p, NULL) Signed-off-by: Monam Agarwal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fwserial/fwserial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging/fwserial/fwserial.c') diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index 9758c351026f..384758b11e3c 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c @@ -1807,7 +1807,7 @@ static void fwserial_release_port(struct fwtty_port *port, bool reset) port->max_payload = link_speed_to_max_payload(SCODE_100); dma_fifo_change_tx_limit(&port->tx_fifo, port->max_payload); - rcu_assign_pointer(port->peer, NULL); + RCU_INIT_POINTER(port->peer, NULL); spin_unlock_bh(&port->lock); if (port->port.console && port->fwcon_ops->notify != NULL) @@ -2240,7 +2240,7 @@ static int fwserial_create(struct fw_unit *unit) port->max_payload = link_speed_to_max_payload(SCODE_100); dma_fifo_init(&port->tx_fifo); - rcu_assign_pointer(port->peer, NULL); + RCU_INIT_POINTER(port->peer, NULL); serial->ports[i] = port; /* get unique bus addr region for port's status & recv fifo */ -- cgit v1.2.3-55-g7522