#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 { … };
#define to_counter_attribute(_dev_attr) …
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)
{ … }
int counter_sysfs_add(struct counter_device *const counter)
{ … }