@@ -63,7 +63,6 @@ struct pt5161l_fw_ver {
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 ;
@@ -72,8 +71,6 @@ struct pt5161l_data {
72
71
bool mm_wide_reg_access ; /* MM assisted wide register access */
73
72
};
74
73
75
- static struct dentry * pt5161l_debugfs_dir ;
76
-
77
74
/*
78
75
* Write multiple data bytes to Aries over I2C
79
76
*/
@@ -568,21 +565,16 @@ static const struct file_operations pt5161l_debugfs_ops_hb_sts = {
568
565
.open = simple_open ,
569
566
};
570
567
571
- static int pt5161l_init_debugfs (struct pt5161l_data * data )
568
+ static void pt5161l_init_debugfs (struct i2c_client * client , struct pt5161l_data * data )
572
569
{
573
- data -> debugfs = debugfs_create_dir (dev_name (& data -> client -> dev ),
574
- pt5161l_debugfs_dir );
575
-
576
- debugfs_create_file ("fw_ver" , 0444 , data -> debugfs , data ,
570
+ debugfs_create_file ("fw_ver" , 0444 , client -> debugfs , data ,
577
571
& pt5161l_debugfs_ops_fw_ver );
578
572
579
- debugfs_create_file ("fw_load_status" , 0444 , data -> debugfs , data ,
573
+ debugfs_create_file ("fw_load_status" , 0444 , client -> debugfs , data ,
580
574
& pt5161l_debugfs_ops_fw_load_sts );
581
575
582
- debugfs_create_file ("heartbeat_status" , 0444 , data -> debugfs , data ,
576
+ debugfs_create_file ("heartbeat_status" , 0444 , client -> debugfs , data ,
583
577
& pt5161l_debugfs_ops_hb_sts );
584
-
585
- return 0 ;
586
578
}
587
579
588
580
static int pt5161l_probe (struct i2c_client * client )
@@ -604,17 +596,12 @@ static int pt5161l_probe(struct i2c_client *client)
604
596
data ,
605
597
& pt5161l_chip_info ,
606
598
NULL );
599
+ if (IS_ERR (hwmon_dev ))
600
+ return PTR_ERR (hwmon_dev );
607
601
608
- pt5161l_init_debugfs (data );
609
-
610
- return PTR_ERR_OR_ZERO (hwmon_dev );
611
- }
612
-
613
- static void pt5161l_remove (struct i2c_client * client )
614
- {
615
- struct pt5161l_data * data = i2c_get_clientdata (client );
602
+ pt5161l_init_debugfs (client , data );
616
603
617
- debugfs_remove_recursive ( data -> debugfs ) ;
604
+ return 0 ;
618
605
}
619
606
620
607
static const struct of_device_id __maybe_unused pt5161l_of_match [] = {
@@ -643,24 +630,9 @@ static struct i2c_driver pt5161l_driver = {
643
630
.acpi_match_table = ACPI_PTR (pt5161l_acpi_match ),
644
631
},
645
632
.probe = pt5161l_probe ,
646
- .remove = pt5161l_remove ,
647
633
.id_table = pt5161l_id ,
648
634
};
649
-
650
- static int __init pt5161l_init (void )
651
- {
652
- pt5161l_debugfs_dir = debugfs_create_dir ("pt5161l" , NULL );
653
- return i2c_add_driver (& pt5161l_driver );
654
- }
655
-
656
- static void __exit pt5161l_exit (void )
657
- {
658
- i2c_del_driver (& pt5161l_driver );
659
- debugfs_remove_recursive (pt5161l_debugfs_dir );
660
- }
661
-
662
- module_init (pt5161l_init );
663
- module_exit (pt5161l_exit );
635
+ module_i2c_driver (pt5161l_driver );
664
636
665
637
MODULE_AUTHOR (
"Cosmo Chou <[email protected] >" );
666
638
MODULE_DESCRIPTION ("Hwmon driver for Astera Labs Aries PCIe retimer" );
0 commit comments