Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-riscv
[platform/kernel/u-boot.git] / drivers / rng / rng-uclass.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (c) 2019, Linaro Limited
4  */
5
6 #define LOG_CATEGORY UCLASS_RNG
7
8 #include <common.h>
9 #include <dm.h>
10 #include <rng.h>
11
12 int dm_rng_read(struct udevice *dev, void *buffer, size_t size)
13 {
14         const struct dm_rng_ops *ops = device_get_ops(dev);
15
16         if (!ops->read)
17                 return -ENOSYS;
18
19         return ops->read(dev, buffer, size);
20 }
21
22 UCLASS_DRIVER(rng) = {
23         .name = "rng",
24         .id = UCLASS_RNG,
25 };