* [Patch 0/5] dt: unittest: fix breakage and warnings
@ 2015-03-14 5:25 Frank Rowand
2015-03-14 6:57 ` [Patch 1/5] dt: unittest: early return from test skips tests Frank Rowand
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Frank Rowand @ 2015-03-14 5:25 UTC (permalink / raw)
To: Grant Likely, Rob Herring, Linux Kernel list, devicetree
Running checkpatch on early versions of my patchset to fix the devicetree
make dependency issues exposed a large number of warnings, including some that
are actual bugs. http://lkml.iu.edu/hypermail/linux/kernel/1503.1/03335.html
These patches fix those bugs, and another bug exposed by fixing those bugs.
As a result, the number of tests completed increased from 102 to 107.
Since I was already poking around, I fixed a few classes of checkpatch warnings.
There are still plenty of warnings, but the noise is greatly reduced and future
checkpatch warnings that are problems should stand out more clearly.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Patch 1/5] dt: unittest: early return from test skips tests
2015-03-14 5:25 [Patch 0/5] dt: unittest: fix breakage and warnings Frank Rowand
@ 2015-03-14 6:57 ` Frank Rowand
2015-03-28 3:58 ` Grant Likely
2015-03-14 6:59 ` Frank Rowand
` (4 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Frank Rowand @ 2015-03-14 6:57 UTC (permalink / raw)
To: Grant Likely, Rob Herring, Linux Kernel list, devicetree
From: Frank Rowand <frank.rowand@sonymobile.com>
Fix bugs pointed out by checkpatch.
Mis-coding of two if statements caused early return from function.
Number of tests completed increased from 102 to 107.
Number of tests failed increased from 0 to 2.
Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
---
drivers/of/unittest.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Index: b/drivers/of/unittest.c
===================================================================
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -762,12 +762,14 @@ static void __init of_selftest_platform_
irq = platform_get_irq(pdev, 0);
selftest(irq < 0 && irq != -EPROBE_DEFER, "device parsing error failed - %d\n", irq);
- if (selftest(np = of_find_node_by_path("/testcase-data/platform-tests"),
- "No testcase data in device tree\n"));
+ np = of_find_node_by_path("/testcase-data/platform-tests");
+ selftest(np, "No testcase data in device tree\n");
+ if (!np)
return;
- if (selftest(!(rc = device_register(&test_bus)),
- "testbus registration failed; rc=%i\n", rc));
+ rc = device_register(&test_bus);
+ selftest(!rc, "testbus registration failed; rc=%i\n", rc);
+ if (rc)
return;
for_each_child_of_node(np, child) {
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Patch 2/5] dt: unittest: typo in error string
@ 2015-03-14 6:59 ` Frank Rowand
0 siblings, 0 replies; 10+ messages in thread
From: Frank Rowand @ 2015-03-14 6:59 UTC (permalink / raw)
To: Grant Likely, Rob Herring, Linux Kernel list, devicetree
From: Frank Rowand <frank.rowand@sonymobile.com>
Fix bug pointed out by checkpatch.
Splitting string incorrectly removed a space between two words.
Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
---
drivers/of/unittest.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: b/drivers/of/unittest.c
===================================================================
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -212,8 +212,9 @@ static void __init of_selftest_check_tre
child_count = of_selftest_check_node_linkage(of_root);
selftest(child_count > 0, "Device node data structure is corrupted\n");
- selftest(child_count == allnode_count, "allnodes list size (%i) doesn't match"
- "sibling lists size (%i)\n", allnode_count, child_count);
+ selftest(child_count == allnode_count,
+ "allnodes list size (%i) doesn't match sibling lists size (%i)\n",
+ allnode_count, child_count);
pr_debug("allnodes list size (%i); sibling lists size (%i)\n", allnode_count, child_count);
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Patch 2/5] dt: unittest: typo in error string
@ 2015-03-14 6:59 ` Frank Rowand
0 siblings, 0 replies; 10+ messages in thread
From: Frank Rowand @ 2015-03-14 6:59 UTC (permalink / raw)
To: Grant Likely, Rob Herring, Linux Kernel list,
devicetree-u79uwXL29TY76Z2rM5mHXA
From: Frank Rowand <frank.rowand-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
Fix bug pointed out by checkpatch.
Splitting string incorrectly removed a space between two words.
Signed-off-by: Frank Rowand <frank.rowand-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
---
drivers/of/unittest.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: b/drivers/of/unittest.c
===================================================================
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -212,8 +212,9 @@ static void __init of_selftest_check_tre
child_count = of_selftest_check_node_linkage(of_root);
selftest(child_count > 0, "Device node data structure is corrupted\n");
- selftest(child_count == allnode_count, "allnodes list size (%i) doesn't match"
- "sibling lists size (%i)\n", allnode_count, child_count);
+ selftest(child_count == allnode_count,
+ "allnodes list size (%i) doesn't match sibling lists size (%i)\n",
+ allnode_count, child_count);
pr_debug("allnodes list size (%i); sibling lists size (%i)\n", allnode_count, child_count);
}
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Patch 3/5] dt: unittest: add const where needed
@ 2015-03-14 7:00 ` Frank Rowand
0 siblings, 0 replies; 10+ messages in thread
From: Frank Rowand @ 2015-03-14 7:00 UTC (permalink / raw)
To: Grant Likely, Rob Herring, Linux Kernel list, devicetree
From: Frank Rowand <frank.rowand@sonymobile.com>
Fix warnings pointed out by checkpatch.
No bugs fixed, but the test code should be a good example of how to use
the devicetree API.
Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
---
drivers/of/unittest.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: b/drivers/of/unittest.c
===================================================================
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -666,7 +666,7 @@ static void __init of_selftest_parse_int
of_node_put(np);
}
-static struct of_device_id match_node_table[] = {
+static const struct of_device_id match_node_table[] = {
{ .data = "A", .name = "name0", }, /* Name alone is lowest priority */
{ .data = "B", .type = "type1", }, /* followed by type alone */
@@ -740,7 +740,7 @@ static void __init of_selftest_platform_
int irq, rc;
struct device_node *np, *child, *grandchild;
struct platform_device *pdev;
- struct of_device_id match[] = {
+ const struct of_device_id match[] = {
{ .compatible = "test-device", },
{}
};
@@ -941,7 +941,7 @@ static int selftest_remove(struct platfo
return 0;
}
-static struct of_device_id selftest_match[] = {
+static const struct of_device_id selftest_match[] = {
{ .compatible = "selftest", },
{},
};
@@ -1533,7 +1533,7 @@ static int selftest_i2c_bus_remove(struc
return 0;
}
-static struct of_device_id selftest_i2c_bus_match[] = {
+static const struct of_device_id selftest_i2c_bus_match[] = {
{ .compatible = "selftest-i2c-bus", },
{},
};
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Patch 3/5] dt: unittest: add const where needed
@ 2015-03-14 7:00 ` Frank Rowand
0 siblings, 0 replies; 10+ messages in thread
From: Frank Rowand @ 2015-03-14 7:00 UTC (permalink / raw)
To: Grant Likely, Rob Herring, Linux Kernel list,
devicetree-u79uwXL29TY76Z2rM5mHXA
From: Frank Rowand <frank.rowand-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
Fix warnings pointed out by checkpatch.
No bugs fixed, but the test code should be a good example of how to use
the devicetree API.
Signed-off-by: Frank Rowand <frank.rowand-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
---
drivers/of/unittest.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: b/drivers/of/unittest.c
===================================================================
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -666,7 +666,7 @@ static void __init of_selftest_parse_int
of_node_put(np);
}
-static struct of_device_id match_node_table[] = {
+static const struct of_device_id match_node_table[] = {
{ .data = "A", .name = "name0", }, /* Name alone is lowest priority */
{ .data = "B", .type = "type1", }, /* followed by type alone */
@@ -740,7 +740,7 @@ static void __init of_selftest_platform_
int irq, rc;
struct device_node *np, *child, *grandchild;
struct platform_device *pdev;
- struct of_device_id match[] = {
+ const struct of_device_id match[] = {
{ .compatible = "test-device", },
{}
};
@@ -941,7 +941,7 @@ static int selftest_remove(struct platfo
return 0;
}
-static struct of_device_id selftest_match[] = {
+static const struct of_device_id selftest_match[] = {
{ .compatible = "selftest", },
{},
};
@@ -1533,7 +1533,7 @@ static int selftest_i2c_bus_remove(struc
return 0;
}
-static struct of_device_id selftest_i2c_bus_match[] = {
+static const struct of_device_id selftest_i2c_bus_match[] = {
{ .compatible = "selftest-i2c-bus", },
{},
};
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Patch 4/5] dt: unittest: reduce checkpatch noise - line after declarations
2015-03-14 5:25 [Patch 0/5] dt: unittest: fix breakage and warnings Frank Rowand
` (2 preceding siblings ...)
2015-03-14 7:00 ` Frank Rowand
@ 2015-03-14 7:02 ` Frank Rowand
2015-03-14 7:04 ` [Patch 5/5] dt: unittest: breadcrumbs to reduce pain of future maintainers Frank Rowand
2015-03-28 2:55 ` [Patch 0/5] dt: unittest: fix breakage and warnings Grant Likely
5 siblings, 0 replies; 10+ messages in thread
From: Frank Rowand @ 2015-03-14 7:02 UTC (permalink / raw)
To: Grant Likely, Rob Herring, Linux Kernel list, devicetree
From: Frank Rowand <frank.rowand@sonymobile.com>
Fix warnings pointed out by checkpatch.
No bug fixes, but reduce the number of checkpatch warnings so that future
problems will stand out better.
Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
---
drivers/of/unittest.c | 5 +++++
1 file changed, 5 insertions(+)
Index: b/drivers/of/unittest.c
===================================================================
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -279,6 +279,7 @@ static void __init of_selftest_parse_pha
for (i = 0; i < 8; i++) {
bool passed = true;
+
rc = of_parse_phandle_with_args(np, "phandle-list",
"#phandle-cells", i, &args);
@@ -539,6 +540,7 @@ static void __init of_selftest_parse_int
for (i = 0; i < 4; i++) {
bool passed = true;
+
args.args_count = 0;
rc = of_irq_parse_one(np, i, &args);
@@ -559,6 +561,7 @@ static void __init of_selftest_parse_int
for (i = 0; i < 4; i++) {
bool passed = true;
+
args.args_count = 0;
rc = of_irq_parse_one(np, i, &args);
@@ -611,6 +614,7 @@ static void __init of_selftest_parse_int
for (i = 0; i < 7; i++) {
bool passed = true;
+
rc = of_irq_parse_one(np, i, &args);
/* Test the values from tests-phandle.dtsi */
@@ -905,6 +909,7 @@ static int __init selftest_data_add(void
np = selftest_data_node->child;
while (np) {
struct device_node *next = np->sibling;
+
np->parent = of_root;
attach_node_and_children(np);
np = next;
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Patch 5/5] dt: unittest: breadcrumbs to reduce pain of future maintainers
2015-03-14 5:25 [Patch 0/5] dt: unittest: fix breakage and warnings Frank Rowand
` (3 preceding siblings ...)
2015-03-14 7:02 ` [Patch 4/5] dt: unittest: reduce checkpatch noise - line after declarations Frank Rowand
@ 2015-03-14 7:04 ` Frank Rowand
2015-03-28 2:55 ` [Patch 0/5] dt: unittest: fix breakage and warnings Grant Likely
5 siblings, 0 replies; 10+ messages in thread
From: Frank Rowand @ 2015-03-14 7:04 UTC (permalink / raw)
To: Grant Likely, Rob Herring, Linux Kernel list, devicetree
From: Frank Rowand <frank.rowand@sonymobile.com>
Fix warnings pointed out by checkpatch.
Checkpatch warns: externs should be avoided in .c files
Reducing pain for future maintainers - adding a comment so that anyone trying
to find where the extern data is created will be able to find it.
(grep will not find that location)
Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
---
drivers/of/unittest.c | 4 ++++
1 file changed, 4 insertions(+)
Index: b/drivers/of/unittest.c
===================================================================
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -865,6 +865,10 @@ static int __init selftest_data_add(void
{
void *selftest_data;
struct device_node *selftest_data_node, *np;
+ /*
+ * __dtb_testcases_begin[] and __dtb_testcases_end[] are magically
+ * created by cmd_dt_S_dtb in scripts/Makefile.lib
+ */
extern uint8_t __dtb_testcases_begin[];
extern uint8_t __dtb_testcases_end[];
const int size = __dtb_testcases_end - __dtb_testcases_begin;
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch 0/5] dt: unittest: fix breakage and warnings
2015-03-14 5:25 [Patch 0/5] dt: unittest: fix breakage and warnings Frank Rowand
` (4 preceding siblings ...)
2015-03-14 7:04 ` [Patch 5/5] dt: unittest: breadcrumbs to reduce pain of future maintainers Frank Rowand
@ 2015-03-28 2:55 ` Grant Likely
5 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2015-03-28 2:55 UTC (permalink / raw)
To: frowand.list, Rob Herring, Linux Kernel list, devicetree
On Fri, 13 Mar 2015 22:25:51 -0700
, Frank Rowand <frowand.list@gmail.com>
wrote:
> Running checkpatch on early versions of my patchset to fix the devicetree
> make dependency issues exposed a large number of warnings, including some that
> are actual bugs. http://lkml.iu.edu/hypermail/linux/kernel/1503.1/03335.html
>
> These patches fix those bugs, and another bug exposed by fixing those bugs.
> As a result, the number of tests completed increased from 102 to 107.
>
> Since I was already poking around, I fixed a few classes of checkpatch warnings.
>
> There are still plenty of warnings, but the noise is greatly reduced and future
> checkpatch warnings that are problems should stand out more clearly.
Thanks for rooting these out. I'll apply the bug fix for v4.0, and the
rest for v4.1
g.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch 1/5] dt: unittest: early return from test skips tests
2015-03-14 6:57 ` [Patch 1/5] dt: unittest: early return from test skips tests Frank Rowand
@ 2015-03-28 3:58 ` Grant Likely
0 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2015-03-28 3:58 UTC (permalink / raw)
To: frowand.list, Rob Herring, Linux Kernel list, devicetree
On Fri, 13 Mar 2015 23:57:40 -0700
, Frank Rowand <frowand.list@gmail.com>
wrote:
> From: Frank Rowand <frank.rowand@sonymobile.com>
>
> Fix bugs pointed out by checkpatch.
>
> Mis-coding of two if statements caused early return from function.
>
> Number of tests completed increased from 102 to 107.
> Number of tests failed increased from 0 to 2.
I was going to send this to Linus right away, but on second thought, it
isn't actually a regression fix. I'm going to queue it up for v4.1 with
the rest of the series instead.
I've also got a bug fix for the new warnings that I'll put in at the
same time.
g.
>
> Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
> ---
> drivers/of/unittest.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> Index: b/drivers/of/unittest.c
> ===================================================================
> --- a/drivers/of/unittest.c
> +++ b/drivers/of/unittest.c
> @@ -762,12 +762,14 @@ static void __init of_selftest_platform_
> irq = platform_get_irq(pdev, 0);
> selftest(irq < 0 && irq != -EPROBE_DEFER, "device parsing error failed - %d\n", irq);
>
> - if (selftest(np = of_find_node_by_path("/testcase-data/platform-tests"),
> - "No testcase data in device tree\n"));
> + np = of_find_node_by_path("/testcase-data/platform-tests");
> + selftest(np, "No testcase data in device tree\n");
> + if (!np)
> return;
>
> - if (selftest(!(rc = device_register(&test_bus)),
> - "testbus registration failed; rc=%i\n", rc));
> + rc = device_register(&test_bus);
> + selftest(!rc, "testbus registration failed; rc=%i\n", rc);
> + if (rc)
> return;
>
> for_each_child_of_node(np, child) {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-03-28 12:04 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-14 5:25 [Patch 0/5] dt: unittest: fix breakage and warnings Frank Rowand
2015-03-14 6:57 ` [Patch 1/5] dt: unittest: early return from test skips tests Frank Rowand
2015-03-28 3:58 ` Grant Likely
2015-03-14 6:59 ` [Patch 2/5] dt: unittest: typo in error string Frank Rowand
2015-03-14 6:59 ` Frank Rowand
2015-03-14 7:00 ` [Patch 3/5] dt: unittest: add const where needed Frank Rowand
2015-03-14 7:00 ` Frank Rowand
2015-03-14 7:02 ` [Patch 4/5] dt: unittest: reduce checkpatch noise - line after declarations Frank Rowand
2015-03-14 7:04 ` [Patch 5/5] dt: unittest: breadcrumbs to reduce pain of future maintainers Frank Rowand
2015-03-28 2:55 ` [Patch 0/5] dt: unittest: fix breakage and warnings Grant Likely
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.