Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7779332rwp; Tue, 18 Jul 2023 23:26:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlERBsMqEX5wfiDSlDlytb8kdRUuE4Byc2zMbk1YlGCLhzpEwmuKuyESFhn3dADRBI2UVf46 X-Received: by 2002:a17:906:3019:b0:992:ba2c:2e0c with SMTP id 25-20020a170906301900b00992ba2c2e0cmr1785004ejz.36.1689747979053; Tue, 18 Jul 2023 23:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689747979; cv=none; d=google.com; s=arc-20160816; b=DcHWmvTTXoEax/f4uk78MplzHf/VV/COLoJDRs3975oBoggwo2VzLGcdnEC71kjY3e ydZHBDjd9P4LvvXCIcE/nOgKq9d2CDqazX4l3mD86D3wKQnUCVCsx/ifDijj910eY9OR 68eK8rSbpEm816tQYTSAiL8q8VGOvHth0Vo8DRgjHjN3lOwYjMLPjYwKgIepZKHskCKw ebTAFUgUAVl7rjDURKDmZirN8j/WNQqBL2UXgpnmYIJPaTAmY6rkaRT6YGUigULWzOkm GlH/1Uk5SKm8s74ZwSfEhnCywEnKGM9h677fyeUgWPsre2XOmsjTr+5IuUHuWrIZglhb h+1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=9+3Oh4n6dNpTypRzfyKGUIxk8BvxlocW8ST/NmptA7E=; fh=sdaWjGZDVrCHhqC2e+AlD4SlbV76MYs2+VXRRtktoXw=; b=vpTNNem+HLO1XP11IdEk0C5+VL42RlXrvmC5vKgSDB6w17vLSSvTLykVvNa0Px1ikW 8+l0uydzOXzZs2KWEgkYo2zHO0k+6seY8MiSbiB/ug2euFx60mmHsQylRaA36cdWaeRk PiY98q59c8EoJF5Ut/ozHdzbQtHYkAO48BGgf0hyc0Sz+1YwvZ8SQIhlnmWUpLPdOY2J 1UelCv4codXhm4xvHu4n6TGWivjzgyaPnyqTbIwZn5MPZi3cibSLKYDwUjf49Es0zF+6 vSvblHenMrpNJzaBKRO4d1mbwizrrIxOEym30fqn3TzaG15HlRKSBFZwFn+XnwX2PhhR 3KrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s27-20020a170906355b00b00997eac101cfsi1245742eja.960.2023.07.18.23.25.54; Tue, 18 Jul 2023 23:26:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229838AbjGSFte (ORCPT + 99 others); Wed, 19 Jul 2023 01:49:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbjGSFtd (ORCPT ); Wed, 19 Jul 2023 01:49:33 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5A9161BF5; Tue, 18 Jul 2023 22:49:32 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 9F07D80AA; Wed, 19 Jul 2023 05:49:31 +0000 (UTC) Date: Wed, 19 Jul 2023 08:49:30 +0300 From: Tony Lindgren To: Jiri Slaby Cc: Greg Kroah-Hartman , Andy Shevchenko , Dhruva Gole , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-omap@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] serial: core: Add support for dev_name:0.0 naming for kernel console Message-ID: <20230719054930.GK5194@atomide.com> References: <20230719051525.46494-1-tony@atomide.com> <35758c24-1543-6f96-7957-b371dc94e59d@kernel.org> <20230719052811.GH5194@atomide.com> <87431096-e883-c90d-853e-44a463c0e8f2@kernel.org> <20230719053220.GI5194@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 * Jiri Slaby [230719 05:36]: > On 19. 07. 23, 7:32, Tony Lindgren wrote: > > * Jiri Slaby [230719 05:29]: > > > On 19. 07. 23, 7:28, Tony Lindgren wrote: > > > > * Jiri Slaby [230719 05:25]: > > > > > On 19. 07. 23, 7:15, Tony Lindgren wrote: > > > > > > +/* > > > > > > + * Add preferred console if configured on kernel command line with naming > > > > > > + * "console=dev_name:0.0". > > > > > > + */ > > > > > > +static int serial_core_add_preferred_console(struct uart_driver *drv, > > > > > > + struct uart_port *port) > > > > > > +{ > > > > > > + char *port_match, *opt, *name; > > > > > > + int len, ret = 0; > > > > > > + > > > > > > + port_match = kasprintf(GFP_KERNEL, "console=%s:%i.%i", > > > > > > + dev_name(port->dev), port->ctrl_id, > > > > > > + port->port_id); > > > > > > + if (!port_match) > > > > > > + return -ENOMEM; > > > > > > + > > > > > > + opt = strstr(saved_command_line, port_match); > > > > > > + if (!opt) > > > > > > + goto free_port_match; > > > > > > + > > > > > > + len = strlen(port_match); > > > > > > + > > > > > > + if (strlen(opt) > len + 1 && opt[len] == ',') > > > > > > + opt += len + 1; > > > > > > + else > > > > > > + opt = NULL; > > > > > > + > > > > > > + name = kstrdup(drv->dev_name, GFP_KERNEL); > > > > > > > > > > Why do you dup the name here? > > > > > > > > I was getting ignoring const warning, but maybe the right solution is > > > > to just use const char *name here.. Let me check. > > > > > > So fix add_preferred_console() instead ;). > > > > Let's see what kind of trouble changing it to use const char *name > > might be. > > I don't see any, the string is copied internally. So it should be > straightforward. Actually all three parameters of __add_preferred_console() > should be const, IMO. But that involves changing struct console_cmdline. But > that should be straightforward too. Yeah I'll send a patch for that. > Aside from that, why do you parse saved_command_line on your own? Instead of > using setup() or other commonly used mechanisms for command line handling? Hmm that might be easier yeah :) Regards, Tony