linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Brian King <brking@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Brian King <brking@linux.vnet.ibm.com>,
	mmc@linux.vnet.ibm.com, brking@pobox.com
Subject: [PATCH 1/7] hvcs: Fix hvcs port reference counting
Date: Mon, 30 Jan 2023 16:43:15 -0600	[thread overview]
Message-ID: <20230130224321.164843-2-brking@linux.vnet.ibm.com> (raw)
In-Reply-To: <20230130224321.164843-1-brking@linux.vnet.ibm.com>

The hvcs driver only ever gets two references to the port. One
at initialization time, and one at install time. Remove the code
that was trying to do multiple port puts for each open, which
would result in more puts than gets.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---
 drivers/tty/hvc/hvcs.c | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 4ba24963685e..faf5ccfc561e 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -1215,12 +1215,9 @@ static void hvcs_hangup(struct tty_struct * tty)
 {
 	struct hvcs_struct *hvcsd = tty->driver_data;
 	unsigned long flags;
-	int temp_open_count;
 	int irq;
 
 	spin_lock_irqsave(&hvcsd->lock, flags);
-	/* Preserve this so that we know how many kref refs to put */
-	temp_open_count = hvcsd->port.count;
 
 	/*
 	 * Don't kref put inside the spinlock because the destruction
@@ -1247,21 +1244,6 @@ static void hvcs_hangup(struct tty_struct * tty)
 	spin_unlock_irqrestore(&hvcsd->lock, flags);
 
 	free_irq(irq, hvcsd);
-
-	/*
-	 * We need to kref_put() for every open_count we have since the
-	 * tty_hangup() function doesn't invoke a close per open connection on a
-	 * non-console device.
-	 */
-	while(temp_open_count) {
-		--temp_open_count;
-		/*
-		 * The final put will trigger destruction of the hvcs_struct.
-		 * NOTE:  If this hangup was signaled from user space then the
-		 * final put will never happen.
-		 */
-		tty_port_put(&hvcsd->port);
-	}
 }
 
 /*
-- 
2.31.1


  reply	other threads:[~2023-01-30 22:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 22:43 [PATCH 0/7] hvcs: Various hvcs device hotplug fixes Brian King
2023-01-30 22:43 ` Brian King [this message]
2023-01-30 22:43 ` [PATCH 2/7] hvcs: Remove sysfs file prior to vio unregister Brian King
2023-01-30 22:43 ` [PATCH 3/7] hvcs: Remove sysfs group earlier Brian King
2023-01-30 22:43 ` [PATCH 4/7] hvcs: Get reference to tty in remove Brian King
2023-01-30 22:43 ` [PATCH 5/7] hvcs: Use vhangup in hotplug remove Brian King
2023-01-30 22:43 ` [PATCH 6/7] hvcs: Synchronize hotplug remove with port free Brian King
2023-01-30 22:43 ` [PATCH 7/7] powerpc: Fix device node refcounting Brian King
2023-02-01 10:32 ` [PATCH 0/7] hvcs: Various hvcs device hotplug fixes Christophe Leroy
2023-02-01 15:09   ` Brian King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230130224321.164843-2-brking@linux.vnet.ibm.com \
    --to=brking@linux.vnet.ibm.com \
    --cc=brking@pobox.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mmc@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).