From patchwork Thu Oct 12 06:42:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 151783 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1027321vqb; Wed, 11 Oct 2023 23:43:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF7esoQDt56kBMH9QwvPTP17Gk75nsoWKmgCf26pYbCxV2kFYiQ/5qpz+th46iNVbwlk3f3 X-Received: by 2002:a17:90a:9f83:b0:27c:fbf8:6c43 with SMTP id o3-20020a17090a9f8300b0027cfbf86c43mr5203966pjp.1.1697093011804; Wed, 11 Oct 2023 23:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697093011; cv=none; d=google.com; s=arc-20160816; b=uYR90ighU/VCSUbTnVeqomBFdOUdm+w3qFLMEwvATf2+8gRMFNWU0MBsjt7+vjBOum 2MZ/tXeY8hYtmsjHYmQXFcwlH0qyp2q1SVd4ypb70fP+WBbN1MIb/7sh3EkgOIi9wbTu +QZZEGMZixjvYV/jzeE1GSgR6DwXAR0st9nec2xMXt0zfrQ09kRAtlhpBN/PUEPgixdv ELSd1cwGoSrxKditcmxHOUdzMG5XvBAOLfw4OAZuWq/ELCiHrAC//P7gJMsv0mkhfcGI c9kmqvVkql4mksWnCVXSEpYz7GGCSBwTPlRSd21AMn3n/IaEIVFGWSRqQud1OYzJRZUD Qo3A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+Sx1x42UmLXQyg7VCwWcrYHa8lBglXzKaKcHQBJ7thU=; fh=o8Wp60O6t9aGNhRKrDSNhfZE8Iko7nroMui1s7mpLf8=; b=XtQ5GPkWAOwckIasttZWYWW6oFckJCaPaiZS69+IH/PXjmFZfsos5Nly6faE0gr07p t2XW6WU/4MBfnwkOj7s5Ko62Rm8C+42ohol6wtQ0qb7nTlbXrDH6xTEvwUz63ercM3KC b8ncukDVLV+pj+N7cDOALwuEoJlPsmbvSgxqjrQu6PPYlLYif1p06u4quTzq6pMlWwm+ tVojNlKua5gbxnX5EZg8MnSxtDmZyspuyUtzbgtqm9XuJ9dPlhlcvRxVlMP3dP91VEap awkWTqjXPpFv7kLk4/3j9tjgSwa7PIUwMnek75MiDb9U7dnltaiFFQrtE+8ABnwGURkB 0q4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id bb19-20020a17090b009300b002776e57a5d5si1618341pjb.94.2023.10.11.23.43.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 23:43:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C9B9281130DE; Wed, 11 Oct 2023 23:43:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347090AbjJLGnO (ORCPT + 19 others); Thu, 12 Oct 2023 02:43:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347082AbjJLGnL (ORCPT ); Thu, 12 Oct 2023 02:43:11 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D36CFBE for ; Wed, 11 Oct 2023 23:43:09 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 44A428107; Thu, 12 Oct 2023 06:43:08 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman , Petr Mladek , Steven Rostedt , John Ogness , Sergey Senozhatsky Cc: Jiri Slaby , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] printk: Constify name for add_preferred_console() Date: Thu, 12 Oct 2023 09:42:57 +0300 Message-ID: <20231012064300.50221-2-tony@atomide.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231012064300.50221-1-tony@atomide.com> References: <20231012064300.50221-1-tony@atomide.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 11 Oct 2023 23:43:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779531002020757957 X-GMAIL-MSGID: 1779531002020757957 While adding a preferred console handling for serial_core for serial port hardware based device addressing, Jiri suggested we constify name for add_preferred_console(). The name gets copied anyways. This allows serial core to add a preferred console using serial drv->dev_name without copying it. Note that constifying options causes changes all over the place because of struct console for match(). Suggested-by: Jiri Slaby Reviewed-by: Petr Mladek Signed-off-by: Tony Lindgren --- Changes since v2: - Rebase after fixing patch 1/2 the const char *name mismerge Changes since v1: - Updated to apply on the const short idx change - Separated out of the serial core related patches, the serial core changes still need some more changes for preferred console usage - Added Reviewed-by from Petr from the serial core thread --- include/linux/console.h | 2 +- kernel/printk/printk.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/console.h b/include/linux/console.h --- a/include/linux/console.h +++ b/include/linux/console.h @@ -340,7 +340,7 @@ enum con_flush_mode { CONSOLE_REPLAY_ALL, }; -extern int add_preferred_console(char *name, const short idx, char *options); +extern int add_preferred_console(const char *name, const short idx, char *options); extern void console_force_preferred_locked(struct console *con); extern void register_console(struct console *); extern int unregister_console(struct console *); diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2404,7 +2404,7 @@ static void set_user_specified(struct console_cmdline *c, bool user_specified) console_set_on_cmdline = 1; } -static int __add_preferred_console(char *name, const short idx, char *options, +static int __add_preferred_console(const char *name, const short idx, char *options, char *brl_options, bool user_specified) { struct console_cmdline *c; @@ -2521,7 +2521,7 @@ __setup("console=", console_setup); * commonly to provide a default console (ie from PROM variables) when * the user has not supplied one. */ -int add_preferred_console(char *name, const short idx, char *options) +int add_preferred_console(const char *name, const short idx, char *options) { return __add_preferred_console(name, idx, options, NULL, false); }