@@ -381,17 +381,12 @@ static const char *const u3_phy_files[] = {
381
381
static int u2_phy_params_show (struct seq_file * sf , void * unused )
382
382
{
383
383
struct mtk_phy_instance * inst = sf -> private ;
384
- const char * fname = file_dentry (sf -> file )-> d_iname ;
385
384
struct u2phy_banks * u2_banks = & inst -> u2_banks ;
386
385
void __iomem * com = u2_banks -> com ;
387
386
u32 max = 0 ;
388
387
u32 tmp = 0 ;
389
388
u32 val = 0 ;
390
- int ret ;
391
-
392
- ret = match_string (u2_phy_files , ARRAY_SIZE (u2_phy_files ), fname );
393
- if (ret < 0 )
394
- return ret ;
389
+ int ret = debugfs_get_aux_num (sf -> file );
395
390
396
391
switch (ret ) {
397
392
case U2P_EYE_VRT :
@@ -438,7 +433,7 @@ static int u2_phy_params_show(struct seq_file *sf, void *unused)
438
433
break ;
439
434
}
440
435
441
- seq_printf (sf , "%s : %d [0, %d]\n" , fname , val , max );
436
+ seq_printf (sf , "%s : %d [0, %d]\n" , u2_phy_files [ ret ] , val , max );
442
437
443
438
return 0 ;
444
439
}
@@ -451,23 +446,18 @@ static int u2_phy_params_open(struct inode *inode, struct file *file)
451
446
static ssize_t u2_phy_params_write (struct file * file , const char __user * ubuf ,
452
447
size_t count , loff_t * ppos )
453
448
{
454
- const char * fname = file_dentry (file )-> d_iname ;
455
449
struct seq_file * sf = file -> private_data ;
456
450
struct mtk_phy_instance * inst = sf -> private ;
457
451
struct u2phy_banks * u2_banks = & inst -> u2_banks ;
458
452
void __iomem * com = u2_banks -> com ;
459
453
ssize_t rc ;
460
454
u32 val ;
461
- int ret ;
455
+ int ret = debugfs_get_aux_num ( file ) ;
462
456
463
457
rc = kstrtouint_from_user (ubuf , USER_BUF_LEN (count ), 0 , & val );
464
458
if (rc )
465
459
return rc ;
466
460
467
- ret = match_string (u2_phy_files , ARRAY_SIZE (u2_phy_files ), fname );
468
- if (ret < 0 )
469
- return (ssize_t )ret ;
470
-
471
461
switch (ret ) {
472
462
case U2P_EYE_VRT :
473
463
mtk_phy_update_field (com + U3P_USBPHYACR1 , PA1_RG_VRT_SEL , val );
@@ -516,23 +506,18 @@ static void u2_phy_dbgfs_files_create(struct mtk_phy_instance *inst)
516
506
int i ;
517
507
518
508
for (i = 0 ; i < count ; i ++ )
519
- debugfs_create_file (u2_phy_files [i ], 0644 , inst -> phy -> debugfs ,
520
- inst , & u2_phy_fops );
509
+ debugfs_create_file_aux_num (u2_phy_files [i ], 0644 , inst -> phy -> debugfs ,
510
+ inst , i , & u2_phy_fops );
521
511
}
522
512
523
513
static int u3_phy_params_show (struct seq_file * sf , void * unused )
524
514
{
525
515
struct mtk_phy_instance * inst = sf -> private ;
526
- const char * fname = file_dentry (sf -> file )-> d_iname ;
527
516
struct u3phy_banks * u3_banks = & inst -> u3_banks ;
528
517
u32 val = 0 ;
529
518
u32 max = 0 ;
530
519
u32 tmp ;
531
- int ret ;
532
-
533
- ret = match_string (u3_phy_files , ARRAY_SIZE (u3_phy_files ), fname );
534
- if (ret < 0 )
535
- return ret ;
520
+ int ret = debugfs_get_aux_num (sf -> file );
536
521
537
522
switch (ret ) {
538
523
case U3P_EFUSE_EN :
@@ -564,7 +549,7 @@ static int u3_phy_params_show(struct seq_file *sf, void *unused)
564
549
break ;
565
550
}
566
551
567
- seq_printf (sf , "%s : %d [0, %d]\n" , fname , val , max );
552
+ seq_printf (sf , "%s : %d [0, %d]\n" , u3_phy_files [ ret ] , val , max );
568
553
569
554
return 0 ;
570
555
}
@@ -577,23 +562,18 @@ static int u3_phy_params_open(struct inode *inode, struct file *file)
577
562
static ssize_t u3_phy_params_write (struct file * file , const char __user * ubuf ,
578
563
size_t count , loff_t * ppos )
579
564
{
580
- const char * fname = file_dentry (file )-> d_iname ;
581
565
struct seq_file * sf = file -> private_data ;
582
566
struct mtk_phy_instance * inst = sf -> private ;
583
567
struct u3phy_banks * u3_banks = & inst -> u3_banks ;
584
568
void __iomem * phyd = u3_banks -> phyd ;
585
569
ssize_t rc ;
586
570
u32 val ;
587
- int ret ;
571
+ int ret = debugfs_get_aux_num ( sf -> file ) ;
588
572
589
573
rc = kstrtouint_from_user (ubuf , USER_BUF_LEN (count ), 0 , & val );
590
574
if (rc )
591
575
return rc ;
592
576
593
- ret = match_string (u3_phy_files , ARRAY_SIZE (u3_phy_files ), fname );
594
- if (ret < 0 )
595
- return (ssize_t )ret ;
596
-
597
577
switch (ret ) {
598
578
case U3P_EFUSE_EN :
599
579
mtk_phy_update_field (phyd + U3P_U3_PHYD_RSV ,
@@ -636,8 +616,8 @@ static void u3_phy_dbgfs_files_create(struct mtk_phy_instance *inst)
636
616
int i ;
637
617
638
618
for (i = 0 ; i < count ; i ++ )
639
- debugfs_create_file (u3_phy_files [i ], 0644 , inst -> phy -> debugfs ,
640
- inst , & u3_phy_fops );
619
+ debugfs_create_file_aux_num (u3_phy_files [i ], 0644 , inst -> phy -> debugfs ,
620
+ inst , i , & u3_phy_fops );
641
621
}
642
622
643
623
static int phy_type_show (struct seq_file * sf , void * unused )
0 commit comments