All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/11] staging/fwserial: Only reset port status for attached peers
@ 2013-01-29  3:34 Peter Hurley
  2013-01-29  3:34 ` [PATCH 02/11] staging/fwserial: Release port regardless of unplug response code Peter Hurley
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Peter Hurley @ 2013-01-29  3:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux1394-devel, linux-kernel, Stefan Richter, Peter Hurley

When a port has been reserved in an attempt to connect to a peer
but that attempt does not succeed, releasing the port should not
reset the port line status. Although resetting is functionally
harmless, it can appear as if a remote peer dropped carrier to a
port it was not attached to (which can be confusing).

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/staging/fwserial/fwserial.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c
index 48523eb..b1482ef 100644
--- a/drivers/staging/fwserial/fwserial.c
+++ b/drivers/staging/fwserial/fwserial.c
@@ -1774,10 +1774,11 @@ static struct fwtty_port *fwserial_find_port(struct fwtty_peer *peer)
 	return NULL;
 }
 
-static void fwserial_release_port(struct fwtty_port *port)
+static void fwserial_release_port(struct fwtty_port *port, bool reset)
 {
 	/* drop carrier (and all other line status) */
-	fwtty_update_port_status(port, 0);
+	if (reset)
+		fwtty_update_port_status(port, 0);
 
 	spin_lock_bh(&port->lock);
 
@@ -1807,7 +1808,7 @@ static void fwserial_plug_timeout(unsigned long data)
 	spin_unlock_bh(&peer->lock);
 
 	if (port)
-		fwserial_release_port(port);
+		fwserial_release_port(port, false);
 }
 
 /**
@@ -1870,7 +1871,7 @@ cancel_timer:
 	peer_revert_state(peer);
 release_port:
 	spin_unlock_bh(&peer->lock);
-	fwserial_release_port(port);
+	fwserial_release_port(port, false);
 free_pkt:
 	kfree(pkt);
 	return err;
@@ -2148,7 +2149,7 @@ static void fwserial_remove_peer(struct fwtty_peer *peer)
 	spin_unlock_bh(&peer->lock);
 
 	if (port)
-		fwserial_release_port(port);
+		fwserial_release_port(port, true);
 
 	synchronize_rcu();
 	kfree(peer);
@@ -2608,7 +2609,7 @@ static void fwserial_handle_plug_req(struct work_struct *work)
 
 	spin_unlock_bh(&peer->lock);
 	if (port)
-		fwserial_release_port(port);
+		fwserial_release_port(port, false);
 
 	rcode = fwserial_send_mgmt_sync(peer, pkt);
 
@@ -2630,7 +2631,7 @@ static void fwserial_handle_plug_req(struct work_struct *work)
 cleanup:
 	spin_unlock_bh(&peer->lock);
 	if (port)
-		fwserial_release_port(port);
+		fwserial_release_port(port, false);
 	kfree(pkt);
 	return;
 }
@@ -2682,7 +2683,7 @@ static void fwserial_handle_unplug_req(struct work_struct *work)
 cleanup:
 	spin_unlock_bh(&peer->lock);
 	if (port)
-		fwserial_release_port(port);
+		fwserial_release_port(port, true);
 	kfree(pkt);
 	return;
 }
@@ -2693,6 +2694,7 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer,
 				     size_t len)
 {
 	struct fwtty_port *port = NULL;
+	bool reset = false;
 	int rcode;
 
 	if (addr != fwserial_mgmt_addr_handler.offset || len < sizeof(pkt->hdr))
@@ -2768,6 +2770,7 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer,
 			if (be16_to_cpu(pkt->hdr.code) & FWSC_RSP_NACK)
 				fwtty_notice(&peer->unit, "NACK unplug?");
 			port = peer_revert_state(peer);
+			reset = true;
 		}
 		break;
 
@@ -2779,7 +2782,7 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer,
 	spin_unlock_bh(&peer->lock);
 
 	if (port)
-		fwserial_release_port(port);
+		fwserial_release_port(port, reset);
 
 	return rcode;
 }
-- 
1.8.1.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-01-30 16:23 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-29  3:34 [PATCH 01/11] staging/fwserial: Only reset port status for attached peers Peter Hurley
2013-01-29  3:34 ` [PATCH 02/11] staging/fwserial: Release port regardless of unplug response code Peter Hurley
2013-01-29  3:34 ` [PATCH 03/11] staging/fwserial: Fix sparse build warnings Peter Hurley
2013-01-29  3:34 ` [PATCH 04/11] staging/fwserial: Create loop device the 'tty' way Peter Hurley
2013-01-29  3:34 ` [PATCH 05/11] staging/fwserial: Cleanup /proc/tty/driver/ file Peter Hurley
2013-01-29  3:34 ` [PATCH 06/11] staging/fwserial: Factor unstable stats/debug/status info to debugfs Peter Hurley
2013-01-29  3:34 ` [PATCH 07/11] staging/fwserial: Don't use deprecated alloc_tty_driver() Peter Hurley
2013-01-29  3:34 ` [PATCH 08/11] staging/fwserial: Remove reference to removed constant Peter Hurley
2013-01-29  3:34 ` [PATCH 09/11] staging/fwserial: add diagnostic for buffer overflow Peter Hurley
2013-01-29  3:34 ` [PATCH 10/11] staging/fwserial: Fix premature unthrottle Peter Hurley
2013-01-30  4:29   ` Greg Kroah-Hartman
2013-01-30 13:11     ` Peter Hurley
2013-01-30 13:32       ` Greg Kroah-Hartman
2013-01-30 13:37         ` Peter Hurley
2013-01-30 16:25           ` Greg Kroah-Hartman
2013-01-29  3:34 ` [PATCH 11/11] staging/fwserial: Remove unneeded push work Peter Hurley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.