i am getting an error while compiling linux kernel for android...
I modded a battery driver:
here there is the commit on github and all the file: https://github.com/Lopicl/android_samsung_thunderkernel_cooperve/commit/6385d6206119a3f8551e17bbeae130d3230965bf
When compiling i am getting an error:
drivers/power/max8986-power.c:188: error: expected specifier-qualifier-list before 'if'
Can u please help me? :)
Thanks in advance, Matteo
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.