From patchwork Wed Oct 11 07:43:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 151182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp376055vqb; Wed, 11 Oct 2023 01:10:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyo8//NRxYYelj4J2t0COEePGtuSYiiM2oVQU9iqqXDPof226div2Ow50+nl/+gKEB/QUo X-Received: by 2002:a17:902:d4c9:b0:1b8:9fc4:2733 with SMTP id o9-20020a170902d4c900b001b89fc42733mr23106288plg.3.1697011803655; Wed, 11 Oct 2023 01:10:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697011803; cv=none; d=google.com; s=arc-20160816; b=qEZVEt0U/BmlO5/u0tsYRYUYujsZOFDNkp7CadGJntbNdxHswbvFojaAHpRLSizTHm gI3EjdJ1OSTfQRuJjf3vh8PMjctNJKq/yexmdr4AExSzwccKMfkJ8Dv932cEMqZiA7kI W0/KTryETBjtHDNl+zbRRqipqmzicEigioKjekcakzsoWkDBOgORKeBaudFVMiKQO1Uv 5SCVny9cuezyfoLEEJwoHv6sZXaiKGGAioMNJV2cm+EE7fk7MZ5b9UPiOsan7PxyBKUB ncX3OG3WAESzkhdRDYeC2ed2gR9sPDiKz/gBJbkc0RZE5JO8auXk7U6M9HRY5+Y0bVRW mmcg== 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=HcdX9pGhMV0PdlySN9VHWp5pkVhh9gbCnbH5RavCaE4=; fh=h34g/pJrAVWUE2lbUuESWDeFNvnSJmdayv/hKJm+NgU=; b=narsRX8DsPUbTqPDaRPJf8UGLkI/aFEZ1PMdObe2tgRZm6FOxugtw0855RNkva0ckr xUPQ+pqlP9ceDenHgM1qp4jX//kOXAAg2Ue+ymzv/2EMN2ZaGSUXhyzAa1nKv/rBdht2 V62Wy+3zkqdi844YW3Z8LoWBunr80pZQM2rnzRyQtruHnukNrUu8Rq4P4Th7xIYSPHLt nS3ERPxYB3u+0yFgbGRgmMQaBqtXv39/WspYPgYnxPqWPZ1nFGo4c8SiF5hnWCJ8aU6H lWcthdN9HC0htYVppD7TR5iIf1On6Wg1N+JeYzNoF3cgLRp4ObkpLgfebSPO8jdO+veo h8ng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id u16-20020a170902e81000b001b8698149fbsi14250430plg.477.2023.10.11.01.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 01:10:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 9DF06801E859; Wed, 11 Oct 2023 01:10:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229977AbjJKIJy (ORCPT + 19 others); Wed, 11 Oct 2023 04:09:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345456AbjJKHnu (ORCPT ); Wed, 11 Oct 2023 03:43:50 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 70330AF for ; Wed, 11 Oct 2023 00:43:49 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id C181480E1; Wed, 11 Oct 2023 07:43:47 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman , Petr Mladek , Steven Rostedt , John Ogness , Sergey Senozhatsky Cc: linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH v2 2/2] printk: Constify name for add_preferred_console() Date: Wed, 11 Oct 2023 10:43:26 +0300 Message-ID: <20231011074330.14487-2-tony@atomide.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231011074330.14487-1-tony@atomide.com> References: <20231011074330.14487-1-tony@atomide.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 01:10:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779445848663708416 X-GMAIL-MSGID: 1779445848663708416 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 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 | 2 +- 2 files changed, 2 insertions(+), 2 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 @@ -2520,7 +2520,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); }