All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] usb: ulpi: Fixes and debugfs support
@ 2022-01-27 19:00 Sean Anderson
  2022-01-27 19:00 ` [PATCH v3 1/3] usb: ulpi: Move of_node_put to ulpi_dev_release Sean Anderson
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sean Anderson @ 2022-01-27 19:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-usb
  Cc: Heikki Krogerus, linux-kernel, Sean Anderson

This adds debugfs support for ulpi devices. The first two patches are
fixes and may be applied independently of the last patch. The last patch
depends on the first two because it modifies adjacent lines.

Changes in v3:
- Use separate patch for moving of_node_put from unregister to release
- Add Fixes tag
- Call put_device if device_register fails
- Re-order patches so the fixes comes first

Changes in v2:
- Call of_node_put correctly
- Always create debugfs files and ignore errors
- Look up dentries dynamically

Sean Anderson (3):
  usb: ulpi: Move of_node_put to ulpi_dev_release
  usb: ulpi: Call of_node_put correctly
  usb: ulpi: Add debugfs support

 drivers/usb/common/ulpi.c | 81 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 77 insertions(+), 4 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/3] usb: ulpi: Move of_node_put to ulpi_dev_release
  2022-01-27 19:00 [PATCH v3 0/3] usb: ulpi: Fixes and debugfs support Sean Anderson
@ 2022-01-27 19:00 ` Sean Anderson
  2022-01-31 11:07   ` Heikki Krogerus
  2022-01-27 19:00 ` [PATCH v3 2/3] usb: ulpi: Call of_node_put correctly Sean Anderson
  2022-01-27 19:00 ` [PATCH v3 3/3] usb: ulpi: Add debugfs support Sean Anderson
  2 siblings, 1 reply; 7+ messages in thread
From: Sean Anderson @ 2022-01-27 19:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-usb
  Cc: Heikki Krogerus, linux-kernel, Sean Anderson

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 <sean.anderson@seco.com>
---

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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 2/3] usb: ulpi: Call of_node_put correctly
  2022-01-27 19:00 [PATCH v3 0/3] usb: ulpi: Fixes and debugfs support Sean Anderson
  2022-01-27 19:00 ` [PATCH v3 1/3] usb: ulpi: Move of_node_put to ulpi_dev_release Sean Anderson
@ 2022-01-27 19:00 ` Sean Anderson
  2022-01-31 11:08   ` Heikki Krogerus
  2022-01-27 19:00 ` [PATCH v3 3/3] usb: ulpi: Add debugfs support Sean Anderson
  2 siblings, 1 reply; 7+ messages in thread
From: Sean Anderson @ 2022-01-27 19:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-usb
  Cc: Heikki Krogerus, linux-kernel, Sean Anderson

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 <sean.anderson@seco.com>
---

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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 3/3] usb: ulpi: Add debugfs support
  2022-01-27 19:00 [PATCH v3 0/3] usb: ulpi: Fixes and debugfs support Sean Anderson
  2022-01-27 19:00 ` [PATCH v3 1/3] usb: ulpi: Move of_node_put to ulpi_dev_release Sean Anderson
  2022-01-27 19:00 ` [PATCH v3 2/3] usb: ulpi: Call of_node_put correctly Sean Anderson
@ 2022-01-27 19:00 ` Sean Anderson
  2022-01-31 11:10   ` Heikki Krogerus
  2 siblings, 1 reply; 7+ messages in thread
From: Sean Anderson @ 2022-01-27 19:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-usb
  Cc: Heikki Krogerus, linux-kernel, Sean Anderson

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 <sean.anderson@seco.com>
---

(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 <linux/module.h>
 #include <linux/slab.h>
 #include <linux/acpi.h>
+#include <linux/debugfs.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/clk/clk-conf.h>
@@ -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);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/3] usb: ulpi: Move of_node_put to ulpi_dev_release
  2022-01-27 19:00 ` [PATCH v3 1/3] usb: ulpi: Move of_node_put to ulpi_dev_release Sean Anderson
@ 2022-01-31 11:07   ` Heikki Krogerus
  0 siblings, 0 replies; 7+ messages in thread
From: Heikki Krogerus @ 2022-01-31 11:07 UTC (permalink / raw)
  To: Sean Anderson; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On Thu, Jan 27, 2022 at 02:00:02PM -0500, Sean Anderson wrote:
> 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 <sean.anderson@seco.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> 
> 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);
> -- 
> 2.25.1

thanks,

-- 
heikki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/3] usb: ulpi: Call of_node_put correctly
  2022-01-27 19:00 ` [PATCH v3 2/3] usb: ulpi: Call of_node_put correctly Sean Anderson
@ 2022-01-31 11:08   ` Heikki Krogerus
  0 siblings, 0 replies; 7+ messages in thread
From: Heikki Krogerus @ 2022-01-31 11:08 UTC (permalink / raw)
  To: Sean Anderson; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On Thu, Jan 27, 2022 at 02:00:03PM -0500, Sean Anderson wrote:
> 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 <sean.anderson@seco.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> 
> 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);
> -- 
> 2.25.1

thanks,

-- 
heikki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 3/3] usb: ulpi: Add debugfs support
  2022-01-27 19:00 ` [PATCH v3 3/3] usb: ulpi: Add debugfs support Sean Anderson
@ 2022-01-31 11:10   ` Heikki Krogerus
  0 siblings, 0 replies; 7+ messages in thread
From: Heikki Krogerus @ 2022-01-31 11:10 UTC (permalink / raw)
  To: Sean Anderson; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On Thu, Jan 27, 2022 at 02:00:04PM -0500, Sean Anderson wrote:
> 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 <sean.anderson@seco.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> 
> (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 <linux/module.h>
>  #include <linux/slab.h>
>  #include <linux/acpi.h>
> +#include <linux/debugfs.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
>  #include <linux/clk/clk-conf.h>
> @@ -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);
>  
> -- 
> 2.25.1

thanks,

-- 
heikki

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-31 11:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 19:00 [PATCH v3 0/3] usb: ulpi: Fixes and debugfs support Sean Anderson
2022-01-27 19:00 ` [PATCH v3 1/3] usb: ulpi: Move of_node_put to ulpi_dev_release Sean Anderson
2022-01-31 11:07   ` Heikki Krogerus
2022-01-27 19:00 ` [PATCH v3 2/3] usb: ulpi: Call of_node_put correctly Sean Anderson
2022-01-31 11:08   ` Heikki Krogerus
2022-01-27 19:00 ` [PATCH v3 3/3] usb: ulpi: Add debugfs support Sean Anderson
2022-01-31 11:10   ` Heikki Krogerus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.