#include <linux/greybus.h>
#include <linux/cdev.h>
#include <linux/fs.h>
#include <linux/ioctl.h>
#include <linux/uaccess.h>
#include "greybus_authentication.h"
#include "firmware.h"
#define CAP_TIMEOUT_MS …
#define NUM_MINORS …
struct gb_cap { … };
static const struct class cap_class = …;
static dev_t cap_dev_num;
static DEFINE_IDA(cap_minors_map);
static LIST_HEAD(cap_list);
static DEFINE_MUTEX(list_mutex);
static void cap_kref_release(struct kref *kref)
{ … }
static void put_cap(struct gb_cap *cap)
{ … }
static struct gb_cap *get_cap(struct cdev *cdev)
{ … }
static int cap_get_endpoint_uid(struct gb_cap *cap, u8 *euid)
{ … }
static int cap_get_ims_certificate(struct gb_cap *cap, u32 class, u32 id,
u8 *certificate, u32 *size, u8 *result)
{ … }
static int cap_authenticate(struct gb_cap *cap, u32 auth_type, u8 *uid,
u8 *challenge, u8 *result, u8 *auth_response,
u32 *signature_size, u8 *signature)
{ … }
static int cap_open(struct inode *inode, struct file *file)
{ … }
static int cap_release(struct inode *inode, struct file *file)
{ … }
static int cap_ioctl(struct gb_cap *cap, unsigned int cmd,
void __user *buf)
{ … }
static long cap_ioctl_unlocked(struct file *file, unsigned int cmd,
unsigned long arg)
{ … }
static const struct file_operations cap_fops = …;
int gb_cap_connection_init(struct gb_connection *connection)
{ … }
void gb_cap_connection_exit(struct gb_connection *connection)
{ … }
int cap_init(void)
{ … }
void cap_exit(void)
{ … }