linux/drivers/base/firmware_loader/sysfs_upload.c

// SPDX-License-Identifier: GPL-2.0

#include <linux/firmware.h>
#include <linux/module.h>
#include <linux/slab.h>

#include "sysfs_upload.h"

/*
 * Support for user-space to initiate a firmware upload to a device.
 */

static const char * const fw_upload_prog_str[] =;

static const char * const fw_upload_err_str[] =;

static const char *fw_upload_progress(struct device *dev,
				      enum fw_upload_prog prog)
{}

static const char *fw_upload_error(struct device *dev,
				   enum fw_upload_err err_code)
{}

static ssize_t
status_show(struct device *dev, struct device_attribute *attr, char *buf)
{}
DEVICE_ATTR_RO();

static ssize_t
error_show(struct device *dev, struct device_attribute *attr, char *buf)
{}
DEVICE_ATTR_RO();

static ssize_t cancel_store(struct device *dev, struct device_attribute *attr,
			    const char *buf, size_t count)
{}
DEVICE_ATTR_WO();

static ssize_t remaining_size_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}
DEVICE_ATTR_RO();

umode_t
fw_upload_is_visible(struct kobject *kobj, struct attribute *attr, int n)
{}

static void fw_upload_update_progress(struct fw_upload_priv *fwlp,
				      enum fw_upload_prog new_progress)
{}

static void fw_upload_set_error(struct fw_upload_priv *fwlp,
				enum fw_upload_err err_code)
{}

static void fw_upload_prog_complete(struct fw_upload_priv *fwlp)
{}

static void fw_upload_main(struct work_struct *work)
{}

/*
 * Start a worker thread to upload data to the parent driver.
 * Must be called with fw_lock held.
 */
int fw_upload_start(struct fw_sysfs *fw_sysfs)
{}

void fw_upload_free(struct fw_sysfs *fw_sysfs)
{}

/**
 * firmware_upload_register() - register for the firmware upload sysfs API
 * @module: kernel module of this device
 * @parent: parent device instantiating firmware upload
 * @name: firmware name to be associated with this device
 * @ops: pointer to structure of firmware upload ops
 * @dd_handle: pointer to parent driver private data
 *
 *	@name must be unique among all users of firmware upload. The firmware
 *	sysfs files for this device will be found at /sys/class/firmware/@name.
 *
 *	Return: struct fw_upload pointer or ERR_PTR()
 *
 **/
struct fw_upload *
firmware_upload_register(struct module *module, struct device *parent,
			 const char *name, const struct fw_upload_ops *ops,
			 void *dd_handle)
{}
EXPORT_SYMBOL_GPL();

/**
 * firmware_upload_unregister() - Unregister firmware upload interface
 * @fw_upload: pointer to struct fw_upload
 **/
void firmware_upload_unregister(struct fw_upload *fw_upload)
{}
EXPORT_SYMBOL_GPL();