sharpsl_pm.battstat.ac_status = (!(STATUS_AC_IN) ? APM_AC_OFFLINE : APM_AC_ONLINE); 
sharpsl_pm.battstat.ac_status = (STATUS_AC_IN() ? APM_AC_ONLINE : APM_AC_OFFLINE); 
static void sharpsl_battery_thread(void *private_){	int voltage, percent, apm_status, i = 0;	if (!sharpsl_pm.machinfo)		return;	sharpsl_pm.battstat.ac_status = (!(STATUS_AC_IN) ? APM_AC_OFFLINE : APM_AC_ONLINE);	/* Corgi cannot confirm when battery fully charged so periodically kick! */	if (machine_is_corgi() && (sharpsl_pm.charge_mode == CHRG_ON)			&& time_after(jiffies, sharpsl_pm.charge_start_time +  SHARPSL_CHARGE_ON_TIME_INTERVAL))		schedule_work(&toggle_charger);	while(1) {		voltage = sharpsl_read_MainBattery();		if (voltage > 0) break;		if (i++ > 5) {			voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage;			dev_warn(sharpsl_pm.dev, "Warning: Cannot read main battery!\n");			break;		}	}	voltage = sharpsl_average_value(voltage);	apm_status = get_apm_status(voltage);	percent = get_percentage(voltage);	/* At low battery voltages, the voltage has a tendency to start           creeping back up so we try to avoid this here */	if ((sharpsl_pm.battstat.ac_status == APM_AC_ONLINE) || (apm_status == APM_BATTERY_STATUS_HIGH) ||  percent <= sharpsl_pm.battstat.mainbat_percent) {		sharpsl_pm.battstat.mainbat_voltage = voltage;		sharpsl_pm.battstat.mainbat_status = apm_status;		sharpsl_pm.battstat.mainbat_percent = percent;	}	dev_dbg(sharpsl_pm.dev, "Battery: voltage: %d, status: %d, percentage: %d, time: %d\n", voltage,			sharpsl_pm.battstat.mainbat_status, sharpsl_pm.battstat.mainbat_percent, jiffies);	/* If battery is low. limit backlight intensity to save power. */	if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)			&& ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) ||			(sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) {		if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) {			corgibl_limit_intensity(1);			sharpsl_pm.flags |= SHARPSL_BL_LIMIT;		}	} else if (sharpsl_pm.flags & SHARPSL_BL_LIMIT) {		corgibl_limit_intensity(0);		sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT;	}	/* Suspend if critical battery level */	if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)			&& (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL)			&& !(sharpsl_pm.flags & SHARPSL_APM_QUEUED)) {		sharpsl_pm.flags |= SHARPSL_APM_QUEUED;		dev_err(sharpsl_pm.dev, "Fatal Off\n");		apm_queue_event(APM_CRITICAL_SUSPEND);	}	schedule_delayed_work(&sharpsl_bat, SHARPSL_BATCHK_TIME);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/c5e1ae9729d97d3c543cc70d7865df1e724da0d0/sharpsl_pm.c/clean/arch/arm/mach-pxa/sharpsl_pm.c