/* applesmc_read_motion_sensor - Read motion sensor (X, Y or Z). Callers must hold applesmc_lock.  */
static int applesmc_read_motion_sensor(int index, s16 *value)
/* applesmc_read_motion_sensor - Read motion sensor (X, Y or Z). Callers must hold applesmc_lock.  */
static int applesmc_read_motion_sensor(int index, s16 *value)
{
	u8 buffer[2];
	int ret;
	switch (index) {
	case SENSOR_X:
		ret = applesmc_read_key(MOTION_SENSOR_X_KEY, buffer, 2);
		break;
	case SENSOR_Y:
		ret = applesmc_read_key(MOTION_SENSOR_Y_KEY, buffer, 2);
		break;
	case SENSOR_Z:
		ret = applesmc_read_key(MOTION_SENSOR_Z_KEY, buffer, 2);
		break;
	default:
		ret = -EINVAL;
	}
	*value = ((s16)buffer[0] << 8) | buffer[1];
	return ret;
}