linux/drivers/counter/counter-sysfs.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Generic Counter sysfs interface
 * Copyright (C) 2020 William Breathitt Gray
 */
#include <linux/counter.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/gfp.h>
#include <linux/kernel.h>
#include <linux/kfifo.h>
#include <linux/kstrtox.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/sysfs.h>
#include <linux/types.h>

#include "counter-sysfs.h"

static inline struct counter_device *counter_from_dev(struct device *dev)
{}

/**
 * struct counter_attribute - Counter sysfs attribute
 * @dev_attr:	device attribute for sysfs
 * @l:		node to add Counter attribute to attribute group list
 * @comp:	Counter component callbacks and data
 * @scope:	Counter scope of the attribute
 * @parent:	pointer to the parent component
 */
struct counter_attribute {};

#define to_counter_attribute(_dev_attr)

/**
 * struct counter_attribute_group - container for attribute group
 * @name:	name of the attribute group
 * @attr_list:	list to keep track of created attributes
 * @num_attr:	number of attributes
 */
struct counter_attribute_group {};

static const char *const counter_function_str[] =;

static const char *const counter_signal_value_str[] =;

static const char *const counter_synapse_action_str[] =;

static const char *const counter_count_direction_str[] =;

static const char *const counter_count_mode_str[] =;

static const char *const counter_signal_polarity_str[] =;

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

static ssize_t counter_comp_u8_store(struct device *dev,
				     struct device_attribute *attr,
				     const char *buf, size_t len)
{}

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

static int counter_find_enum(u32 *const enum_item, const u32 *const enums,
			     const size_t num_enums, const char *const buf,
			     const char *const string_array[])
{}

static ssize_t counter_comp_u32_store(struct device *dev,
				      struct device_attribute *attr,
				      const char *buf, size_t len)
{}

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

static ssize_t counter_comp_u64_store(struct device *dev,
				      struct device_attribute *attr,
				      const char *buf, size_t len)
{}

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

static ssize_t counter_comp_array_u32_store(struct device *dev,
					    struct device_attribute *attr,
					    const char *buf, size_t len)
{}

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

static ssize_t counter_comp_array_u64_store(struct device *dev,
					    struct device_attribute *attr,
					    const char *buf, size_t len)
{}

static ssize_t enums_available_show(const u32 *const enums,
				    const size_t num_enums,
				    const char *const strs[], char *buf)
{}

static ssize_t strs_available_show(const struct counter_available *const avail,
				   char *buf)
{}

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

static int counter_avail_attr_create(struct device *const dev,
	struct counter_attribute_group *const group,
	const struct counter_comp *const comp, void *const parent)
{}

static int counter_attr_create(struct device *const dev,
			       struct counter_attribute_group *const group,
			       const struct counter_comp *const comp,
			       const enum counter_scope scope,
			       void *const parent)
{}

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

static int counter_name_attr_create(struct device *const dev,
				    struct counter_attribute_group *const group,
				    const char *const name)
{}

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

static int counter_comp_id_attr_create(struct device *const dev,
				       struct counter_attribute_group *const group,
				       const char *name, const size_t id)
{}

static int counter_ext_attrs_create(struct device *const dev,
				    struct counter_attribute_group *const group,
				    const struct counter_comp *const ext,
				    const enum counter_scope scope,
				    void *const parent, const size_t id)
{}

static int counter_array_attrs_create(struct device *const dev,
				      struct counter_attribute_group *const group,
				      const struct counter_comp *const comp,
				      const enum counter_scope scope,
				      void *const parent, const size_t id)
{}

static int counter_sysfs_exts_add(struct device *const dev,
				  struct counter_attribute_group *const group,
				  const struct counter_comp *const exts,
				  const size_t num_ext,
				  const enum counter_scope scope,
				  void *const parent)
{}

static struct counter_comp counter_signal_comp =;

static int counter_signal_attrs_create(struct counter_device *const counter,
	struct counter_attribute_group *const cattr_group,
	struct counter_signal *const signal)
{}

static int counter_sysfs_signals_add(struct counter_device *const counter,
	struct counter_attribute_group *const groups)
{}

static int counter_sysfs_synapses_add(struct counter_device *const counter,
	struct counter_attribute_group *const group,
	struct counter_count *const count)
{}

static struct counter_comp counter_count_comp =;

static struct counter_comp counter_function_comp =;

static int counter_count_attrs_create(struct counter_device *const counter,
	struct counter_attribute_group *const cattr_group,
	struct counter_count *const count)
{}

static int counter_sysfs_counts_add(struct counter_device *const counter,
	struct counter_attribute_group *const groups)
{}

static int counter_num_signals_read(struct counter_device *counter, u8 *val)
{}

static int counter_num_counts_read(struct counter_device *counter, u8 *val)
{}

static int counter_events_queue_size_read(struct counter_device *counter,
					  u64 *val)
{}

static int counter_events_queue_size_write(struct counter_device *counter,
					   u64 val)
{}

static struct counter_comp counter_num_signals_comp =;

static struct counter_comp counter_num_counts_comp =;

static struct counter_comp counter_events_queue_size_comp =;

static int counter_sysfs_attr_add(struct counter_device *const counter,
				  struct counter_attribute_group *cattr_group)
{}

/**
 * counter_sysfs_add - Adds Counter sysfs attributes to the device structure
 * @counter:	Pointer to the Counter device structure
 *
 * Counter sysfs attributes are created and added to the respective device
 * structure for later registration to the system. Resource-managed memory
 * allocation is performed by this function, and this memory should be freed
 * when no longer needed (automatically by a device_unregister call, or
 * manually by a devres_release_all call).
 */
int counter_sysfs_add(struct counter_device *const counter)
{}