-
Notifications
You must be signed in to change notification settings - Fork 50
Remove fallback to default device open #210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
quic-lxu5
wants to merge
1
commit into
qualcomm:development
Choose a base branch
from
quic-lxu5:fallback
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,7 +71,7 @@ static domain_t *get_domain_uri(int domain_id) { | |
| } | ||
|
|
||
| static const char *get_secure_device_name(int domain_id) { | ||
| const char *name; | ||
| const char *name = NULL; | ||
| int domain = GET_DOMAIN_FROM_EFFEC_DOMAIN_ID(domain_id); | ||
|
|
||
| switch (domain) { | ||
|
|
@@ -97,15 +97,15 @@ static const char *get_secure_device_name(int domain_id) { | |
| name = GDSP1_SECURE_DEVICE_NAME; | ||
| break; | ||
| default: | ||
| name = DEFAULT_DEVICE; | ||
| FARF(ERROR, "ERROR: %s Invalid domain_id %d", __func__, domain_id); | ||
| break; | ||
| } | ||
|
|
||
| return name; | ||
| } | ||
|
|
||
| static const char *get_default_device_name(int domain_id) { | ||
| const char *name; | ||
| static const char *get_non_secure_device_name(int domain_id) { | ||
| const char *name = NULL; | ||
| int domain = GET_DOMAIN_FROM_EFFEC_DOMAIN_ID(domain_id); | ||
|
|
||
| switch (domain) { | ||
|
|
@@ -131,7 +131,7 @@ static const char *get_default_device_name(int domain_id) { | |
| name = GDSP1_DEVICE_NAME; | ||
| break; | ||
| default: | ||
| name = DEFAULT_DEVICE; | ||
| FARF(ERROR, "ERROR: %s Invalid domain_id %d", __func__, domain_id); | ||
| break; | ||
| } | ||
|
|
||
|
|
@@ -152,6 +152,9 @@ static bool fastrpc_dev_exists(const char* dev_name) | |
| char *path = NULL; | ||
| uint64_t len; | ||
|
|
||
| if (!dev_name) | ||
| return false; | ||
|
|
||
| len = snprintf(0, 0, "/dev/%s", dev_name) + 1; | ||
| if(NULL == (path = (char *)malloc(len * sizeof(char)))) | ||
| return false; | ||
|
|
@@ -172,13 +175,13 @@ static bool fastrpc_dev_exists(const char* dev_name) | |
| static int fastrpc_wait_for_device(int domain) | ||
| { | ||
| int inotify_fd = -1, watch_fd = -1, err = 0; | ||
| const char *sec_dev_name = NULL, *def_dev_name = NULL; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check for non-secure device also to maintain backward compatibility |
||
| const char *sec_dev_name = NULL, *non_sec_dev_name = NULL; | ||
| struct pollfd pfd[1]; | ||
|
|
||
| sec_dev_name = get_secure_device_name(domain); | ||
| def_dev_name = get_default_device_name(domain); | ||
| non_sec_dev_name = get_non_secure_device_name(domain); | ||
|
|
||
| if (fastrpc_dev_exists(sec_dev_name) || fastrpc_dev_exists(def_dev_name)) | ||
| if (fastrpc_dev_exists(sec_dev_name) || fastrpc_dev_exists(non_sec_dev_name)) | ||
| return 0; | ||
|
|
||
| inotify_fd = inotify_init(); | ||
|
|
@@ -194,7 +197,7 @@ static int fastrpc_wait_for_device(int domain) | |
| return AEE_EINVALIDFD; | ||
| } | ||
|
|
||
| if (fastrpc_dev_exists(sec_dev_name) || fastrpc_dev_exists(def_dev_name)) | ||
| if (fastrpc_dev_exists(sec_dev_name) || fastrpc_dev_exists(non_sec_dev_name)) | ||
| goto bail; | ||
|
|
||
| memset(pfd, 0 , sizeof(pfd)); | ||
|
|
@@ -231,7 +234,7 @@ static int fastrpc_wait_for_device(int domain) | |
| /* Check if the event corresponds to the creation of the device node. */ | ||
| if (event->wd == watch_fd && (event->mask & IN_CREATE) && | ||
| ((strcmp(sec_dev_name, event->name) == 0) || | ||
| (strcmp(def_dev_name, event->name) == 0))) { | ||
| (strcmp(non_sec_dev_name, event->name) == 0))) { | ||
| /* Device node created, process proceed to open and use it. */ | ||
| VERIFY_IPRINTF("Device node %s created!\n", event->name); | ||
| goto bail; /* Exit the loop after device creation is detected. */ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I checked and this function cannot be removed. The reason is that some old platform use non-secure devices for daemons(if non-secure-domain property is added in DT).
You can just rename the function as get_non_secure_device_name and modify the default: case here.