From 7791934cc47ff3a01753adb07f7f9ecab56a499b Mon Sep 17 00:00:00 2001 From: Yuan Liu Date: Fri, 29 Jun 2018 14:32:48 +0800 Subject: [PATCH] misc: fix cbc_attach blocks APL NUC boot for 20 seconds This patch resolved systemd be blocking for 20 seconds due to waiting the "READY=1" from cbc_attach. And cbc_attach will retry 60 sec at the worst case which can be reproduced on non-IOC boards. This is one temporary solution. The final solution need modify SBL to export IOC ACPI device through ACPI table, and also Linux IOC CBC driver need trigger uevent which should be the trigger of launching cbc_attach service. This patch changes the service type to simple instead of notify due to systemd is needn't wait cbc related services. And change Restart to no due to cbc_attach already has retry mechanism. These changes are also reasonable for the board integrated IOC component. So they should be keep even the long term final solution implemented. Signed-off-by: Yuan Liu Reviewed-by: Alex Du Reviewed-by: Yu Wang --- misc/cbc_attach/Makefile | 2 +- misc/cbc_attach/cbc_attach.c | 9 +-------- misc/cbc_attach/cbc_attach.service | 4 ++-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/misc/cbc_attach/Makefile b/misc/cbc_attach/Makefile index 39315453c..b138deb2c 100644 --- a/misc/cbc_attach/Makefile +++ b/misc/cbc_attach/Makefile @@ -1,7 +1,7 @@ OUT_DIR ?= . all: - gcc -o $(OUT_DIR)/cbc_attach cbc_attach.c -lsystemd + gcc -o $(OUT_DIR)/cbc_attach cbc_attach.c clean: rm -rf $(OUT_DIR)/cbc_attach diff --git a/misc/cbc_attach/cbc_attach.c b/misc/cbc_attach/cbc_attach.c index 3eb3c7b49..6dbd16b1c 100644 --- a/misc/cbc_attach/cbc_attach.c +++ b/misc/cbc_attach/cbc_attach.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include @@ -23,7 +24,6 @@ #include #ifndef ANDROID_BUILD -#include #define APP_INFO "v" VERSION_STRING #else #define APP_INFO "" @@ -403,13 +403,6 @@ int main(int argc, char **argv) } while (retry_time > 0); - -#ifndef ANDROID_BUILD - /* it is recommended by systemd to ignore the return value of - * sd_notify() - */ - (void)sd_notify(0, "READY=1"); -#endif if (success) { pause(); cbc_attach_shutdown(&deviceFd); diff --git a/misc/cbc_attach/cbc_attach.service b/misc/cbc_attach/cbc_attach.service index 5fb126e9d..f6fac44ce 100644 --- a/misc/cbc_attach/cbc_attach.service +++ b/misc/cbc_attach/cbc_attach.service @@ -6,8 +6,8 @@ Before=basic.target [Service] ExecStart=/usr/bin/cbc_attach /dev/ttyS2 -Restart=always -Type=notify +Restart=no +Type=simple [Install] WantedBy=basic.target