@@ -367,7 +367,6 @@ static struct {
367
367
u32 beep_needs_two_args :1 ;
368
368
u32 mixer_no_level_control :1 ;
369
369
u32 battery_force_primary :1 ;
370
- u32 sensors_pdrv_registered :1 ;
371
370
u32 hotkey_poll_active :1 ;
372
371
u32 has_adaptive_kbd :1 ;
373
372
u32 kbd_lang :1 ;
@@ -11815,12 +11814,10 @@ static void thinkpad_acpi_module_exit(void)
11815
11814
{
11816
11815
tpacpi_lifecycle = TPACPI_LIFE_EXITING ;
11817
11816
11818
- if (tpacpi_hwmon )
11819
- hwmon_device_unregister (tpacpi_hwmon );
11820
- if (tp_features .sensors_pdrv_registered )
11817
+ if (tpacpi_sensors_pdev ) {
11821
11818
platform_driver_unregister (& tpacpi_hwmon_pdriver );
11822
- if (tpacpi_sensors_pdev )
11823
11819
platform_device_unregister (tpacpi_sensors_pdev );
11820
+ }
11824
11821
11825
11822
if (tpacpi_pdev ) {
11826
11823
platform_driver_unregister (& tpacpi_pdriver );
@@ -11891,6 +11888,17 @@ static int __init tpacpi_pdriver_probe(struct platform_device *pdev)
11891
11888
return ret ;
11892
11889
}
11893
11890
11891
+ static int __init tpacpi_hwmon_pdriver_probe (struct platform_device * pdev )
11892
+ {
11893
+ tpacpi_hwmon = devm_hwmon_device_register_with_groups (
11894
+ & tpacpi_sensors_pdev -> dev , TPACPI_NAME , NULL , tpacpi_hwmon_groups );
11895
+
11896
+ if (IS_ERR (tpacpi_hwmon ))
11897
+ pr_err ("unable to register hwmon device\n" );
11898
+
11899
+ return PTR_ERR_OR_ZERO (tpacpi_hwmon );
11900
+ }
11901
+
11894
11902
static int __init thinkpad_acpi_module_init (void )
11895
11903
{
11896
11904
const struct dmi_system_id * dmi_id ;
@@ -11964,37 +11972,19 @@ static int __init thinkpad_acpi_module_init(void)
11964
11972
return ret ;
11965
11973
}
11966
11974
11967
- tpacpi_sensors_pdev = platform_device_register_simple (
11968
- TPACPI_HWMON_DRVR_NAME ,
11969
- PLATFORM_DEVID_NONE , NULL , 0 );
11975
+ tpacpi_sensors_pdev = platform_create_bundle ( & tpacpi_hwmon_pdriver ,
11976
+ tpacpi_hwmon_pdriver_probe ,
11977
+ NULL , 0 , NULL , 0 );
11970
11978
if (IS_ERR (tpacpi_sensors_pdev )) {
11971
11979
ret = PTR_ERR (tpacpi_sensors_pdev );
11972
11980
tpacpi_sensors_pdev = NULL ;
11973
- pr_err ("unable to register hwmon platform device\n" );
11981
+ pr_err ("unable to register hwmon platform device/driver bundle \n" );
11974
11982
thinkpad_acpi_module_exit ();
11975
11983
return ret ;
11976
11984
}
11977
11985
11978
11986
tpacpi_lifecycle = TPACPI_LIFE_RUNNING ;
11979
11987
11980
- ret = platform_driver_register (& tpacpi_hwmon_pdriver );
11981
- if (ret ) {
11982
- pr_err ("unable to register hwmon platform driver\n" );
11983
- thinkpad_acpi_module_exit ();
11984
- return ret ;
11985
- }
11986
- tp_features .sensors_pdrv_registered = 1 ;
11987
-
11988
- tpacpi_hwmon = hwmon_device_register_with_groups (
11989
- & tpacpi_sensors_pdev -> dev , TPACPI_NAME , NULL , tpacpi_hwmon_groups );
11990
- if (IS_ERR (tpacpi_hwmon )) {
11991
- ret = PTR_ERR (tpacpi_hwmon );
11992
- tpacpi_hwmon = NULL ;
11993
- pr_err ("unable to register hwmon device\n" );
11994
- thinkpad_acpi_module_exit ();
11995
- return ret ;
11996
- }
11997
-
11998
11988
return 0 ;
11999
11989
}
12000
11990
0 commit comments