1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2008 - 2009
4 * Windriver, <www.windriver.com>
5 * Tom Rix <Tom.Rix@windriver.com>
7 * Copyright 2011 Sebastian Andrzej Siewior <bigeasy@linutronix.de>
9 * Copyright 2014 Linaro, Ltd.
10 * Rob Herring <robh@kernel.org>
17 * fastboot_response() - Writes a response of the form "$tag$reason".
19 * @tag: The first part of the response
20 * @response: Pointer to fastboot response buffer
21 * @format: printf style format string
23 void fastboot_response(const char *tag, char *response,
24 const char *format, ...)
28 strlcpy(response, tag, FASTBOOT_RESPONSE_LEN);
30 va_start(args, format);
31 vsnprintf(response + strlen(response),
32 FASTBOOT_RESPONSE_LEN - strlen(response) - 1,
39 * fastboot_fail() - Write a FAIL response of the form "FAIL$reason".
41 * @reason: Pointer to returned reason string
42 * @response: Pointer to fastboot response buffer
44 void fastboot_fail(const char *reason, char *response)
46 fastboot_response("FAIL", response, "%s", reason);
50 * fastboot_okay() - Write an OKAY response of the form "OKAY$reason".
52 * @reason: Pointer to returned reason string, or NULL to send a bare "OKAY"
53 * @response: Pointer to fastboot response buffer
55 void fastboot_okay(const char *reason, char *response)
58 fastboot_response("OKAY", response, "%s", reason);
60 fastboot_response("OKAY", response, NULL);