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

platform/x86: compal-laptop: Get rid of a few forward declarations

Declarations for static symbols are useless repetition (unless there are
cyclic dependencies).

By changing the order of a few symbols two forward declarations can be
dropped.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220923094759.87804-1-u.kleine-koenig@pengutronix.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Uwe Kleine-König and committed by
Hans de Goede
d443fcad 76a13da7

+74 -77
+74 -77
drivers/platform/x86/compal-laptop.c
··· 721 721 }; 722 722 ATTRIBUTE_GROUPS(compal_hwmon); 723 723 724 - static int compal_probe(struct platform_device *); 725 - static int compal_remove(struct platform_device *); 726 - static struct platform_driver compal_driver = { 727 - .driver = { 728 - .name = DRIVER_NAME, 729 - }, 730 - .probe = compal_probe, 731 - .remove = compal_remove, 732 - }; 733 - 734 724 static enum power_supply_property compal_bat_properties[] = { 735 725 POWER_SUPPLY_PROP_STATUS, 736 726 POWER_SUPPLY_PROP_HEALTH, ··· 955 965 return ret; 956 966 } 957 967 968 + static int compal_probe(struct platform_device *pdev) 969 + { 970 + int err; 971 + struct compal_data *data; 972 + struct device *hwmon_dev; 973 + struct power_supply_config psy_cfg = {}; 974 + 975 + if (!extra_features) 976 + return 0; 977 + 978 + /* Fan control */ 979 + data = devm_kzalloc(&pdev->dev, sizeof(struct compal_data), GFP_KERNEL); 980 + if (!data) 981 + return -ENOMEM; 982 + 983 + initialize_fan_control_data(data); 984 + 985 + err = sysfs_create_group(&pdev->dev.kobj, &compal_platform_attr_group); 986 + if (err) 987 + return err; 988 + 989 + hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev, 990 + "compal", data, 991 + compal_hwmon_groups); 992 + if (IS_ERR(hwmon_dev)) { 993 + err = PTR_ERR(hwmon_dev); 994 + goto remove; 995 + } 996 + 997 + /* Power supply */ 998 + initialize_power_supply_data(data); 999 + psy_cfg.drv_data = data; 1000 + data->psy = power_supply_register(&compal_device->dev, &psy_bat_desc, 1001 + &psy_cfg); 1002 + if (IS_ERR(data->psy)) { 1003 + err = PTR_ERR(data->psy); 1004 + goto remove; 1005 + } 1006 + 1007 + platform_set_drvdata(pdev, data); 1008 + 1009 + return 0; 1010 + 1011 + remove: 1012 + sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group); 1013 + return err; 1014 + } 1015 + 1016 + static int compal_remove(struct platform_device *pdev) 1017 + { 1018 + struct compal_data *data; 1019 + 1020 + if (!extra_features) 1021 + return 0; 1022 + 1023 + pr_info("Unloading: resetting fan control to motherboard\n"); 1024 + pwm_disable_control(); 1025 + 1026 + data = platform_get_drvdata(pdev); 1027 + power_supply_unregister(data->psy); 1028 + 1029 + sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group); 1030 + 1031 + return 0; 1032 + } 1033 + 1034 + static struct platform_driver compal_driver = { 1035 + .driver = { 1036 + .name = DRIVER_NAME, 1037 + }, 1038 + .probe = compal_probe, 1039 + .remove = compal_remove, 1040 + }; 1041 + 958 1042 static int __init compal_init(void) 959 1043 { 960 1044 int ret; ··· 1092 1028 return ret; 1093 1029 } 1094 1030 1095 - static int compal_probe(struct platform_device *pdev) 1096 - { 1097 - int err; 1098 - struct compal_data *data; 1099 - struct device *hwmon_dev; 1100 - struct power_supply_config psy_cfg = {}; 1101 - 1102 - if (!extra_features) 1103 - return 0; 1104 - 1105 - /* Fan control */ 1106 - data = devm_kzalloc(&pdev->dev, sizeof(struct compal_data), GFP_KERNEL); 1107 - if (!data) 1108 - return -ENOMEM; 1109 - 1110 - initialize_fan_control_data(data); 1111 - 1112 - err = sysfs_create_group(&pdev->dev.kobj, &compal_platform_attr_group); 1113 - if (err) 1114 - return err; 1115 - 1116 - hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev, 1117 - "compal", data, 1118 - compal_hwmon_groups); 1119 - if (IS_ERR(hwmon_dev)) { 1120 - err = PTR_ERR(hwmon_dev); 1121 - goto remove; 1122 - } 1123 - 1124 - /* Power supply */ 1125 - initialize_power_supply_data(data); 1126 - psy_cfg.drv_data = data; 1127 - data->psy = power_supply_register(&compal_device->dev, &psy_bat_desc, 1128 - &psy_cfg); 1129 - if (IS_ERR(data->psy)) { 1130 - err = PTR_ERR(data->psy); 1131 - goto remove; 1132 - } 1133 - 1134 - platform_set_drvdata(pdev, data); 1135 - 1136 - return 0; 1137 - 1138 - remove: 1139 - sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group); 1140 - return err; 1141 - } 1142 - 1143 1031 static void __exit compal_cleanup(void) 1144 1032 { 1145 1033 platform_device_unregister(compal_device); ··· 1104 1088 1105 1089 pr_info("Driver unloaded\n"); 1106 1090 } 1107 - 1108 - static int compal_remove(struct platform_device *pdev) 1109 - { 1110 - struct compal_data *data; 1111 - 1112 - if (!extra_features) 1113 - return 0; 1114 - 1115 - pr_info("Unloading: resetting fan control to motherboard\n"); 1116 - pwm_disable_control(); 1117 - 1118 - data = platform_get_drvdata(pdev); 1119 - power_supply_unregister(data->psy); 1120 - 1121 - sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group); 1122 - 1123 - return 0; 1124 - } 1125 - 1126 1091 1127 1092 module_init(compal_init); 1128 1093 module_exit(compal_cleanup);