linux/drivers/base/firmware_loader/sysfs.c

// SPDX-License-Identifier: GPL-2.0

#include <linux/highmem.h>
#include <linux/module.h>
#include <linux/security.h>
#include <linux/slab.h>
#include <linux/types.h>

#include "sysfs.h"

/*
 * sysfs support for firmware loader
 */

void __fw_load_abort(struct fw_priv *fw_priv)
{}

#ifdef CONFIG_FW_LOADER_USER_HELPER
static ssize_t timeout_show(const struct class *class, const struct class_attribute *attr,
			    char *buf)
{}

/**
 * timeout_store() - set number of seconds to wait for firmware
 * @class: device class pointer
 * @attr: device attribute pointer
 * @buf: buffer to scan for timeout value
 * @count: number of bytes in @buf
 *
 *	Sets the number of seconds to wait for the firmware.  Once
 *	this expires an error will be returned to the driver and no
 *	firmware will be provided.
 *
 *	Note: zero means 'wait forever'.
 **/
static ssize_t timeout_store(const struct class *class, const struct class_attribute *attr,
			     const char *buf, size_t count)
{}
static CLASS_ATTR_RW(timeout);

static struct attribute *firmware_class_attrs[] =;
ATTRIBUTE_GROUPS();

static int do_firmware_uevent(const struct fw_sysfs *fw_sysfs, struct kobj_uevent_env *env)
{}

static int firmware_uevent(const struct device *dev, struct kobj_uevent_env *env)
{}
#endif /* CONFIG_FW_LOADER_USER_HELPER */

static void fw_dev_release(struct device *dev)
{}

static struct class firmware_class =;

int register_sysfs_loader(void)
{}

void unregister_sysfs_loader(void)
{}

static ssize_t firmware_loading_show(struct device *dev,
				     struct device_attribute *attr, char *buf)
{}

/**
 * firmware_loading_store() - set value in the 'loading' control file
 * @dev: device pointer
 * @attr: device attribute pointer
 * @buf: buffer to scan for loading control value
 * @count: number of bytes in @buf
 *
 *	The relevant values are:
 *
 *	 1: Start a load, discarding any previous partial load.
 *	 0: Conclude the load and hand the data to the driver code.
 *	-1: Conclude the load with an error and discard any written data.
 **/
static ssize_t firmware_loading_store(struct device *dev,
				      struct device_attribute *attr,
				      const char *buf, size_t count)
{}

DEVICE_ATTR();

static void firmware_rw_data(struct fw_priv *fw_priv, char *buffer,
			     loff_t offset, size_t count, bool read)
{}

static void firmware_rw(struct fw_priv *fw_priv, char *buffer,
			loff_t offset, size_t count, bool read)
{}

static ssize_t firmware_data_read(struct file *filp, struct kobject *kobj,
				  struct bin_attribute *bin_attr,
				  char *buffer, loff_t offset, size_t count)
{}

static int fw_realloc_pages(struct fw_sysfs *fw_sysfs, int min_size)
{}

/**
 * firmware_data_write() - write method for firmware
 * @filp: open sysfs file
 * @kobj: kobject for the device
 * @bin_attr: bin_attr structure
 * @buffer: buffer being written
 * @offset: buffer offset for write in total data store area
 * @count: buffer size
 *
 *	Data written to the 'data' attribute will be later handed to
 *	the driver as a firmware image.
 **/
static ssize_t firmware_data_write(struct file *filp, struct kobject *kobj,
				   struct bin_attribute *bin_attr,
				   char *buffer, loff_t offset, size_t count)
{}

static struct bin_attribute firmware_attr_data =;

static struct attribute *fw_dev_attrs[] =;

static struct bin_attribute *fw_dev_bin_attrs[] =;

static const struct attribute_group fw_dev_attr_group =;

static const struct attribute_group *fw_dev_attr_groups[] =;

struct fw_sysfs *
fw_create_instance(struct firmware *firmware, const char *fw_name,
		   struct device *device, u32 opt_flags)
{}