Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp193300ybk; Fri, 8 May 2020 23:44:18 -0700 (PDT) X-Google-Smtp-Source: APiQypLjUi3Ig5HaOAQYQ/eFJDfppztv+2bk899dBwDPRkq21GlJvYnuwXpszi7PZErBmHyTfEX8 X-Received: by 2002:a50:9e6a:: with SMTP id z97mr4927361ede.375.1589006658454; Fri, 08 May 2020 23:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589006658; cv=none; d=google.com; s=arc-20160816; b=jLwVebZ+LRcJ/OX71X3SZb8qJv4b4+NVYQJj5Al+z0L2Ggj1ber7XI8ZtcZzWfwKk/ iuymdaxkumdA2ViiEcXgdKEYQxldTyADNjLQNacXjiuwi63YivhlVavN9SoP+cL5rFDx OyWmBiVytv9r1RNf5AlsdtiKnYQwTIjc0FqCaOWelrvSkJywCsmAJHAEPbW0ZbKvScWH RBfeHU6JS8p8rPbWIzdNAwB0lLzeFaojSBy2dLJ5uqWgjr+b52AHQQOEl8UyLSx7xhUW oeM60memiN2T2YBfjtypgk40uduabQBA8nrPChswMrzrH+vIobJ6GLGt/UQhyoj5FIRl SrWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=60n2qMm5K3/KFW4emGr1d3myZn6+1d8YGIMg/Ekg+iA=; b=1IhgNKHiaFelIBTWPww/wrwLoA2cjHFFFd/+lyZuisIxWglPjruJShykRK43OS/KRW OgfJJriD4B9YgppgZPYI/h8dvxkz2eguAzip2FJVvmLgY6MV48GVc9862ybNTTLtWWaS mGCTMCmD59GSdxAzid1EGb5EqMNaVGiCAfPkdx3G9k/5Lz9SpkRB+hEa5A4q2lkC73++ +iMhAb8O3/YUgy8hrq7My8a5lWaFVHvWsC/nxFNwHrX4FaNCOmTKA9VMK5d0/6R4bvh6 Rb+T3hdaVbDU/TU9PI/KX3g4he0mxQW4jAHMXRwpFcJuA84pLU3oWKfwlA+Y2I+UQ72e mjTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p21si2353645edm.75.2020.05.08.23.43.54; Fri, 08 May 2020 23:44:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728892AbgEIGl0 (ORCPT + 99 others); Sat, 9 May 2020 02:41:26 -0400 Received: from mga01.intel.com ([192.55.52.88]:51306 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725940AbgEIGlZ (ORCPT ); Sat, 9 May 2020 02:41:25 -0400 IronPort-SDR: piFth/WoSK8/glW9ye7CfYYXBgno5EGltp69YJ86mhVZlClXrZQZzvgUujUcUv3q6mo039fcdQ NtwzvtJXfajg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2020 23:41:23 -0700 IronPort-SDR: YJehiYscluXueXQs/gNYZzNglJ2ZUgA7gfrzwKaAzb40JSnRpXyf2kufy/NfCn/LYI0D/N4OCp cP1FPhhbWhjA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,370,1583222400"; d="scan'208";a="279251600" Received: from sgsxdev001.isng.intel.com (HELO localhost) ([10.226.88.11]) by orsmga002.jf.intel.com with ESMTP; 08 May 2020 23:41:21 -0700 From: Rahul Tanwar To: gregkh@linuxfoundation.org, linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org, andriy.shevchenko@intel.com, Rahul Tanwar Subject: [PATCH v2 2/2] serial: lantiq: Make driver modular Date: Sat, 9 May 2020 14:41:15 +0800 Message-Id: <7ca89173492b17207da6c85dbec0abed6d4708c7.1589006353.git.rahul.tanwar@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <35f2d002ba1cb26192fe4d9b8cdab275300705bc.1589006353.git.rahul.tanwar@linux.intel.com> References: <35f2d002ba1cb26192fe4d9b8cdab275300705bc.1589006353.git.rahul.tanwar@linux.intel.com> In-Reply-To: <35f2d002ba1cb26192fe4d9b8cdab275300705bc.1589006353.git.rahul.tanwar@linux.intel.com> References: <35f2d002ba1cb26192fe4d9b8cdab275300705bc.1589006353.git.rahul.tanwar@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add changes so Lantiq serial driver can be compiled as a module. Signed-off-by: Rahul Tanwar --- drivers/tty/serial/Kconfig | 4 +++- drivers/tty/serial/lantiq.c | 26 ++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index bb4009a1135f..c0681da66653 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -1034,11 +1034,13 @@ config SERIAL_SIFIVE_CONSOLE boot time.) config SERIAL_LANTIQ - bool "Lantiq serial driver" + tristate "Lantiq serial driver" depends on (LANTIQ || X86) || COMPILE_TEST select SERIAL_CORE help Support for UART on Lantiq and Intel SoCs. + To compile this driver as a module, select M here. The + module will be called lantiq. config SERIAL_LANTIQ_CONSOLE bool "Console on Lantiq UART" diff --git a/drivers/tty/serial/lantiq.c b/drivers/tty/serial/lantiq.c index d3b62a1be6ad..42fa52a224f7 100644 --- a/drivers/tty/serial/lantiq.c +++ b/drivers/tty/serial/lantiq.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -908,6 +909,13 @@ lqasc_probe(struct platform_device *pdev) return ret; } +static int lqasc_remove(struct platform_device *pdev) +{ + struct uart_port *port = platform_get_drvdata(pdev); + + return uart_remove_one_port(&lqasc_reg, port); +} + static const struct ltq_soc_data soc_data_lantiq = { .fetch_irq = fetch_irq_lantiq, .request_irq = request_irq_lantiq, @@ -925,8 +933,11 @@ static const struct of_device_id ltq_asc_match[] = { { .compatible = "intel,lgm-asc", .data = &soc_data_intel }, {}, }; +MODULE_DEVICE_TABLE(of, ltq_asc_match); static struct platform_driver lqasc_driver = { + .probe = lqasc_probe, + .remove = lqasc_remove, .driver = { .name = DRVNAME, .of_match_table = ltq_asc_match, @@ -942,10 +953,21 @@ init_lqasc(void) if (ret != 0) return ret; - ret = platform_driver_probe(&lqasc_driver, lqasc_probe); + ret = platform_driver_register(&lqasc_driver); if (ret != 0) uart_unregister_driver(&lqasc_reg); return ret; } -device_initcall(init_lqasc); + +static void __exit exit_lqasc(void) +{ + platform_driver_unregister(&lqasc_driver); + uart_unregister_driver(&lqasc_reg); +} + +module_init(init_lqasc); +module_exit(exit_lqasc); + +MODULE_DESCRIPTION("Serial driver for Lantiq & Intel gateway SoCs"); +MODULE_LICENSE("GPL v2"); -- 2.11.0