diff options
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/ab8500_btemp.c | 15 | ||||
-rw-r--r-- | drivers/power/ab8500_charger.c | 16 | ||||
-rw-r--r-- | drivers/power/ab8500_fg.c | 15 | ||||
-rw-r--r-- | drivers/power/abx500_chargalg.c | 14 |
4 files changed, 20 insertions, 40 deletions
diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index 8f8044e1acf3..bf2e5dd301e7 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c | |||
@@ -906,26 +906,21 @@ static int ab8500_btemp_get_property(struct power_supply *psy, | |||
906 | static int ab8500_btemp_get_ext_psy_data(struct device *dev, void *data) | 906 | static int ab8500_btemp_get_ext_psy_data(struct device *dev, void *data) |
907 | { | 907 | { |
908 | struct power_supply *psy; | 908 | struct power_supply *psy; |
909 | struct power_supply *ext; | 909 | struct power_supply *ext = dev_get_drvdata(dev); |
910 | const char **supplicants = (const char **)ext->supplied_to; | ||
910 | struct ab8500_btemp *di; | 911 | struct ab8500_btemp *di; |
911 | union power_supply_propval ret; | 912 | union power_supply_propval ret; |
912 | int i, j; | 913 | int j; |
913 | bool psy_found = false; | ||
914 | 914 | ||
915 | psy = (struct power_supply *)data; | 915 | psy = (struct power_supply *)data; |
916 | ext = dev_get_drvdata(dev); | ||
917 | di = power_supply_get_drvdata(psy); | 916 | di = power_supply_get_drvdata(psy); |
918 | 917 | ||
919 | /* | 918 | /* |
920 | * For all psy where the name of your driver | 919 | * For all psy where the name of your driver |
921 | * appears in any supplied_to | 920 | * appears in any supplied_to |
922 | */ | 921 | */ |
923 | for (i = 0; i < ext->num_supplicants; i++) { | 922 | j = match_string(supplicants, ext->num_supplicants, psy->desc->name); |
924 | if (!strcmp(ext->supplied_to[i], psy->desc->name)) | 923 | if (j < 0) |
925 | psy_found = true; | ||
926 | } | ||
927 | |||
928 | if (!psy_found) | ||
929 | return 0; | 924 | return 0; |
930 | 925 | ||
931 | /* Go through all properties for the psy */ | 926 | /* Go through all properties for the psy */ |
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index e388171f4e58..30de5d42b26a 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c | |||
@@ -1929,11 +1929,11 @@ static int ab8540_charger_usb_pre_chg_enable(struct ux500_charger *charger, | |||
1929 | static int ab8500_charger_get_ext_psy_data(struct device *dev, void *data) | 1929 | static int ab8500_charger_get_ext_psy_data(struct device *dev, void *data) |
1930 | { | 1930 | { |
1931 | struct power_supply *psy; | 1931 | struct power_supply *psy; |
1932 | struct power_supply *ext; | 1932 | struct power_supply *ext = dev_get_drvdata(dev); |
1933 | const char **supplicants = (const char **)ext->supplied_to; | ||
1933 | struct ab8500_charger *di; | 1934 | struct ab8500_charger *di; |
1934 | union power_supply_propval ret; | 1935 | union power_supply_propval ret; |
1935 | int i, j; | 1936 | int j; |
1936 | bool psy_found = false; | ||
1937 | struct ux500_charger *usb_chg; | 1937 | struct ux500_charger *usb_chg; |
1938 | 1938 | ||
1939 | usb_chg = (struct ux500_charger *)data; | 1939 | usb_chg = (struct ux500_charger *)data; |
@@ -1941,15 +1941,9 @@ static int ab8500_charger_get_ext_psy_data(struct device *dev, void *data) | |||
1941 | 1941 | ||
1942 | di = to_ab8500_charger_usb_device_info(usb_chg); | 1942 | di = to_ab8500_charger_usb_device_info(usb_chg); |
1943 | 1943 | ||
1944 | ext = dev_get_drvdata(dev); | ||
1945 | |||
1946 | /* For all psy where the driver name appears in any supplied_to */ | 1944 | /* For all psy where the driver name appears in any supplied_to */ |
1947 | for (i = 0; i < ext->num_supplicants; i++) { | 1945 | j = match_string(supplicants, ext->num_supplicants, psy->desc->name); |
1948 | if (!strcmp(ext->supplied_to[i], psy->desc->name)) | 1946 | if (j < 0) |
1949 | psy_found = true; | ||
1950 | } | ||
1951 | |||
1952 | if (!psy_found) | ||
1953 | return 0; | 1947 | return 0; |
1954 | 1948 | ||
1955 | /* Go through all properties for the psy */ | 1949 | /* Go through all properties for the psy */ |
diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index 3830dade5d69..5a36cf88578a 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c | |||
@@ -2168,26 +2168,21 @@ static int ab8500_fg_get_property(struct power_supply *psy, | |||
2168 | static int ab8500_fg_get_ext_psy_data(struct device *dev, void *data) | 2168 | static int ab8500_fg_get_ext_psy_data(struct device *dev, void *data) |
2169 | { | 2169 | { |
2170 | struct power_supply *psy; | 2170 | struct power_supply *psy; |
2171 | struct power_supply *ext; | 2171 | struct power_supply *ext = dev_get_drvdata(dev); |
2172 | const char **supplicants = (const char **)ext->supplied_to; | ||
2172 | struct ab8500_fg *di; | 2173 | struct ab8500_fg *di; |
2173 | union power_supply_propval ret; | 2174 | union power_supply_propval ret; |
2174 | int i, j; | 2175 | int j; |
2175 | bool psy_found = false; | ||
2176 | 2176 | ||
2177 | psy = (struct power_supply *)data; | 2177 | psy = (struct power_supply *)data; |
2178 | ext = dev_get_drvdata(dev); | ||
2179 | di = power_supply_get_drvdata(psy); | 2178 | di = power_supply_get_drvdata(psy); |
2180 | 2179 | ||
2181 | /* | 2180 | /* |
2182 | * For all psy where the name of your driver | 2181 | * For all psy where the name of your driver |
2183 | * appears in any supplied_to | 2182 | * appears in any supplied_to |
2184 | */ | 2183 | */ |
2185 | for (i = 0; i < ext->num_supplicants; i++) { | 2184 | j = match_string(supplicants, ext->num_supplicants, psy->desc->name); |
2186 | if (!strcmp(ext->supplied_to[i], psy->desc->name)) | 2185 | if (j < 0) |
2187 | psy_found = true; | ||
2188 | } | ||
2189 | |||
2190 | if (!psy_found) | ||
2191 | return 0; | 2186 | return 0; |
2192 | 2187 | ||
2193 | /* Go through all properties for the psy */ | 2188 | /* Go through all properties for the psy */ |
diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c index 541f702e0451..d9104b1ab7cf 100644 --- a/drivers/power/abx500_chargalg.c +++ b/drivers/power/abx500_chargalg.c | |||
@@ -975,22 +975,18 @@ static void handle_maxim_chg_curr(struct abx500_chargalg *di) | |||
975 | static int abx500_chargalg_get_ext_psy_data(struct device *dev, void *data) | 975 | static int abx500_chargalg_get_ext_psy_data(struct device *dev, void *data) |
976 | { | 976 | { |
977 | struct power_supply *psy; | 977 | struct power_supply *psy; |
978 | struct power_supply *ext; | 978 | struct power_supply *ext = dev_get_drvdata(dev); |
979 | const char **supplicants = (const char **)ext->supplied_to; | ||
979 | struct abx500_chargalg *di; | 980 | struct abx500_chargalg *di; |
980 | union power_supply_propval ret; | 981 | union power_supply_propval ret; |
981 | int i, j; | 982 | int j; |
982 | bool psy_found = false; | ||
983 | bool capacity_updated = false; | 983 | bool capacity_updated = false; |
984 | 984 | ||
985 | psy = (struct power_supply *)data; | 985 | psy = (struct power_supply *)data; |
986 | ext = dev_get_drvdata(dev); | ||
987 | di = power_supply_get_drvdata(psy); | 986 | di = power_supply_get_drvdata(psy); |
988 | /* For all psy where the driver name appears in any supplied_to */ | 987 | /* For all psy where the driver name appears in any supplied_to */ |
989 | for (i = 0; i < ext->num_supplicants; i++) { | 988 | j = match_string(supplicants, ext->num_supplicants, psy->desc->name); |
990 | if (!strcmp(ext->supplied_to[i], psy->desc->name)) | 989 | if (j < 0) |
991 | psy_found = true; | ||
992 | } | ||
993 | if (!psy_found) | ||
994 | return 0; | 990 | return 0; |
995 | 991 | ||
996 | /* | 992 | /* |