Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1853163rwd; Fri, 2 Jun 2023 00:43:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ss4iAS0P63hKVi1EkxJ79attM28AX4c6CyLK8bCDANwr2AGepDci7tW6MjGEoqpOUwZbc X-Received: by 2002:a05:6a20:9381:b0:110:2064:ecb with SMTP id x1-20020a056a20938100b0011020640ecbmr5269716pzh.15.1685691801259; Fri, 02 Jun 2023 00:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685691801; cv=none; d=google.com; s=arc-20160816; b=vp3Co7CgY7s4rLqwyzY3Iu1p34FEoJ7CjFfVECxpih6EHttx3tt5G1+moIbUeBQRFi lx85JfJDl94jcK4Bpfm1qWRL7PDQYlkiwHEOTKAdMTmAEpCDbBHfQv5XvQpPloK2vok9 TWnLSDt0jBsjJPuznqXeYUSw42llAZeOkG04tqGC739BAt/BJMlMSXeBIwPPEI5W+gzy +nKn3eucuaFOONANoDOJfM8x4Kb2Fom9yMUNHKlNSWQE0ZjpVlqI/2pR1870LIIQ6sgU +Fxv2H0gOFY8oVHsNpVmFv7z8TsPBwfk0W0TPZcWnzdnbMR6eNCSyt/Q8LdK4ScsQPvf RcbQ== 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=Wk50Mw2GcpDA4DRVKpnLEkUZRMmyoaCiuN9llyXRzZc=; b=SNOxgxkCpvP3ExlTAFgzH2u2XIVqlnw+tX+CKex8JTuBsrDKqF6JsnVxi9XfeW6tUB se0tLlQ0QxZDZvHQmPVtHVPieHtfSUQWDTlTXeSVBFuF1/M9uIzd1nmkFFT+txpGkF0C Vj5yLVf1G/L8+xukS6N5Dum7LAgrwALrAUKXSEYF4LOwTnuqXMWIIgwlb9LD1w/bN4I0 aSX1uuEZfrWRU4uyVaIPUUjYwKsYONRMImoqOsMe2ATU7YKp6MaaO7lVBcK/Yb/GY3mc /9zi+C5MP4k1Wkx5nrVcrD7hC816Fu9eMhCZelFyzmZ+bCVSwtJXiVGpSLMT1TxLv1L1 3nag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ia+ogJXF; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h186-20020a636cc3000000b0053eee173732si571717pgc.161.2023.06.02.00.43.07; Fri, 02 Jun 2023 00:43:21 -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=@linuxfoundation.org header.s=korg header.b=Ia+ogJXF; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234289AbjFBHkx (ORCPT + 99 others); Fri, 2 Jun 2023 03:40:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232239AbjFBHku (ORCPT ); Fri, 2 Jun 2023 03:40:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D37E195; Fri, 2 Jun 2023 00:40:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8AFE664D00; Fri, 2 Jun 2023 07:40:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A21A1C433EF; Fri, 2 Jun 2023 07:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1685691648; bh=QWLCTnUxuk/bgCq8TXw/6CiD075kLmr0khRTXCmFoDk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ia+ogJXFPRRxmNYYif7JFvwThMXOpsbSDPPDX31kmuuHTFWlXqQM31dRsedh0P9+1 Nwe0teuf+kbxrzMKrFXNKAPiqlU2KVQhHGD0EbOiKRf/UnP32b8OCFkqDw7W401o6w hUfegvmYvdCE211kxJDqH3J54QRitYAaN845R4Hc= Date: Fri, 2 Jun 2023 08:40:45 +0100 From: Greg KH To: Geert Uytterhoeven Cc: andy.shevchenko@gmail.com, Wolfram Sang , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Andy Shevchenko Subject: Re: [PATCH v8 1/1] gpio: add sloppy logic analyzer using polling Message-ID: <2023060209-scouts-affection-f54d@gregkh> References: <20220329091126.4730-1-wsa+renesas@sang-engineering.com> <20220329091126.4730-2-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Fri, Jun 02, 2023 at 08:51:50AM +0200, Geert Uytterhoeven wrote: > Hi Andy, > > CC GregKH > > On Thu, Jun 1, 2023 at 11:40 PM wrote: > > Tue, Mar 29, 2022 at 11:11:26AM +0200, Wolfram Sang kirjoitti: > > > This is a sloppy logic analyzer using GPIOs. It comes with a script to > > > isolate a CPU for polling. While this is definitely not a production > > > level analyzer, it can be a helpful first view when remote debugging. > > > Read the documentation for details. > > > > One note since I have done recent review and realize one issue with debugfs. > > > > ... > > > > > + priv->debug_dir = debugfs_create_dir(devname, gpio_la_poll_debug_dir); > > > > If this fails with NULL... > > > > > + debugfs_create_blob("meta_data", 0400, priv->debug_dir, &priv->meta); > > > + debugfs_create_ulong("delay_ns", 0600, priv->debug_dir, &priv->delay_ns); > > > + debugfs_create_ulong("delay_ns_acquisition", 0400, priv->debug_dir, &priv->acq_delay); > > > + debugfs_create_file_unsafe("buf_size", 0600, priv->debug_dir, priv, &fops_buf_size); > > > + debugfs_create_file_unsafe("capture", 0200, priv->debug_dir, priv, &fops_capture); > > > + debugfs_create_file_unsafe("trigger", 0200, priv->debug_dir, priv, &fops_trigger); > > > > ...and any of these is not, we will end up with the file in a root folder of debugfs... > > > > > + dev_info(dev, "initialized"); Nit, please remove this line. Drivers are quiet when they work properly, don't add to a mess in the kernel log. > > ... > > > > > +static int gpio_la_poll_remove(struct platform_device *pdev) > > > +{ > > > + struct gpio_la_poll_priv *priv = platform_get_drvdata(pdev); > > > + > > > + mutex_lock(&priv->lock); > > > + debugfs_remove_recursive(priv->debug_dir); > > > > ...and this one won't remove it. > > > > > + mutex_unlock(&priv->lock); > > > + mutex_destroy(&priv->lock); > > > + > > > + return 0; > > > +} > > > > ... > > > > However, I haven't checked if it's pure theoretical issue with the current code > > base of debugfs or a potential problem. Easy fix is to check an error code and > > I think debugfs_create_dir() can only fail reasonably due to OOM. > > > skip the files creation. Not sure if driver will be useful in that case. > > Having to add such error checks would really be unfortunate, because > one of the design principles of debugfs is that there is never a need > to check for errors. If you really want, you can check the return value of the directory creation and just return and keep going forward (do NOT propagate an error upwards as drivers need to keep working if debugfs is hosed). But really, the only way the call can fail is if you did something wrong and tried to create a directory that was already there, so don't even worry about checking the return value, all is fine. thanks, greg k-h