@@ -466,14 +466,12 @@ static int i2c_smbus_host_notify_to_irq(const struct i2c_client *client)
466
466
static int i2c_device_probe (struct device * dev )
467
467
{
468
468
struct i2c_client * client = i2c_verify_client (dev );
469
- struct i2c_adapter * adap ;
470
469
struct i2c_driver * driver ;
471
470
int status ;
472
471
473
472
if (!client )
474
473
return 0 ;
475
474
476
- adap = client -> adapter ;
477
475
client -> irq = client -> init_irq ;
478
476
479
477
if (!client -> irq ) {
@@ -539,14 +537,6 @@ static int i2c_device_probe(struct device *dev)
539
537
540
538
dev_dbg (dev , "probe\n" );
541
539
542
- if (adap -> bus_regulator ) {
543
- status = regulator_enable (adap -> bus_regulator );
544
- if (status < 0 ) {
545
- dev_err (& adap -> dev , "Failed to enable bus regulator\n" );
546
- goto err_clear_wakeup_irq ;
547
- }
548
- }
549
-
550
540
status = of_clk_set_defaults (dev -> of_node , false);
551
541
if (status < 0 )
552
542
goto err_clear_wakeup_irq ;
@@ -605,10 +595,8 @@ static int i2c_device_probe(struct device *dev)
605
595
static void i2c_device_remove (struct device * dev )
606
596
{
607
597
struct i2c_client * client = to_i2c_client (dev );
608
- struct i2c_adapter * adap ;
609
598
struct i2c_driver * driver ;
610
599
611
- adap = client -> adapter ;
612
600
driver = to_i2c_driver (dev -> driver );
613
601
if (driver -> remove ) {
614
602
int status ;
@@ -623,8 +611,6 @@ static void i2c_device_remove(struct device *dev)
623
611
devres_release_group (& client -> dev , client -> devres_group_id );
624
612
625
613
dev_pm_domain_detach (& client -> dev , !i2c_acpi_waive_d0_probe (dev ));
626
- if (!pm_runtime_status_suspended (& client -> dev ) && adap -> bus_regulator )
627
- regulator_disable (adap -> bus_regulator );
628
614
629
615
dev_pm_clear_wake_irq (& client -> dev );
630
616
device_init_wakeup (& client -> dev , false);
@@ -634,86 +620,6 @@ static void i2c_device_remove(struct device *dev)
634
620
pm_runtime_put (& client -> adapter -> dev );
635
621
}
636
622
637
- #ifdef CONFIG_PM_SLEEP
638
- static int i2c_resume_early (struct device * dev )
639
- {
640
- struct i2c_client * client = i2c_verify_client (dev );
641
- int err ;
642
-
643
- if (!client )
644
- return 0 ;
645
-
646
- if (pm_runtime_status_suspended (& client -> dev ) &&
647
- client -> adapter -> bus_regulator ) {
648
- err = regulator_enable (client -> adapter -> bus_regulator );
649
- if (err )
650
- return err ;
651
- }
652
-
653
- return pm_generic_resume_early (& client -> dev );
654
- }
655
-
656
- static int i2c_suspend_late (struct device * dev )
657
- {
658
- struct i2c_client * client = i2c_verify_client (dev );
659
- int err ;
660
-
661
- if (!client )
662
- return 0 ;
663
-
664
- err = pm_generic_suspend_late (& client -> dev );
665
- if (err )
666
- return err ;
667
-
668
- if (!pm_runtime_status_suspended (& client -> dev ) &&
669
- client -> adapter -> bus_regulator )
670
- return regulator_disable (client -> adapter -> bus_regulator );
671
-
672
- return 0 ;
673
- }
674
- #endif
675
-
676
- #ifdef CONFIG_PM
677
- static int i2c_runtime_resume (struct device * dev )
678
- {
679
- struct i2c_client * client = i2c_verify_client (dev );
680
- int err ;
681
-
682
- if (!client )
683
- return 0 ;
684
-
685
- if (client -> adapter -> bus_regulator ) {
686
- err = regulator_enable (client -> adapter -> bus_regulator );
687
- if (err )
688
- return err ;
689
- }
690
-
691
- return pm_generic_runtime_resume (& client -> dev );
692
- }
693
-
694
- static int i2c_runtime_suspend (struct device * dev )
695
- {
696
- struct i2c_client * client = i2c_verify_client (dev );
697
- int err ;
698
-
699
- if (!client )
700
- return 0 ;
701
-
702
- err = pm_generic_runtime_suspend (& client -> dev );
703
- if (err )
704
- return err ;
705
-
706
- if (client -> adapter -> bus_regulator )
707
- return regulator_disable (client -> adapter -> bus_regulator );
708
- return 0 ;
709
- }
710
- #endif
711
-
712
- static const struct dev_pm_ops i2c_device_pm = {
713
- SET_LATE_SYSTEM_SLEEP_PM_OPS (i2c_suspend_late , i2c_resume_early )
714
- SET_RUNTIME_PM_OPS (i2c_runtime_suspend , i2c_runtime_resume , NULL )
715
- };
716
-
717
623
static void i2c_device_shutdown (struct device * dev )
718
624
{
719
625
struct i2c_client * client = i2c_verify_client (dev );
@@ -773,7 +679,6 @@ struct bus_type i2c_bus_type = {
773
679
.probe = i2c_device_probe ,
774
680
.remove = i2c_device_remove ,
775
681
.shutdown = i2c_device_shutdown ,
776
- .pm = & i2c_device_pm ,
777
682
};
778
683
EXPORT_SYMBOL_GPL (i2c_bus_type );
779
684
0 commit comments