Skip to content

Commit 3d52c5b

Browse files
committed
Merge tag 'devicetree-fixes-for-4.0' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
Pull DeviceTree fixes from Rob Herring: - fix for stdout-path option parsing with added unittest - fix for stdout-path interaction with earlycon - several DT unittest fixes - fix Sparc allmodconfig build error on of_platform_register_reconfig_notifier - several DT overlay kconfig and build warning fixes - several DT binding documentation updates * tag 'devicetree-fixes-for-4.0' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: of/platform: Fix sparc:allmodconfig build of: unittest: Add options string testcase variants of: fix handling of '/' in options for of_find_node_by_path() of/unittest: Fix the wrong expected value in of_selftest_property_string of/unittest: remove the duplicate of_changeset_init dt: submitting-patches: clarify that DT maintainers are to be cced on bindings of: unittest: fix I2C dependency of/overlay: Remove unused variable Documentation: DT: Renamed of-serial.txt to 8250.txt of: Fix premature bootconsole disable with 'stdout-path' serial: add device tree binding documentation for ETRAX FS UART of/overlay: Directly include idr.h of: Drop superfluous dependance for OF_OVERLAY of: Add vendor prefix for Arasan of: Add prompt for OF_OVERLAY config
2 parents f788baa + a697c2e commit 3d52c5b

File tree

9 files changed

+65
-22
lines changed

9 files changed

+65
-22
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
ETRAX FS UART
2+
3+
Required properties:
4+
- compatible : "axis,etraxfs-uart"
5+
- reg: offset and length of the register set for the device.
6+
- interrupts: device interrupt
7+
8+
Optional properties:
9+
- {dtr,dsr,ri,cd}-gpios: specify a GPIO for DTR/DSR/RI/CD
10+
line respectively.
11+
12+
Example:
13+
14+
serial@b00260000 {
15+
compatible = "axis,etraxfs-uart";
16+
reg = <0xb0026000 0x1000>;
17+
interrupts = <68>;
18+
status = "disabled";
19+
};

Documentation/devicetree/bindings/submitting-patches.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ I. For patch submitters
1212

1313
devicetree@vger.kernel.org
1414

15+
and Cc: the DT maintainers. Use scripts/get_maintainer.pl to identify
16+
all of the DT maintainers.
17+
1518
3) The Documentation/ portion of the patch should come in the series before
1619
the code implementing the binding.
1720

Documentation/devicetree/bindings/vendor-prefixes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ amlogic Amlogic, Inc.
2020
ams AMS AG
2121
amstaos AMS-Taos Inc.
2222
apm Applied Micro Circuits Corporation (APM)
23+
arasan Arasan Chip Systems
2324
arm ARM Ltd.
2425
armadeus ARMadeus Systems SARL
2526
asahi-kasei Asahi Kasei Corp.
2627
atmel Atmel Corporation
2728
auo AU Optronics Corporation
2829
avago Avago Technologies
2930
avic Shanghai AVIC Optoelectronics Co., Ltd.
31+
axis Axis Communications AB
3032
bosch Bosch Sensortec GmbH
3133
brcm Broadcom Corporation
3234
buffalo Buffalo, Inc.

drivers/of/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ config OF_RESOLVE
8484
bool
8585

8686
config OF_OVERLAY
87-
bool
88-
depends on OF
87+
bool "Device Tree overlays"
8988
select OF_DYNAMIC
9089
select OF_RESOLVE
9190

