Linux-Serial Archive on lore.kernel.org
 help / color / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>,
	"Nicolas Saenz Julienne" <nsaenzjulienne@suse.de>,
	linux-serial@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	Martin Sperl <kernel@martin.sperl.org>
Subject: [PATCH 1/6] serial: 8250_bcm2835aux: Fix line mismatch on driver unbind
Date: Thu, 16 Jan 2020 13:14:01 +0100
Message-ID: <912ccf553c5258135c6d7e8f404a101ef320f0f4.1579175223.git.lukas@wunner.de> (raw)
In-Reply-To: <cover.1579175223.git.lukas@wunner.de>

Unbinding the bcm2835aux UART driver raises the following error if the
maximum number of 8250 UARTs is set to 1 (via the 8250.nr_uarts module
parameter or CONFIG_SERIAL_8250_RUNTIME_UARTS):

(NULL device *): Removing wrong port: a6f80333 != fa20408b

That's because bcm2835aux_serial_probe() retrieves UART line number 1
from the devicetree and stores it in data->uart.port.line, while
serial8250_register_8250_port() instead uses UART line number 0,
which is stored in data->line.

On driver unbind, bcm2835aux_serial_remove() uses data->uart.port.line,
which contains the wrong number.  Fix it.

The issue does not occur if the maximum number of 8250 UARTs is >= 2.

Fixes: bdc5f3009580 ("serial: bcm2835: add driver for bcm2835-aux-uart")
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: stable@vger.kernel.org # v4.6+
Cc: Martin Sperl <kernel@martin.sperl.org>
---
 drivers/tty/serial/8250/8250_bcm2835aux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c
index 8ce700c1a7fc..4997c519ebb3 100644
--- a/drivers/tty/serial/8250/8250_bcm2835aux.c
+++ b/drivers/tty/serial/8250/8250_bcm2835aux.c
@@ -113,7 +113,7 @@ static int bcm2835aux_serial_remove(struct platform_device *pdev)
 {
 	struct bcm2835aux_data *data = platform_get_drvdata(pdev);
 
-	serial8250_unregister_port(data->uart.port.line);
+	serial8250_unregister_port(data->line);
 	clk_disable_unprepare(data->clk);
 
 	return 0;
-- 
2.24.0


  reply index

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16 12:14 [PATCH 0/6] Raspberry Pi auxiliary UART fixes & cleanups Lukas Wunner
2020-01-16 12:14 ` Lukas Wunner [this message]
2020-01-16 12:14 ` [PATCH 2/6] serial: 8250_bcm2835aux: Suppress clk_get error on -EPROBE_DEFER Lukas Wunner
2020-01-16 12:58   ` Matthias Brugger
2020-01-16 12:14 ` [PATCH 3/6] serial: 8250_bcm2835aux: Suppress register_port " Lukas Wunner
2020-01-16 12:58   ` Matthias Brugger
2020-01-16 12:14 ` [PATCH 4/6] serial: 8250_bcm2835aux: Allocate uart_8250_port on stack Lukas Wunner
2020-01-16 13:06   ` Matthias Brugger
2020-01-16 12:14 ` [PATCH 5/6] serial: 8250_bcm2835aux: Use generic remapping code Lukas Wunner
2020-01-16 12:14 ` [PATCH 6/6] serial: 8250_bcm2835aux: Document struct bcm2835aux_data Lukas Wunner
2020-01-16 13:02   ` Matthias Brugger
2020-01-16 16:11 ` [PATCH 0/6] Raspberry Pi auxiliary UART fixes & cleanups Nicolas Saenz Julienne

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=912ccf553c5258135c6d7e8f404a101ef320f0f4.1579175223.git.lukas@wunner.de \
    --to=lukas@wunner.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=kernel@martin.sperl.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=nsaenzjulienne@suse.de \
    /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

Linux-Serial Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-serial/0 linux-serial/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-serial linux-serial/ https://lore.kernel.org/linux-serial \
		linux-serial@vger.kernel.org
	public-inbox-index linux-serial

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-serial


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git