Things with a # before them are processed only once, when your code is compiled; they are not processed at run time. This makes, for example, the following code bad:
if (max8986_power->isFullcharged == TRUE)
{
#define FULLY_CHARGED 1
}
else
{
#define FULLY_CHARGED 0
}
because you will in effect #define FULLY_CHARGED x
twice (the pre-processor ignores the actual C code; the if
checks are not used).
Later when you if (FULLY_CHARGED = 0)
you are not only attempting to examine an invalidly defined macro, but your code is attempting to assign the value rather than just examine it! IF FULLY_CHARGED
was a variable, you would mean your code to be if (FULLY_CHARGED == 0)
(note the double equal signs, for equality checking).
Perhaps you want to change the definition of your macro to:
#if defined CONFIG_BLX
#define FULLY_CHARGED (max8986_power->batt_percentage == MAX_CHARGINGLIMIT) && (max8986_power->charging_status == POWER_SUPPLY_STATUS_CHARGING)
#else
#define FULLY_CHARGED (max8986_power->isFullcharged == TRUE)
#endif
and fix all your IF statements to check for equality rather than assignment.