Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1841466rwo; Wed, 2 Aug 2023 23:59:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlEKvOVRqFFnBwmJ20gAVmUW19456eI3CzYwbPaxzZo/r2s4YHcjyF/7LXqAQtFGfWlIPBNJ X-Received: by 2002:aa7:de14:0:b0:51b:d567:cfed with SMTP id h20-20020aa7de14000000b0051bd567cfedmr7754064edv.5.1691045999578; Wed, 02 Aug 2023 23:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691045999; cv=none; d=google.com; s=arc-20160816; b=vOAmc62+yB4GrWj8rWHZl+dSjjo71EGvnDvHHZEaeO5bI8z4vWgp7J3mzFDzibQFjl pZ9bXx08gejOB/MJ3VTeuDJBiVVzJ6DubMXd6B/AQtg/wcFR0Yc49Y4+iGppB2mDtw/L knbCDfIH+VUlQV0SsK6n9WZB5KL4/9idy+wQ1VJk3IaAw7kCXt0w47CzHcU4YjbNP8ST LuAjQ3TGPAzrldVn1bjOqc4ai2s6IKHKaa5NRqqnyxnvUmLEYkoduCoCyVhKJRFLnxkS 1Ct4s9krLU/CKXjs+lreMowdW+l/v4MWj9uK2XhnWnLANH3ThCgh+bkVeJTewMPh4rW/ Z+Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=t/+wHAm+pSFsxBZxH6R9J1UEW1BsnRshtaSbp6LTgTk=; fh=+JoELgotblWu69sBNispIoyDbXWLkGfbRuMrHR1NnYQ=; b=NdoocmsX/8UHm4EMwgPtx3brXUrCUvxx+SWFETbwgD03dDinf7RMPuhNekSpSFldtu WsYy892jPOZh6s49KVaUo7lMZyEpjHrymW5q4ZJ1sp7Qfm+2JMaDdfBmnwcfKSvMLs1J 688oNUVcVgcXKksnh5yn0C/sS1PhrWURPIA9//Tx62Wd/eXL01y3HywRClu0CHYc2iUJ RNHyXAwwgssECchRVWHZdyC7f1MN7+QMDKVcszZwBokdrEbZo9/eiFswtowAuan+VZ3z ZyMwVHYtGJ8sA+08mfou18rGBAbejf/G1RAjtUZtaguNgtFJCNIzbg8/i2i2TpQRczLI XeAA== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r11-20020aa7da0b000000b0052275246241si11041451eds.189.2023.08.02.23.59.35; Wed, 02 Aug 2023 23:59:59 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232135AbjHCFNk (ORCPT + 99 others); Thu, 3 Aug 2023 01:13:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231506AbjHCFNj (ORCPT ); Thu, 3 Aug 2023 01:13:39 -0400 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B381E43; Wed, 2 Aug 2023 22:13:37 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-3178dd81ac4so481567f8f.3; Wed, 02 Aug 2023 22:13:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691039616; x=1691644416; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=t/+wHAm+pSFsxBZxH6R9J1UEW1BsnRshtaSbp6LTgTk=; b=d4ad+ZC+kClI2upxC11+SImqqZyeTqMKTuOLkGgqk7rkYixRfmW3N6EmiZbJQIH+tE jmsZ52ipcB8K/M0Ct1HdDWLdfIJrQGu+lLLxJ2eEdy5Aziidjt5A/M2YbBOKWDXCa1am WJmIqHUzem7xVaCuNbE8i2FkqOtTWbMyyI5ij+ch7OIY0Xdv72JnfIE5nwFErOaJWZ2w Rr0HN/fzgRZCqZNPwO6wRsBNlYwz24bWc2J5dlXn3HPRDJfSXXhoAq/qw0JjylUcNB9U pBIlDOlDaqvgZKgZqPC461fNnrfQ+59jN9Ij0Um7RWUNBxLo5ARUmbAm172L4zDXx9ra h4/Q== X-Gm-Message-State: ABy/qLbu5EWV8hYiyroVRNPOdNMgQ8MmsdZZElkZS2iBe/6Wc6svf941 ujtH8TZwMOgCLKxoArnvcHA= X-Received: by 2002:adf:ee52:0:b0:317:57f0:fae with SMTP id w18-20020adfee52000000b0031757f00faemr6252072wro.63.1691039615638; Wed, 02 Aug 2023 22:13:35 -0700 (PDT) Received: from [192.168.1.58] (185-219-167-24-static.vivo.cz. [185.219.167.24]) by smtp.gmail.com with ESMTPSA id c4-20020a056000104400b003143b14848dsm20683080wrx.102.2023.08.02.22.13.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Aug 2023 22:13:34 -0700 (PDT) Message-ID: <496b56e1-1cc3-dfa3-d628-aeab62b9e60f@kernel.org> Date: Thu, 3 Aug 2023 07:13:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 Subject: Re: [PATCH] serial: core: Fix serial_base_match() after fixing controller port name Content-Language: en-US To: Tony Lindgren , Greg Kroah-Hartman , Andy Shevchenko Cc: Andy Shevchenko , Dhruva Gole , =?UTF-8?Q?Ilpo_J=c3=a4rvinen?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, kernel test robot References: <20230802114846.21899-1-tony@atomide.com> From: Jiri Slaby In-Reply-To: <20230802114846.21899-1-tony@atomide.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 On 02. 08. 23, 13:48, Tony Lindgren wrote: > While fixing DEVNAME to be more usable, I broke serial_base_match() as > the ctrl and port prefix for device seemed unnecessary. It's not completely clear to me what you are actually fixing. Please elaborate in more detail. > Let's fix the issue by checking against dev->type and drv->name. > > Fixes: 1ef2c2df1199 ("serial: core: Fix serial core controller port name to show controller id") > Reported-by: kernel test robot Then we are missing a Link here. > Signed-off-by: Tony Lindgren > --- > drivers/tty/serial/serial_base.h | 3 +++ > drivers/tty/serial/serial_base_bus.c | 10 ++++++++-- > drivers/tty/serial/serial_ctrl.c | 2 +- > drivers/tty/serial/serial_port.c | 2 +- > 4 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/drivers/tty/serial/serial_base.h b/drivers/tty/serial/serial_base.h > --- a/drivers/tty/serial/serial_base.h > +++ b/drivers/tty/serial/serial_base.h > @@ -6,6 +6,9 @@ > * Author: Tony Lindgren > */ > > +#define SERIAL_BASE_CTRL_NAME "ctrl" > +#define SERIAL_BASE_PORT_NAME "port" Could you make those char[] instead? The compiler/linker will hopefully (will it?) de-dup the occurrences, but the arrays would look cleaner and safer from this POV. > #define to_serial_base_ctrl_device(d) container_of((d), struct serial_ctrl_device, dev) > #define to_serial_base_port_device(d) container_of((d), struct serial_port_device, dev) > > 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 > @@ -29,9 +29,15 @@ static const struct device_type serial_port_type = { > > static int serial_base_match(struct device *dev, struct device_driver *drv) > { > - int len = strlen(drv->name); > + if (dev->type == &serial_ctrl_type && > + !strncmp(SERIAL_BASE_CTRL_NAME, drv->name, 4)) > + return 1; > > - return !strncmp(dev_name(dev), drv->name, len); > + if (dev->type == &serial_port_type && > + !strncmp(SERIAL_BASE_PORT_NAME, drv->name, 4)) > + return 1; > + > + return 0; > } > > static struct bus_type serial_base_bus_type = { > diff --git a/drivers/tty/serial/serial_ctrl.c b/drivers/tty/serial/serial_ctrl.c > --- a/drivers/tty/serial/serial_ctrl.c > +++ b/drivers/tty/serial/serial_ctrl.c > @@ -47,7 +47,7 @@ void serial_ctrl_unregister_port(struct uart_driver *drv, struct uart_port *port > } > > static struct device_driver serial_ctrl_driver = { > - .name = "ctrl", > + .name = SERIAL_BASE_CTRL_NAME, > .suppress_bind_attrs = true, > .probe = serial_ctrl_probe, > .remove = serial_ctrl_remove, > diff --git a/drivers/tty/serial/serial_port.c b/drivers/tty/serial/serial_port.c > --- a/drivers/tty/serial/serial_port.c > +++ b/drivers/tty/serial/serial_port.c > @@ -83,7 +83,7 @@ void uart_remove_one_port(struct uart_driver *drv, struct uart_port *port) > EXPORT_SYMBOL(uart_remove_one_port); > > static struct device_driver serial_port_driver = { > - .name = "port", > + .name = SERIAL_BASE_PORT_NAME, > .suppress_bind_attrs = true, > .probe = serial_port_probe, > .remove = serial_port_remove, -- js suse labs