linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <shubhrajyoti.datta@gmail.com>
To: <linux-serial@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <gregkh@linuxfoundation.org>, <jslaby@suse.com>,
	<jacmet@sunsite.dk>,
	Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>,
	Michal Simek <michal.simek@xilinx.com>
Subject: [LINUX PATCHv3 3/9] serial-uartlite: Do not use static struct uart_driver out of probe()
Date: Tue, 16 Oct 2018 15:48:02 +0530	[thread overview]
Message-ID: <1539685088-13465-4-git-send-email-shubhrajyoti.datta@gmail.com> (raw)
In-Reply-To: <1539685088-13465-1-git-send-email-shubhrajyoti.datta@gmail.com>

From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>

ulite_uart_suspend()/resume() and remove() are using static reference
to struct uart_driver. Assign this referece to private data structure
as preparation step for dynamic struct uart_driver allocation.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/tty/serial/uartlite.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index 441a216..64c7248 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -63,6 +63,7 @@ static struct uart_port *console_port;
 struct uartlite_data {
 	const struct uartlite_reg_ops *reg_ops;
 	struct clk *clk;
+	struct uart_driver *ulite_uart_driver;
 };
 
 struct uartlite_reg_ops {
@@ -691,10 +692,11 @@ static int ulite_assign(struct device *dev, int id, u32 base, int irq,
 static int ulite_release(struct device *dev)
 {
 	struct uart_port *port = dev_get_drvdata(dev);
+	struct uartlite_data *pdata = port->private_data;
 	int rc = 0;
 
 	if (port) {
-		rc = uart_remove_one_port(&ulite_uart_driver, port);
+		rc = uart_remove_one_port(pdata->ulite_uart_driver, port);
 		dev_set_drvdata(dev, NULL);
 		port->mapbase = 0;
 	}
@@ -711,9 +713,10 @@ static int ulite_release(struct device *dev)
 static int __maybe_unused ulite_suspend(struct device *dev)
 {
 	struct uart_port *port = dev_get_drvdata(dev);
+	struct uartlite_data *pdata = port->private_data;
 
 	if (port)
-		uart_suspend_port(&ulite_uart_driver, port);
+		uart_suspend_port(pdata->ulite_uart_driver, port);
 
 	return 0;
 }
@@ -727,9 +730,10 @@ static int __maybe_unused ulite_suspend(struct device *dev)
 static int __maybe_unused ulite_resume(struct device *dev)
 {
 	struct uart_port *port = dev_get_drvdata(dev);
+	struct uartlite_data *pdata = port->private_data;
 
 	if (port)
-		uart_resume_port(&ulite_uart_driver, port);
+		uart_resume_port(pdata->ulite_uart_driver, port);
 
 	return 0;
 }
@@ -804,6 +808,7 @@ static int ulite_probe(struct platform_device *pdev)
 		pdata->clk = NULL;
 	}
 
+	pdata->ulite_uart_driver = &ulite_uart_driver;
 	ret = clk_prepare_enable(pdata->clk);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to prepare clock\n");
-- 
2.1.1


  parent reply	other threads:[~2018-10-16 10:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 10:17 [LINUX PATCHv3 0/9] serial-uartlite: Add support for dynamic allocation shubhrajyoti.datta
2018-10-16 10:18 ` [LINUX PATCHv3 1/9] serial-uartlite: Move the uart register shubhrajyoti.datta
2018-10-16 10:18 ` [LINUX PATCHv3 2/9] serial-uartlite: Add get serial id if not provided shubhrajyoti.datta
2018-10-16 10:18 ` shubhrajyoti.datta [this message]
2018-10-16 10:18 ` [LINUX PATCHv3 4/9] serial-uartlite: Add runtime support shubhrajyoti.datta
2018-10-16 10:18 ` [LINUX PATCHv3 5/9] serial-uartlite: Fix the unbind path shubhrajyoti.datta
2018-10-16 10:18 ` [LINUX PATCHv3 6/9] serial-uartlite: Change logic how console_port is setup shubhrajyoti.datta
2018-10-16 14:09   ` kbuild test robot
2018-10-16 10:18 ` [LINUX PATCHv3 7/9] serial-uartlite: Use allocated structure instead of static ones shubhrajyoti.datta
2018-10-16 10:18 ` [LINUX PATCHv3 8/9] serial-uartlite: Remove ULITE_NR_PORTS macro shubhrajyoti.datta
2018-10-16 10:18 ` [LINUX PATCHv3 9/9] serial-uartlite: Remove SERIAL_UARTLITE_NR_UARTS shubhrajyoti.datta
2018-11-09 16:45 ` [LINUX PATCHv3 0/9] serial-uartlite: Add support for dynamic allocation Greg KH

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=1539685088-13465-4-git-send-email-shubhrajyoti.datta@gmail.com \
    --to=shubhrajyoti.datta@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jacmet@sunsite.dk \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=shubhrajyoti.datta@xilinx.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).