mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
thunderbolt: dma_test: No need to store debugfs directory pointer
We don't actually need to store the debugfs directory pointer inside struct dma_test. Instead we can use the debugfs_lookup_and_remove() which also handles the case if the debugfs directory is already removed by the core driver (for example when cable is disconnected). Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
8b40609986
commit
7f35f42395
|
|
@ -87,7 +87,6 @@ static const char * const dma_test_result_names[] = {
|
|||
* @error_code: Error code of the last run
|
||||
* @complete: Used to wait for the Rx to complete
|
||||
* @lock: Lock serializing access to this structure
|
||||
* @debugfs_dir: dentry of this dma_test
|
||||
*/
|
||||
struct dma_test {
|
||||
const struct tb_service *svc;
|
||||
|
|
@ -108,7 +107,6 @@ struct dma_test {
|
|||
enum dma_test_test_error error_code;
|
||||
struct completion complete;
|
||||
struct mutex lock;
|
||||
struct dentry *debugfs_dir;
|
||||
};
|
||||
|
||||
/* DMA test property directory UUID: 3188cd10-6523-4a5a-a682-fdca07a248d8 */
|
||||
|
|
@ -619,18 +617,18 @@ DEFINE_SHOW_ATTRIBUTE(status);
|
|||
|
||||
static void dma_test_debugfs_init(struct tb_service *svc)
|
||||
{
|
||||
struct dma_test *dt = tb_service_get_drvdata(svc);
|
||||
struct dentry *debugfs_dir;
|
||||
|
||||
dt->debugfs_dir = debugfs_create_dir("dma_test", svc->debugfs_dir);
|
||||
debugfs_dir = debugfs_create_dir("dma_test", svc->debugfs_dir);
|
||||
|
||||
debugfs_create_file("lanes", 0600, dt->debugfs_dir, svc, &lanes_fops);
|
||||
debugfs_create_file("speed", 0600, dt->debugfs_dir, svc, &speed_fops);
|
||||
debugfs_create_file("packets_to_receive", 0600, dt->debugfs_dir, svc,
|
||||
debugfs_create_file("lanes", 0600, debugfs_dir, svc, &lanes_fops);
|
||||
debugfs_create_file("speed", 0600, debugfs_dir, svc, &speed_fops);
|
||||
debugfs_create_file("packets_to_receive", 0600, debugfs_dir, svc,
|
||||
&packets_to_receive_fops);
|
||||
debugfs_create_file("packets_to_send", 0600, dt->debugfs_dir, svc,
|
||||
debugfs_create_file("packets_to_send", 0600, debugfs_dir, svc,
|
||||
&packets_to_send_fops);
|
||||
debugfs_create_file("status", 0400, dt->debugfs_dir, svc, &status_fops);
|
||||
debugfs_create_file("test", 0200, dt->debugfs_dir, svc, &test_fops);
|
||||
debugfs_create_file("status", 0400, debugfs_dir, svc, &status_fops);
|
||||
debugfs_create_file("test", 0200, debugfs_dir, svc, &test_fops);
|
||||
}
|
||||
|
||||
static int dma_test_probe(struct tb_service *svc, const struct tb_service_id *id)
|
||||
|
|
@ -658,7 +656,7 @@ static void dma_test_remove(struct tb_service *svc)
|
|||
struct dma_test *dt = tb_service_get_drvdata(svc);
|
||||
|
||||
mutex_lock(&dt->lock);
|
||||
debugfs_remove_recursive(dt->debugfs_dir);
|
||||
debugfs_lookup_and_remove("dma_test", svc->debugfs_dir);
|
||||
mutex_unlock(&dt->lock);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user