Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp864053rwl; Thu, 10 Aug 2023 02:52:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSC0loPKlW6n19UEXftTUoUDZefYQI3w56dgT1d9BFyF/IyPOjVgrhlUxMRd1kbskzrYEm X-Received: by 2002:a05:6402:3448:b0:522:201f:dee8 with SMTP id l8-20020a056402344800b00522201fdee8mr1783402edc.0.1691661175488; Thu, 10 Aug 2023 02:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691661175; cv=none; d=google.com; s=arc-20160816; b=YIWlqbl6KdGDXUPNTsoHZevJGD5apHhbmz5l02HK3t3UGNoXTHCTJm2NBgDE5b+TSn 6KNZ5fDbmbdo3yL0kiciREgEMqduF9hAAsvDkG+NiUF6/Xt8xjtJYvfz/aBOb11Ot0aS 8td58Ni4oDDtvVjXcKdiicBh9/kjXKycGu+z20YK7CiVPmBH9ahYdHSewneWwDjSDCFJ WgpDnDl6Kb1yl6aYZoByHcfeuJcHqI4kMQjdVDj03v+YSjxsQwNJhC19hQr6upEoDy4y cTyBvQ1s3eYOhm7g/uZIYux2I46MYFDBaDaT2MFzU4UfnDYaQrZme8NxDlJTBz8Bsk5m TwMA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TK+7eZtAxQ6ybowS5kLhfjD7TB/ir+8Wnhi5be/ubNE=; fh=YZMMBt+SM8tx3yMP4mImPoXnhZEsYGzg6kTB65ASl3k=; b=pXLjdP+1RGLntjWdNB8IOeOlJZ3xI2HRo2nxymlOviHiO90WS+92LRjWsdC2RiWhw0 0swLbcZGNUyi3bKe/1hARmwj4AcGmxj6IZOHPdw87BiL9DlokoMQ+iQPR4UzDJRrbWDq yDJZFojnVhJbvfT5NPyYdZVHlz1CSt7RGnSQhven0zMjAh4auZtZxOhOW0xNmvYQYCHX B0GT89Wlx3I7G/NHywpEENaGaSHNHBNpFzuMS+DiMbWkwsZkaCntN52zjVZEZgMIuPHv RmrGC09sdAZnO8POx3yfxQQHIw/ZWhMeeL1Ps/NZ5hNALQ6g2PlI2QC8Gqm0i0n3wYpT CmVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=DcBHrFn7; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w25-20020a056402129900b005222c7ab4d9si1146601edv.351.2023.08.10.02.52.29; Thu, 10 Aug 2023 02:52:55 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=DcBHrFn7; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234254AbjHJIjX (ORCPT + 99 others); Thu, 10 Aug 2023 04:39:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230064AbjHJIjX (ORCPT ); Thu, 10 Aug 2023 04:39:23 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01B55DC; Thu, 10 Aug 2023 01:39:20 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 37A8aZxA116335; Thu, 10 Aug 2023 03:36:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1691656595; bh=TK+7eZtAxQ6ybowS5kLhfjD7TB/ir+8Wnhi5be/ubNE=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=DcBHrFn7DCDbqpqYrSKzTvhrG1Q7FxcHW9tZJiQZITJC3ycPXRvz1fTik9j6G1BdW tMu++J9R+farI/CttE7v8a6bxKnBVUVnxlCYPanoGeu6jJP8GSmh5NCqcU5/sgIeiN cTpU4ZAz85155g5AVEwyz0AB+B4zbQSPjC4r1O68= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 37A8aZ73088447 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 10 Aug 2023 03:36:35 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 10 Aug 2023 03:36:35 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 10 Aug 2023 03:36:35 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 37A8aYjQ045402; Thu, 10 Aug 2023 03:36:34 -0500 Date: Thu, 10 Aug 2023 14:06:33 +0530 From: Dhruva Gole To: Tony Lindgren CC: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , , , Guenter Roeck Subject: Re: [PATCH] serial: core: Fix serial core port id, including multiport devices Message-ID: <20230810083633.tu2na6fcbg2kv53s@dhruva> References: <20230810065737.47294-1-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230810065737.47294-1-tony@atomide.com> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS 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 On Aug 10, 2023 at 09:57:34 +0300, Tony Lindgren wrote: > We want to fix the serial core port DEVNAME to use a port id of the > hardware specific controller port instance instead of the port->line. > > For example, the 8250 driver sets up a number of serial8250 ports > initially that can be inherited by the hardware specific driver. At that > the port->line no longer decribes the port's relation to the serial core > controller instance. > > Let's fix the issue by assigning port->port_id for each serial core > controller port instance. > > Fixes: 7d695d83767c ("serial: core: Fix serial_base_match() after fixing controller port name") > Tested-by: Guenter Roeck > Signed-off-by: Tony Lindgren > --- Please can you provide the base commit? I am unable to cleanly apply this patch on commit: 21ef7b1e17d0 (tag: next-20230809, linux-next/master) Add linux-next specific files for 20230809 > drivers/tty/serial/serial_base.h | 1 + > drivers/tty/serial/serial_base_bus.c | 28 +++++++++++++++++++++++++++- > 2 files changed, 28 insertions(+), 1 deletion(-) > [...] > > struct serial_port_device { > 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 > @@ -10,6 +10,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -112,6 +113,8 @@ struct serial_ctrl_device *serial_base_ctrl_add(struct uart_port *port, > if (!ctrl_dev) > return ERR_PTR(-ENOMEM); > > + ida_init(&ctrl_dev->port_ida); > + > err = serial_base_device_init(port, &ctrl_dev->dev, > parent, &serial_ctrl_type, > serial_base_ctrl_release, > @@ -142,16 +145,31 @@ struct serial_port_device *serial_base_port_add(struct uart_port *port, > struct serial_ctrl_device *ctrl_dev) > { > struct serial_port_device *port_dev; > + unsigned int min = 0, max = ~0U; > int err; > > port_dev = kzalloc(sizeof(*port_dev), GFP_KERNEL); > if (!port_dev) > return ERR_PTR(-ENOMEM); > > + /* Device driver specified port_id vs automatic assignment? */ > + if (port->port_id) { > + min = port->port_id; > + max = port->port_id; > + } > + > + err = ida_alloc_range(&ctrl_dev->port_ida, min, max, GFP_KERNEL); > + if (err < 0) { > + kfree(port_dev); > + return ERR_PTR(err); > + } > + > + port->port_id = err; > + > err = serial_base_device_init(port, &port_dev->dev, > &ctrl_dev->dev, &serial_port_type, > serial_base_port_release, > - port->ctrl_id, port->line); > + port->ctrl_id, port->port_id); > if (err) > goto err_put_device; > > @@ -165,16 +183,24 @@ struct serial_port_device *serial_base_port_add(struct uart_port *port, > > err_put_device: > put_device(&port_dev->dev); > + ida_free(&ctrl_dev->port_ida, port->port_id); > > return ERR_PTR(err); > } > > void serial_base_port_device_remove(struct serial_port_device *port_dev) > { > + struct serial_ctrl_device *ctrl_dev; > + struct device *parent; > + > if (!port_dev) > return; > > + parent = port_dev->dev.parent; > + ctrl_dev = to_serial_base_ctrl_device(parent); > + > device_del(&port_dev->dev); > + ida_free(&ctrl_dev->port_ida, port_dev->port->port_id); > put_device(&port_dev->dev); > } > > -- > 2.41.0 > This is the issue I faced: ➜ patch -p1 < patches/20230810_tony_serial_core_fix_serial_core_port_id_including_multiport_devices.mbx patching file drivers/tty/serial/serial_base.h patching file drivers/tty/serial/serial_base_bus.c Hunk #3 FAILED at 145. 1 out of 4 hunks FAILED -- saving rejects to file drivers/tty/serial/serial_base_bus.c.rej Perhaps this patch needs a rebase? -- Best regards, Dhruva Gole