Received: by 2002:ab2:23c8:0:b0:1f2:fdbc:cb93 with SMTP id a8csp257002lqe; Wed, 27 Mar 2024 05:06:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXfNemQN51WEZOgDhsisHgTHuJOtIrxRR5MNECZg+3ioxdGirINhZtjNJDOQWw66tl2/bIMtIJwdn2g1OvwbIMqtGwCZQKD4haj7cAS+w== X-Google-Smtp-Source: AGHT+IE46xvZPthQQLAatWMqIOcyXKqVZj4Ae9xCtKr4PPbznVMBAveoDgdS3pZa0O9u/iQviOuQ X-Received: by 2002:a05:6a20:3d0b:b0:1a3:d60c:f16d with SMTP id y11-20020a056a203d0b00b001a3d60cf16dmr5135915pzi.51.1711541188086; Wed, 27 Mar 2024 05:06:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711541188; cv=pass; d=google.com; s=arc-20160816; b=iUabD+Vx3KxndSuaaTo10P4OYrg2ed2f9oqMnroFqP9IpnftF/JMArNokyuZnzrf5F C8B62U1epCvL6WsyOqem0YM6w96Ky7g07lyOO5SqNeUONsUoyw3HN3VbdKxnteQznvjM /mh/1/SiXWYyQ4k3XjPBsqXGG93CEim6j5ZYMKaHv5u1xA9HzJNBl0MYkkn9luwdZUWR ue03EO/O5WOnfSh0z9efz/mQ5D0PEK/vmVdn1Sea6cRWXqOqzyFjZ4pq86FE5SCHuUJV en0R7E8Zd0Ci2qZwFC5SNj0ibPQUTMYDMiDwNJpg3mSIOizqn2o2vn6B3xI9PLJ5Q5Po KaTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Gk0s1gYjF2xQrOB5cswRptTBPAPIZKJZt/fr0+3EIro=; fh=qZjR4FRzCammr0y4Ol3QkScLI4wemh+oQYE39x5b6TU=; b=QDJ3w1NNfA1WDFgiE7lS7WaTnIvSroaTYF/7r7GpctrFw0oPVmW03BN2a2OA5WZwWG aYpnwvbmMK4wPmmrKmoJieMjHTyUr9Fhwc9tqkDU7tSve+Z318Xkp3niFfmY9ZQfsVu5 zbhjQXZodKL8KV6eF1DUXt4vNe0DhhL0zNuDBPgvHVAcStF2dKm7b0+bGyOY2zAp0u39 CkNQhc3Wq4di8z75voFnRK6q0mL1YL3mw135MIrAqOhgWf5f1m4crzDF5k7+SzA46uZi oqgByU+zBsTQd2zaEJTPSFrYWKrGiKgL+/1ljBmsveRrPYXXsPKLiubFdcCoasjIEcEk x4rA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@atomide.com header.s=25mailst header.b="E78haD/l"; arc=pass (i=1 dkim=pass dkdomain=atomide.com); spf=pass (google.com: domain of linux-kernel+bounces-120718-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120718-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id nn16-20020a17090b38d000b002a0493ae5bbsi1381107pjb.111.2024.03.27.05.06.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 05:06:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-120718-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@atomide.com header.s=25mailst header.b="E78haD/l"; arc=pass (i=1 dkim=pass dkdomain=atomide.com); spf=pass (google.com: domain of linux-kernel+bounces-120718-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120718-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B2CAEB24EC9 for ; Wed, 27 Mar 2024 11:05:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C20CD52F94; Wed, 27 Mar 2024 11:04:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=atomide.com header.i=@atomide.com header.b="E78haD/l" Received: from mail5.25mail.st (mail5.25mail.st [74.50.62.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EDC71CA87; Wed, 27 Mar 2024 11:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.50.62.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711537494; cv=none; b=hVcGWJNZthfnvMjCZkN0b7oQsKhIo4fv0rA0ZxMhAvD8rJMRJHVRNpf5vIbW3Vw8XdGUpYw4Tn0prA8x36A6qGXNgA+TLUz+Br7Rveyy1keW7EkzFER4NOC+VetqDWNXKy1eUjZr2tEfbr/6R6Ssk2HhoyctFbqgS5xuHgZP2RY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711537494; c=relaxed/simple; bh=FVa5bi1yq0xqqzfDtP5OhrFMjnS0wCkQGnO4ANrGaIY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iZHRjgyQevlNF6Ot1//xbgw127Jw18oJe9ynZJkcgGAoQinSdxGGUyeuF8jmGOgifrS19+e2n8LqVxkTV5IuKhQOMpwNZKdCadJO2YLrGrPRPBEiYb2rsg0AuCjbtmPIW+0wYU35S61xXeOUtEpO/8IliabMkZHWxJlQXnXfvak= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atomide.com; spf=fail smtp.mailfrom=atomide.com; dkim=pass (2048-bit key) header.d=atomide.com header.i=@atomide.com header.b=E78haD/l; arc=none smtp.client-ip=74.50.62.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atomide.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=atomide.com Received: from localhost (91-158-86-216.elisa-laajakaista.fi [91.158.86.216]) by mail5.25mail.st (Postfix) with ESMTPSA id DCA65604C8; Wed, 27 Mar 2024 11:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=atomide.com; s=25mailst; t=1711537490; bh=FVa5bi1yq0xqqzfDtP5OhrFMjnS0wCkQGnO4ANrGaIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E78haD/lP+5ZeHx6W02O895pt9KyLcJ1lCN5xn6RvQjXOJwhp8hoIVNSetyk8MbBs oOrHHm4BRTFP1EIPRAGzKQZRSWc9diEGPwn0pYcpcFKPx0HZLbzdVe3br1k1t9xMU/ aFViEEAxS0j4OGYa3bRFVVEbCj1ABYMS+580VDe6l8yC0jGtxhU2Te28uy9gLbXWcT gYQyiKY2l9/K27DuVuVHY0b6tCe6cYgcujqIW6ANcUui/Tsw/5f38SYhWdOFOw4Sk3 q7ye56PdUCalsZh9H04+ZKjacM6nGKfzlKpYagztTm6h23pOg7P4UhZBk+rr7tS+3P h7hqOgQKCFB7g== From: Tony Lindgren To: Greg Kroah-Hartman , Jiri Slaby , Jonathan Corbet , Petr Mladek , Steven Rostedt , John Ogness , Sergey Senozhatsky Cc: "David S . Miller" , Andy Shevchenko , Dhruva Gole , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Sebastian Reichel , linux-doc@vger.kernel.org Subject: [PATCH v7 5/7] serial: core: Handle serial console options Date: Wed, 27 Mar 2024 12:59:39 +0200 Message-ID: <20240327110021.59793-6-tony@atomide.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327110021.59793-1-tony@atomide.com> References: <20240327110021.59793-1-tony@atomide.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In order to start moving the serial console quirks out of console_setup(), let's add parsing for the quirks to the serial core layer. We can use serial_base_add_one_prefcon() to handle the quirks. Note that eventually we may want to set up driver specific console quirk handling for the serial port device drivers to use. But we need to figure out which driver(s) need to call the quirk. So for now, we just handle the sparc quirk directly. Signed-off-by: Tony Lindgren --- drivers/tty/serial/serial_base_bus.c | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/tty/serial/serial_base_bus.c b/drivers/tty/serial/serial_base_bus.c --- a/drivers/tty/serial/serial_base_bus.c +++ b/drivers/tty/serial/serial_base_bus.c @@ -219,9 +219,58 @@ static int serial_base_add_one_prefcon(const char *match, const char *dev_name, return ret; } +#ifdef __sparc__ + +/* Handle Sparc ttya and ttyb options as done in console_setup() */ +static int serial_base_add_sparc_console(const char *dev_name, int idx) +{ + const char *name; + + switch (idx) { + case 0: + name = "ttya"; + break; + case 1: + name = "ttyb"; + break; + default: + return 0; + } + + return serial_base_add_one_prefcon(name, dev_name, idx); +} + +#else + +static inline int serial_base_add_sparc_console(const char *dev_name, int idx) +{ + return 0; +} + +#endif + static int serial_base_add_prefcon(const char *name, int idx) { const char *char_match __free(kfree) = NULL; + const char *nmbr_match __free(kfree) = NULL; + int ret; + + /* Handle ttyS specific options */ + if (strstarts(name, "ttyS")) { + /* No name, just a number */ + nmbr_match = kasprintf(GFP_KERNEL, "%i", idx); + if (!nmbr_match) + return -ENODEV; + + ret = serial_base_add_one_prefcon(nmbr_match, name, idx); + if (ret) + return ret; + + /* Sparc ttya and ttyb */ + ret = serial_base_add_sparc_console(name, idx); + if (ret) + return ret; + } /* Handle the traditional character device name style console=ttyS0 */ char_match = kasprintf(GFP_KERNEL, "%s%i", name, idx); -- 2.44.0