tests: drivers: entropy: api: use DEVICE_DT_GET
Obtain a reference to the chosen entropy device at compile time. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
9a02676d9e
commit
1766ac5cfa
1 changed files with 3 additions and 4 deletions
|
@ -67,13 +67,12 @@ static int random_entropy(const struct device *dev, char *buffer, char num)
|
|||
*/
|
||||
static int get_entropy(void)
|
||||
{
|
||||
const struct device *dev;
|
||||
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy));
|
||||
uint8_t buffer[BUFFER_LENGTH] = { 0 };
|
||||
int ret;
|
||||
|
||||
dev = device_get_binding(DT_CHOSEN_ZEPHYR_ENTROPY_LABEL);
|
||||
if (!dev) {
|
||||
TC_PRINT("error: no random device\n");
|
||||
if (!device_is_ready(dev)) {
|
||||
TC_PRINT("error: random device not ready\n");
|
||||
return TC_FAIL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue