Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp531295pxu; Fri, 11 Dec 2020 08:03:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhJVJiYDiFv/wgGamGmPu5zK2ZGGxEOxxz+oKx9eRj7Qwxz64mYXWV3Fy2o9OHoU8ABA0D X-Received: by 2002:a17:906:a4b:: with SMTP id x11mr11421696ejf.11.1607702614161; Fri, 11 Dec 2020 08:03:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607702614; cv=none; d=google.com; s=arc-20160816; b=l5a2PjoSzjbicvaNaeMvK1xdxnTt0QjEfDW3yJ+SxXom66bwruYwB44Ct53GUp02Ni /X0V8cwoOKUQyWYKMbARRzwCDhFWkf1tqhLGoPG2c5CQ8BFRdh0cQ1hf2GLIA+JPzVBh ix977TgGEQ5c3jzTv55TDsGHYvgZkD7WIXTpZSEw/FjA0ePjAvbD+1n82BdnKAe3hmiZ xYmQaRn9bXNFlIiJYNzEUrC8C6F5m1gzsMc7iMdhdSANihwb/dhRMshFPkNAnRILaECv U3BdBzCahV+pAoBavGaL5wwTjwg7GOXJ5uP/UKuVTYESCjNrMCI8ONNzao1CEpZjkQMu dz7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=MTuxwf9KusT/ntlnVCF0gMBlWlskbWARxkaUDrHOkdo=; b=C3gZsYyLvTvGmgMSfn1uDywmy2I3L63UivuDsjuvyyaIU9UTGYJcQsldfrsc7bH6W/ lNQCOPB0JPZROQkp0HXS5NcYH97FS+/sbXQHZpUTq/C4gtrXPpGb33wa8oX9autRjlTz scxHkP9ISPo91tty0OunyC9kt/6ceX8QqEu6Quvi9U3C+zswvZIp/54IkZN5LO4BgrSy Kphi1UtVsDO23+j+c2sDINuHa0yzcGVTFMbBXnxi30qzQ0WBLVNR5/tnJ3q23N6EtZfU Od7tHZ1V/vnl7Ap23qMuwGa8jtUEpaZia0khOidtsc0SidCE0U1ur0H4t6oBYsY/OZGB gBPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="ra/WyZQo"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si5011005edx.538.2020.12.11.08.03.07; Fri, 11 Dec 2020 08:03:34 -0800 (PST) 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; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="ra/WyZQo"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394684AbgLKA6n (ORCPT + 99 others); Thu, 10 Dec 2020 19:58:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394682AbgLKA60 (ORCPT ); Thu, 10 Dec 2020 19:58:26 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F2C9C0613CF for ; Thu, 10 Dec 2020 16:57:46 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id d2so5879044pfq.5 for ; Thu, 10 Dec 2020 16:57:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MTuxwf9KusT/ntlnVCF0gMBlWlskbWARxkaUDrHOkdo=; b=ra/WyZQoH+AGVlTrKDauhvPdiS00/pxJvs9pj4d37efoZQNZVc+YC1W+GtSV7wDQMv 3Mvpwy7tvnA3/aqi6p8jyeGn0RiTWUQzE26nqhAEyR6TfToOa6tfqR/WnOi+SIx2rSjl /Ps0Va+qa275/zgoJ4ATYKXWrjKpbYdpMxcm7iLqoC+1WKuYLh4B3j95Cz1dvR3hEXEw AqPD+8q9+w7dwHS9riwHOjGYOsr05T3IFKZkynpELZtrlObf0jCMlMw/2M4ICCJQGYxr d5hGfjj7Q2LHqEf0FebkxA0WQ+JAXOeSrNEh8ZScYqFJn8LIUmGoyRRvZHSe6LWnB/dn EVnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MTuxwf9KusT/ntlnVCF0gMBlWlskbWARxkaUDrHOkdo=; b=hbzKrVJlSiv0X2PBkuwUsi+uHGbk1ix3f97csxbEs9zG4BuQcrlfkQh344e7tQL6Ht diShJ2MD7T0LAAed+qkW2ABo4NZGlkGuFBro3xF7qMPoI8GqjNXw5XvtV6nmq9QRK6Na ExswiXcmIh/mXA6Iewy/IEtcSF7Nwyzzv8LxZtn13bglvuAS30dCexSMLT1SVgliSUar drKoc85AyU3AhE+OfJtJ3FvuGt+e+0R7CEdlQrh17nmap2QMCR31guU5sXdCHskaFnPf /wVBTj9iJvSQ+QtqQ0QkKzF7cyd8tVjhIpHdNMJhCSwftKSVoPB5V7NktZEPz+8fhZFl IVmw== X-Gm-Message-State: AOAM533ziKKjsRG75qHtnUxgZbtj96Z551QMngg1yfGWYta8ue13F5Ej 558d+8L1CodIRVEBjh7Rj3B0SUeKwWzH/Myt X-Received: by 2002:a65:518a:: with SMTP id h10mr9153953pgq.340.1607648265788; Thu, 10 Dec 2020 16:57:45 -0800 (PST) Received: from localhost (c-71-197-186-152.hsd1.wa.comcast.net. [71.197.186.152]) by smtp.gmail.com with ESMTPSA id x6sm6829532pgr.20.2020.12.10.16.57.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 16:57:45 -0800 (PST) From: Kevin Hilman To: linux-serial@vger.kernel.org Cc: Greg Kroah-Hartman , Jiri Slaby , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Amlogic Meson SoC support), linux-amlogic@lists.infradead.org (open list:ARM/Amlogic Meson SoC support) Subject: [PATCH] tty: serial: meson: enable console as module Date: Thu, 10 Dec 2020 16:57:44 -0800 Message-Id: <20201211005744.12855-1-khilman@baylibre.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Enable serial driver to be built as a module. To do so, init the console support on driver/module load instead of using console_initcall(). Signed-off-by: Kevin Hilman --- Yes, I'm well aware that having the serial console as a module makes devices hard to debug, so I'm not changing any default behavior. The goal is just to enable building as a module for environments where serial debug is not available or needed. drivers/tty/serial/Kconfig | 2 +- drivers/tty/serial/meson_uart.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 1044fc387691..c3fa78e63357 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -206,7 +206,7 @@ config SERIAL_MESON config SERIAL_MESON_CONSOLE bool "Support for console on meson" - depends on SERIAL_MESON=y + depends on SERIAL_MESON select SERIAL_CORE_CONSOLE select SERIAL_EARLYCON help diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c index d2c08b760f83..69eeef9edfa5 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -604,7 +604,6 @@ static int __init meson_serial_console_init(void) register_console(&meson_serial_console); return 0; } -console_initcall(meson_serial_console_init); static void meson_serial_early_console_write(struct console *co, const char *s, @@ -634,6 +633,9 @@ OF_EARLYCON_DECLARE(meson, "amlogic,meson-ao-uart", #define MESON_SERIAL_CONSOLE (&meson_serial_console) #else +static int __init meson_serial_console_init(void) { + return 0; +} #define MESON_SERIAL_CONSOLE NULL #endif @@ -824,6 +826,10 @@ static int __init meson_uart_init(void) { int ret; + ret = meson_serial_console_init(); + if (ret) + return ret; + ret = uart_register_driver(&meson_uart_driver); if (ret) return ret; -- 2.29.2