]> Git Repo - u-boot.git/blame - drivers/fwu-mdata/fwu-mdata-uclass.c
Subtree merge tag 'v6.9-dts' of devicetree-rebasing repo [1] into dts/upstream
[u-boot.git] / drivers / fwu-mdata / fwu-mdata-uclass.c
CommitLineData
2eaedc95
SG
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (c) 2022, Linaro Limited
4 */
5
6#define LOG_CATEGORY UCLASS_FWU_MDATA
7
2eaedc95
SG
8#include <dm.h>
9#include <efi_loader.h>
10#include <fwu.h>
11#include <fwu_mdata.h>
12#include <log.h>
13
14#include <linux/errno.h>
15#include <linux/types.h>
2eaedc95 16
167994f2
JB
17/**
18 * fwu_read_mdata() - Wrapper around fwu_mdata_ops.read_mdata()
19 *
20 * Return: 0 if OK, -ve on error
21 */
22int fwu_read_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary)
23{
24 const struct fwu_mdata_ops *ops = device_get_ops(dev);
25
26 if (!ops->read_mdata) {
27 log_debug("read_mdata() method not defined\n");
28 return -ENOSYS;
29 }
30
31 return ops->read_mdata(dev, mdata, primary);
32}
33
34/**
35 * fwu_write_mdata() - Wrapper around fwu_mdata_ops.write_mdata()
36 *
37 * Return: 0 if OK, -ve on error
38 */
39int fwu_write_mdata(struct udevice *dev, struct fwu_mdata *mdata, bool primary)
40{
41 const struct fwu_mdata_ops *ops = device_get_ops(dev);
42
43 if (!ops->write_mdata) {
44 log_debug("write_mdata() method not defined\n");
45 return -ENOSYS;
46 }
47
48 return ops->write_mdata(dev, mdata, primary);
49}
50
2eaedc95
SG
51UCLASS_DRIVER(fwu_mdata) = {
52 .id = UCLASS_FWU_MDATA,
53 .name = "fwu-mdata",
54};
This page took 0.084674 seconds and 4 git commands to generate.