mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-14 22:23:56 +09:00
![Masahiro Yamada](/assets/img/avatar_default.png)
U-Boot widely uses error() as a bit noisier variant of printf(). This macro causes name conflict with the following line in include/linux/compiler-gcc.h: # define __compiletime_error(message) __attribute__((error(message))) This prevents us from using __compiletime_error(), and makes it difficult to fully sync BUILD_BUG macros with Linux. (Notice Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().) Let's convert error() into now treewide-available pr_err(). Done with the help of Coccinelle, excluing tools/ directory. The semantic patch I used is as follows: // <smpl> @@@@ -error +pr_err (...) // </smpl> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: Re-run Coccinelle] Signed-off-by: Tom Rini <trini@konsulko.com>
51 lines
1.0 KiB
C
51 lines
1.0 KiB
C
/*
|
|
* cmd_sdp.c -- sdp command
|
|
*
|
|
* Copyright (C) 2016 Toradex
|
|
* Author: Stefan Agner <stefan.agner@toradex.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <g_dnl.h>
|
|
#include <sdp.h>
|
|
#include <usb.h>
|
|
|
|
static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
{
|
|
int ret = CMD_RET_FAILURE;
|
|
|
|
if (argc < 2)
|
|
return CMD_RET_USAGE;
|
|
|
|
char *usb_controller = argv[1];
|
|
int controller_index = simple_strtoul(usb_controller, NULL, 0);
|
|
board_usb_init(controller_index, USB_INIT_DEVICE);
|
|
|
|
g_dnl_clear_detach();
|
|
g_dnl_register("usb_dnl_sdp");
|
|
|
|
ret = sdp_init(controller_index);
|
|
if (ret) {
|
|
pr_err("SDP init failed: %d", ret);
|
|
goto exit;
|
|
}
|
|
|
|
/* This command typically does not return but jumps to an image */
|
|
sdp_handle(controller_index);
|
|
pr_err("SDP ended");
|
|
|
|
exit:
|
|
g_dnl_unregister();
|
|
board_usb_cleanup(controller_index, USB_INIT_DEVICE);
|
|
|
|
return ret;
|
|
}
|
|
|
|
U_BOOT_CMD(sdp, 2, 1, do_sdp,
|
|
"Serial Downloader Protocol",
|
|
"<USB_controller>\n"
|
|
" - serial downloader protocol via <USB_controller>\n"
|
|
);
|