]> Git Repo - J-u-boot.git/blame - drivers/smem/smem-uclass.c
net: dwc_eth_qos: Remove obsolete imx8 includes
[J-u-boot.git] / drivers / smem / smem-uclass.c
CommitLineData
7b384ecc
RF
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (c) 2018 Ramon Fried <[email protected]>
4 */
5
b953ec2b
PD
6#define LOG_CATEGORY UCLASS_SMEM
7
7b384ecc
RF
8#include <dm.h>
9#include <smem.h>
10
11int smem_alloc(struct udevice *dev, unsigned int host,
12 unsigned int item, size_t size)
13{
14 struct smem_ops *ops = smem_get_ops(dev);
15
16 if (!ops->alloc)
17 return -ENOSYS;
18
19 return ops->alloc(host, item, size);
20}
21
22void *smem_get(struct udevice *dev, unsigned int host,
23 unsigned int item, size_t *size)
24{
25 struct smem_ops *ops = smem_get_ops(dev);
26
27 if (!ops->get)
28 return NULL;
29
30 return ops->get(host, item, size);
31}
32
33int smem_get_free_space(struct udevice *dev, unsigned int host)
34{
35 struct smem_ops *ops = smem_get_ops(dev);
36
37 if (!ops->get_free_space)
38 return -ENOSYS;
39
40 return ops->get_free_space(host);
41}
42
43UCLASS_DRIVER(smem) = {
44 .id = UCLASS_SMEM,
45 .name = "smem",
46};
This page took 0.185153 seconds and 4 git commands to generate.