drivers/of/base.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -714,16 +714,17 @@ static struct device_node *__of_find_node_by_path(struct device_node *parent,
714714
const char *path)
715715
{
716716
struct device_node *child;
717-
int len = strchrnul(path, '/') - path;
718-
int term;
717+
int len;
718+
const char *end;
719719

720+
end = strchr(path, ':');
721+
if (!end)
722+
end = strchrnul(path, '/');
723+
724+
len = end - path;
720725
if (!len)
721726
return NULL;
722727

723-
term = strchrnul(path, ':') - path;
724-
if (term < len)
725-
len = term;
726-
727728
__for_each_child_of_node(parent, child) {
728729
const char *name = strrchr(child->full_name, '/');
729730
if (WARN(!name, "malformed device_node %s\n", child->full_name))
@@ -768,8 +769,12 @@ struct device_node *of_find_node_opts_by_path(const char *path, const char **opt
768769

769770
/* The path could begin with an alias */
770771
if (*path != '/') {
771-
char *p = strchrnul(path, '/');
772-
int len = separator ? separator - path : p - path;
772+
int len;
773+
const char *p = separator;
774+
775+
if (!p)
776+
p = strchrnul(path, '/');
777+
len = p - path;
773778

774779
/* of_aliases must not be NULL */
775780
if (!of_aliases)
@@ -794,6 +799,8 @@ struct device_node *of_find_node_opts_by_path(const char *path, const char **opt
794799
path++; /* Increment past '/' delimiter */
795800
np = __of_find_node_by_path(np, path);
796801
path = strchrnul(path, '/');
802+
if (separator && separator < path)
803+
break;
797804
}
798805
raw_spin_unlock_irqrestore(&devtree_lock, flags);
799806
return np;
@@ -1886,8 +1893,10 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
18861893
name = of_get_property(of_chosen, "linux,stdout-path", NULL);
18871894
if (IS_ENABLED(CONFIG_PPC) && !name)
18881895
name = of_get_property(of_aliases, "stdout", NULL);
1889-
if (name)
1896+
if (name) {
18901897
of_stdout = of_find_node_opts_by_path(name, &of_stdout_options);
1898+
add_preferred_console("stdout-path", 0, NULL);
1899+
}
18911900
}
18921901

18931902
if (!of_aliases)

drivers/of/overlay.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/string.h>
2020
#include <linux/slab.h>
2121
#include <linux/err.h>
22+
#include <linux/idr.h>
2223

2324
#include "of_private.h"
2425

@@ -85,7 +86,7 @@ static int of_overlay_apply_single_device_node(struct of_overlay *ov,
8586
struct device_node *target, struct device_node *child)
8687
{
8788
const char *cname;
88-
struct device_node *tchild, *grandchild;
89+
struct device_node *tchild;
8990
int ret = 0;
9091

9192
cname = kbasename(child->full_name);

drivers/of/unittest.c

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ static void __init of_selftest_find_node_by_name(void)
9292
"option path test failed\n");
9393
of_node_put(np);
9494

95+
np = of_find_node_opts_by_path("/testcase-data:test/option", &options);
96+
selftest(np && !strcmp("test/option", options),
97+
"option path test, subcase #1 failed\n");
98+
of_node_put(np);
99+
95100
np = of_find_node_opts_by_path("/testcase-data:testoption", NULL);
96101
selftest(np, "NULL option path test failed\n");
97102
of_node_put(np);
@@ -102,6 +107,12 @@ static void __init of_selftest_find_node_by_name(void)
102107
"option alias path test failed\n");
103108
of_node_put(np);
104109

110+
np = of_find_node_opts_by_path("testcase-alias:test/alias/option",
111+
&options);
112+
selftest(np && !strcmp("test/alias/option", options),
113+
"option alias path test, subcase #1 failed\n");
114+
of_node_put(np);
115+
105116
np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL);
106117
selftest(np, "NULL option alias path test failed\n");
107118
of_node_put(np);
@@ -378,9 +389,9 @@ static void __init of_selftest_property_string(void)
378389
rc = of_property_match_string(np, "phandle-list-names", "first");
379390
selftest(rc == 0, "first expected:0 got:%i\n", rc);
380391
rc = of_property_match_string(np, "phandle-list-names", "second");
381-
selftest(rc == 1, "second expected:0 got:%i\n", rc);
392+
selftest(rc == 1, "second expected:1 got:%i\n", rc);
382393
rc = of_property_match_string(np, "phandle-list-names", "third");
383-
selftest(rc == 2, "third expected:0 got:%i\n", rc);
394+
selftest(rc == 2, "third expected:2 got:%i\n", rc);
384395
rc = of_property_match_string(np, "phandle-list-names", "fourth");
385396
selftest(rc == -ENODATA, "unmatched string; rc=%i\n", rc);
386397
rc = of_property_match_string(np, "missing-property", "blah");
@@ -478,7 +489,6 @@ static void __init of_selftest_changeset(void)
478489
struct device_node *n1, *n2, *n21, *nremove, *parent, *np;
479490
struct of_changeset chgset;
480491

481-
of_changeset_init(&chgset);
482492
n1 = __of_node_dup(NULL, "/testcase-data/changeset/n1");
483493
selftest(n1, "testcase setup failure\n");
484494
n2 = __of_node_dup(NULL, "/testcase-data/changeset/n2");
@@ -979,7 +989,7 @@ static int of_path_platform_device_exists(const char *path)
979989
return pdev != NULL;
980990
}
981991

