Staging: most: fix coding style issues
Subsystems (2)
PATCH 1/1 Staging: most: fix coding style issues
This is a patch for the core.[ch] files that fixes up warnings found with the checkpatch.pl tool.
--- drivers/staging/most/core.c | 4 +++- drivers/staging/most/core.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/staging/most/core.c +3 -1
@@ -303,7 +303,8 @@ static ssize_t set_datatype_show(struct device *dev,for (i =0 ; i <ARRAY_SIZE (ch_data_type); i++) {if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) -return snprintf (buf,PAGE_SIZE ,"%s" , ch_data_type[i].name); +return snprintf (buf,PAGE_SIZE , +"%s" , ch_data_type[i].name); }return snprintf (buf,PAGE_SIZE ,"unconfigured\n" ); }
@@ -728,6 +729,7 @@ int most_add_link(char *mdev, char *mdev_ch, char *comp_name, char *link_name,return link_channel_to_component (c, comp, link_name, comp_param); } +/** * remove_link_store - store function for remove_link attribute * @drv: device driver
drivers/staging/most/core.h +1 -1
@@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0 +/* SPDX-License-Identifier: GPL-2.0 */ /* * most.h - API for component and adapter drivers *
Signature · 1 line
2.21.0
Quoted 2 lines · Gabriel Beauchamp
This is a patch for the core.[ch] files that fixes up warnings found with the checkpatch.pl tool.
[]
drivers/staging/most/core.c
Quoted 1 line
drivers/staging/most/core.c +0
-0
[]
drivers/staging/most/core.c static ssize_t set_datatype_show(struct device *dev, · line 310
Quoted 10 lines
drivers/staging/most/core.c +2
-1@@ -303,7 +303,8 @@ static ssize_t set_datatype_show(struct device *dev,for (i =0 ; i <ARRAY_SIZE (ch_data_type); i++) {if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) -return snprintf (buf,PAGE_SIZE ,"%s" , ch_data_type[i].name); +return snprintf (buf,PAGE_SIZE , +"%s" , ch_data_type[i].name); }return snprintf (buf,PAGE_SIZE ,"unconfigured\n" ); }
Assuming the newline difference is unintentional, (if not change "unconfigured" to "unconfigured\n")
How about using a single sprintf and reducing object code size too?
char *type = "unconfigured";
for (...)
if (c-> etc...) {
type = ch_data_type[i].name;
break;
}
}
return snprintf(buf, PAGE_SIZE, "%s", type);PATCH v2 1/1 Staging: most: fix coding style issues
This is a patch for the core.[ch] files that fixes up warnings found with the checkpatch.pl tool.
---
Changes in v2:
- use a single snprintf
--- drivers/staging/most/core.c | 7 +++++-- drivers/staging/most/core.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/staging/most/core.c +5 -2
@@ -299,13 +299,15 @@ static ssize_t set_datatype_show(struct device *dev, char *buf) {int i; +char *type ="unconfigured\n" ; +struct most_channel *c =to_channel (dev);for (i =0 ; i <ARRAY_SIZE (ch_data_type); i++) {if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) -return snprintf (buf,PAGE_SIZE ,"%s" , ch_data_type[i].name); + type = ch_data_type[i].name; } -return snprintf (buf,PAGE_SIZE ,"unconfigured\n" ); +return snprintf (buf,PAGE_SIZE ,"%s" , type); } static ssize_t set_subbuffer_size_show(struct device *dev,
@@ -728,6 +730,7 @@ int most_add_link(char *mdev, char *mdev_ch, char *comp_name, char *link_name,return link_channel_to_component (c, comp, link_name, comp_param); } +/** * remove_link_store - store function for remove_link attribute * @drv: device driver
drivers/staging/most/core.h +1 -1
@@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0 +/* SPDX-License-Identifier: GPL-2.0 */ /* * most.h - API for component and adapter drivers *
Signature · 1 line
2.21.0
PATCH v3 1/1 Staging: most: fix coding style issues
This is a patch for the core.[ch] files that fixes up warnings found with the checkpatch.pl tool.
---
Changes in v3:
- add a break statement to preserve the control flow Changes in v2:
- use a single snprintf
--- drivers/staging/most/core.c | 11 ++++++++--- drivers/staging/most/core.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/staging/most/core.c +8 -3
@@ -299,13 +299,17 @@ static ssize_t set_datatype_show(struct device *dev, char *buf) {int i; +char *type ="unconfigured\n" ; +struct most_channel *c =to_channel (dev);for (i =0 ; i <ARRAY_SIZE (ch_data_type); i++) { -if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) -return snprintf (buf,PAGE_SIZE ,"%s" , ch_data_type[i].name); +if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) { + type = ch_data_type[i].name; +break ; + } } -return snprintf (buf,PAGE_SIZE ,"unconfigured\n" ); +return snprintf (buf,PAGE_SIZE ,"%s" , type); } static ssize_t set_subbuffer_size_show(struct device *dev,
@@ -728,6 +732,7 @@ int most_add_link(char *mdev, char *mdev_ch, char *comp_name, char *link_name,return link_channel_to_component (c, comp, link_name, comp_param); } +/** * remove_link_store - store function for remove_link attribute * @drv: device driver
drivers/staging/most/core.h +1 -1
@@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0 +/* SPDX-License-Identifier: GPL-2.0 */ /* * most.h - API for component and adapter drivers *
Signature · 1 line
2.21.0
kbuild test robot
build botThank you for the patch! Perhaps something to improve:
Hi Gabriel,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v5.2-rc6 next-20190625]
[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/Gabriel-Beauchamp/Staging-most-fix-coding-style-issues/20190701-203804
config: i386-randconfig-x074-201926 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-9) 7.4.0 reproduce:
# save the attached .config to linux build tree
make ARCH=i386 If you fix the issue, kindly add following tag
All warnings (new ones prefixed by >>):
drivers/staging/most/core.c: In function 'set_datatype_show':
>> drivers/staging/most/core.c:308:9: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
type = ch_data_type[i].name;
^vim +/const +308 drivers/staging/most/core.c
296
297 static ssize_t set_datatype_show(struct device *dev,
298 struct device_attribute *attr,
299 char *buf)
300 {
301 int i;
302 char *type = "unconfigured\n";
303
304 struct most_channel *c = to_channel(dev);
305
306 for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
307 if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) {
> 308 type = ch_data_type[i].name;
309 break;
310 }
311 }
312 return snprintf(buf, PAGE_SIZE, "%s", type);
313 }
314
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botThank you for the patch! Perhaps something to improve:
Hi Gabriel,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v5.2-rc6 next-20190625]
[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/Gabriel-Beauchamp/Staging-most-fix-coding-style-issues/20190701-203804
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-rc1-7-g2b96cd8-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'If you fix the issue, kindly add following tag
sparse warnings: (new ones prefixed by >>)
vim +308 drivers/staging/most/core.c
296
297 static ssize_t set_datatype_show(struct device *dev,
298 struct device_attribute *attr,
299 char *buf)
300 {
301 int i;
302 char *type = "unconfigured\n";
303
304 struct most_channel *c = to_channel(dev);
305
306 for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
307 if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) {
> 308 type = ch_data_type[i].name;
309 break;
310 }
311 }
312 return snprintf(buf, PAGE_SIZE, "%s", type);
313 }
314
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH v4 1/1 Staging: most: fix coding style issues
In reply to Gabriel BeauchampThis is a patch for the core.[ch] files that fixes up warnings found with the checkpatch.pl tool.
---
Changes in v4:
- fix a warning by making '*type' const Changes in v3:
- add a break statement to preserve the control flow Changes in v2:
- use a single snprintf
--- drivers/staging/most/core.c | 11 ++++++++--- drivers/staging/most/core.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/staging/most/core.c +8 -3
@@ -299,13 +299,17 @@ static ssize_t set_datatype_show(struct device *dev, char *buf) {int i; +const char *type ="unconfigured\n" ; +struct most_channel *c =to_channel (dev);for (i =0 ; i <ARRAY_SIZE (ch_data_type); i++) { -if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) -return snprintf (buf,PAGE_SIZE ,"%s" , ch_data_type[i].name); +if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) { + type = ch_data_type[i].name; +break ; + } } -return snprintf (buf,PAGE_SIZE ,"unconfigured\n" ); +return snprintf (buf,PAGE_SIZE ,"%s" , type); } static ssize_t set_subbuffer_size_show(struct device *dev,
@@ -728,6 +732,7 @@ int most_add_link(char *mdev, char *mdev_ch, char *comp_name, char *link_name,return link_channel_to_component (c, comp, link_name, comp_param); } +/** * remove_link_store - store function for remove_link attribute * @drv: device driver
drivers/staging/most/core.h +1 -1
@@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0 +/* SPDX-License-Identifier: GPL-2.0 */ /* * most.h - API for component and adapter drivers *
Signature · 1 line
2.21.0
Greg KH
maintainerQuoted 4 lines · Gabriel Beauchamp
This is a patch for the core.[ch] files that fixes up warnings found with the checkpatch.pl tool.
Signed-off-by Gabriel Beauchamp <[email protected]>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- Your patch did many different things all at once, making it difficult to review. All Linux kernel patches need to only do one thing at a time. If you need to do multiple things (such as clean up all coding style issues in a file/driver), do it in a sequence of patches, each one doing only one thing. This will make it easier to review the patches to ensure that they are correct, and to help alleviate any merge issues that larger patches can cause.
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot
kbuild test robot
build botThank you for the patch! Perhaps something to improve:
Hi Gabriel,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on staging/staging-testing]
[cannot apply to v5.3-rc1 next-20190723]
[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/Gabriel-Beauchamp/Staging-most-fix-coding-style-issues/20190701-203804
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-rc1-7-g2b96cd8-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'If you fix the issue, kindly add following tag
sparse warnings: (new ones prefixed by >>)
>> drivers/staging/most/core.c:308:30: sparse: sparse: incorrect type in assignment (different modifiers) @@ expected char *type @@ got char const *char *type @@ >> drivers/staging/most/core.c:308:30: sparse: expected char *type >> drivers/staging/most/core.c:308:30: sparse: got char const *const name
vim +308 drivers/staging/most/core.c
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botThank you for the patch! Perhaps something to improve:
Hi Gabriel,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on staging/staging-testing]
[cannot apply to v5.3-rc3 next-20190808]
[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/Gabriel-Beauchamp/Staging-most-fix-coding-style-issues/20190701-203804
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-rc1-7-g2b96cd8-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'If you fix the issue, kindly add following tag
sparse warnings: (new ones prefixed by >>)
>> drivers/staging/most/core.c:308:30: sparse: sparse: incorrect type in assignment (different modifiers) @@ expected char *type @@ got char const *char *type @@ >> drivers/staging/most/core.c:308:30: sparse: expected char *type >> drivers/staging/most/core.c:308:30: sparse: got char const *const name
vim +308 drivers/staging/most/core.c
296
297 static ssize_t set_datatype_show(struct device *dev,
298 struct device_attribute *attr,
299 char *buf)
300 {
301 int i;
302 char *type = "unconfigured\n";
303
304 struct most_channel *c = to_channel(dev);
305
306 for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
307 if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) {
> 308 type = ch_data_type[i].name;
309 break;
310 }
311 }
312 return snprintf(buf, PAGE_SIZE, "%s", type);
313 }
314
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Greg KH
maintainerQuoted 4 lines · Gabriel Beauchamp
This is a patch for the core.[ch] files that fixes up warnings found with the checkpatch.pl tool.
Signed-off-by Gabriel Beauchamp <[email protected]>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- Your patch did many different things all at once, making it difficult to review. All Linux kernel patches need to only do one thing at a time. If you need to do multiple things (such as clean up all coding style issues in a file/driver), do it in a sequence of patches, each one doing only one thing. This will make it easier to review the patches to ensure that they are correct, and to help alleviate any merge issues that larger patches can cause.
- You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what is needed in order to properly describe the change.
- You did not write a descriptive Subject: for the patch, allowing Greg, and everyone else, to know what this patch is all about. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what a proper Subject: line should look like.
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot