* [PATCH] staging: most: Adds parentheses around macros with complex values
@ 2017-03-23 8:38 Mark Stenglein
2017-03-23 8:59 ` Greg KH
2017-03-25 7:26 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Mark Stenglein @ 2017-03-23 8:38 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Stenglein
Fixes three instances of the following checklist error:
- ERROR: Macros with complex values should be enclosed
in parentheses
Simply adds parentheses around the macros to fix the problem.
Signed-off-by: Mark Stenglein <mark@stengle.in>
---
drivers/staging/most/mostcore/core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c
index 191404bc5906..13e65f149d68 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -341,8 +341,8 @@ static ssize_t show_channel_starving(struct most_c_obj *c,
return snprintf(buf, PAGE_SIZE, "%d\n", c->is_starving);
}
-#define create_show_channel_attribute(val) \
- static MOST_CHNL_ATTR(val, 0444, show_##val, NULL)
+#define(create_show_channel_attribute(val) \
+ static MOST_CHNL_ATTR(val, 0444, show_##val, NULL))
create_show_channel_attribute(available_directions);
create_show_channel_attribute(available_datatypes);
@@ -493,8 +493,8 @@ static ssize_t store_set_packets_per_xact(struct most_c_obj *c,
return count;
}
-#define create_channel_attribute(value) \
- static MOST_CHNL_ATTR(value, 0644, show_##value, store_##value)
+#define(create_channel_attribute(value) \
+ static MOST_CHNL_ATTR(value, 0644, show_##value, store_##value))
create_channel_attribute(set_buffer_size);
create_channel_attribute(set_number_of_buffers);
@@ -687,8 +687,8 @@ static ssize_t show_interface(struct most_inst_obj *instance_obj,
return snprintf(buf, PAGE_SIZE, "unknown\n");
}
-#define create_inst_attribute(value) \
- static MOST_INST_ATTR(value, 0444, show_##value, NULL)
+#define(create_inst_attribute(value) \
+ static MOST_INST_ATTR(value, 0444, show_##value, NULL))
create_inst_attribute(description);
create_inst_attribute(interface);
--
2.12.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: most: Adds parentheses around macros with complex values
2017-03-23 8:38 [PATCH] staging: most: Adds parentheses around macros with complex values Mark Stenglein
@ 2017-03-23 8:59 ` Greg KH
2017-03-25 7:26 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2017-03-23 8:59 UTC (permalink / raw)
To: Mark Stenglein; +Cc: devel, linux-kernel
On Thu, Mar 23, 2017 at 04:38:38AM -0400, Mark Stenglein wrote:
> Fixes three instances of the following checklist error:
> - ERROR: Macros with complex values should be enclosed
> in parentheses
>
> Simply adds parentheses around the macros to fix the problem.
>
> Signed-off-by: Mark Stenglein <mark@stengle.in>
> ---
> drivers/staging/most/mostcore/core.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c
> index 191404bc5906..13e65f149d68 100644
> --- a/drivers/staging/most/mostcore/core.c
> +++ b/drivers/staging/most/mostcore/core.c
> @@ -341,8 +341,8 @@ static ssize_t show_channel_starving(struct most_c_obj *c,
> return snprintf(buf, PAGE_SIZE, "%d\n", c->is_starving);
> }
>
> -#define create_show_channel_attribute(val) \
> - static MOST_CHNL_ATTR(val, 0444, show_##val, NULL)
> +#define(create_show_channel_attribute(val) \
> + static MOST_CHNL_ATTR(val, 0444, show_##val, NULL))
I don't think this does what you think it does. Did you test build
this???
Please learn C before working on kernel code, the kernel is not a place
to learn it.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: most: Adds parentheses around macros with complex values
2017-03-23 8:38 [PATCH] staging: most: Adds parentheses around macros with complex values Mark Stenglein
2017-03-23 8:59 ` Greg KH
@ 2017-03-25 7:26 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2017-03-25 7:26 UTC (permalink / raw)
To: Mark Stenglein; +Cc: kbuild-all, gregkh, devel, Mark Stenglein, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 26341 bytes --]
Hi Mark,
[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Mark-Stenglein/staging-most-Adds-parentheses-around-macros-with-complex-values/20170325-145958
config: i386-randconfig-x073-201712 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All error/warnings (new ones prefixed by >>):
>> drivers/staging//most/mostcore/core.c:344:8: error: macro names must be identifiers
#define(create_show_channel_attribute(val) \
^
>> drivers/staging//most/mostcore/core.c:347:1: warning: data definition has no type or storage class
create_show_channel_attribute(available_directions);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:347:1: error: type defaults to 'int' in declaration of 'create_show_channel_attribute' [-Werror=implicit-int]
>> drivers/staging//most/mostcore/core.c:347:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:348:1: warning: data definition has no type or storage class
create_show_channel_attribute(available_datatypes);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:348:1: error: type defaults to 'int' in declaration of 'create_show_channel_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:348:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:349:1: warning: data definition has no type or storage class
create_show_channel_attribute(number_of_packet_buffers);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:349:1: error: type defaults to 'int' in declaration of 'create_show_channel_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:349:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:350:1: warning: data definition has no type or storage class
create_show_channel_attribute(number_of_stream_buffers);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:350:1: error: type defaults to 'int' in declaration of 'create_show_channel_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:350:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:351:1: warning: data definition has no type or storage class
create_show_channel_attribute(size_of_stream_buffer);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:351:1: error: type defaults to 'int' in declaration of 'create_show_channel_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:351:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:352:1: warning: data definition has no type or storage class
create_show_channel_attribute(size_of_packet_buffer);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:352:1: error: type defaults to 'int' in declaration of 'create_show_channel_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:352:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:353:1: warning: data definition has no type or storage class
create_show_channel_attribute(channel_starving);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:353:1: error: type defaults to 'int' in declaration of 'create_show_channel_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:353:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:496:8: error: macro names must be identifiers
#define(create_channel_attribute(value) \
^
drivers/staging//most/mostcore/core.c:499:1: warning: data definition has no type or storage class
create_channel_attribute(set_buffer_size);
^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:499:1: error: type defaults to 'int' in declaration of 'create_channel_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:499:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:500:1: warning: data definition has no type or storage class
create_channel_attribute(set_number_of_buffers);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:500:1: error: type defaults to 'int' in declaration of 'create_channel_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:500:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:501:1: warning: data definition has no type or storage class
create_channel_attribute(set_direction);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:501:1: error: type defaults to 'int' in declaration of 'create_channel_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:501:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:502:1: warning: data definition has no type or storage class
create_channel_attribute(set_datatype);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:502:1: error: type defaults to 'int' in declaration of 'create_channel_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:502:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:503:1: warning: data definition has no type or storage class
create_channel_attribute(set_subbuffer_size);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:503:1: error: type defaults to 'int' in declaration of 'create_channel_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:503:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:504:1: warning: data definition has no type or storage class
create_channel_attribute(set_packets_per_xact);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:504:1: error: type defaults to 'int' in declaration of 'create_channel_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:504:1: warning: parameter names (without types) in function declaration
>> drivers/staging//most/mostcore/core.c:510:3: error: 'most_chnl_attr_available_directions' undeclared here (not in a function)
&most_chnl_attr_available_directions.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:511:3: error: 'most_chnl_attr_available_datatypes' undeclared here (not in a function)
&most_chnl_attr_available_datatypes.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:512:3: error: 'most_chnl_attr_number_of_packet_buffers' undeclared here (not in a function)
&most_chnl_attr_number_of_packet_buffers.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:513:3: error: 'most_chnl_attr_number_of_stream_buffers' undeclared here (not in a function)
&most_chnl_attr_number_of_stream_buffers.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:514:3: error: 'most_chnl_attr_size_of_packet_buffer' undeclared here (not in a function)
&most_chnl_attr_size_of_packet_buffer.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:515:3: error: 'most_chnl_attr_size_of_stream_buffer' undeclared here (not in a function)
&most_chnl_attr_size_of_stream_buffer.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:516:3: error: 'most_chnl_attr_set_number_of_buffers' undeclared here (not in a function)
&most_chnl_attr_set_number_of_buffers.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:517:3: error: 'most_chnl_attr_set_buffer_size' undeclared here (not in a function)
&most_chnl_attr_set_buffer_size.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:518:3: error: 'most_chnl_attr_set_direction' undeclared here (not in a function)
&most_chnl_attr_set_direction.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:519:3: error: 'most_chnl_attr_set_datatype' undeclared here (not in a function)
&most_chnl_attr_set_datatype.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:520:3: error: 'most_chnl_attr_set_subbuffer_size' undeclared here (not in a function)
&most_chnl_attr_set_subbuffer_size.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:521:3: error: 'most_chnl_attr_set_packets_per_xact' undeclared here (not in a function)
&most_chnl_attr_set_packets_per_xact.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:522:3: error: 'most_chnl_attr_channel_starving' undeclared here (not in a function)
&most_chnl_attr_channel_starving.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:690:8: error: macro names must be identifiers
#define(create_inst_attribute(value) \
^
drivers/staging//most/mostcore/core.c:693:1: warning: data definition has no type or storage class
create_inst_attribute(description);
^~~~~~~~~~~~~~~~~~~~~
>> drivers/staging//most/mostcore/core.c:693:1: error: type defaults to 'int' in declaration of 'create_inst_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:693:1: warning: parameter names (without types) in function declaration
drivers/staging//most/mostcore/core.c:694:1: warning: data definition has no type or storage class
create_inst_attribute(interface);
^~~~~~~~~~~~~~~~~~~~~
drivers/staging//most/mostcore/core.c:694:1: error: type defaults to 'int' in declaration of 'create_inst_attribute' [-Werror=implicit-int]
drivers/staging//most/mostcore/core.c:694:1: warning: parameter names (without types) in function declaration
>> drivers/staging//most/mostcore/core.c:697:3: error: 'most_inst_attr_description' undeclared here (not in a function)
&most_inst_attr_description.attr,
^~~~~~~~~~~~~~~~~~~~~~~~~~
vim +347 drivers/staging//most/mostcore/core.c
57562a72 Christian Gromm 2015-07-24 338 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 339 char *buf)
57562a72 Christian Gromm 2015-07-24 340 {
57562a72 Christian Gromm 2015-07-24 341 return snprintf(buf, PAGE_SIZE, "%d\n", c->is_starving);
57562a72 Christian Gromm 2015-07-24 342 }
57562a72 Christian Gromm 2015-07-24 343
979628ad Mark Stenglein 2017-03-23 @344 #define(create_show_channel_attribute(val) \
979628ad Mark Stenglein 2017-03-23 345 static MOST_CHNL_ATTR(val, 0444, show_##val, NULL))
57562a72 Christian Gromm 2015-07-24 346
57562a72 Christian Gromm 2015-07-24 @347 create_show_channel_attribute(available_directions);
57562a72 Christian Gromm 2015-07-24 348 create_show_channel_attribute(available_datatypes);
57562a72 Christian Gromm 2015-07-24 349 create_show_channel_attribute(number_of_packet_buffers);
57562a72 Christian Gromm 2015-07-24 350 create_show_channel_attribute(number_of_stream_buffers);
57562a72 Christian Gromm 2015-07-24 351 create_show_channel_attribute(size_of_stream_buffer);
57562a72 Christian Gromm 2015-07-24 352 create_show_channel_attribute(size_of_packet_buffer);
57562a72 Christian Gromm 2015-07-24 @353 create_show_channel_attribute(channel_starving);
57562a72 Christian Gromm 2015-07-24 354
57562a72 Christian Gromm 2015-07-24 355 static ssize_t show_set_number_of_buffers(struct most_c_obj *c,
57562a72 Christian Gromm 2015-07-24 356 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 357 char *buf)
57562a72 Christian Gromm 2015-07-24 358 {
57562a72 Christian Gromm 2015-07-24 359 return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.num_buffers);
57562a72 Christian Gromm 2015-07-24 360 }
57562a72 Christian Gromm 2015-07-24 361
57562a72 Christian Gromm 2015-07-24 362 static ssize_t store_set_number_of_buffers(struct most_c_obj *c,
57562a72 Christian Gromm 2015-07-24 363 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 364 const char *buf,
57562a72 Christian Gromm 2015-07-24 365 size_t count)
57562a72 Christian Gromm 2015-07-24 366 {
57562a72 Christian Gromm 2015-07-24 367 int ret = kstrtou16(buf, 0, &c->cfg.num_buffers);
57562a72 Christian Gromm 2015-07-24 368
57562a72 Christian Gromm 2015-07-24 369 if (ret)
57562a72 Christian Gromm 2015-07-24 370 return ret;
57562a72 Christian Gromm 2015-07-24 371 return count;
57562a72 Christian Gromm 2015-07-24 372 }
57562a72 Christian Gromm 2015-07-24 373
57562a72 Christian Gromm 2015-07-24 374 static ssize_t show_set_buffer_size(struct most_c_obj *c,
57562a72 Christian Gromm 2015-07-24 375 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 376 char *buf)
57562a72 Christian Gromm 2015-07-24 377 {
57562a72 Christian Gromm 2015-07-24 378 return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.buffer_size);
57562a72 Christian Gromm 2015-07-24 379 }
57562a72 Christian Gromm 2015-07-24 380
57562a72 Christian Gromm 2015-07-24 381 static ssize_t store_set_buffer_size(struct most_c_obj *c,
57562a72 Christian Gromm 2015-07-24 382 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 383 const char *buf,
57562a72 Christian Gromm 2015-07-24 384 size_t count)
57562a72 Christian Gromm 2015-07-24 385 {
57562a72 Christian Gromm 2015-07-24 386 int ret = kstrtou16(buf, 0, &c->cfg.buffer_size);
57562a72 Christian Gromm 2015-07-24 387
57562a72 Christian Gromm 2015-07-24 388 if (ret)
57562a72 Christian Gromm 2015-07-24 389 return ret;
57562a72 Christian Gromm 2015-07-24 390 return count;
57562a72 Christian Gromm 2015-07-24 391 }
57562a72 Christian Gromm 2015-07-24 392
57562a72 Christian Gromm 2015-07-24 393 static ssize_t show_set_direction(struct most_c_obj *c,
57562a72 Christian Gromm 2015-07-24 394 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 395 char *buf)
57562a72 Christian Gromm 2015-07-24 396 {
57562a72 Christian Gromm 2015-07-24 397 if (c->cfg.direction & MOST_CH_TX)
95f73013 Christian Gromm 2016-09-21 398 return snprintf(buf, PAGE_SIZE, "tx\n");
57562a72 Christian Gromm 2015-07-24 399 else if (c->cfg.direction & MOST_CH_RX)
95f73013 Christian Gromm 2016-09-21 400 return snprintf(buf, PAGE_SIZE, "rx\n");
57562a72 Christian Gromm 2015-07-24 401 return snprintf(buf, PAGE_SIZE, "unconfigured\n");
57562a72 Christian Gromm 2015-07-24 402 }
57562a72 Christian Gromm 2015-07-24 403
57562a72 Christian Gromm 2015-07-24 404 static ssize_t store_set_direction(struct most_c_obj *c,
57562a72 Christian Gromm 2015-07-24 405 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 406 const char *buf,
57562a72 Christian Gromm 2015-07-24 407 size_t count)
57562a72 Christian Gromm 2015-07-24 408 {
9deba73d Christian Gromm 2015-10-21 409 if (!strcmp(buf, "dir_rx\n")) {
57562a72 Christian Gromm 2015-07-24 410 c->cfg.direction = MOST_CH_RX;
95f73013 Christian Gromm 2016-09-21 411 } else if (!strcmp(buf, "rx\n")) {
95f73013 Christian Gromm 2016-09-21 412 c->cfg.direction = MOST_CH_RX;
9deba73d Christian Gromm 2015-10-21 413 } else if (!strcmp(buf, "dir_tx\n")) {
57562a72 Christian Gromm 2015-07-24 414 c->cfg.direction = MOST_CH_TX;
95f73013 Christian Gromm 2016-09-21 415 } else if (!strcmp(buf, "tx\n")) {
95f73013 Christian Gromm 2016-09-21 416 c->cfg.direction = MOST_CH_TX;
9deba73d Christian Gromm 2015-10-21 417 } else {
57562a72 Christian Gromm 2015-07-24 418 pr_info("WARN: invalid attribute settings\n");
57562a72 Christian Gromm 2015-07-24 419 return -EINVAL;
57562a72 Christian Gromm 2015-07-24 420 }
57562a72 Christian Gromm 2015-07-24 421 return count;
57562a72 Christian Gromm 2015-07-24 422 }
57562a72 Christian Gromm 2015-07-24 423
57562a72 Christian Gromm 2015-07-24 424 static ssize_t show_set_datatype(struct most_c_obj *c,
57562a72 Christian Gromm 2015-07-24 425 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 426 char *buf)
57562a72 Christian Gromm 2015-07-24 427 {
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 428 int i;
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 429
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 430 for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 431 if (c->cfg.data_type & ch_data_type[i].most_ch_data_type)
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 432 return snprintf(buf, PAGE_SIZE, ch_data_type[i].name);
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 433 }
57562a72 Christian Gromm 2015-07-24 434 return snprintf(buf, PAGE_SIZE, "unconfigured\n");
57562a72 Christian Gromm 2015-07-24 435 }
57562a72 Christian Gromm 2015-07-24 436
57562a72 Christian Gromm 2015-07-24 437 static ssize_t store_set_datatype(struct most_c_obj *c,
57562a72 Christian Gromm 2015-07-24 438 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 439 const char *buf,
57562a72 Christian Gromm 2015-07-24 440 size_t count)
57562a72 Christian Gromm 2015-07-24 441 {
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 442 int i;
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 443
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 444 for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 445 if (!strcmp(buf, ch_data_type[i].name)) {
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 446 c->cfg.data_type = ch_data_type[i].most_ch_data_type;
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 447 break;
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 448 }
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 449 }
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 450
e7f2b70f Hari Prasath Gujulan Elango 2015-12-28 451 if (i == ARRAY_SIZE(ch_data_type)) {
57562a72 Christian Gromm 2015-07-24 452 pr_info("WARN: invalid attribute settings\n");
57562a72 Christian Gromm 2015-07-24 453 return -EINVAL;
57562a72 Christian Gromm 2015-07-24 454 }
57562a72 Christian Gromm 2015-07-24 455 return count;
57562a72 Christian Gromm 2015-07-24 456 }
57562a72 Christian Gromm 2015-07-24 457
57562a72 Christian Gromm 2015-07-24 458 static ssize_t show_set_subbuffer_size(struct most_c_obj *c,
57562a72 Christian Gromm 2015-07-24 459 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 460 char *buf)
57562a72 Christian Gromm 2015-07-24 461 {
57562a72 Christian Gromm 2015-07-24 462 return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.subbuffer_size);
57562a72 Christian Gromm 2015-07-24 463 }
57562a72 Christian Gromm 2015-07-24 464
57562a72 Christian Gromm 2015-07-24 465 static ssize_t store_set_subbuffer_size(struct most_c_obj *c,
57562a72 Christian Gromm 2015-07-24 466 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 467 const char *buf,
57562a72 Christian Gromm 2015-07-24 468 size_t count)
57562a72 Christian Gromm 2015-07-24 469 {
57562a72 Christian Gromm 2015-07-24 470 int ret = kstrtou16(buf, 0, &c->cfg.subbuffer_size);
57562a72 Christian Gromm 2015-07-24 471
57562a72 Christian Gromm 2015-07-24 472 if (ret)
57562a72 Christian Gromm 2015-07-24 473 return ret;
57562a72 Christian Gromm 2015-07-24 474 return count;
57562a72 Christian Gromm 2015-07-24 475 }
57562a72 Christian Gromm 2015-07-24 476
57562a72 Christian Gromm 2015-07-24 477 static ssize_t show_set_packets_per_xact(struct most_c_obj *c,
57562a72 Christian Gromm 2015-07-24 478 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 479 char *buf)
57562a72 Christian Gromm 2015-07-24 480 {
57562a72 Christian Gromm 2015-07-24 481 return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.packets_per_xact);
57562a72 Christian Gromm 2015-07-24 482 }
57562a72 Christian Gromm 2015-07-24 483
57562a72 Christian Gromm 2015-07-24 484 static ssize_t store_set_packets_per_xact(struct most_c_obj *c,
57562a72 Christian Gromm 2015-07-24 485 struct most_c_attr *attr,
57562a72 Christian Gromm 2015-07-24 486 const char *buf,
57562a72 Christian Gromm 2015-07-24 487 size_t count)
57562a72 Christian Gromm 2015-07-24 488 {
57562a72 Christian Gromm 2015-07-24 489 int ret = kstrtou16(buf, 0, &c->cfg.packets_per_xact);
57562a72 Christian Gromm 2015-07-24 490
57562a72 Christian Gromm 2015-07-24 491 if (ret)
57562a72 Christian Gromm 2015-07-24 492 return ret;
57562a72 Christian Gromm 2015-07-24 493 return count;
57562a72 Christian Gromm 2015-07-24 494 }
57562a72 Christian Gromm 2015-07-24 495
979628ad Mark Stenglein 2017-03-23 496 #define(create_channel_attribute(value) \
979628ad Mark Stenglein 2017-03-23 497 static MOST_CHNL_ATTR(value, 0644, show_##value, store_##value))
57562a72 Christian Gromm 2015-07-24 498
57562a72 Christian Gromm 2015-07-24 @499 create_channel_attribute(set_buffer_size);
57562a72 Christian Gromm 2015-07-24 500 create_channel_attribute(set_number_of_buffers);
57562a72 Christian Gromm 2015-07-24 501 create_channel_attribute(set_direction);
57562a72 Christian Gromm 2015-07-24 502 create_channel_attribute(set_datatype);
57562a72 Christian Gromm 2015-07-24 @503 create_channel_attribute(set_subbuffer_size);
57562a72 Christian Gromm 2015-07-24 @504 create_channel_attribute(set_packets_per_xact);
57562a72 Christian Gromm 2015-07-24 505
57562a72 Christian Gromm 2015-07-24 506 /**
57562a72 Christian Gromm 2015-07-24 507 * most_channel_def_attrs - array of default attributes of channel object
57562a72 Christian Gromm 2015-07-24 508 */
57562a72 Christian Gromm 2015-07-24 509 static struct attribute *most_channel_def_attrs[] = {
57562a72 Christian Gromm 2015-07-24 @510 &most_chnl_attr_available_directions.attr,
57562a72 Christian Gromm 2015-07-24 @511 &most_chnl_attr_available_datatypes.attr,
57562a72 Christian Gromm 2015-07-24 @512 &most_chnl_attr_number_of_packet_buffers.attr,
57562a72 Christian Gromm 2015-07-24 @513 &most_chnl_attr_number_of_stream_buffers.attr,
57562a72 Christian Gromm 2015-07-24 @514 &most_chnl_attr_size_of_packet_buffer.attr,
57562a72 Christian Gromm 2015-07-24 @515 &most_chnl_attr_size_of_stream_buffer.attr,
57562a72 Christian Gromm 2015-07-24 @516 &most_chnl_attr_set_number_of_buffers.attr,
57562a72 Christian Gromm 2015-07-24 @517 &most_chnl_attr_set_buffer_size.attr,
57562a72 Christian Gromm 2015-07-24 @518 &most_chnl_attr_set_direction.attr,
57562a72 Christian Gromm 2015-07-24 @519 &most_chnl_attr_set_datatype.attr,
57562a72 Christian Gromm 2015-07-24 @520 &most_chnl_attr_set_subbuffer_size.attr,
57562a72 Christian Gromm 2015-07-24 @521 &most_chnl_attr_set_packets_per_xact.attr,
57562a72 Christian Gromm 2015-07-24 @522 &most_chnl_attr_channel_starving.attr,
57562a72 Christian Gromm 2015-07-24 523 NULL,
57562a72 Christian Gromm 2015-07-24 524 };
57562a72 Christian Gromm 2015-07-24 525
:::::: The code at line 347 was first introduced by commit
:::::: 57562a72414ca35b2e614cfe0a1b1a7b7e7813dd Staging: most: add MOST driver's core module
:::::: TO: Christian Gromm <christian.gromm@microchip.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26450 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-25 7:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-23 8:38 [PATCH] staging: most: Adds parentheses around macros with complex values Mark Stenglein
2017-03-23 8:59 ` Greg KH
2017-03-25 7:26 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.