Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1864822rwo; Thu, 3 Aug 2023 00:29:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlGCunl1pyQnNXzhGcM4/prsZ8JqO83+jvVpz1FUrIKiknLLAkPFjnjKMN4YmjUiQP05PzSL X-Received: by 2002:a05:6359:3112:b0:134:c682:213f with SMTP id rh18-20020a056359311200b00134c682213fmr6896771rwb.31.1691047752011; Thu, 03 Aug 2023 00:29:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691047751; cv=none; d=google.com; s=arc-20160816; b=HQ/qWMrCse+Y7qEgTbzJBz+ZIZTNoc8M/vsPrPXwfMmiI3Jq4auJ2Wcrqj7K/Slwbz q14kR/KPiWeYEo6ehHN2ZMBXID1iKLrw2r6meAmMOeZPmYG9u3t7cfQ3yRCyB0B3ASwr aUjJFlR6+M4VhLJGaem2QBGxCbjCfLlTBcYIfFlzkYoyRk8xqNJbJdIC6wSb3A+lVczt 3Z2OQ7mY2WTjRYUVhd1PSPzSL9bTajkQjHpKiUJpyBWUgbhjQw/3ejf1i3ZVGoSGcSvO FH3kP0MiSHvLR9oaBEk/LF85MiVaVX1oeLqbkVSEwDa5xev6OVt+gEPihJ3uADHAUD8i qDPw== 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 :message-id:date:subject:cc:to:from; bh=SyaeUl84LRN5PlTHHTNzQPk/dAUEIu4UToGZnbg8ZPM=; fh=tjtRR0AeIV3H3iXvv6awkTuO8R/V4QglKkv3GjXJ/LQ=; b=J1qN7o4MhDGObeV0e50UYCCdxI7eoUQ0nCJm3RWU5PmeFkee6ijTJn5TdanD/5aR3D Z31vRqs7IAcPOCu28xThPERL1EOIBFURu/IM5xPagSfGVaPw65k9j7xzEOM2pFI4XUb8 OoDtGgazWXBLiUDiIiepYvLieEh1QVo4pluINMrxmopn95Bw5QRWr24j39dVbfSB59UU wNJwrL1mrCXH3xlCbRt4txMe0EAldtiPKdMPx1TEDT0ykVie8cTaDXAkSxtJcyWyqH7Y NDvn8b2ekQCsXEUCeL72GsTgzsxlAEqEO5olir8ZmpucBgINB5mGcAoN7Rf+W28aoc5v ivLg== 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 u11-20020a6540cb000000b00564a5c89290si254459pgp.363.2023.08.03.00.28.59; Thu, 03 Aug 2023 00:29:11 -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 S233191AbjHCHKq (ORCPT + 99 others); Thu, 3 Aug 2023 03:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232800AbjHCHKo (ORCPT ); Thu, 3 Aug 2023 03:10:44 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9DB23FF; Thu, 3 Aug 2023 00:10:43 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 3808380FE; Thu, 3 Aug 2023 07:10:41 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko Cc: Andy Shevchenko , Dhruva Gole , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, kernel test robot Subject: [PATCH v2 1/1] serial: core: Fix serial_base_match() after fixing controller port name Date: Thu, 3 Aug 2023 10:10:32 +0300 Message-ID: <20230803071034.25571-1-tony@atomide.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 While fixing DEVNAME to be more usable, I broke serial_base_match() as the ctrl and port prefix for device names seemed unnecessary. The prefixes are still needed by serial_base_match() to probe the serial base controller port, and serial tx is now broken. Let's fix the issue by checking against dev->type and drv->name instead of the prefixes that are no longer in the DEVNAME. Fixes: 1ef2c2df1199 ("serial: core: Fix serial core controller port name to show controller id") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202308021529.35b3ad6c-oliver.sang@intel.com Signed-off-by: Tony Lindgren --- Changes since v1: - Leave out magic numbers and use str_has_prefix() as suggested by Andy and Greg - Improve patch description and add a link for Closes tag as suggested by Jiri - Check the name against device_type name since we have it and leave out the changes to try to define names in the header because of the issues noted by Jiri - Leave out Tested-by from Mark and Anders as the patch changed --- drivers/tty/serial/serial_base_bus.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 && + str_has_prefix(drv->name, serial_ctrl_type.name)) + return 1; - return !strncmp(dev_name(dev), drv->name, len); + if (dev->type == &serial_port_type && + str_has_prefix(drv->name, serial_port_type.name)) + return 1; + + return 0; } static struct bus_type serial_base_bus_type = { -- 2.41.0