Commit 6e8661ed authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

staging: fwserial: Use normal logging styles

Logging messages without newline termination are subject
to interleaving by other messages.

Avoid this by adding newlines to each message.

Neaten fwtty_<level> logging macros.
Convert driver_err to pr_err.
Add #define pr_fmt to prefix those messages.
Remove now unused driver_err macro.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ee76875e
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -101,13 +103,16 @@ struct fwtty_transaction { ...@@ -101,13 +103,16 @@ struct fwtty_transaction {
}; };
#define to_device(a, b) (a->b) #define to_device(a, b) (a->b)
#define fwtty_err(p, s, v...) dev_err(to_device(p, device), s, ##v) #define fwtty_err(p, fmt, ...) \
#define fwtty_info(p, s, v...) dev_info(to_device(p, device), s, ##v) dev_err(to_device(p, device), fmt, ##__VA_ARGS__)
#define fwtty_notice(p, s, v...) dev_notice(to_device(p, device), s, ##v) #define fwtty_info(p, fmt, ...) \
#define fwtty_dbg(p, s, v...) \ dev_info(to_device(p, device), fmt, ##__VA_ARGS__)
dev_dbg(to_device(p, device), "%s: " s, __func__, ##v) #define fwtty_notice(p, fmt, ...) \
#define fwtty_err_ratelimited(p, s, v...) \ dev_notice(to_device(p, device), fmt, ##__VA_ARGS__)
dev_err_ratelimited(to_device(p, device), s, ##v) #define fwtty_dbg(p, fmt, ...) \
dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__)
#define fwtty_err_ratelimited(p, fmt, ...) \
dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__)
#ifdef DEBUG #ifdef DEBUG
static inline void debug_short_write(struct fwtty_port *port, int c, int n) static inline void debug_short_write(struct fwtty_port *port, int c, int n)
...@@ -118,7 +123,7 @@ static inline void debug_short_write(struct fwtty_port *port, int c, int n) ...@@ -118,7 +123,7 @@ static inline void debug_short_write(struct fwtty_port *port, int c, int n)
spin_lock_bh(&port->lock); spin_lock_bh(&port->lock);
avail = dma_fifo_avail(&port->tx_fifo); avail = dma_fifo_avail(&port->tx_fifo);
spin_unlock_bh(&port->lock); spin_unlock_bh(&port->lock);
fwtty_dbg(port, "short write: avail:%d req:%d wrote:%d", fwtty_dbg(port, "short write: avail:%d req:%d wrote:%d\n",
avail, c, n); avail, c, n);
} }
} }
...@@ -197,22 +202,22 @@ static void fwtty_log_tx_error(struct fwtty_port *port, int rcode) ...@@ -197,22 +202,22 @@ static void fwtty_log_tx_error(struct fwtty_port *port, int rcode)
{ {
switch (rcode) { switch (rcode) {
case RCODE_SEND_ERROR: case RCODE_SEND_ERROR:
fwtty_err_ratelimited(port, "card busy"); fwtty_err_ratelimited(port, "card busy\n");
break; break;
case RCODE_ADDRESS_ERROR: case RCODE_ADDRESS_ERROR:
fwtty_err_ratelimited(port, "bad unit addr or write length"); fwtty_err_ratelimited(port, "bad unit addr or write length\n");
break; break;
case RCODE_DATA_ERROR: case RCODE_DATA_ERROR:
fwtty_err_ratelimited(port, "failed rx"); fwtty_err_ratelimited(port, "failed rx\n");
break; break;
case RCODE_NO_ACK: case RCODE_NO_ACK:
fwtty_err_ratelimited(port, "missing ack"); fwtty_err_ratelimited(port, "missing ack\n");
break; break;
case RCODE_BUSY: case RCODE_BUSY:
fwtty_err_ratelimited(port, "remote busy"); fwtty_err_ratelimited(port, "remote busy\n");
break; break;
default: default:
fwtty_err_ratelimited(port, "failed tx: %d", rcode); fwtty_err_ratelimited(port, "failed tx: %d\n", rcode);
} }
} }
...@@ -287,7 +292,7 @@ static void __fwtty_restart_tx(struct fwtty_port *port) ...@@ -287,7 +292,7 @@ static void __fwtty_restart_tx(struct fwtty_port *port)
schedule_delayed_work(&port->drain, 0); schedule_delayed_work(&port->drain, 0);
avail = dma_fifo_avail(&port->tx_fifo); avail = dma_fifo_avail(&port->tx_fifo);
fwtty_dbg(port, "fifo len: %d avail: %d", len, avail); fwtty_dbg(port, "fifo len: %d avail: %d\n", len, avail);
} }
static void fwtty_restart_tx(struct fwtty_port *port) static void fwtty_restart_tx(struct fwtty_port *port)
...@@ -323,7 +328,7 @@ static void fwtty_update_port_status(struct fwtty_port *port, unsigned status) ...@@ -323,7 +328,7 @@ static void fwtty_update_port_status(struct fwtty_port *port, unsigned status)
if (delta & TIOCM_CTS) if (delta & TIOCM_CTS)
++port->icount.cts; ++port->icount.cts;
fwtty_dbg(port, "status: %x delta: %x", status, delta); fwtty_dbg(port, "status: %x delta: %x\n", status, delta);
if (delta & TIOCM_CAR) { if (delta & TIOCM_CAR) {
tty = tty_port_tty_get(&port->port); tty = tty_port_tty_get(&port->port);
...@@ -509,7 +514,7 @@ static void fwtty_emit_breaks(struct work_struct *work) ...@@ -509,7 +514,7 @@ static void fwtty_emit_breaks(struct work_struct *work)
n = (elapsed * port->cps) / HZ + 1; n = (elapsed * port->cps) / HZ + 1;
port->break_last = now; port->break_last = now;
fwtty_dbg(port, "sending %d brks", n); fwtty_dbg(port, "sending %d brks\n", n);
while (n) { while (n) {
t = min(n, 16); t = min(n, 16);
...@@ -570,7 +575,7 @@ static int fwtty_buffer_rx(struct fwtty_port *port, unsigned char *d, size_t n) ...@@ -570,7 +575,7 @@ static int fwtty_buffer_rx(struct fwtty_port *port, unsigned char *d, size_t n)
size_t size = (n + sizeof(struct buffered_rx) + 0xFF) & ~0xFF; size_t size = (n + sizeof(struct buffered_rx) + 0xFF) & ~0xFF;
if (port->buffered + n > HIGH_WATERMARK) { if (port->buffered + n > HIGH_WATERMARK) {
fwtty_err_ratelimited(port, "overflowed rx buffer: buffered: %d new: %zu wtrmk: %d", fwtty_err_ratelimited(port, "overflowed rx buffer: buffered: %d new: %zu wtrmk: %d\n",
port->buffered, n, HIGH_WATERMARK); port->buffered, n, HIGH_WATERMARK);
return 0; return 0;
} }
...@@ -599,7 +604,7 @@ static int fwtty_rx(struct fwtty_port *port, unsigned char *data, size_t len) ...@@ -599,7 +604,7 @@ static int fwtty_rx(struct fwtty_port *port, unsigned char *data, size_t len)
unsigned lsr; unsigned lsr;
int err = 0; int err = 0;
fwtty_dbg(port, "%d", n); fwtty_dbg(port, "%d\n", n);
profile_size_distrib(port->stats.reads, n); profile_size_distrib(port->stats.reads, n);
if (port->write_only) { if (port->write_only) {
...@@ -689,7 +694,7 @@ static void fwtty_port_handler(struct fw_card *card, ...@@ -689,7 +694,7 @@ static void fwtty_port_handler(struct fw_card *card,
rcu_read_unlock(); rcu_read_unlock();
if (!peer || peer != rcu_access_pointer(port->peer)) { if (!peer || peer != rcu_access_pointer(port->peer)) {
rcode = RCODE_ADDRESS_ERROR; rcode = RCODE_ADDRESS_ERROR;
fwtty_err_ratelimited(port, "ignoring unauthenticated data"); fwtty_err_ratelimited(port, "ignoring unauthenticated data\n");
goto respond; goto respond;
} }
...@@ -746,7 +751,7 @@ static void fwtty_tx_complete(struct fw_card *card, int rcode, ...@@ -746,7 +751,7 @@ static void fwtty_tx_complete(struct fw_card *card, int rcode,
struct fwtty_port *port = txn->port; struct fwtty_port *port = txn->port;
int len; int len;
fwtty_dbg(port, "rcode: %d", rcode); fwtty_dbg(port, "rcode: %d\n", rcode);
switch (rcode) { switch (rcode) {
case RCODE_COMPLETE: case RCODE_COMPLETE:
...@@ -809,7 +814,7 @@ static int fwtty_tx(struct fwtty_port *port, bool drain) ...@@ -809,7 +814,7 @@ static int fwtty_tx(struct fwtty_port *port, bool drain)
n = dma_fifo_out_pend(&port->tx_fifo, &txn->dma_pended); n = dma_fifo_out_pend(&port->tx_fifo, &txn->dma_pended);
spin_unlock_bh(&port->lock); spin_unlock_bh(&port->lock);
fwtty_dbg(port, "out: %u rem: %d", txn->dma_pended.len, n); fwtty_dbg(port, "out: %u rem: %d\n", txn->dma_pended.len, n);
if (n < 0) { if (n < 0) {
kmem_cache_free(fwtty_txn_cache, txn); kmem_cache_free(fwtty_txn_cache, txn);
...@@ -819,7 +824,8 @@ static int fwtty_tx(struct fwtty_port *port, bool drain) ...@@ -819,7 +824,8 @@ static int fwtty_tx(struct fwtty_port *port, bool drain)
profile_size_distrib(port->stats.txns, 0); profile_size_distrib(port->stats.txns, 0);
else { else {
++port->stats.fifo_errs; ++port->stats.fifo_errs;
fwtty_err_ratelimited(port, "fifo err: %d", n); fwtty_err_ratelimited(port, "fifo err: %d\n",
n);
} }
break; break;
} }
...@@ -877,7 +883,7 @@ static void fwtty_write_xchar(struct fwtty_port *port, char ch) ...@@ -877,7 +883,7 @@ static void fwtty_write_xchar(struct fwtty_port *port, char ch)
++port->stats.xchars; ++port->stats.xchars;
fwtty_dbg(port, "%02x", ch); fwtty_dbg(port, "%02x\n", ch);
rcu_read_lock(); rcu_read_lock();
peer = rcu_dereference(port->peer); peer = rcu_dereference(port->peer);
...@@ -964,7 +970,7 @@ static void fwtty_port_dtr_rts(struct tty_port *tty_port, int on) ...@@ -964,7 +970,7 @@ static void fwtty_port_dtr_rts(struct tty_port *tty_port, int on)
{ {
struct fwtty_port *port = to_port(tty_port, port); struct fwtty_port *port = to_port(tty_port, port);
fwtty_dbg(port, "on/off: %d", on); fwtty_dbg(port, "on/off: %d\n", on);
spin_lock_bh(&port->lock); spin_lock_bh(&port->lock);
/* Don't change carrier state if this is a console */ /* Don't change carrier state if this is a console */
...@@ -992,7 +998,7 @@ static int fwtty_port_carrier_raised(struct tty_port *tty_port) ...@@ -992,7 +998,7 @@ static int fwtty_port_carrier_raised(struct tty_port *tty_port)
rc = (port->mstatus & TIOCM_CAR); rc = (port->mstatus & TIOCM_CAR);
fwtty_dbg(port, "%d", rc); fwtty_dbg(port, "%d\n", rc);
return rc; return rc;
} }
...@@ -1177,7 +1183,7 @@ static int fwtty_write(struct tty_struct *tty, const unsigned char *buf, int c) ...@@ -1177,7 +1183,7 @@ static int fwtty_write(struct tty_struct *tty, const unsigned char *buf, int c)
struct fwtty_port *port = tty->driver_data; struct fwtty_port *port = tty->driver_data;
int n, len; int n, len;
fwtty_dbg(port, "%d", c); fwtty_dbg(port, "%d\n", c);
profile_size_distrib(port->stats.writes, c); profile_size_distrib(port->stats.writes, c);
spin_lock_bh(&port->lock); spin_lock_bh(&port->lock);
...@@ -1204,7 +1210,7 @@ static int fwtty_write_room(struct tty_struct *tty) ...@@ -1204,7 +1210,7 @@ static int fwtty_write_room(struct tty_struct *tty)
n = dma_fifo_avail(&port->tx_fifo); n = dma_fifo_avail(&port->tx_fifo);
spin_unlock_bh(&port->lock); spin_unlock_bh(&port->lock);
fwtty_dbg(port, "%d", n); fwtty_dbg(port, "%d\n", n);
return n; return n;
} }
...@@ -1218,7 +1224,7 @@ static int fwtty_chars_in_buffer(struct tty_struct *tty) ...@@ -1218,7 +1224,7 @@ static int fwtty_chars_in_buffer(struct tty_struct *tty)
n = dma_fifo_level(&port->tx_fifo); n = dma_fifo_level(&port->tx_fifo);
spin_unlock_bh(&port->lock); spin_unlock_bh(&port->lock);
fwtty_dbg(port, "%d", n); fwtty_dbg(port, "%d\n", n);
return n; return n;
} }
...@@ -1227,7 +1233,7 @@ static void fwtty_send_xchar(struct tty_struct *tty, char ch) ...@@ -1227,7 +1233,7 @@ static void fwtty_send_xchar(struct tty_struct *tty, char ch)
{ {
struct fwtty_port *port = tty->driver_data; struct fwtty_port *port = tty->driver_data;
fwtty_dbg(port, "%02x", ch); fwtty_dbg(port, "%02x\n", ch);
fwtty_write_xchar(port, ch); fwtty_write_xchar(port, ch);
} }
...@@ -1254,7 +1260,7 @@ static void fwtty_unthrottle(struct tty_struct *tty) ...@@ -1254,7 +1260,7 @@ static void fwtty_unthrottle(struct tty_struct *tty)
{ {
struct fwtty_port *port = tty->driver_data; struct fwtty_port *port = tty->driver_data;
fwtty_dbg(port, "CRTSCTS: %d", (C_CRTSCTS(tty) != 0)); fwtty_dbg(port, "CRTSCTS: %d\n", (C_CRTSCTS(tty) != 0));
profile_fifo_avail(port, port->stats.unthrottle); profile_fifo_avail(port, port->stats.unthrottle);
...@@ -1409,7 +1415,7 @@ static int fwtty_break_ctl(struct tty_struct *tty, int state) ...@@ -1409,7 +1415,7 @@ static int fwtty_break_ctl(struct tty_struct *tty, int state)
struct fwtty_port *port = tty->driver_data; struct fwtty_port *port = tty->driver_data;
long ret; long ret;
fwtty_dbg(port, "%d", state); fwtty_dbg(port, "%d\n", state);
if (state == -1) { if (state == -1) {
set_bit(STOP_TX, &port->flags); set_bit(STOP_TX, &port->flags);
...@@ -1446,7 +1452,7 @@ static int fwtty_tiocmget(struct tty_struct *tty) ...@@ -1446,7 +1452,7 @@ static int fwtty_tiocmget(struct tty_struct *tty)
tiocm = (port->mctrl & MCTRL_MASK) | (port->mstatus & ~MCTRL_MASK); tiocm = (port->mctrl & MCTRL_MASK) | (port->mstatus & ~MCTRL_MASK);
spin_unlock_bh(&port->lock); spin_unlock_bh(&port->lock);
fwtty_dbg(port, "%x", tiocm); fwtty_dbg(port, "%x\n", tiocm);
return tiocm; return tiocm;
} }
...@@ -1455,7 +1461,7 @@ static int fwtty_tiocmset(struct tty_struct *tty, unsigned set, unsigned clear) ...@@ -1455,7 +1461,7 @@ static int fwtty_tiocmset(struct tty_struct *tty, unsigned set, unsigned clear)
{ {
struct fwtty_port *port = tty->driver_data; struct fwtty_port *port = tty->driver_data;
fwtty_dbg(port, "set: %x clear: %x", set, clear); fwtty_dbg(port, "set: %x clear: %x\n", set, clear);
/* TODO: simulate loopback if TIOCM_LOOP set */ /* TODO: simulate loopback if TIOCM_LOOP set */
...@@ -1775,7 +1781,7 @@ static void fwserial_virt_plug_complete(struct fwtty_peer *peer, ...@@ -1775,7 +1781,7 @@ static void fwserial_virt_plug_complete(struct fwtty_peer *peer,
if (port->port.console && port->fwcon_ops->notify != NULL) if (port->port.console && port->fwcon_ops->notify != NULL)
(*port->fwcon_ops->notify)(FWCON_NOTIFY_ATTACH, port->con_data); (*port->fwcon_ops->notify)(FWCON_NOTIFY_ATTACH, port->con_data);
fwtty_info(&peer->unit, "peer (guid:%016llx) connected on %s", fwtty_info(&peer->unit, "peer (guid:%016llx) connected on %s\n",
(unsigned long long)peer->guid, dev_name(port->device)); (unsigned long long)peer->guid, dev_name(port->device));
} }
...@@ -1797,7 +1803,7 @@ static inline int fwserial_send_mgmt_sync(struct fwtty_peer *peer, ...@@ -1797,7 +1803,7 @@ static inline int fwserial_send_mgmt_sync(struct fwtty_peer *peer,
pkt, be16_to_cpu(pkt->hdr.len)); pkt, be16_to_cpu(pkt->hdr.len));
if (rcode == RCODE_BUSY || rcode == RCODE_SEND_ERROR || if (rcode == RCODE_BUSY || rcode == RCODE_SEND_ERROR ||
rcode == RCODE_GENERATION) { rcode == RCODE_GENERATION) {
fwtty_dbg(&peer->unit, "mgmt write error: %d", rcode); fwtty_dbg(&peer->unit, "mgmt write error: %d\n", rcode);
continue; continue;
} else } else
break; break;
...@@ -1918,7 +1924,7 @@ static int fwserial_connect_peer(struct fwtty_peer *peer) ...@@ -1918,7 +1924,7 @@ static int fwserial_connect_peer(struct fwtty_peer *peer)
port = fwserial_find_port(peer); port = fwserial_find_port(peer);
if (!port) { if (!port) {
fwtty_err(&peer->unit, "avail ports in use"); fwtty_err(&peer->unit, "avail ports in use\n");
err = -EBUSY; err = -EBUSY;
goto free_pkt; goto free_pkt;
} }
...@@ -2056,7 +2062,7 @@ static struct fwtty_peer *__fwserial_peer_by_node_id(struct fw_card *card, ...@@ -2056,7 +2062,7 @@ static struct fwtty_peer *__fwserial_peer_by_node_id(struct fw_card *card,
* has created its remote unit device before this driver has * has created its remote unit device before this driver has
* been probed for any unit devices... * been probed for any unit devices...
*/ */
fwtty_err(card, "unknown card (guid %016llx)", fwtty_err(card, "unknown card (guid %016llx)\n",
(unsigned long long) card->guid); (unsigned long long) card->guid);
return NULL; return NULL;
} }
...@@ -2084,8 +2090,8 @@ static void __dump_peer_list(struct fw_card *card) ...@@ -2084,8 +2090,8 @@ static void __dump_peer_list(struct fw_card *card)
list_for_each_entry_rcu(peer, &serial->peer_list, list) { list_for_each_entry_rcu(peer, &serial->peer_list, list) {
int g = peer->generation; int g = peer->generation;
smp_rmb(); smp_rmb();
fwtty_dbg(card, "peer(%d:%x) guid: %016llx\n", g, fwtty_dbg(card, "peer(%d:%x) guid: %016llx\n",
peer->node_id, (unsigned long long) peer->guid); g, peer->node_id, (unsigned long long) peer->guid);
} }
} }
#else #else
...@@ -2173,7 +2179,7 @@ static int fwserial_add_peer(struct fw_serial *serial, struct fw_unit *unit) ...@@ -2173,7 +2179,7 @@ static int fwserial_add_peer(struct fw_serial *serial, struct fw_unit *unit)
peer->serial = serial; peer->serial = serial;
list_add_rcu(&peer->list, &serial->peer_list); list_add_rcu(&peer->list, &serial->peer_list);
fwtty_info(&peer->unit, "peer added (guid:%016llx)", fwtty_info(&peer->unit, "peer added (guid:%016llx)\n",
(unsigned long long)peer->guid); (unsigned long long)peer->guid);
/* identify the local unit & virt cable to loopback port */ /* identify the local unit & virt cable to loopback port */
...@@ -2236,7 +2242,7 @@ static void fwserial_remove_peer(struct fwtty_peer *peer) ...@@ -2236,7 +2242,7 @@ static void fwserial_remove_peer(struct fwtty_peer *peer)
list_del_rcu(&peer->list); list_del_rcu(&peer->list);
fwtty_info(&peer->unit, "peer removed (guid:%016llx)", fwtty_info(&peer->unit, "peer removed (guid:%016llx)\n",
(unsigned long long)peer->guid); (unsigned long long)peer->guid);
spin_unlock_bh(&peer->lock); spin_unlock_bh(&peer->lock);
...@@ -2324,7 +2330,7 @@ static int fwserial_create(struct fw_unit *unit) ...@@ -2324,7 +2330,7 @@ static int fwserial_create(struct fw_unit *unit)
err = fwtty_ports_add(serial); err = fwtty_ports_add(serial);
if (err) { if (err) {
fwtty_err(&unit, "no space in port table"); fwtty_err(&unit, "no space in port table\n");
goto free_ports; goto free_ports;
} }
...@@ -2335,7 +2341,8 @@ static int fwserial_create(struct fw_unit *unit) ...@@ -2335,7 +2341,8 @@ static int fwserial_create(struct fw_unit *unit)
card->device); card->device);
if (IS_ERR(tty_dev)) { if (IS_ERR(tty_dev)) {
err = PTR_ERR(tty_dev); err = PTR_ERR(tty_dev);
fwtty_err(&unit, "register tty device error (%d)", err); fwtty_err(&unit, "register tty device error (%d)\n",
err);
goto unregister_ttys; goto unregister_ttys;
} }
...@@ -2352,7 +2359,8 @@ static int fwserial_create(struct fw_unit *unit) ...@@ -2352,7 +2359,8 @@ static int fwserial_create(struct fw_unit *unit)
card->device); card->device);
if (IS_ERR(loop_dev)) { if (IS_ERR(loop_dev)) {
err = PTR_ERR(loop_dev); err = PTR_ERR(loop_dev);
fwtty_err(&unit, "create loop device failed (%d)", err); fwtty_err(&unit, "create loop device failed (%d)\n",
err);
goto unregister_ttys; goto unregister_ttys;
} }
serial->ports[j]->device = loop_dev; serial->ports[j]->device = loop_dev;
...@@ -2372,14 +2380,14 @@ static int fwserial_create(struct fw_unit *unit) ...@@ -2372,14 +2380,14 @@ static int fwserial_create(struct fw_unit *unit)
list_add_rcu(&serial->list, &fwserial_list); list_add_rcu(&serial->list, &fwserial_list);
fwtty_notice(&unit, "TTY over FireWire on device %s (guid %016llx)", fwtty_notice(&unit, "TTY over FireWire on device %s (guid %016llx)\n",
dev_name(card->device), (unsigned long long) card->guid); dev_name(card->device), (unsigned long long) card->guid);
err = fwserial_add_peer(serial, unit); err = fwserial_add_peer(serial, unit);
if (!err) if (!err)
return 0; return 0;
fwtty_err(&unit, "unable to add peer unit device (%d)", err); fwtty_err(&unit, "unable to add peer unit device (%d)\n", err);
/* fall-through to error processing */ /* fall-through to error processing */
debugfs_remove_recursive(serial->debugfs); debugfs_remove_recursive(serial->debugfs);
...@@ -2621,7 +2629,7 @@ static void fwserial_handle_plug_req(struct work_struct *work) ...@@ -2621,7 +2629,7 @@ static void fwserial_handle_plug_req(struct work_struct *work)
switch (peer->state) { switch (peer->state) {
case FWPS_NOT_ATTACHED: case FWPS_NOT_ATTACHED:
if (!port) { if (!port) {
fwtty_err(&peer->unit, "no more ports avail"); fwtty_err(&peer->unit, "no more ports avail\n");
fill_plug_rsp_nack(pkt); fill_plug_rsp_nack(pkt);
} else { } else {
peer->port = port; peer->port = port;
...@@ -2663,7 +2671,7 @@ static void fwserial_handle_plug_req(struct work_struct *work) ...@@ -2663,7 +2671,7 @@ static void fwserial_handle_plug_req(struct work_struct *work)
fwtty_write_port_status(tmp); fwtty_write_port_status(tmp);
spin_lock_bh(&peer->lock); spin_lock_bh(&peer->lock);
} else { } else {
fwtty_err(&peer->unit, "PLUG_RSP error (%d)", rcode); fwtty_err(&peer->unit, "PLUG_RSP error (%d)\n", rcode);
port = peer_revert_state(peer); port = peer_revert_state(peer);
} }
} }
...@@ -2715,7 +2723,8 @@ static void fwserial_handle_unplug_req(struct work_struct *work) ...@@ -2715,7 +2723,8 @@ static void fwserial_handle_unplug_req(struct work_struct *work)
spin_lock_bh(&peer->lock); spin_lock_bh(&peer->lock);
if (peer->state == FWPS_UNPLUG_RESPONDING) { if (peer->state == FWPS_UNPLUG_RESPONDING) {
if (rcode != RCODE_COMPLETE) if (rcode != RCODE_COMPLETE)
fwtty_err(&peer->unit, "UNPLUG_RSP error (%d)", rcode); fwtty_err(&peer->unit, "UNPLUG_RSP error (%d)\n",
rcode);
port = peer_revert_state(peer); port = peer_revert_state(peer);
} }
cleanup: cleanup:
...@@ -2750,19 +2759,19 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer, ...@@ -2750,19 +2759,19 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer,
* already removed from the bus -- and the removal was * already removed from the bus -- and the removal was
* processed before we rec'd this transaction * processed before we rec'd this transaction
*/ */
fwtty_err(&peer->unit, "peer already removed"); fwtty_err(&peer->unit, "peer already removed\n");
spin_unlock_bh(&peer->lock); spin_unlock_bh(&peer->lock);
return RCODE_ADDRESS_ERROR; return RCODE_ADDRESS_ERROR;
} }
rcode = RCODE_COMPLETE; rcode = RCODE_COMPLETE;
fwtty_dbg(&peer->unit, "mgmt: hdr.code: %04hx", pkt->hdr.code); fwtty_dbg(&peer->unit, "mgmt: hdr.code: %04hx\n", pkt->hdr.code);
switch (be16_to_cpu(pkt->hdr.code) & FWSC_CODE_MASK) { switch (be16_to_cpu(pkt->hdr.code) & FWSC_CODE_MASK) {
case FWSC_VIRT_CABLE_PLUG: case FWSC_VIRT_CABLE_PLUG:
if (work_pending(&peer->work)) { if (work_pending(&peer->work)) {
fwtty_err(&peer->unit, "plug req: busy"); fwtty_err(&peer->unit, "plug req: busy\n");
rcode = RCODE_CONFLICT_ERROR; rcode = RCODE_CONFLICT_ERROR;
} else { } else {
...@@ -2777,7 +2786,7 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer, ...@@ -2777,7 +2786,7 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer,
rcode = RCODE_CONFLICT_ERROR; rcode = RCODE_CONFLICT_ERROR;
} else if (be16_to_cpu(pkt->hdr.code) & FWSC_RSP_NACK) { } else if (be16_to_cpu(pkt->hdr.code) & FWSC_RSP_NACK) {
fwtty_notice(&peer->unit, "NACK plug rsp"); fwtty_notice(&peer->unit, "NACK plug rsp\n");
port = peer_revert_state(peer); port = peer_revert_state(peer);
} else { } else {
...@@ -2793,7 +2802,7 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer, ...@@ -2793,7 +2802,7 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer,
case FWSC_VIRT_CABLE_UNPLUG: case FWSC_VIRT_CABLE_UNPLUG:
if (work_pending(&peer->work)) { if (work_pending(&peer->work)) {
fwtty_err(&peer->unit, "unplug req: busy"); fwtty_err(&peer->unit, "unplug req: busy\n");
rcode = RCODE_CONFLICT_ERROR; rcode = RCODE_CONFLICT_ERROR;
} else { } else {
PREPARE_WORK(&peer->work, fwserial_handle_unplug_req); PREPARE_WORK(&peer->work, fwserial_handle_unplug_req);
...@@ -2806,14 +2815,14 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer, ...@@ -2806,14 +2815,14 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer,
rcode = RCODE_CONFLICT_ERROR; rcode = RCODE_CONFLICT_ERROR;
else { else {
if (be16_to_cpu(pkt->hdr.code) & FWSC_RSP_NACK) if (be16_to_cpu(pkt->hdr.code) & FWSC_RSP_NACK)
fwtty_notice(&peer->unit, "NACK unplug?"); fwtty_notice(&peer->unit, "NACK unplug?\n");
port = peer_revert_state(peer); port = peer_revert_state(peer);
reset = true; reset = true;
} }
break; break;
default: default:
fwtty_err(&peer->unit, "unknown mgmt code %d", fwtty_err(&peer->unit, "unknown mgmt code %d\n",
be16_to_cpu(pkt->hdr.code)); be16_to_cpu(pkt->hdr.code));
rcode = RCODE_DATA_ERROR; rcode = RCODE_DATA_ERROR;
} }
...@@ -2847,7 +2856,7 @@ static void fwserial_mgmt_handler(struct fw_card *card, ...@@ -2847,7 +2856,7 @@ static void fwserial_mgmt_handler(struct fw_card *card,
rcu_read_lock(); rcu_read_lock();
peer = __fwserial_peer_by_node_id(card, generation, source); peer = __fwserial_peer_by_node_id(card, generation, source);
if (!peer) { if (!peer) {
fwtty_dbg(card, "peer(%d:%x) not found", generation, source); fwtty_dbg(card, "peer(%d:%x) not found\n", generation, source);
__dump_peer_list(card); __dump_peer_list(card);
rcode = RCODE_CONFLICT_ERROR; rcode = RCODE_CONFLICT_ERROR;
...@@ -2897,7 +2906,7 @@ static int __init fwserial_init(void) ...@@ -2897,7 +2906,7 @@ static int __init fwserial_init(void)
err = tty_register_driver(fwtty_driver); err = tty_register_driver(fwtty_driver);
if (err) { if (err) {
driver_err("register tty driver failed (%d)", err); pr_err("register tty driver failed (%d)\n", err);
goto put_tty; goto put_tty;
} }
...@@ -2922,7 +2931,7 @@ static int __init fwserial_init(void) ...@@ -2922,7 +2931,7 @@ static int __init fwserial_init(void)
err = tty_register_driver(fwloop_driver); err = tty_register_driver(fwloop_driver);
if (err) { if (err) {
driver_err("register loop driver failed (%d)", err); pr_err("register loop driver failed (%d)\n", err);
goto put_loop; goto put_loop;
} }
} }
...@@ -2948,7 +2957,7 @@ static int __init fwserial_init(void) ...@@ -2948,7 +2957,7 @@ static int __init fwserial_init(void)
err = fw_core_add_address_handler(&fwserial_mgmt_addr_handler, err = fw_core_add_address_handler(&fwserial_mgmt_addr_handler,
&fwserial_mgmt_addr_region); &fwserial_mgmt_addr_region);
if (err) { if (err) {
driver_err("add management handler failed (%d)", err); pr_err("add management handler failed (%d)\n", err);
goto destroy_cache; goto destroy_cache;
} }
...@@ -2956,13 +2965,13 @@ static int __init fwserial_init(void) ...@@ -2956,13 +2965,13 @@ static int __init fwserial_init(void)
FW_UNIT_ADDRESS(fwserial_mgmt_addr_handler.offset); FW_UNIT_ADDRESS(fwserial_mgmt_addr_handler.offset);
err = fw_core_add_descriptor(&fwserial_unit_directory); err = fw_core_add_descriptor(&fwserial_unit_directory);
if (err) { if (err) {
driver_err("add unit descriptor failed (%d)", err); pr_err("add unit descriptor failed (%d)\n", err);
goto remove_handler; goto remove_handler;
} }
err = driver_register(&fwserial_driver.driver); err = driver_register(&fwserial_driver.driver);
if (err) { if (err) {
driver_err("register fwserial driver failed (%d)", err); pr_err("register fwserial driver failed (%d)\n", err);
goto remove_descriptor; goto remove_descriptor;
} }
......
...@@ -356,8 +356,6 @@ static const char loop_dev_name[] = "fwloop"; ...@@ -356,8 +356,6 @@ static const char loop_dev_name[] = "fwloop";
extern struct tty_driver *fwtty_driver; extern struct tty_driver *fwtty_driver;
#define driver_err(s, v...) pr_err(KBUILD_MODNAME ": " s, ##v)
struct fwtty_port *fwtty_port_get(unsigned index); struct fwtty_port *fwtty_port_get(unsigned index);
void fwtty_port_put(struct fwtty_port *port); void fwtty_port_put(struct fwtty_port *port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment