Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2733186rdb; Tue, 12 Sep 2023 10:20:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZiOUNYrkN8ckSmBDzlGHexT6881YzcSHMlhocnJHkTT+hb2mjbyZy+x9j6B8pB0zernAh X-Received: by 2002:a17:902:f80a:b0:1be:ff74:ec21 with SMTP id ix10-20020a170902f80a00b001beff74ec21mr366149plb.27.1694539215151; Tue, 12 Sep 2023 10:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694539215; cv=none; d=google.com; s=arc-20160816; b=WWXID/GhfxREl2Xv4jVGbZ2u3RsBppdemw6D10tsF3zwTa8ydxTMIm2q9uJlWwHVf/ bP3ykX/VAYkNOKp6ZM2LSofs/sIaD186NZtiqJN9LWkmq/y6Cle+BVQE/96ELQ+10C1+ 1pPUpLdKo6MaT9uBvSLIoA5ibQExqEUVOSZBMJoCMb36uXkm0YDkP7JOeXDYeWwk518w AEjB9ljqhDXuJU4r9yKRCnP9OYMMajLLGtL6y3roJxrQjBgOGeYJCX7M53xWepgiq8o/ JxH0sPdtSS4tlZRpdOc1xqxwhscPqlnY5/UtPzHmmEydCj+PMxhk25c0SgqWfdXWjePJ 1bcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=/rbUp+GBHK0CH+kDSy95NDaFcHudmRBX9ytUr9sGHKc=; fh=+pEOKK4xluj0DFGnswAzUpS/5uIsoOZyK/cWca0wJEs=; b=jRr40R9tmu3/+AhHiqH3Jx0o0kXZ5eq7FI8wA5LVJuqRspTIFCKmg0ZLekBbKrcEo4 atLzSSS38svjyeFYySJExg2gmkgZ2JAYHHLScv0u1/dcHLzUcrKch6wb7cVUckk+Nvp6 dMo7B6iibuVGHIdrxdinwmip7YH8/tK0QP6KsMl4f4NV1ltWdoBVdrL5sjf6CFUWWk1Z 5R/dKSpzISSvzGeU+utVURQswSlGMdhUSNimGMi34uvp5x33LFq0a+uGd2QxNW5cifAi 3kW3OJ/3Jr3u0mrmImtv/FrAXmTXL2PJqQ2oNNKH+e9gVQtLFCu9qQdRncE2y2WCAsTS yn5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="N/2DfbdY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id u18-20020a17090341d200b001b67bdc438csi5763743ple.376.2023.09.12.10.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 10:20:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="N/2DfbdY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 85CDE803B3AF; Tue, 12 Sep 2023 08:17:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236326AbjILPRd (ORCPT + 99 others); Tue, 12 Sep 2023 11:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236294AbjILPRc (ORCPT ); Tue, 12 Sep 2023 11:17:32 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5727D12E; Tue, 12 Sep 2023 08:17:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694531848; x=1726067848; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=9ek7zeRveSjW1HyewGP99m9eXHqbmJXZueDnRe0MSmc=; b=N/2DfbdYstgODafxxGrnpDTc8uEac9MoZ0/DMKA4aIy1+5cYbn8dkFLQ sKBAQhtZ5E3jgZ0V+k0Rmk/xaQpA4Lm69TNm1gW/daFo8xDfegm7qiScq LdltDlcfE5kghl/XJxYsOUHjO3g39+2ozlklJjCdN0e+Fy93ydBIMl+oA aplriftZ+8sBVRzB/Catznky1504OvoW4HQxZc/KxKb9Y/CSsObaO/x9m JDol4ZSWYotIZHNG4unaa7vEZeixOXjN24Cq8IHYLXEXaY8nDRYvpQsk9 S2PTHQpRMnyQ4AnyLW2nF9fyUGECoBPMWygiHLueVlFmmozox19U2B+TV A==; X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="377322543" X-IronPort-AV: E=Sophos;i="6.02,139,1688454000"; d="scan'208";a="377322543" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 08:17:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="858839099" X-IronPort-AV: E=Sophos;i="6.02,139,1688454000"; d="scan'208";a="858839099" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 08:17:24 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qg58j-008cFf-2z; Tue, 12 Sep 2023 18:17:21 +0300 Date: Tue, 12 Sep 2023 18:17:21 +0300 From: Andy Shevchenko To: Tony Lindgren Cc: Greg Kroah-Hartman , Jiri Slaby , Dhruva Gole , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH v2 3/3] serial: core: Add sysfs links for serial core port instances for ttys Message-ID: References: <20230912110350.14482-1-tony@atomide.com> <20230912110350.14482-4-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230912110350.14482-4-tony@atomide.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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 (morse.vger.email [0.0.0.0]); Tue, 12 Sep 2023 08:17:41 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email On Tue, Sep 12, 2023 at 02:03:45PM +0300, Tony Lindgren wrote: > Let's allow the userspace to find out the ttyS style name for a serial > core port device if a tty exists. This can be done with: > > $ grep DEVNAME /sys/bus/serial-base/devices/*/tty/uevent > /sys/bus/serial-base/devices/00:04:0.0/tty/uevent:DEVNAME=ttyS0 > /sys/bus/serial-base/devices/serial8250:0.1/tty/uevent:DEVNAME=ttyS1 > /sys/bus/serial-base/devices/serial8250:0.2/tty/uevent:DEVNAME=ttyS2 > /sys/bus/serial-base/devices/serial8250:0.3/tty/uevent:DEVNAME=ttyS3 > > With this change, we can add /dev/serial/by-id symlinks for the serial > core port device instances. This allows using hardware based port > addressing in addition to the legacy ttyS style naming. > > The serial core port naming is DEVNAME:0.0, such as the 00:04:0.0 above. > The 0.0 above are serial core controller id and port id. The port id and > controller id are typically both zero unless the serial port hardware > controller has multiple controllers or ports. ... > + struct uart_match match = {port, drv}; A nit: struct uart_match match = { .port = port, .driver = drv }; ... > + tty_dev = device_find_child(port->dev, &match, serial_match_port); > + if (tty_dev) { > + ret = sysfs_create_link(&port->port_dev->dev.kobj, &tty_dev->kobj, > + "tty"); I would do it on a single line (you already over 80 anyway). > + put_device(tty_dev); > + if (ret) > + goto err_remove_port; > + } ... > + struct uart_match match = {port, drv}; As per above. ... > + tty_dev = device_find_child(port->dev, &match, serial_match_port); Can be written as tty_dev = device_find_child(phys_dev, &match, serial_match_port); ? > + if (tty_dev) { > + sysfs_remove_link(&port->port_dev->dev.kobj, "tty"); Can be written as sysfs_remove_link(&port_dev->dev.kobj, "tty"); can't be? > + put_device(tty_dev); > + } -- With Best Regards, Andy Shevchenko