#include <linux/cdev.h>
#include <linux/completion.h>
#include <linux/firmware.h>
#include <linux/fs.h>
#include <linux/idr.h>
#include <linux/ioctl.h>
#include <linux/uaccess.h>
#include <linux/greybus.h>
#include "firmware.h"
#include "greybus_firmware.h"
#define FW_MGMT_TIMEOUT_MS …
struct fw_mgmt { … };
#define NUM_MINORS …
static const struct class fw_mgmt_class = …;
static dev_t fw_mgmt_dev_num;
static DEFINE_IDA(fw_mgmt_minors_map);
static LIST_HEAD(fw_mgmt_list);
static DEFINE_MUTEX(list_mutex);
static void fw_mgmt_kref_release(struct kref *kref)
{ … }
static void put_fw_mgmt(struct fw_mgmt *fw_mgmt)
{ … }
static struct fw_mgmt *get_fw_mgmt(struct cdev *cdev)
{ … }
static int fw_mgmt_interface_fw_version_operation(struct fw_mgmt *fw_mgmt,
struct fw_mgmt_ioc_get_intf_version *fw_info)
{ … }
static int fw_mgmt_load_and_validate_operation(struct fw_mgmt *fw_mgmt,
u8 load_method, const char *tag)
{ … }
static int fw_mgmt_interface_fw_loaded_operation(struct gb_operation *op)
{ … }
static int fw_mgmt_backend_fw_version_operation(struct fw_mgmt *fw_mgmt,
struct fw_mgmt_ioc_get_backend_version *fw_info)
{ … }
static int fw_mgmt_backend_fw_update_operation(struct fw_mgmt *fw_mgmt,
char *tag)
{ … }
static int fw_mgmt_backend_fw_updated_operation(struct gb_operation *op)
{ … }
static int fw_mgmt_open(struct inode *inode, struct file *file)
{ … }
static int fw_mgmt_release(struct inode *inode, struct file *file)
{ … }
static int fw_mgmt_ioctl(struct fw_mgmt *fw_mgmt, unsigned int cmd,
void __user *buf)
{ … }
static long fw_mgmt_ioctl_unlocked(struct file *file, unsigned int cmd,
unsigned long arg)
{ … }
static const struct file_operations fw_mgmt_fops = …;
int gb_fw_mgmt_request_handler(struct gb_operation *op)
{ … }
int gb_fw_mgmt_connection_init(struct gb_connection *connection)
{ … }
void gb_fw_mgmt_connection_exit(struct gb_connection *connection)
{ … }
int fw_mgmt_init(void)
{ … }
void fw_mgmt_exit(void)
{ … }