982-
#if IS_ENABLED(CONFIG_I2C)
992+
#if IS_BUILTIN(CONFIG_I2C)
983993

984994
/* get the i2c client device instantiated at the path */
985995
static struct i2c_client *of_path_to_i2c_client(const char *path)
@@ -1445,7 +1455,7 @@ static void of_selftest_overlay_11(void)
14451455
return;
14461456
}
14471457

1448-
#if IS_ENABLED(CONFIG_I2C) && IS_ENABLED(CONFIG_OF_OVERLAY)
1458+
#if IS_BUILTIN(CONFIG_I2C) && IS_ENABLED(CONFIG_OF_OVERLAY)
14491459

14501460
struct selftest_i2c_bus_data {
14511461
struct platform_device *pdev;
@@ -1584,7 +1594,7 @@ static struct i2c_driver selftest_i2c_dev_driver = {
15841594
.id_table = selftest_i2c_dev_id,
15851595
};
15861596

1587-
#if IS_ENABLED(CONFIG_I2C_MUX)
1597+
#if IS_BUILTIN(CONFIG_I2C_MUX)
15881598

15891599
struct selftest_i2c_mux_data {
15901600
int nchans;
@@ -1695,7 +1705,7 @@ static int of_selftest_overlay_i2c_init(void)
16951705
"could not register selftest i2c bus driver\n"))
16961706
return ret;
16971707

1698-
#if IS_ENABLED(CONFIG_I2C_MUX)
1708+
#if IS_BUILTIN(CONFIG_I2C_MUX)
16991709
ret = i2c_add_driver(&selftest_i2c_mux_driver);
17001710
if (selftest(ret == 0,
17011711
"could not register selftest i2c mux driver\n"))
@@ -1707,7 +1717,7 @@ static int of_selftest_overlay_i2c_init(void)
17071717

17081718
static void of_selftest_overlay_i2c_cleanup(void)
17091719
{
1710-
#if IS_ENABLED(CONFIG_I2C_MUX)
1720+
#if IS_BUILTIN(CONFIG_I2C_MUX)
17111721
i2c_del_driver(&selftest_i2c_mux_driver);
17121722
#endif
17131723
platform_driver_unregister(&selftest_i2c_bus_driver);
@@ -1814,7 +1824,7 @@ static void __init of_selftest_overlay(void)
18141824
of_selftest_overlay_10();
18151825
of_selftest_overlay_11();
18161826

1817-
#if IS_ENABLED(CONFIG_I2C)
1827+
#if IS_BUILTIN(CONFIG_I2C)
18181828
if (selftest(of_selftest_overlay_i2c_init() == 0, "i2c init failed\n"))
18191829
goto out;
18201830

include/linux/of_platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static inline int of_platform_populate(struct device_node *root,
8484
static inline void of_platform_depopulate(struct device *parent) { }
8585
#endif
8686

87-
#ifdef CONFIG_OF_DYNAMIC
87+
#if defined(CONFIG_OF_DYNAMIC) && defined(CONFIG_OF_ADDRESS)
8888
extern void of_platform_register_reconfig_notifier(void);
8989
#else
9090
static inline void of_platform_register_reconfig_notifier(void) { }

0 commit comments

Comments
 (0)