From patchwork Thu Jan 27 19:00:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 537891 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 311B6C433FE for ; Thu, 27 Jan 2022 19:00:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245196AbiA0TAc (ORCPT ); Thu, 27 Jan 2022 14:00:32 -0500 Received: from mail-vi1eur05on2045.outbound.protection.outlook.com ([40.107.21.45]:49655 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238995AbiA0TAb (ORCPT ); Thu, 27 Jan 2022 14:00:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MfoPQXdtLRI7mtBTWr9y72s8Uy7uZasXMyWLw7IddK1quO994+RZtdFAsghrinMiw4/avdvje9y/rOakzfJc7afgQOcP+YwZfNXmeR+voBixstR/wwBGH7kB65RhCoaCZnR8Xzz1RAmSQF/ULtgNsnTuZotel6UMRkoFog2BYpYpXiIvoU35M0UNe3jggn/cYhQeq8B1b8IWc8tXAu47e7s7xTYv9J15C4J1wjLyRIebko0UVYlyjhujL8ME/mVYrZwrEaSAFASFhMskmGy6xQC9rUaPzfC8GxeNMSjCKe8rdqBLhObEKtsEnI7lFhGxRnHC62h9OM1PGAhnRP9pCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TySb2zixNX9e6Jg3TRqqnRb8CbNdAFjVTcxUHpv+AxE=; b=SM0kTcT8miISGW/tCgfaSRtpS0YtCvNfDvc8UtZdwe1xrxfAjBNRYRxeASlz+cbI3xa3IaeMkDJwb6oX1pMNE9EBhjWGw+JDO2UWI2QJ7Mtr75W517u+8LEnEwKxakq1CM0uW6kMZQsX3Xb4AZoJLQMrY/VZ29oMzH28fixJBSJIEzaq7IoMB+2Jv6wHTTx0ZPfTKGIVobjPeL1nQiDdrrcgDaQfbpwJnsAdWv6f4L4mVUhtUGrORt1b5l5yWIJjlB76ZhEQPyhhx8jgnpPIzozZnE43yzAXZFIHFzDiFZN3gprsuNCbp+IPjMXNJGDg4fa4blm2/Nzi9azxXc+Idg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TySb2zixNX9e6Jg3TRqqnRb8CbNdAFjVTcxUHpv+AxE=; b=NY6miHd3ezP8BAxZ5XlcmyRca9d41nzlCDpnfra2QfQJ3KTEKYoev9rB3ndRgTofS1q7pu7/cVHQYZfq07R1knpS0pZIy/XdZna4fmmpjrFQW6IvaUgDuEXoyJ1TJTavglI3kMr9mUxOCgiv2qEAb1ShH7VlYVc4upNj2PwjzkkPEoPlFuhwLc5pLjbpRVO0tJ+I9LqMl37tb6hWOrrCthrxsTw5jqBZow9tyqGajotkI4uD+wHcU7WhA2ogjoWanJM5wBULXZCSjt7JnoXjFYPHHu7ytbS7VhG/JPLZxgjhHDt89BXg54XK2oXVDWl4lMnVsS81PGjO/jwyQ9tNzA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) by PR2PR03MB5466.eurprd03.prod.outlook.com (2603:10a6:101:1e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Thu, 27 Jan 2022 19:00:25 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::2d1f:654e:f946:1a95]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::2d1f:654e:f946:1a95%6]) with mapi id 15.20.4930.015; Thu, 27 Jan 2022 19:00:25 +0000 From: Sean Anderson To: Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: Heikki Krogerus , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 1/3] usb: ulpi: Move of_node_put to ulpi_dev_release Date: Thu, 27 Jan 2022 14:00:02 -0500 Message-Id: <20220127190004.1446909-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220127190004.1446909-1-sean.anderson@seco.com> References: <20220127190004.1446909-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR04CA0008.namprd04.prod.outlook.com (2603:10b6:208:d4::21) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3c28c2cd-9590-4c3f-8d7e-08d9e1c74681 X-MS-TrafficTypeDiagnostic: PR2PR03MB5466:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oFPaxqnbuv81b5wyBo7LLAWIJ2IjxrpVE3zC8daKJtmIKtU8qVdeNwHf7FxxURmoNfJLka/cKM7T3OI9nLGaO1DCibgVRQrPsHKgdV5gDdPMmWNveaaWa+WnSGMMPMPj6UH74JWHtkh33MsrpZCoTemiinUTef0H1+cXPtVsy4m+hVnz90ftdhMr/cGeOkYtgkY4OTRuAxRn1x0hnUU3w5yZYhVN4hMqc6LBtslvAVpP+Hb5H3teDRViceLsEM+xn36q65PnYhi7OWeQxiSdlGB9rjXfTcV22mpGyIL8ZiqAP0vIsWdTL533XryP4SBAVoBMD31nd0rHpvDiHTlvGPvPbwm7ssGDblBNbAo7urD8ipzMiYAU/GD75Ij5COA5cjdrT1g/uma28bAJ4kNgO9Sk5OOdcRRRSN1NsNK1LOJAJUFGxriLaqZQh+VlYWCjjhXfNpmtFqBcl3uWo9JDuKsmRZ+CtvjnB7MLExS3kXw5qiw4LYovZ18WzFfEXuCMyoN9GTpltorRHJcxm3AzqLkQAV6oSEVqarVSvHSTmFBmjTTAqdpEZE3XJ3n+wsqgVFbLSE5alzzWX3hVdA2dSiuurW6t8JCz5FgFTxIXQPYYVCTmAU5hz+k1HiMjquRBDhTuqBxdfs3xPglNEa/SMuu4sC2wbNMFENTGtcnK+tOpndH2rjjdVItTYin+3/edDly2VNaBTWblNmfu9zbGjg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR03MB4523.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(44832011)(36756003)(4326008)(54906003)(6506007)(5660300002)(8936002)(66476007)(316002)(66946007)(66556008)(38100700002)(38350700002)(8676002)(6666004)(83380400001)(2906002)(6486002)(86362001)(6512007)(1076003)(508600001)(52116002)(107886003)(186003)(26005)(2616005)(20210929001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0H4exOMvenXXZiGSvVIkzObNGacCKl/fsVGIgC85MgEpiJe8HDK8PkVt6lKqdlfbhkpvOiYiibEqbbGrOvmGPSXlaeWmH4Eu1O+Hbzb61JRvySrWgpwDS625VLVbV98xHbjpV1tP5+YL9uwwwzaetlje0diq6cii6HB+RvCKDpOEzKM/ynR6B9M6VxnkylZA+OgRSed+LG5Io2rZ3y4MmGJOaMsG41bWJWu8Tzv6s+Hn39q9Up2dkfyGlfAGUTRETsPzZ43OhaV6ZBjjDk+jmk1FsE6fyKoE1YthJBArritmxJnJBPdlR9QHIEfKwDyzCGJUOgXaf3k0GMGP5Q6RC1rHer2vfVgUYuRNkZyAteKIwb7yQOB7IoelvEx50v12URnsBjzmzZbpJp0ce+uxzIpzM9Jnt72pftQjH01Eql8+7aY+YJZim3NkqUyoPrSBJRHS21mTlgDkWIllCMYvpjoAHgt8m7phQsvtbIwJcP0aR+/NWVVRiYulCzYeeca1QPs+GkODtHkVpNG7VKGtwRRPGsqXv2gv5x3EqKsXwd8+Cca+djODnYiHynB3cPAVdB+CykFlSP9CZI/FL0HEjl9HG3u8G9TmeLXO2AoqZZE9CEOEnxwj8HlGjQhM2ILd2WGMyfSS/+Pm8v+Pp6lQQjAt3XWYb8ARW83AF3AqHIraqiT5rHrgTa908kBmuovMrsDb65hiDAVTeAqvKZ2064hrZHy9M8LydAn+33H1S2Eh13sVQNtDK4AgLysrJMflEhqtY8cA+GppKjnA8sshR7dJnnyFMlUk2HTduSRKju+SaregM/maaSlpR3YG046ZS/dz02Kt8gWXNTmw7y/bMj4+1umToSCVP4x2JbL+bv7JDzF4gMf1JVhcn0GKPTTF1grpG3jZxQla3ChdaUm9wTlZjjygQiP6Le66t2V1PNMiBPbU2NVrmOKKnudIJnFqDB43y2jK8XqiijuZ+lPcpONJYn6HYR0Ax9Wk3eVZJ7O0y7J0h9xN0xHh09qdShlFWip/OrGCIDlTOxG2TBu9vtt4YUU4sI03lAUdU54K9+kB+OcXcH889wS3OiQCM4uqCWOBtVJj2CXj8xWs495suVEN5YqkUYP3Kp/+qa/urMEPDA2kfw1BC3IvKOIqcSHZ1JJWFWRMz5Ws2cqee7KcFF4mTU0MpOPjWAZ2liERK2nrmlqlDB/3tAPuNMrQPgvJHVpfJHIu6IgmAWTKXtJ7jPGi/miYa8czV9tb6vuJ4xjwfteZhkT6QGtHmUFGD55+9bwbP4IC7IGJm2sW7UZy9Hs3n1dsWXd7NtgV5CxU23lASQTXJ40uP+T4XykxB1xmKF0OSmUI4n1p1/ODFATU71cT+GkuP4pRYQRsZ1Nc8UyCHCduSixSReb4VwafVawXa26K2i3ErZhIOJFF85A7k/qaS0p1/BiE4SzeB5iulsSFfUNmAz78xwIp8u1jNZlLcjT+OCOoaUBrrBP59NrrbU19QmKIKYaXTGxR2pI9wPZGsUtn0tJzQ2scX9v5MVX8Q9PzJtO4siwvCwUXI/aJM4OkiFXqTDc/PvggVgvzc9ecIxNMm3jDpCyqyBW3g9YMXcavFbhKepUivYZ0jMlXWvqQ3gGUpNqzncMEJyHAU5Q= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c28c2cd-9590-4c3f-8d7e-08d9e1c74681 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2022 19:00:24.9460 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CsgrdjxKrr/DiVkvvt3X0ciraxYOCHhQJCsYQJtxttSLoLYoVq7wLt2s/xFElW5nTnlIzadSez8J8U9qchstpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR03MB5466 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drivers are not unbound from the device when ulpi_unregister_interface is called. Move of_node-freeing code to ulpi_dev_release which is called only after all users are gone. Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") Signed-off-by: Sean Anderson Reviewed-by: Heikki Krogerus --- Changes in v3: - Use separate patch for moving of_node_put from unregister to release drivers/usb/common/ulpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c index 4169cf40a03b..c90a1ab705a3 100644 --- a/drivers/usb/common/ulpi.c +++ b/drivers/usb/common/ulpi.c @@ -127,6 +127,7 @@ static const struct attribute_group *ulpi_dev_attr_groups[] = { static void ulpi_dev_release(struct device *dev) { + of_node_put(dev->of_node); kfree(to_ulpi_dev(dev)); } @@ -296,7 +297,6 @@ EXPORT_SYMBOL_GPL(ulpi_register_interface); */ void ulpi_unregister_interface(struct ulpi *ulpi) { - of_node_put(ulpi->dev.of_node); device_unregister(&ulpi->dev); } EXPORT_SYMBOL_GPL(ulpi_unregister_interface); From patchwork Thu Jan 27 19:00:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 537531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E200C433FE for ; Thu, 27 Jan 2022 19:00:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245396AbiA0TAj (ORCPT ); Thu, 27 Jan 2022 14:00:39 -0500 Received: from mail-vi1eur05on2045.outbound.protection.outlook.com ([40.107.21.45]:49655 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S245190AbiA0TAc (ORCPT ); Thu, 27 Jan 2022 14:00:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X3OCEgsyQxI1TycYMgWIcE6i6I8zA9vO368lWnpyGK1SnB6p1U145pM8JKwCUB4FdQkH2T2S4XLbnhWoKwh2ET3foCAGkUU7+o6ugeeody1xDWnWllbNQO0C5vZOB5av5UarhnyLLyncjLwS6MdHB/aAbFcArj78AtMhm+q1/ZRoaTLm+dNS7qdaobn88s1C80z3O8gtFJhqkZ8Y+Ai40IuxZCrZiSST5cGKN7sN+Sh7+b9QbSQp/Wa1mZWxTy2Dm8Bdo+8uIYlcQHAqAJeUTX5XnveVAd277beHGK4sdbeNf9zV101aNsb5Q9RTxmnx5Kih8fYji4VJL2POvfxXhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0bbMdOUrgPHbbbx0+slVc+FT+cJ7CfYzcREzPX/lui4=; b=XeCbROHsUvHXzdm2ahiy1SIICOlt0WD7p81F1PShyDtPtCZcEaBxtTWZ/5rjYTZ0YlA2bv0STBkK3lNvP5Gy1xtYIU9a+j6NzxWSbT4ANlCJeMAzEsWvB047XACxn9kB7Q9irUeENchOVIRcC/ya4uwqdwLcrQcRj9khWQvldw4Z9Q0svQzjwx8/6rTgvLjrK6XiTfVclXr6euMzZfJpz9E8VuIaGvkkBO4IFVCSu5dGd0710nqqqaYwehoWSXmq1t+/6Wx4wPzW/N9MrLFKMy5zFi8f4nHpnHCYhgZ8DEUh3HuxoS8JbELxyzzCnEiAmB6VztbTA9fNlxlSbclmzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0bbMdOUrgPHbbbx0+slVc+FT+cJ7CfYzcREzPX/lui4=; b=kTE6ZWluTaGByiY0ENls/eye+kP9pUkYUJnTcyBUiWykBRXm0AEUhXG1oyhAn00X3PrbfEDwEzln3vN/qt00SIV9I2z/nDA/HYiCIfj91W2Zd+rEr1jg2t7V0RgHtrQXKdL1s66b0biMtNTTXhUf2N5+tj+bqsOm8V4352pTpOmgCs+t9uFDXsmCCfCjJshOGnhjI0A4YzWaU4IFhCXdMzeanD88QBdywlj/jyTB45TkXIdJnAdldunCTTsFJXeyGwTLGC1rPe/7XHKPIjVlVHX0DLObfltMwiCJhX2x4kaPgDQ+alnokLKOOqRdPsEUMoTxbjnAx8rByhxKTXTkdg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) by PR2PR03MB5466.eurprd03.prod.outlook.com (2603:10a6:101:1e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Thu, 27 Jan 2022 19:00:26 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::2d1f:654e:f946:1a95]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::2d1f:654e:f946:1a95%6]) with mapi id 15.20.4930.015; Thu, 27 Jan 2022 19:00:26 +0000 From: Sean Anderson To: Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: Heikki Krogerus , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 2/3] usb: ulpi: Call of_node_put correctly Date: Thu, 27 Jan 2022 14:00:03 -0500 Message-Id: <20220127190004.1446909-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220127190004.1446909-1-sean.anderson@seco.com> References: <20220127190004.1446909-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR04CA0008.namprd04.prod.outlook.com (2603:10b6:208:d4::21) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5180027f-15e5-4e03-6d59-08d9e1c74747 X-MS-TrafficTypeDiagnostic: PR2PR03MB5466:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B4eMYMitSsSNSizqhKZxbgWjB8ABrsKWP6b6+8erSGeYQ+b0Gs6Cw/XVDLseL9n+w4m50WM3+E05tNkxFWofl348xd89r38a54BEh3Q0Joyb0C1Pz7NlO+YzvHI9CdcGPOnvXtcuMYZOje0qsASMYG/5TJJ4r0jQRf5BXNtxp3nFdwptIfP6uHOglL6WSHUoC4txF5pehD5BVMihUMyWkqg9ygY3sICCLHWHuaeOipNWIU2soQg0tY2EEieyS0F04YCv0P+4DIEoXN/kBNl80CMZErxYCxZp6M8lAuUVkSlyv5/1Pv8j0IYYCZgo3pFix7lemmwy7eFlMugmEiitU2KJZCwTpkim7zkZed23DOTQYWjzFHBN61f1ne/wCArlN2R6e6zm7ywhd/6ycH98nE0U+iNvNcVgqC6hZ3mP5IM6M6Hd9yrklNHtBtS/H6oT9Yc8cY30aBJUpzCvOcyBKMvJb0tlp0K8M8t5RW7Y6r6cY6bnQzvROgJgTQpWb4kSA2Op1HMXZDr4w0ol9XzT79cMf4OavmXE2K2vVZHstAsha356EwRIRAyYKQHm8HCcTzBxn8EAGCoFo95vk/phTiZXVPPBo4szmFj12jxIutvCnShnp44ZXy4xhJh8TyxZqW1Z7H/DURijt9kujsS9InJYAhp8Ux0qHOXNysWaJTDN56nrvhSpya2hMTBsTSccPZkZDLd3ozGUUanLBX8akQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR03MB4523.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(44832011)(36756003)(4326008)(54906003)(6506007)(5660300002)(8936002)(66476007)(316002)(66946007)(66556008)(38100700002)(38350700002)(8676002)(6666004)(83380400001)(2906002)(6486002)(86362001)(6512007)(1076003)(508600001)(52116002)(107886003)(186003)(26005)(2616005)(20210929001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AgAyCF+jqee2oduBt9ouMkMDjJ6xJlW/rAsz8rl6+YOA38w7BFVJ3JGkD3X4hS5H0QUfCXXMYr42bfUSWOFzEjf++Id/GYoLuHcwuOLoOeFs72O3guh2ynQWl1K2Z2XcXljb7pKje/sSnsii0dbx8ys1bhUEhfTIL0Speqgclo0P9pz5IuvpSGE75v9OHGswN35kDGPUVYjJCe1HvB+UggTpSCZ42JNkyzLgRGbSNQ5bTygxYu2Ob7EFm5rn6AuGM6VoP2XzDSS7YxFa6Eiz7NVD4Rlalx7IsWH9SCy9lAipN49B0TfGVKj2NntnqMe/ozif/UqMrlkjU6grttv8P5BVNHmGszuTUXcMzcZrkhQdfgL9PHRoUzurX8EatNTTDlCPswsGLIsPOp/CTw4yMiuUEstyEZ6WqrelsW1P5BUKdfJb3ubyPwsIHROdOsJ8u7j7Etk0+5eNYq5K5RXOaedN9uy7LqjQBJ18io55qncHEgroHXbHvE5qUfpv7oy2+8YK4gHx4hENkQYeXibn4K2P0vmTKTHi9TlHZtmwW7QUY1n2VLqzNzJMuEtRl9Jr0e12jDRFzXofT+fhdStEoog+J3qGqXtsq9/JnRQKeUuRwnjVe4zWbFJHPeUb+aas33Ec2jZSn+SCpyM4xUtavDN7QJRUmtZrf96X+tdbDZkVSJYe/QGRl0E5xhiUKNEbxz7dxin8frEuSnT0//XxpxWF2INZ1SNeQPJoYsC9qSYhII/7WK+Dl5u7XrUIqHC/L41vP0x0PQ0bLBxtwRzGo1FoCqygquotws+DP4YmrcRyCQYO8tzXlRBvx1jpEYTCUXTjXr2L0gG+cgzanspUU1wXpL9dvG4Ppx2mEiLRoXl27BCk700LN35PUWUqowN+bGCUus/BNgAmQuw3nzTbMvrP9dMYg/Oc2nnn5dEXUblPnMqznfbz5Vuznbco83IJccdzY5FQkoUl2ScsVqnx6ZSMNvhcq8Y2F9e4njGwl+nWruYZ+1HUs2/zL3aU3VIoXF/sB1mshYaUcXC0SFRIiCVaxSdeGG6mMImHchsHANUnBucL/M05M1ZrXqaS+Fz2DlkqVD7zG3EQVT7LZe8uqWyYYQ3Z+e2hVUyPJhap5N3Y1X50AjfZikrF94WG2bxF1aN3/i4x5erMnzZeevkC96FuwXJ34YC86hhiyYX+W5u8RpmCkljJaADhzBSKhKudtgInpPrLPx5UI34l4c34aGKgea/HMS1YNSGXXaV6ltlbEN68k3Tv0yhK5JDD//yCdK+x7XihRPCrSoaqgHVYSQr2+1udqiJfjWUoDVYTi1x/hEqU5AXaBKucqaiZdhxHhE/ZLx5f2RL/nzRRpvlFFntWbG7Zp/3yUzjus8jrYMzs6bLYW00z2zodYC1OZ/0NEuekBqtWLG5ofEiwHlMVrRVLxBpM/cH3uTlKRWtmb7KoHtGHfuZic62u40PL0A8aN6YB8b2qE2sW6cBwvPPrBIa57ZxeBYK4jU9Xuv16XeJxDmdp5X+a6zUE4EV1CNFJkyFrUopznPKiiOPYfMD7yQZShNFVdH24lst2uljJwUEUAAjw4dwhTS8D++idJCK0AJVxgcnzigOwS8e2NnlT1RafD5w+uJRT5EdT+SW04m0= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5180027f-15e5-4e03-6d59-08d9e1c74747 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2022 19:00:26.2584 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0UcsDLVyrvpvqdZKuxTEr9Zj7CmxsQC9XxtLLZxihOisSNCd/vhm5q+UOuDGyC6RxSDCtMxreBW0pPG6thUOLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR03MB5466 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org of_node_put should always be called on device nodes gotten from of_get_*. Additionally, it should only be called after there are no remaining users. To address the first issue, call of_node_put if later steps in ulpi_register fail. To address the latter, call put_device if device_register fails, which will call ulpi_dev_release if necessary. Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") Signed-off-by: Sean Anderson Reviewed-by: Heikki Krogerus --- Changes in v3: - Add Fixes tag - Call put_device if device_register fails Changes in v2: - New drivers/usb/common/ulpi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c index c90a1ab705a3..dedcb749a02f 100644 --- a/drivers/usb/common/ulpi.c +++ b/drivers/usb/common/ulpi.c @@ -245,12 +245,16 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi) return ret; ret = ulpi_read_id(ulpi); - if (ret) + if (ret) { + of_node_put(ulpi->dev.of_node); return ret; + } ret = device_register(&ulpi->dev); - if (ret) + if (ret) { + put_device(&ulpi->dev); return ret; + } dev_dbg(&ulpi->dev, "registered ULPI PHY: vendor %04x, product %04x\n", ulpi->id.vendor, ulpi->id.product); From patchwork Thu Jan 27 19:00:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 537890 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 439E2C4332F for ; Thu, 27 Jan 2022 19:00:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245190AbiA0TAl (ORCPT ); Thu, 27 Jan 2022 14:00:41 -0500 Received: from mail-vi1eur05on2045.outbound.protection.outlook.com ([40.107.21.45]:49655 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S245355AbiA0TAg (ORCPT ); Thu, 27 Jan 2022 14:00:36 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CulJ/YegMiBNBs3ecNJdYPbdAyNEzBbzGOU/smun8yga+AUEdNXUbYhPaLI41+63iHS/XPCGsjCJNQIf2fDngKa2iSNbpeBe8rkBfyc/SD5+iOy61POho5Mv16uZIVzg+8EOuWxFlvARwYianULqk3gFhztDSFuwj/7MYPdJFCBFPMsjvlkr2rb5NhkYuLOjSUc/C/O4wUeo4yqvNSxoLVd/Eq5EBNkUxRRWDTSmNckMElnTA5i+jx5Lnu7Oojp+V/vNc6gZ+KRS1c66EU7qhLh/MzwlKjqGdtCMRmmNlT4ARghEPMgvfhpU3iDl6t7oHvn2cLA7kgqWnUM+jU/3kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L58mPA+UQQaMhVFi4BsiVloZjuevT88VtMmdQ4hhIyc=; b=LQHN9Lp4CFolpksaYjfa26M/XD+kcC1aI1nm5DNRKATRjw8Pelop4A0+j1fF4GIle9mpIUxXIF5TqCk4j3Kw0gHmGZrqitV/nUA0BE7TyCA5alQOnq9+e2WfUYBCXs9pWUZMyaomOBWoKvMrUpX0X758J9XpeUF316QME6F9cy4KrI/ZeTYp7CY5jGiGqK7iJ1PqbQvX784mIv5zWa1wr3cgtT9XH/3By5Xb+ICRlBy6vfSAZw/tnSlD5yyrlAdyXM0jPwrkrL8LhjlYr3Ru78H2fw9zr14PfSsPgyUfLhfWAX0LbzhlKkuYfmMvIwrgyMnZA0QkVYRGjrrbCvFxww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L58mPA+UQQaMhVFi4BsiVloZjuevT88VtMmdQ4hhIyc=; b=mgDzbN0luAu4tEXQD2KRKNBlPCS2SK9h5HPveG3cwsdMsiRlkilENe9Rd/cfyo7DSa3RIrFSnpC6VvPF6mOcH/0NWtiKRFq7AmgJ4Y4Hw3nbRWWiz+mGJee/KthWMT/XF2Q/+I1N0LiEGSAUzjXpcF4oMpMNbWpdCAwuZNNVryyfrYgltZG1w3Fd0jhJ28bNZ8/0NMVFdprnYs8S7AQk1036e+BB6FQqIyyBj/hxRqy/v8pgheRyaoBx/EZ1bezEFbRZXfH3Nt/Dv8qA6GzPFeWF2ESbe+ZPmHkNjn4FWmGfhe1sZFoX68BZ2RCmqn8zt/bbeN5mBeqiThlpnzsgCw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) by PR2PR03MB5466.eurprd03.prod.outlook.com (2603:10a6:101:1e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Thu, 27 Jan 2022 19:00:27 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::2d1f:654e:f946:1a95]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::2d1f:654e:f946:1a95%6]) with mapi id 15.20.4930.015; Thu, 27 Jan 2022 19:00:27 +0000 From: Sean Anderson To: Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: Heikki Krogerus , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 3/3] usb: ulpi: Add debugfs support Date: Thu, 27 Jan 2022 14:00:04 -0500 Message-Id: <20220127190004.1446909-4-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220127190004.1446909-1-sean.anderson@seco.com> References: <20220127190004.1446909-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR04CA0008.namprd04.prod.outlook.com (2603:10b6:208:d4::21) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 340fcef8-abfa-4a5b-88c2-08d9e1c74808 X-MS-TrafficTypeDiagnostic: PR2PR03MB5466:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iKz11ztsW8lU3DIygxwGX+qbKhvNN6vKNmXC0kpQNzcTusoX7wuWGEOmrivHjom1P28JO//d4y06But3weJNWsN4sSaCOENIu3WwXHqXS5AsCyhXMJNAsEpc2zuPxcpoOQss1vCrKdf9RS4ugU6ps+qtoVml3lj7y2FtlyIZeIUky06wCfvAC24SEvNbPSt4juZLUBnLMjyInorR2JHDymx3yzxGP1EYB5uPQtxmomkpvZJ5LGxdSwrBZT15YA2HGMmXGFW0lSJ1C9jttIpyNFrAWvA3mcHbq+6I/XN5kzlSBR+to1npTMQKWMv+SRqKVlr6TpeUE+uBuf+4FCGHlEfEeUK7BAEeHho5eGP2GDa5S+52lersWqIy3RLP4NaQ/qaXGDlXZ95n7RX+I4vCh9QlirnerdgGXU1lZZPmtSUK0xLErNWlPQi7RRwkRibQN3LNX2Yuef/Sfj2rDBYjh+u7X+0xxNKGD5SS6WoEYjmQhOW88KkDWaY5I/29r5LS87UpHuJg4y8J3DaKR/8hnurVUxKKnEeMb4TXzs9oQPAFNjQxHzQm57drd8yl5V6YCz4Q5rlmcge5Me+8Sj0eO8Nlb+yiXH0A0i4QzhiVTBrkVLzvhFCiAhRAF0tvE5sGPNEt6irL3BkZZW5vef/wcO8uj3UVLElFdHAsPQg6l9Nd40UcU6BJV9o2omic0zO/2MKrhbv/GunORRZ4W+Aw4A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR03MB4523.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(44832011)(36756003)(4326008)(54906003)(6506007)(5660300002)(8936002)(66476007)(316002)(66946007)(66556008)(38100700002)(38350700002)(8676002)(6666004)(83380400001)(2906002)(6486002)(86362001)(6512007)(1076003)(508600001)(52116002)(107886003)(186003)(26005)(2616005)(20210929001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xooOHNLHxWphddPLB2EfA+fBXF34ahsEfY6bfOjcxT56KJeMItosWo9cfTkevt8C+9JQczq3rKjeVnvk+R/LuzA0Tyr1OK/XL3MwPoTqveX+j5C6KPQQRUlateDXXy5+1J2t6Ec/zL8hzrNGcYafEtGXmTIo6lN+VD37AyDP997fVIPT0TjfRqnvvUTCbgIn4TkMlRAyqSXfeahGAfwevoJ7WKFyvbf7QdIAYG/EDKMfxrVD/TEGPTZyThp03Lj7ZmByvx6K83YQ0p+8RtKlkZ4NfiseYlHcWXIbh7oOg1GHuHbyZKHkH/rXDe7/Lu+CW7GQSY38NqbuFT0z4M8uUCVck+TFBCh2dGB/+HxwhkKHzBjU4GZS8KOfzcKMFu26KzylNNupMTVw1c3KINZv4Yz+Tp+NEvXG2Cq2gySbguKdW2bGSTp/JgT5Vju51j/m5NseXBlXHsuiNrQUreu/tADAVr1H8nmgbgloYOKlswXKwwUI2tpwEyja9t2r+WSp1KQPeCtOZNAJjoDgJR/GNMI/aeMR4fDA9H5NNitspdFtcdiq+Ex1JIYqFOCuMJ+kz3bV3eJ900NWuy6lm8g6+3Zm2y28DqnMZS7/PtnjwveFzOaxgdRnhav6V1o8CL+IjH1QtMAv8Cx/COL24smIDxMcrO/OYz1A8DpCwppeZaV9mA1QmhpqjSvPtWK7jtUrotU15UmQvpM6UvSlm7AAFNUWGzO08mpdiqN4bKfqq7f0lyH8bdCpxrid4DyOq4oD3KbCt+Th0WctpqUPqmAGsA/qDPuYn/3y4SMpJnRJovR36G/3i/KR9gWd1m1Xz/h9mDTuIPhRRT0zzjx5fjNxSZYAvzNAyhBY14yck/E+oS3KgV8foxN2kWH6OgC7zeBn3N19YUXoM9b9ksoeqvywy1M+61rZp0SiGn1BBhpa5JaGV2cFvX1vgZWKFzh7scL5xi4uB9eYf/nXr7/pnhmCg9EtW1nfzRF93xWpyErF26Os5u1kn71ExsUFmK9VgB5GFRjbFNqTZ6PHfAaWUDI8MyUj7eSxwgfslWF4gPe7Ql4mKmMc9pJdcMZGgpJ3PAeuor89MKYcXx2cCQY/8nn9ayohk5Lr3Q3Do+h4GU6d0D2WAEG5fEf6GabJgWa8iqWlCBrlTQRAu9fK03kArBexzS04xsmct0rPROEntCIRqJ3TmO3EDIeGGZTz2zdYvPGbrL47vEXZXDv84yvPuGsCOZfazqMvNi/3eKApOgV5ITMM6YvRPi45NTTVnW3ZYpGUt0pTP8hN0Q1ggWGdJw/K8m6eu9DrzbKK+SdWNF2Au0DlgMOOZ9hOaSuAr3SeQ6K7nPuvf2+7VTm8cQjaBFyiUN5GNDOffHd2JlzI38GqZDozh9logGXUyQS/Siskk8XwJG+63h5IQOvSLAcJv8Egtc4hVMMchP1s+hr6HL5pK99oIt4Z5ZrPZBXU7w0EEHi3dHN0HJ/IJAf7gC5KjAG+O4mCNg5TRhJbGxg0gfH7j2Yf3vBGQ+9PxwpD+eZ44OlVLrinL39HwD23q30VuWkYHQ+rHjAzWRZG6yCrQbODYVgTkPSI1402/lHZkMTxeyMTCTmTv+El8qLWlLMNAnctV8EdmBh0tUFlxO55ggGc6zE= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 340fcef8-abfa-4a5b-88c2-08d9e1c74808 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2022 19:00:27.4302 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: euPPI+MwP3lJS8LDSeOs6UJXm2+ROJXYTgBBwK3LOt5VHvHx5wRQl6dJJZnr5XeMjSIZI3XM4wTQ+85gVjqjyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR03MB5466 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This adds a debugfs file for ULPI devices which contains a dump of their registers. This is useful for debugging basic connectivity problems. The file is created in ulpi_register because many devices will never have a driver bound (as they are managed in hardware by the USB controller device). The root directory of this subsystem is created before we register the bus to ensure that devices can always create their directories. Signed-off-by: Sean Anderson Reviewed-by: Heikki Krogerus --- (no changes since v2) Changes in v2: - Always create debugfs files and ignore errors - Look up dentries dynamically drivers/usb/common/ulpi.c | 71 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c index dedcb749a02f..897e1a374f9e 100644 --- a/drivers/usb/common/ulpi.c +++ b/drivers/usb/common/ulpi.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -229,9 +230,64 @@ static int ulpi_read_id(struct ulpi *ulpi) return 0; } +static int ulpi_regs_read(struct seq_file *seq, void *data) +{ + struct ulpi *ulpi = seq->private; + +#define ulpi_print(name, reg) do { \ + int ret = ulpi_read(ulpi, reg); \ + if (ret < 0) \ + return ret; \ + seq_printf(seq, name " %.02x\n", ret); \ +} while (0) + + ulpi_print("Vendor ID Low ", ULPI_VENDOR_ID_LOW); + ulpi_print("Vendor ID High ", ULPI_VENDOR_ID_HIGH); + ulpi_print("Product ID Low ", ULPI_PRODUCT_ID_LOW); + ulpi_print("Product ID High ", ULPI_PRODUCT_ID_HIGH); + ulpi_print("Function Control ", ULPI_FUNC_CTRL); + ulpi_print("Interface Control ", ULPI_IFC_CTRL); + ulpi_print("OTG Control ", ULPI_OTG_CTRL); + ulpi_print("USB Interrupt Enable Rising ", ULPI_USB_INT_EN_RISE); + ulpi_print("USB Interrupt Enable Falling", ULPI_USB_INT_EN_FALL); + ulpi_print("USB Interrupt Status ", ULPI_USB_INT_STS); + ulpi_print("USB Interrupt Latch ", ULPI_USB_INT_LATCH); + ulpi_print("Debug ", ULPI_DEBUG); + ulpi_print("Scratch Register ", ULPI_SCRATCH); + ulpi_print("Carkit Control ", ULPI_CARKIT_CTRL); + ulpi_print("Carkit Interrupt Delay ", ULPI_CARKIT_INT_DELAY); + ulpi_print("Carkit Interrupt Enable ", ULPI_CARKIT_INT_EN); + ulpi_print("Carkit Interrupt Status ", ULPI_CARKIT_INT_STS); + ulpi_print("Carkit Interrupt Latch ", ULPI_CARKIT_INT_LATCH); + ulpi_print("Carkit Pulse Control ", ULPI_CARKIT_PLS_CTRL); + ulpi_print("Transmit Positive Width ", ULPI_TX_POS_WIDTH); + ulpi_print("Transmit Negative Width ", ULPI_TX_NEG_WIDTH); + ulpi_print("Receive Polarity Recovery ", ULPI_POLARITY_RECOVERY); + + return 0; +} + +static int ulpi_regs_open(struct inode *inode, struct file *f) +{ + struct ulpi *ulpi = inode->i_private; + + return single_open(f, ulpi_regs_read, ulpi); +} + +static const struct file_operations ulpi_regs_ops = { + .owner = THIS_MODULE, + .open = ulpi_regs_open, + .release = single_release, + .read = seq_read, + .llseek = seq_lseek +}; + +#define ULPI_ROOT debugfs_lookup(KBUILD_MODNAME, NULL) + static int ulpi_register(struct device *dev, struct ulpi *ulpi) { int ret; + struct dentry *root; ulpi->dev.parent = dev; /* needed early for ops */ ulpi->dev.bus = &ulpi_bus; @@ -256,6 +312,9 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi) return ret; } + root = debugfs_create_dir(dev_name(dev), ULPI_ROOT); + debugfs_create_file("regs", 0444, root, ulpi, &ulpi_regs_ops); + dev_dbg(&ulpi->dev, "registered ULPI PHY: vendor %04x, product %04x\n", ulpi->id.vendor, ulpi->id.product); @@ -301,6 +360,8 @@ EXPORT_SYMBOL_GPL(ulpi_register_interface); */ void ulpi_unregister_interface(struct ulpi *ulpi) { + debugfs_remove_recursive(debugfs_lookup(dev_name(&ulpi->dev), + ULPI_ROOT)); device_unregister(&ulpi->dev); } EXPORT_SYMBOL_GPL(ulpi_unregister_interface); @@ -309,13 +370,21 @@ EXPORT_SYMBOL_GPL(ulpi_unregister_interface); static int __init ulpi_init(void) { - return bus_register(&ulpi_bus); + int ret; + struct dentry *root; + + root = debugfs_create_dir(KBUILD_MODNAME, NULL); + ret = bus_register(&ulpi_bus); + if (ret) + debugfs_remove(root); + return ret; } subsys_initcall(ulpi_init); static void __exit ulpi_exit(void) { bus_unregister(&ulpi_bus); + debugfs_remove_recursive(ULPI_ROOT); } module_exit(ulpi_exit);