From patchwork Mon Sep 3 13:10:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 10585835 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 21129112B for ; Mon, 3 Sep 2018 13:14:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1138E297B8 for ; Mon, 3 Sep 2018 13:14:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04B0D297BF; Mon, 3 Sep 2018 13:14:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 50610297B8 for ; Mon, 3 Sep 2018 13:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=GRYGkSV8KAmyS0Uza8jYPHmruMOFXkT1NCNNSCPsB30=; b=kI+q0gIYIlIsPz5EhyGeJsM1MO kWjK+QUYloWVAl9v/mNeP4u55MRFWwLZv7YfOJoRB4s+KGUjrkGEq92T6NWA18nk28nhoJnwjYltA Pw2wdh1fqGrk+9XjR9zykI2Eo+fVv86gV4DFTx9A0XTn1pMEk3qyibaTd7LPPG+q0QEVAheu8UToh +K+0HwwUV16ygNCAQ451T0en8MBWsvRDvW9wiYJ7CKVm1IjDcycVCaLaiu8zGlNRxcBuC3Qz62AW5 C60FblhT3pSMkZLv5LtF/H3X9sr8Ttn3fk3gbBH2XrbmDVxS1ddy7IUNn6RrYIBYXvf8xwgaFJtt4 L3BH4pIg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fwogH-00029W-0t; Mon, 03 Sep 2018 13:14:13 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fwodO-0000px-Gy for linux-arm-kernel@lists.infradead.org; Mon, 03 Sep 2018 13:11:17 +0000 Received: by mail-wr1-x443.google.com with SMTP id 20-v6so576978wrb.12 for ; Mon, 03 Sep 2018 06:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=xVHVmREQe1YJ/hOcPwmY7D8Tk1cvKWJ1/S6c2AWMoG4=; b=SgxAu2rVzvZ7AkcfWcyy9Og6fZgiRL1A9f+IvI9KLvTKoWKVHrF25UWkGy2DmkPD3J 5l4Maqk8jzDVMJ69Ap/GYApuq/yO5RIhfOzIVKpRFpDWAPD5Di02AInTlFRfab1QyrTK md0zZsH0tqLtTZS/8GayoM/1HIj/4V58tgfaPTcMOpHiqoMs709i5XwKDI8bgZQOtrIk CIyZEsvyneXuxlHu2K0+AF6cPLEWt8wot2qyRbGBpmILUhe0mJqIcVVzBuESv/H0ngmo b6iXCAxlnvMHOHJi9S1XE6YE2USt7hq/KES4s6ylLkeI1AwHKD85xKW3+bseLmCw0UKt KeBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=xVHVmREQe1YJ/hOcPwmY7D8Tk1cvKWJ1/S6c2AWMoG4=; b=Ll1c/cUwAjDH+8ODc5EMXMSxeHI170OWlodIWngeCASAyHEp4DdL64nBO5+/tNn29G +v5agMWVK1ZVVyC3nl3NrGfjx98kFUZ+kEfQw7fx774RDwgfC9imIDe4Vc2rZiX19Cc8 qzss81gq34MTtS16FYEUCwQjj9QZPproVMXvSjY5SZmpE/IJcGP0kr0dXLKtfTRnGVVk edQG9SvhTlNgdYKDXU1JBuwMm5GSIHjoX53zOJn5yhOBjebZORTcm90HzJ+DpREKpjsW Uw1An458ZTq6D66V3kcnLsmf3E3TwcJo5rLEEWSjgOYKoyVOXtmSxfUWcRLi0FcVy61W 27tw== X-Gm-Message-State: APzg51BQsSE92H/iw37JdSL1D1YhLhCl3g+IaH9AfjJy53QES7x8vOBc H0MNgAviRyR9Z/+WjUZwwAQC6w== X-Google-Smtp-Source: ANB0VdZP1ejnhjjrmz8TAFH2GpAT5zfhBOJW3KSqNGqLz/vgKqCbfCWHJuGbz7s76u/72tI0ylWcoA== X-Received: by 2002:adf:9d81:: with SMTP id p1-v6mr18268945wre.12.1535980266368; Mon, 03 Sep 2018 06:11:06 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id b74-v6sm13926847wma.8.2018.09.03.06.11.05 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 03 Sep 2018 06:11:05 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu, gnomes@lxorguk.ukuu.org.uk, Alexander Graf , shubhraj@xilinx.com, robh@kernel.org Subject: [PATCH v3 04/10] serial: uartps: Do not use static struct uart_driver out of probe() Date: Mon, 3 Sep 2018 15:10:52 +0200 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180903_061114_593786_7A6009F5 X-CRM114-Status: GOOD ( 15.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, Jiri Slaby MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP cdns_uart_suspend()/resume() and remove() are using static reference to struct uart_driver. Assign this reference to private data structure as preparation step for dynamic struct uart_driver allocation. Signed-off-by: Michal Simek --- Changes in v3: None Changes in v2: - new patch - it can be sent separately too drivers/tty/serial/xilinx_uartps.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index fc0ecaf3615d..5bd2b0607df6 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -180,6 +180,7 @@ * @port: Pointer to the UART port * @uartclk: Reference clock * @pclk: APB clock + * @cdns_uart_driver: Pointer to UART driver * @baud: Current baud rate * @clk_rate_change_nb: Notifier block for clock changes * @quirks: Flags for RXBS support. @@ -188,6 +189,7 @@ struct cdns_uart { struct uart_port *port; struct clk *uartclk; struct clk *pclk; + struct uart_driver *cdns_uart_driver; unsigned int baud; struct notifier_block clk_rate_change_nb; u32 quirks; @@ -1272,6 +1274,7 @@ static int cdns_uart_console_setup(struct console *co, char *options) static int cdns_uart_suspend(struct device *device) { struct uart_port *port = dev_get_drvdata(device); + struct cdns_uart *cdns_uart = port->private_data; int may_wake; may_wake = device_may_wakeup(device); @@ -1295,7 +1298,7 @@ static int cdns_uart_suspend(struct device *device) * Call the API provided in serial_core.c file which handles * the suspend. */ - return uart_suspend_port(&cdns_uart_uart_driver, port); + return uart_suspend_port(cdns_uart->cdns_uart_driver, port); } /** @@ -1307,6 +1310,7 @@ static int cdns_uart_suspend(struct device *device) static int cdns_uart_resume(struct device *device) { struct uart_port *port = dev_get_drvdata(device); + struct cdns_uart *cdns_uart = port->private_data; unsigned long flags = 0; u32 ctrl_reg; int may_wake; @@ -1314,8 +1318,6 @@ static int cdns_uart_resume(struct device *device) may_wake = device_may_wakeup(device); if (console_suspend_enabled && !may_wake) { - struct cdns_uart *cdns_uart = port->private_data; - clk_enable(cdns_uart->pclk); clk_enable(cdns_uart->uartclk); @@ -1349,7 +1351,7 @@ static int cdns_uart_resume(struct device *device) spin_unlock_irqrestore(&port->lock, flags); } - return uart_resume_port(&cdns_uart_uart_driver, port); + return uart_resume_port(cdns_uart->cdns_uart_driver, port); } #endif /* ! CONFIG_PM_SLEEP */ static int __maybe_unused cdns_runtime_suspend(struct device *dev) @@ -1413,6 +1415,8 @@ static int cdns_uart_probe(struct platform_device *pdev) if (!port) return -ENOMEM; + cdns_uart_data->cdns_uart_driver = &cdns_uart_uart_driver; + match = of_match_node(cdns_uart_of_match, pdev->dev.of_node); if (match && match->data) { const struct cdns_platform_data *data = match->data; @@ -1570,7 +1574,7 @@ static int cdns_uart_remove(struct platform_device *pdev) clk_notifier_unregister(cdns_uart_data->uartclk, &cdns_uart_data->clk_rate_change_nb); #endif - rc = uart_remove_one_port(&cdns_uart_uart_driver, port); + rc = uart_remove_one_port(cdns_uart_data->cdns_uart_driver, port); port->mapbase = 0; clk_disable_unprepare(cdns_uart_data->uartclk); clk_disable_unprepare(cdns_uart_data->pclk);