mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 15:42:32 +00:00
counter: Simplify the count_read and count_write callbacks
The count_read and count_write callbacks are simplified to pass val as unsigned long rather than as an opaque data structure. The opaque counter_count_read_value and counter_count_write_value structures, counter_count_value_type enum, and relevant counter_count_read_value_set and counter_count_write_value_get functions, are removed as they are no longer used. Cc: Patrick Havelange <patrick.havelange@essensium.com> Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com> Acked-by: David Lechner <david@lechnology.com> Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
16922ffee1
commit
d49e6ee2d6
7 changed files with 51 additions and 212 deletions
|
@ -290,53 +290,22 @@ struct counter_device_state {
|
|||
const struct attribute_group **groups;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct counter_signal_read_value - Opaque Signal read value
|
||||
* @buf: string representation of Signal read value
|
||||
* @len: length of string in @buf
|
||||
*/
|
||||
struct counter_signal_read_value {
|
||||
char *buf;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct counter_count_read_value - Opaque Count read value
|
||||
* @buf: string representation of Count read value
|
||||
* @len: length of string in @buf
|
||||
*/
|
||||
struct counter_count_read_value {
|
||||
char *buf;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct counter_count_write_value - Opaque Count write value
|
||||
* @buf: string representation of Count write value
|
||||
*/
|
||||
struct counter_count_write_value {
|
||||
const char *buf;
|
||||
enum counter_signal_value {
|
||||
COUNTER_SIGNAL_LOW = 0,
|
||||
COUNTER_SIGNAL_HIGH
|
||||
};
|
||||
|
||||
/**
|
||||
* struct counter_ops - Callbacks from driver
|
||||
* @signal_read: optional read callback for Signal attribute. The read
|
||||
* value of the respective Signal should be passed back via
|
||||
* the val parameter. val points to an opaque type which
|
||||
* should be set only by calling the
|
||||
* counter_signal_read_value_set function from within the
|
||||
* signal_read callback.
|
||||
* the val parameter.
|
||||
* @count_read: optional read callback for Count attribute. The read
|
||||
* value of the respective Count should be passed back via
|
||||
* the val parameter. val points to an opaque type which
|
||||
* should be set only by calling the
|
||||
* counter_count_read_value_set function from within the
|
||||
* count_read callback.
|
||||
* the val parameter.
|
||||
* @count_write: optional write callback for Count attribute. The write
|
||||
* value for the respective Count is passed in via the val
|
||||
* parameter. val points to an opaque type which should be
|
||||
* accessed only by calling the
|
||||
* counter_count_write_value_get function.
|
||||
* parameter.
|
||||
* @function_get: function to get the current count function mode. Returns
|
||||
* 0 on success and negative error code on error. The index
|
||||
* of the respective Count's returned function mode should
|
||||
|
@ -355,13 +324,11 @@ struct counter_count_write_value {
|
|||
struct counter_ops {
|
||||
int (*signal_read)(struct counter_device *counter,
|
||||
struct counter_signal *signal,
|
||||
struct counter_signal_read_value *val);
|
||||
enum counter_signal_value *val);
|
||||
int (*count_read)(struct counter_device *counter,
|
||||
struct counter_count *count,
|
||||
struct counter_count_read_value *val);
|
||||
struct counter_count *count, unsigned long *val);
|
||||
int (*count_write)(struct counter_device *counter,
|
||||
struct counter_count *count,
|
||||
struct counter_count_write_value *val);
|
||||
struct counter_count *count, unsigned long val);
|
||||
int (*function_get)(struct counter_device *counter,
|
||||
struct counter_count *count, size_t *function);
|
||||
int (*function_set)(struct counter_device *counter,
|
||||
|
@ -477,29 +444,6 @@ struct counter_device {
|
|||
void *priv;
|
||||
};
|
||||
|
||||
enum counter_signal_level {
|
||||
COUNTER_SIGNAL_LEVEL_LOW = 0,
|
||||
COUNTER_SIGNAL_LEVEL_HIGH
|
||||
};
|
||||
|
||||
enum counter_signal_value_type {
|
||||
COUNTER_SIGNAL_LEVEL = 0
|
||||
};
|
||||
|
||||
enum counter_count_value_type {
|
||||
COUNTER_COUNT_POSITION = 0,
|
||||
};
|
||||
|
||||
void counter_signal_read_value_set(struct counter_signal_read_value *const val,
|
||||
const enum counter_signal_value_type type,
|
||||
void *const data);
|
||||
void counter_count_read_value_set(struct counter_count_read_value *const val,
|
||||
const enum counter_count_value_type type,
|
||||
void *const data);
|
||||
int counter_count_write_value_get(void *const data,
|
||||
const enum counter_count_value_type type,
|
||||
const struct counter_count_write_value *const val);
|
||||
|
||||
int counter_register(struct counter_device *const counter);
|
||||
void counter_unregister(struct counter_device *const counter);
|
||||
int devm_counter_register(struct device *dev,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue