From patchwork Mon Sep 25 10:09:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 144453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1268784vqu; Mon, 25 Sep 2023 07:52:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnVPfEdWVdaG9rP300C+OaEwsmEbQow/SzrqI1eXtHeAjVU2Dwk1U8CguWYLEPYj5NQcz9 X-Received: by 2002:a05:6a21:47ca:b0:15e:921d:19c5 with SMTP id as10-20020a056a2147ca00b0015e921d19c5mr4266181pzc.54.1695653579594; Mon, 25 Sep 2023 07:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695653579; cv=none; d=google.com; s=arc-20160816; b=R94DRWplWPaSs9jM/piyuj/n8KFOo+IfY/4tIubZMgZqotcZeE8TJwELlGYhAVSnvo 93MATAgsS5JlUloiqls6uRb84r79srorjrTPvoQyqH6Qxsu9DwVWP5a93vIXiKJOQYR5 lBpcQAxzRJqlFrz04iB5HWcO/+IUaKOwdCm3O8VZlONa3kx7Q5AIXBj3nhbX2+6Z2wB2 X6rMZAWDgwdtIm0Mi164psb+c0Kv47NUXdqYdMsTUG3A5hZQpu7lfCUR8LPaeAHeJcWp KCfRuD3DLKu/MC0l/EGR3WwJ/QJRNxOsqnZyVSIeMVGssmuHOXVcUfCwI6kpLENWcdn9 boTA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=H2wyU2rmP9lqduXbPLrNIXYzZXO+lL7+kolCQ5oMH2g=; fh=OAXu+6B60s53cNl9dyQ0pFYr542Omdd5vE01wUx7zG4=; b=c6x2B60YZxr0lKQcKnJk9yO4vgmo9xZuUQlgV7qz2Fk2oIVjLBh0fhJMCdMFKayfaE nAasCFwB/LM3tJ8p3TCLOSaAGQM6DbsYR+RIQDZcutHSGQ2gWT1oZIFwa09Enwf9ssZY xWXgMhiDwXWlguA2U6P7IaYUynwiuxfK11PE4/zHavil/zrMriyDNZMkmoD2OUAq9H9l sbHtve9Tl0zLYlS+F5Ssb6ddzWpjhogYz0hFp+izwfu8Fl7hdnwspOvdC4x3IY1URWT6 /KNm8q+VUdOPQsKOOR0XXEQoPvt+Brp76DQcGqwtPje4AHmc4ITSejODDzvGmu4n9kMJ 9tmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=Fs3XLuAW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id ij9-20020a170902ab4900b001c5e1816251si5029724plb.497.2023.09.25.07.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 07:52:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=Fs3XLuAW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 6617580859B7; Mon, 25 Sep 2023 03:10:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231488AbjIYKKh (ORCPT + 29 others); Mon, 25 Sep 2023 06:10:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231344AbjIYKKY (ORCPT ); Mon, 25 Sep 2023 06:10:24 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3F95E4F for ; Mon, 25 Sep 2023 03:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=H2wyU2rmP9lqduXbPLrNIXYzZXO+lL7+kolCQ5oMH2g=; b=Fs3XLu AWp7kVj+DJCd8vZzjieyE+WQ9bS3x3/c7EJT16Hvf9jtIom/cIepOL1/3zi7YLWQ m04IY6QYEeXNVAMXqmmBgYETCzH722ihXCwIIM4IYuB5LCYnzPBFRSHM5PqG3qNh 1NhFITDZ+YgRebWW628veVjntAhtlRQM5XWff+Ux7jGwVdyDoJfvmp8xjJH0SXL+ r5/QfimR24Y7dnpBvLyg4UYAPQzuAX3BXZE/wU8TJwUyIGAStGsE+jZPphyTI9gT HRJxJuT08E7yASoOItlMVxMn2REBh+ObqT8MiDspIU9Pw3SVV9GR9ha9sf7KTM3u aNGd/1UU3lfhzBPQ== Received: (qmail 2356866 invoked from network); 25 Sep 2023 12:10:09 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 25 Sep 2023 12:10:09 +0200 X-UD-Smtp-Session: l3s3148p1@Rc6+KSwG8zwucs9T From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] i2c: create debugfs entry per adapter Date: Mon, 25 Sep 2023 12:09:53 +0200 Message-Id: <20230925100956.117939-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230925100956.117939-1-wsa+renesas@sang-engineering.com> References: <20230925100956.117939-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=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 lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Mon, 25 Sep 2023 03:10:39 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778021648014345820 X-GMAIL-MSGID: 1778021648014345820 Two drivers already implement custom debugfs handling for their i2c_adapter and more will come. So, let the core create a debugfs directory per adapter and pass that to drivers for their debugfs files. Signed-off-by: Wolfram Sang --- drivers/i2c/i2c-core-base.c | 11 +++++++++++ include/linux/i2c.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 60746652fd52..7ecc7b0527d3 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,8 @@ static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver); static DEFINE_STATIC_KEY_FALSE(i2c_trace_msg_key); static bool is_registered; +static struct dentry *i2c_debugfs_root; + int i2c_transfer_trace_reg(void) { static_branch_inc(&i2c_trace_msg_key); @@ -1517,6 +1520,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap) goto out_list; } + adap->debugfs = debugfs_create_dir(dev_name(&adap->dev), i2c_debugfs_root); + res = i2c_setup_smbus_alert(adap); if (res) goto out_reg; @@ -1556,6 +1561,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap) return 0; out_reg: + debugfs_remove_recursive(adap->debugfs); init_completion(&adap->dev_released); device_unregister(&adap->dev); wait_for_completion(&adap->dev_released); @@ -1757,6 +1763,8 @@ void i2c_del_adapter(struct i2c_adapter *adap) i2c_host_notify_irq_teardown(adap); + debugfs_remove_recursive(adap->debugfs); + /* wait until all references to the device are gone * * FIXME: This is old code and should ideally be replaced by an @@ -2054,6 +2062,8 @@ static int __init i2c_init(void) is_registered = true; + i2c_debugfs_root = debugfs_create_dir("i2c", NULL); + #ifdef CONFIG_I2C_COMPAT i2c_adapter_compat_class = class_compat_register("i2c-adapter"); if (!i2c_adapter_compat_class) { @@ -2092,6 +2102,7 @@ static void __exit i2c_exit(void) #ifdef CONFIG_I2C_COMPAT class_compat_unregister(i2c_adapter_compat_class); #endif + debugfs_remove_recursive(i2c_debugfs_root); bus_unregister(&i2c_bus_type); tracepoint_synchronize_unregister(); } diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 0dae9db27538..cb93a054cdec 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -746,6 +746,8 @@ struct i2c_adapter { struct irq_domain *host_notify_domain; struct regulator *bus_regulator; + + struct dentry *debugfs; }; #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) From patchwork Mon Sep 25 10:09:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 144413 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1181575vqu; Mon, 25 Sep 2023 05:44:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/dgE2yZPwGDCBWXQqpJpcjNgjE3fmJT+mkqch6HLfXXpTvT8kxjmeYCXyzrEUq1oElz8z X-Received: by 2002:a05:6808:1823:b0:3ae:100d:5320 with SMTP id bh35-20020a056808182300b003ae100d5320mr7061685oib.2.1695645861042; Mon, 25 Sep 2023 05:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695645861; cv=none; d=google.com; s=arc-20160816; b=bh/NzKEJlF1yh2wgqIgr77UyD9LsczOET8SnDfccPyHpNxIFZuO3ry+RXFurPtrjbX cMM+enL5rZ6UeN2ta5cgy2BbfD1ePjd3ewKY6XQFDXkVx0QE6RJptX3zc4dKrbgq6WGR e47Uf/zAwmQ8rDU3tIkBi9ZO2i2b2FVS7E6Mvi77lQShvY8oqhVb3j9PGNQF6sIC5pOs qm3MLspRxwznIdwxLGTG/ZM9PvGeS6axVoaaXOMh0ltsZDOs21W7aEjZs8mXxhDxWWog 6DLbftqPmAtsSuozRt4sAstpwK0Y+IGa2mKmt0VPMvA6dvtqXMt4o1vJcmFlj3pS4BfD +U7g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vbUqwmZYLQSophio2MK/mGVclCdXcimyfQ0TcCK1Z74=; fh=NpCcEGPWKBmwVefsgL6jjkOeO1GCMMZJnSn01XR7qY4=; b=ejTuu6swtNKnd0OBYBR+64U2RbhGDVNQcyWmavjSE9ezDhiOLzAitJsPRKgqzDef4W gjwk3l4/VCq90eWLLWHg94W9lqfSFApSCJVeNFbMDqq6cHlMniJl1ATL/8l5CrgTEnRg nqb8lz9K5PhIQZbB4+1/s7VzstOQUSDVHg6v5qP2xB9ZsU2y0Aked5f/7TwQZirDNhjM NNrLPlWWiGv1StSXzXCL1vDwxFN1b/c0AUTRQQXv6MiMmSguuGslH2dj4OW+FPa1+TOc RgB1dTvEEYJy2DFqY1BSK803Qo5p3GQyIEFhzsg9S9uBuCPq0M9JauHmc+6oa3HUVPOC 1kaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=MwL59L4S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id y21-20020a056a00191500b0068fbbef7909si10537756pfi.256.2023.09.25.05.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 05:44:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=MwL59L4S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 5234B808A909; Mon, 25 Sep 2023 03:10:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230059AbjIYKKm (ORCPT + 29 others); Mon, 25 Sep 2023 06:10:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231364AbjIYKKY (ORCPT ); Mon, 25 Sep 2023 06:10:24 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6388E6F for ; Mon, 25 Sep 2023 03:10:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=vbUqwmZYLQSophio2MK/mGVclCdXcimyfQ0TcCK1Z74=; b=MwL59L 4SEBqafAEDRhJsUAwfhC88Sfwi31l/hjm6uLYl4hNkum9kHL0s2HRavpQqvwg/t8 nPN3TKzsnkCZ+w/89pLlJwl3j/pmcTCAoAajCruBUVZOAXXTy20laCd32JYn5W0n +sJpCHXUIHmpRCmsRLdkSe5PrIVqtMnWo2tS7bzo0trSL2PSfJ4poy6vwUqd2ruZ gs8e6qWzUopi0AcSyPUXw+Z+yDS+o7QcdQSmTViSaV4JzboqJQ/3AxWZ46CSUUGL jOQqKqkMT0t3pSzeTpGgjO53iWAfqEZMf28iC5VOzuBeD89kEo5/INHUJe3O3gSv 819N+MIpJ/MqR4HA== Received: (qmail 2356904 invoked from network); 25 Sep 2023 12:10:10 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 25 Sep 2023 12:10:10 +0200 X-UD-Smtp-Session: l3s3148p1@12zQKSwGk2Mucs9T From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Andi Shyti , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] i2c: gpio: move to per-adapter debugfs directory Date: Mon, 25 Sep 2023 12:09:54 +0200 Message-Id: <20230925100956.117939-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230925100956.117939-1-wsa+renesas@sang-engineering.com> References: <20230925100956.117939-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=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 lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Mon, 25 Sep 2023 03:10:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778013554299124156 X-GMAIL-MSGID: 1778013554299124156 The I2C core now provides a per-adapter debugfs directory. Use it instead of creating a custom one. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-gpio.c | 39 ++++++----------------------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c index e5a5b9e8bf2c..9c8531137354 100644 --- a/drivers/i2c/busses/i2c-gpio.c +++ b/drivers/i2c/busses/i2c-gpio.c @@ -25,7 +25,6 @@ struct i2c_gpio_private_data { struct i2c_algo_bit_data bit_data; struct i2c_gpio_platform_data pdata; #ifdef CONFIG_I2C_GPIO_FAULT_INJECTOR - struct dentry *debug_dir; /* these must be protected by bus lock */ struct completion scl_irq_completion; u64 scl_irq_data; @@ -72,7 +71,6 @@ static int i2c_gpio_getscl(void *data) } #ifdef CONFIG_I2C_GPIO_FAULT_INJECTOR -static struct dentry *i2c_gpio_debug_dir; #define setsda(bd, val) ((bd)->setsda((bd)->data, val)) #define setscl(bd, val) ((bd)->setscl((bd)->data, val)) @@ -258,46 +256,23 @@ static void i2c_gpio_fault_injector_init(struct platform_device *pdev) { struct i2c_gpio_private_data *priv = platform_get_drvdata(pdev); - /* - * If there will be a debugfs-dir per i2c adapter somewhen, put the - * 'fault-injector' dir there. Until then, we have a global dir with - * all adapters as subdirs. - */ - if (!i2c_gpio_debug_dir) { - i2c_gpio_debug_dir = debugfs_create_dir("i2c-fault-injector", NULL); - if (!i2c_gpio_debug_dir) - return; - } - - priv->debug_dir = debugfs_create_dir(pdev->name, i2c_gpio_debug_dir); - if (!priv->debug_dir) - return; - init_completion(&priv->scl_irq_completion); - debugfs_create_file_unsafe("incomplete_address_phase", 0200, priv->debug_dir, + debugfs_create_file_unsafe("incomplete_address_phase", 0200, priv->adap.debugfs, priv, &fops_incomplete_addr_phase); - debugfs_create_file_unsafe("incomplete_write_byte", 0200, priv->debug_dir, + debugfs_create_file_unsafe("incomplete_write_byte", 0200, priv->adap.debugfs, priv, &fops_incomplete_write_byte); if (priv->bit_data.getscl) { - debugfs_create_file_unsafe("inject_panic", 0200, priv->debug_dir, + debugfs_create_file_unsafe("inject_panic", 0200, priv->adap.debugfs, priv, &fops_inject_panic); - debugfs_create_file_unsafe("lose_arbitration", 0200, priv->debug_dir, + debugfs_create_file_unsafe("lose_arbitration", 0200, priv->adap.debugfs, priv, &fops_lose_arbitration); } - debugfs_create_file_unsafe("scl", 0600, priv->debug_dir, priv, &fops_scl); - debugfs_create_file_unsafe("sda", 0600, priv->debug_dir, priv, &fops_sda); -} - -static void i2c_gpio_fault_injector_exit(struct platform_device *pdev) -{ - struct i2c_gpio_private_data *priv = platform_get_drvdata(pdev); - - debugfs_remove_recursive(priv->debug_dir); + debugfs_create_file_unsafe("scl", 0600, priv->adap.debugfs, priv, &fops_scl); + debugfs_create_file_unsafe("sda", 0600, priv->adap.debugfs, priv, &fops_sda); } #else static inline void i2c_gpio_fault_injector_init(struct platform_device *pdev) {} -static inline void i2c_gpio_fault_injector_exit(struct platform_device *pdev) {} #endif /* CONFIG_I2C_GPIO_FAULT_INJECTOR*/ /* Get i2c-gpio properties from DT or ACPI table */ @@ -480,8 +455,6 @@ static void i2c_gpio_remove(struct platform_device *pdev) struct i2c_gpio_private_data *priv; struct i2c_adapter *adap; - i2c_gpio_fault_injector_exit(pdev); - priv = platform_get_drvdata(pdev); adap = &priv->adap; From patchwork Mon Sep 25 10:09:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 144360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1105853vqu; Mon, 25 Sep 2023 03:22:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsvXLv4XZE8AGqctwsaXi+Nk7LWD67Q5fbx37gg+oREehsB2nCl7LpfyPzTRhAZMh/2N0u X-Received: by 2002:a05:6a00:cd6:b0:690:38b6:b2db with SMTP id b22-20020a056a000cd600b0069038b6b2dbmr9134517pfv.6.1695637353069; Mon, 25 Sep 2023 03:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695637353; cv=none; d=google.com; s=arc-20160816; b=N3gHobLnwz7yCDw9LXTuBFFKeJOGQBogm1CiiOuewViWoZxtGKM8J1lZNPlLzjdMEA s9IE7QSIaVpB2KtL7MXyLoitzn8mFtfXelkp7l3ptduWvndifvgfFcfsF8IAKAbPmhgg lXBo05sHe+UBRLK89c5Rb/KvZxxZ2kbKZq+cC/OWraCU7bxYX86aZSO1TVGRoK74cbw0 4lI7X5TPvHIgRrZiMs1NdbCOnT26ygKIogfmJvl9ut//N1O4mn/T0G6Mpde23n73jJMx UzJ8ybLcuP8HFREmy9S/GwoVQw+tAvEqoc3YFknZavEeRcC1y02axzogRhDWJoFWxwg+ fajw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hWHpByxbxk7AQm4ckeZ/BJr0ENeshN7bukPmrgSsylY=; fh=dDPUzVlZBLVdUCRlDKOj2ilhrDw7sei9DcQMQsm5Udc=; b=lZL1Ilnh6tgqMTJI6BeW7tQny+4Dc5GN84JzgSeevTgaa4Cp2Zj7oN4z7DfbcDqXg/ w2eFKlIIrnKhE4iGbLv9Tb8mqfZKBO/g2JOkJlhgcabiVXpH1zWQabKd42V+2MpF8mLf NLmbw+3aiGmAHRZvmx6U+7dVw0BYLdOS1boyRlSI/YrwLELe6AOmJMBJr3IQYd4feAzN iK6xc5RrfpK3oFfSxOfcBQ9TJRdEvzSGbuLVe6D+0hBte4bjq8uc6kMeb2UknKaghvlH /at/dmAobPdyhTEsqiguI7wh35IdqJsvic5RRR4CTdhDqYVQVjLCK0TOJ9Lz8mxdmGyd BOQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=khcSAUNC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id t64-20020a638143000000b005774bb908d0si9519169pgd.132.2023.09.25.03.22.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 03:22:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=khcSAUNC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 74999808D205; Mon, 25 Sep 2023 03:10:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231204AbjIYKKq (ORCPT + 29 others); Mon, 25 Sep 2023 06:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230459AbjIYKK1 (ORCPT ); Mon, 25 Sep 2023 06:10:27 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C5F810DB for ; Mon, 25 Sep 2023 03:10:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=hWHpByxbxk7AQm4ckeZ/BJr0ENeshN7bukPmrgSsylY=; b=khcSAU NCK/odx7kxWOUUj/iyveRtOxxoZrF/ZvPXSLDmRMgaXFmKTqf4J0//ejFw3mBj17 XQFYl0fJe/V9hiq1KzL9bY4dGG/LDPJrJdGhHKrtSzMIUI/I+9GHZkzkD4WaFD5P YUEHQTVU7ehyovvQthq2STbtw9cl/bKCBKxUzcBSa+7RpYLo3OwjUsJXE0A66SYt uR8vxrl3MpXgnbiRpsAF308gdHVJl9MP7p1JqiQOl356bBAzcoEC56zWECKRmY8n gUMEaEtAdgPe41z04k9Zb+s9rI55Brat3zZENXKb3C5vAaOVt4Zj+3THBfbNNw4z LfHbCb/GPyHpov6Q== Received: (qmail 2356943 invoked from network); 25 Sep 2023 12:10:11 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 25 Sep 2023 12:10:11 +0200 X-UD-Smtp-Session: l3s3148p1@kWviKSwGxWoucs9T From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Andi Shyti , openbmc@lists.ozlabs.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFT 3/3] i2c: npcm7xx: move to per-adapter debugfs directory Date: Mon, 25 Sep 2023 12:09:55 +0200 Message-Id: <20230925100956.117939-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230925100956.117939-1-wsa+renesas@sang-engineering.com> References: <20230925100956.117939-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=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 lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Mon, 25 Sep 2023 03:10:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778004633500154283 X-GMAIL-MSGID: 1778004633500154283 The I2C core now provides a per-adapter debugfs directory. Use it instead of creating a custom one. Signed-off-by: Wolfram Sang --- I could only build test this, so I would appreciate it very much if this could be tested on actual HW. Thanks in advance! drivers/i2c/busses/i2c-npcm7xx.c | 49 +++++--------------------------- 1 file changed, 7 insertions(+), 42 deletions(-) diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c index 495a8b5f6a2b..2326e7de9cf0 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -326,7 +326,6 @@ struct npcm_i2c { u8 slv_rd_buf[MAX_I2C_HW_FIFO_SIZE]; u8 slv_wr_buf[MAX_I2C_HW_FIFO_SIZE]; #endif - struct dentry *debugfs; /* debugfs device directory */ u64 ber_cnt; u64 rec_succ_cnt; u64 rec_fail_cnt; @@ -2253,27 +2252,15 @@ static const struct i2c_algorithm npcm_i2c_algo = { #endif }; -/* i2c debugfs directory: used to keep health monitor of i2c devices */ -static struct dentry *npcm_i2c_debugfs_dir; - static void npcm_i2c_init_debugfs(struct platform_device *pdev, struct npcm_i2c *bus) { - struct dentry *d; - - if (!npcm_i2c_debugfs_dir) - return; - d = debugfs_create_dir(dev_name(&pdev->dev), npcm_i2c_debugfs_dir); - if (IS_ERR_OR_NULL(d)) - return; - debugfs_create_u64("ber_cnt", 0444, d, &bus->ber_cnt); - debugfs_create_u64("nack_cnt", 0444, d, &bus->nack_cnt); - debugfs_create_u64("rec_succ_cnt", 0444, d, &bus->rec_succ_cnt); - debugfs_create_u64("rec_fail_cnt", 0444, d, &bus->rec_fail_cnt); - debugfs_create_u64("timeout_cnt", 0444, d, &bus->timeout_cnt); - debugfs_create_u64("tx_complete_cnt", 0444, d, &bus->tx_complete_cnt); - - bus->debugfs = d; + debugfs_create_u64("ber_cnt", 0444, bus->adap.debugfs, &bus->ber_cnt); + debugfs_create_u64("nack_cnt", 0444, bus->adap.debugfs, &bus->nack_cnt); + debugfs_create_u64("rec_succ_cnt", 0444, bus->adap.debugfs, &bus->rec_succ_cnt); + debugfs_create_u64("rec_fail_cnt", 0444, bus->adap.debugfs, &bus->rec_fail_cnt); + debugfs_create_u64("timeout_cnt", 0444, bus->adap.debugfs, &bus->timeout_cnt); + debugfs_create_u64("tx_complete_cnt", 0444, bus->adap.debugfs, &bus->tx_complete_cnt); } static int npcm_i2c_probe_bus(struct platform_device *pdev) @@ -2365,7 +2352,6 @@ static void npcm_i2c_remove_bus(struct platform_device *pdev) unsigned long lock_flags; struct npcm_i2c *bus = platform_get_drvdata(pdev); - debugfs_remove_recursive(bus->debugfs); spin_lock_irqsave(&bus->lock, lock_flags); npcm_i2c_disable(bus); spin_unlock_irqrestore(&bus->lock, lock_flags); @@ -2388,28 +2374,7 @@ static struct platform_driver npcm_i2c_bus_driver = { } }; -static int __init npcm_i2c_init(void) -{ - int ret; - - npcm_i2c_debugfs_dir = debugfs_create_dir("npcm_i2c", NULL); - - ret = platform_driver_register(&npcm_i2c_bus_driver); - if (ret) { - debugfs_remove_recursive(npcm_i2c_debugfs_dir); - return ret; - } - - return 0; -} -module_init(npcm_i2c_init); - -static void __exit npcm_i2c_exit(void) -{ - platform_driver_unregister(&npcm_i2c_bus_driver); - debugfs_remove_recursive(npcm_i2c_debugfs_dir); -} -module_exit(npcm_i2c_exit); +module_platform_driver(npcm_i2c_bus_driver); MODULE_AUTHOR("Avi Fishman "); MODULE_AUTHOR("Tali Perry ");