From 8357a4fb160bda9a3c926c674492cb604421b7f1 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 1 Oct 2019 15:08:19 -0700 Subject: fpsensor: Fix public build Add stubs for fp_sensor_init and fp_sensor_deinit when building without the private FP sensor files. BRANCH=none BUG=b:124773209,b:141924178 TEST=make buildall -j Change-Id: Ie85a4bb0e568b205ada0d378ae658e8fe478c0a9 Signed-off-by: Tom Hughes Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1834274 Reviewed-by: Nicolas Norvez --- common/fpsensor/build.mk | 3 +++ common/fpsensor/fpsensor_stubs.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 common/fpsensor/fpsensor_stubs.c (limited to 'common/fpsensor') diff --git a/common/fpsensor/build.mk b/common/fpsensor/build.mk index 7df7dbaf28..9556515f2f 100644 --- a/common/fpsensor/build.mk +++ b/common/fpsensor/build.mk @@ -12,3 +12,6 @@ all-obj-$(HAS_TASK_FPSENSOR)+=$(_fpsensor_dir)fpsensor_crypto.o ifneq ($(CONFIG_SPI_FP_PORT),) all-obj-$(HAS_TASK_FPSENSOR)+=$(_fpsensor_dir)fpsensor.o endif +ifeq ($(HAS_MOCK_FPSENSOR),) +all-obj-$(HAS_TASK_FPSENSOR)+=$(_fpsensor_dir)fpsensor_stubs.o +endif diff --git a/common/fpsensor/fpsensor_stubs.c b/common/fpsensor/fpsensor_stubs.c new file mode 100644 index 0000000000..3acaa689f5 --- /dev/null +++ b/common/fpsensor/fpsensor_stubs.c @@ -0,0 +1,30 @@ +/* Copyright 2019 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "common.h" +#include "fpsensor_state.h" +#include "panic.h" + +/* + * These are built when we don't have the private driver files. + * The definitions are intentionally kept separate from the mock + * implementations so that we don't accidentally compile mocks into a release. + */ + +#if !defined(HAVE_FP_PRIVATE_DRIVER) + +int fp_sensor_init(void) +{ + panic("fp_sensor_init stub should never be called\n"); + return EC_ERROR_UNKNOWN; +} + +int fp_sensor_deinit(void) +{ + panic("fp_sensor_deinit stub should never be called\n"); + return EC_ERROR_UNKNOWN; +} + +#endif /* !HAVE_FP_PRIVATE_DRIVER */ -- cgit v1.2.1