Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (pt5161l) Use per-client debugfs entry

The I2C core now offers a debugfs-directory per client. Use it and
remove the custom handling.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20250305123149.16990-2-wsa+renesas@sang-engineering.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Wolfram Sang and committed by
Guenter Roeck
ee65d9e6 23242777

+9 -37
+9 -37
drivers/hwmon/pt5161l.c
··· 63 63 /* Each client has this additional data */ 64 64 struct pt5161l_data { 65 65 struct i2c_client *client; 66 - struct dentry *debugfs; 67 66 struct pt5161l_fw_ver fw_ver; 68 67 struct mutex lock; /* for atomic I2C transactions */ 69 68 bool init_done; ··· 70 71 bool mm_heartbeat_okay; /* indicate if Main Micro heartbeat is good */ 71 72 bool mm_wide_reg_access; /* MM assisted wide register access */ 72 73 }; 73 - 74 - static struct dentry *pt5161l_debugfs_dir; 75 74 76 75 /* 77 76 * Write multiple data bytes to Aries over I2C ··· 565 568 .open = simple_open, 566 569 }; 567 570 568 - static int pt5161l_init_debugfs(struct pt5161l_data *data) 571 + static void pt5161l_init_debugfs(struct i2c_client *client, struct pt5161l_data *data) 569 572 { 570 - data->debugfs = debugfs_create_dir(dev_name(&data->client->dev), 571 - pt5161l_debugfs_dir); 572 - 573 - debugfs_create_file("fw_ver", 0444, data->debugfs, data, 573 + debugfs_create_file("fw_ver", 0444, client->debugfs, data, 574 574 &pt5161l_debugfs_ops_fw_ver); 575 575 576 - debugfs_create_file("fw_load_status", 0444, data->debugfs, data, 576 + debugfs_create_file("fw_load_status", 0444, client->debugfs, data, 577 577 &pt5161l_debugfs_ops_fw_load_sts); 578 578 579 - debugfs_create_file("heartbeat_status", 0444, data->debugfs, data, 579 + debugfs_create_file("heartbeat_status", 0444, client->debugfs, data, 580 580 &pt5161l_debugfs_ops_hb_sts); 581 - 582 - return 0; 583 581 } 584 582 585 583 static int pt5161l_probe(struct i2c_client *client) ··· 596 604 data, 597 605 &pt5161l_chip_info, 598 606 NULL); 607 + if (IS_ERR(hwmon_dev)) 608 + return PTR_ERR(hwmon_dev); 599 609 600 - pt5161l_init_debugfs(data); 610 + pt5161l_init_debugfs(client, data); 601 611 602 - return PTR_ERR_OR_ZERO(hwmon_dev); 603 - } 604 - 605 - static void pt5161l_remove(struct i2c_client *client) 606 - { 607 - struct pt5161l_data *data = i2c_get_clientdata(client); 608 - 609 - debugfs_remove_recursive(data->debugfs); 612 + return 0; 610 613 } 611 614 612 615 static const struct of_device_id __maybe_unused pt5161l_of_match[] = { ··· 630 643 .acpi_match_table = ACPI_PTR(pt5161l_acpi_match), 631 644 }, 632 645 .probe = pt5161l_probe, 633 - .remove = pt5161l_remove, 634 646 .id_table = pt5161l_id, 635 647 }; 636 - 637 - static int __init pt5161l_init(void) 638 - { 639 - pt5161l_debugfs_dir = debugfs_create_dir("pt5161l", NULL); 640 - return i2c_add_driver(&pt5161l_driver); 641 - } 642 - 643 - static void __exit pt5161l_exit(void) 644 - { 645 - i2c_del_driver(&pt5161l_driver); 646 - debugfs_remove_recursive(pt5161l_debugfs_dir); 647 - } 648 - 649 - module_init(pt5161l_init); 650 - module_exit(pt5161l_exit); 648 + module_i2c_driver(pt5161l_driver); 651 649 652 650 MODULE_AUTHOR("Cosmo Chou <cosmo.chou@quantatw.com>"); 653 651 MODULE_DESCRIPTION("Hwmon driver for Astera Labs Aries PCIe retimer");