i2c: Fix core-managed per-client debugfs handling
The debugfs directory should be created when a device
is probed, not when it is registered. It should be removed
when the device is removed, not when it is unregistered.
Fixes: d06905d686 ("i2c: add core-managed per-client directory in debugfs")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
committed by
Wolfram Sang
parent
5851a88dac
commit
6250ebe666
@@ -583,6 +583,9 @@ static int i2c_device_probe(struct device *dev)
|
||||
goto err_detach_pm_domain;
|
||||
}
|
||||
|
||||
client->debugfs = debugfs_create_dir(dev_name(&client->dev),
|
||||
client->adapter->debugfs);
|
||||
|
||||
if (driver->probe)
|
||||
status = driver->probe(client);
|
||||
else
|
||||
@@ -602,6 +605,7 @@ static int i2c_device_probe(struct device *dev)
|
||||
return 0;
|
||||
|
||||
err_release_driver_resources:
|
||||
debugfs_remove_recursive(client->debugfs);
|
||||
devres_release_group(&client->dev, client->devres_group_id);
|
||||
err_detach_pm_domain:
|
||||
dev_pm_domain_detach(&client->dev, do_power_on);
|
||||
@@ -627,6 +631,8 @@ static void i2c_device_remove(struct device *dev)
|
||||
driver->remove(client);
|
||||
}
|
||||
|
||||
debugfs_remove_recursive(client->debugfs);
|
||||
|
||||
devres_release_group(&client->dev, client->devres_group_id);
|
||||
|
||||
dev_pm_domain_detach(&client->dev, true);
|
||||
@@ -1015,8 +1021,6 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf
|
||||
if (status)
|
||||
goto out_remove_swnode;
|
||||
|
||||
client->debugfs = debugfs_create_dir(dev_name(&client->dev), adap->debugfs);
|
||||
|
||||
dev_dbg(&adap->dev, "client [%s] registered with bus id %s\n",
|
||||
client->name, dev_name(&client->dev));
|
||||
|
||||
@@ -1061,7 +1065,6 @@ void i2c_unregister_device(struct i2c_client *client)
|
||||
if (ACPI_COMPANION(&client->dev))
|
||||
acpi_device_clear_enumerated(ACPI_COMPANION(&client->dev));
|
||||
|
||||
debugfs_remove_recursive(client->debugfs);
|
||||
device_remove_software_node(&client->dev);
|
||||
device_unregister(&client->dev);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user