linux/drivers/misc/rpmb-core.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright(c) 2015 - 2019 Intel Corporation. All rights reserved.
 * Copyright(c) 2021 - 2024 Linaro Ltd.
 */
#include <linux/device.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/rpmb.h>
#include <linux/slab.h>

static DEFINE_IDA(rpmb_ida);
static DEFINE_MUTEX(rpmb_mutex);

/**
 * rpmb_dev_get() - increase rpmb device ref counter
 * @rdev: rpmb device
 */
struct rpmb_dev *rpmb_dev_get(struct rpmb_dev *rdev)
{}
EXPORT_SYMBOL_GPL();

/**
 * rpmb_dev_put() - decrease rpmb device ref counter
 * @rdev: rpmb device
 */
void rpmb_dev_put(struct rpmb_dev *rdev)
{}
EXPORT_SYMBOL_GPL();

/**
 * rpmb_route_frames() - route rpmb frames to rpmb device
 * @rdev:	rpmb device
 * @req:	rpmb request frames
 * @req_len:	length of rpmb request frames in bytes
 * @rsp:	rpmb response frames
 * @rsp_len:	length of rpmb response frames in bytes
 *
 * Returns: < 0 on failure
 */
int rpmb_route_frames(struct rpmb_dev *rdev, u8 *req,
		      unsigned int req_len, u8 *rsp, unsigned int rsp_len)
{}
EXPORT_SYMBOL_GPL();

static void rpmb_dev_release(struct device *dev)
{}

static struct class rpmb_class =;

/**
 * rpmb_dev_find_device() - return first matching rpmb device
 * @start: rpmb device to begin with
 * @data: data for the match function
 * @match: the matching function
 *
 * Iterate over registered RPMB devices, and call @match() for each passing
 * it the RPMB device and @data.
 *
 * The return value of @match() is checked for each call. If it returns
 * anything other 0, break and return the found RPMB device.
 *
 * It's the callers responsibility to call rpmb_dev_put() on the returned
 * device, when it's done with it.
 *
 * Returns: a matching rpmb device or NULL on failure
 */
struct rpmb_dev *rpmb_dev_find_device(const void *data,
				      const struct rpmb_dev *start,
				      int (*match)(struct device *dev,
						   const void *data))
{}
EXPORT_SYMBOL_GPL();

int rpmb_interface_register(struct class_interface *intf)
{}
EXPORT_SYMBOL_GPL();

void rpmb_interface_unregister(struct class_interface *intf)
{}
EXPORT_SYMBOL_GPL();

/**
 * rpmb_dev_unregister() - unregister RPMB partition from the RPMB subsystem
 * @rdev: the rpmb device to unregister
 *
 * This function should be called from the release function of the
 * underlying device used when the RPMB device was registered.
 *
 * Returns: < 0 on failure
 */
int rpmb_dev_unregister(struct rpmb_dev *rdev)
{}
EXPORT_SYMBOL_GPL();

/**
 * rpmb_dev_register - register RPMB partition with the RPMB subsystem
 * @dev: storage device of the rpmb device
 * @descr: RPMB device description
 *
 * While registering the RPMB partition extract needed device information
 * while needed resources are available.
 *
 * Returns: a pointer to a 'struct rpmb_dev' or an ERR_PTR on failure
 */
struct rpmb_dev *rpmb_dev_register(struct device *dev,
				   struct rpmb_descr *descr)
{}
EXPORT_SYMBOL_GPL();

static int __init rpmb_init(void)
{}

static void __exit rpmb_exit(void)
{}

subsys_initcall(rpmb_init);
module_exit(rpmb_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();