From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Christian Gromm Subject: [PATCH 05/13] staging: most: use __ATTR_RW in create_channel_attribute Date: Fri, 31 Mar 2017 15:22:26 +0200 Message-ID: <20170331132234.21722-5-christian.gromm@microchip.com> In-Reply-To: <20170331132234.21722-1-christian.gromm@microchip.com> References: <20170331132234.21722-1-christian.gromm@microchip.com> MIME-Version: 1.0 Content-Type: text/plain List-ID: To: gregkh@linuxfoundation.org Cc: driverdev-devel@linuxdriverproject.org, Andrey Shvetsov , Christian Gromm From: Andrey Shvetsov This patch replaces the use of a macro MOST_CHNL_ATTR in the macro create_channel_attribute with a macro __ATTR_RW. Additionally, this patch removes not anymore used macro MOST_CHNL_ATTR. Signed-off-by: Andrey Shvetsov Signed-off-by: Christian Gromm --- drivers/staging/most/mostcore/core.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c index f3a2dc4f4b47..826984c2424d 100644 --- a/drivers/staging/most/mostcore/core.c +++ b/drivers/staging/most/mostcore/core.c @@ -127,10 +127,6 @@ struct most_c_attr { #define to_channel_attr(a) container_of(a, struct most_c_attr, attr) -#define MOST_CHNL_ATTR(_name, _mode, _show, _store) \ - struct most_c_attr most_chnl_attr_##_name = \ - __ATTR(_name, _mode, _show, _store) - /** * channel_attr_show - show function of channel object * @kobj: pointer to its kobject @@ -352,14 +348,14 @@ create_show_channel_attribute(size_of_stream_buffer); create_show_channel_attribute(size_of_packet_buffer); create_show_channel_attribute(channel_starving); -static ssize_t show_set_number_of_buffers(struct most_c_obj *c, +static ssize_t set_number_of_buffers_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.num_buffers); } -static ssize_t store_set_number_of_buffers(struct most_c_obj *c, +static ssize_t set_number_of_buffers_store(struct most_c_obj *c, struct most_c_attr *attr, const char *buf, size_t count) @@ -371,14 +367,14 @@ static ssize_t store_set_number_of_buffers(struct most_c_obj *c, return count; } -static ssize_t show_set_buffer_size(struct most_c_obj *c, +static ssize_t set_buffer_size_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.buffer_size); } -static ssize_t store_set_buffer_size(struct most_c_obj *c, +static ssize_t set_buffer_size_store(struct most_c_obj *c, struct most_c_attr *attr, const char *buf, size_t count) @@ -390,7 +386,7 @@ static ssize_t store_set_buffer_size(struct most_c_obj *c, return count; } -static ssize_t show_set_direction(struct most_c_obj *c, +static ssize_t set_direction_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { @@ -401,7 +397,7 @@ static ssize_t show_set_direction(struct most_c_obj *c, return snprintf(buf, PAGE_SIZE, "unconfigured\n"); } -static ssize_t store_set_direction(struct most_c_obj *c, +static ssize_t set_direction_store(struct most_c_obj *c, struct most_c_attr *attr, const char *buf, size_t count) @@ -421,7 +417,7 @@ static ssize_t store_set_direction(struct most_c_obj *c, return count; } -static ssize_t show_set_datatype(struct most_c_obj *c, +static ssize_t set_datatype_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { @@ -434,7 +430,7 @@ static ssize_t show_set_datatype(struct most_c_obj *c, return snprintf(buf, PAGE_SIZE, "unconfigured\n"); } -static ssize_t store_set_datatype(struct most_c_obj *c, +static ssize_t set_datatype_store(struct most_c_obj *c, struct most_c_attr *attr, const char *buf, size_t count) @@ -455,14 +451,14 @@ static ssize_t store_set_datatype(struct most_c_obj *c, return count; } -static ssize_t show_set_subbuffer_size(struct most_c_obj *c, +static ssize_t set_subbuffer_size_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.subbuffer_size); } -static ssize_t store_set_subbuffer_size(struct most_c_obj *c, +static ssize_t set_subbuffer_size_store(struct most_c_obj *c, struct most_c_attr *attr, const char *buf, size_t count) @@ -474,14 +470,14 @@ static ssize_t store_set_subbuffer_size(struct most_c_obj *c, return count; } -static ssize_t show_set_packets_per_xact(struct most_c_obj *c, +static ssize_t set_packets_per_xact_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.packets_per_xact); } -static ssize_t store_set_packets_per_xact(struct most_c_obj *c, +static ssize_t set_packets_per_xact_store(struct most_c_obj *c, struct most_c_attr *attr, const char *buf, size_t count) @@ -494,7 +490,7 @@ static ssize_t store_set_packets_per_xact(struct most_c_obj *c, } #define create_channel_attribute(value) \ - static MOST_CHNL_ATTR(value, 0644, show_##value, store_##value) + static struct most_c_attr most_chnl_attr_##value = __ATTR_RW(value) create_channel_attribute(set_buffer_size); create_channel_attribute(set_number_of_buffers); -- 2.11.0