Commit 37ef1647 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'driver-core-4.1-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core fixes from Greg KH:
 "Here are two fixes for the driver core that resolve some reported
  issues.

  One is a regression from 4.0, the other a fixes a reported oops that
  has been there since 3.19.

  Both have been in linux-next for a while with no problems"

* tag 'driver-core-4.1-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  drivers/base: cacheinfo: handle absence of caches
  drivers: of/base: move of_init to driver_init
parents eadc21f5 3370e13a
...@@ -179,7 +179,7 @@ static int detect_cache_attributes(unsigned int cpu) ...@@ -179,7 +179,7 @@ static int detect_cache_attributes(unsigned int cpu)
{ {
int ret; int ret;
if (init_cache_level(cpu)) if (init_cache_level(cpu) || !cache_leaves(cpu))
return -ENOENT; return -ENOENT;
per_cpu_cacheinfo(cpu) = kcalloc(cache_leaves(cpu), per_cpu_cacheinfo(cpu) = kcalloc(cache_leaves(cpu),
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/memory.h> #include <linux/memory.h>
#include <linux/of.h>
#include "base.h" #include "base.h"
...@@ -34,4 +35,5 @@ void __init driver_init(void) ...@@ -34,4 +35,5 @@ void __init driver_init(void)
cpu_dev_init(); cpu_dev_init();
memory_dev_init(); memory_dev_init();
container_dev_init(); container_dev_init();
of_core_init();
} }
...@@ -189,7 +189,7 @@ int __of_attach_node_sysfs(struct device_node *np) ...@@ -189,7 +189,7 @@ int __of_attach_node_sysfs(struct device_node *np)
return 0; return 0;
} }
static int __init of_init(void) void __init of_core_init(void)
{ {
struct device_node *np; struct device_node *np;
...@@ -198,7 +198,8 @@ static int __init of_init(void) ...@@ -198,7 +198,8 @@ static int __init of_init(void)
of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj); of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj);
if (!of_kset) { if (!of_kset) {
mutex_unlock(&of_mutex); mutex_unlock(&of_mutex);
return -ENOMEM; pr_err("devicetree: failed to register existing nodes\n");
return;
} }
for_each_of_allnodes(np) for_each_of_allnodes(np)
__of_attach_node_sysfs(np); __of_attach_node_sysfs(np);
...@@ -207,10 +208,7 @@ static int __init of_init(void) ...@@ -207,10 +208,7 @@ static int __init of_init(void)
/* Symlink in /proc as required by userspace ABI */ /* Symlink in /proc as required by userspace ABI */
if (of_root) if (of_root)
proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base"); proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base");
return 0;
} }
core_initcall(of_init);
static struct property *__of_find_property(const struct device_node *np, static struct property *__of_find_property(const struct device_node *np,
const char *name, int *lenp) const char *name, int *lenp)
......
...@@ -121,6 +121,8 @@ extern struct device_node *of_stdout; ...@@ -121,6 +121,8 @@ extern struct device_node *of_stdout;
extern raw_spinlock_t devtree_lock; extern raw_spinlock_t devtree_lock;
#ifdef CONFIG_OF #ifdef CONFIG_OF
void of_core_init(void);
static inline bool is_of_node(struct fwnode_handle *fwnode) static inline bool is_of_node(struct fwnode_handle *fwnode)
{ {
return fwnode && fwnode->type == FWNODE_OF; return fwnode && fwnode->type == FWNODE_OF;
...@@ -376,6 +378,10 @@ bool of_console_check(struct device_node *dn, char *name, int index); ...@@ -376,6 +378,10 @@ bool of_console_check(struct device_node *dn, char *name, int index);
#else /* CONFIG_OF */ #else /* CONFIG_OF */
static inline void of_core_init(void)
{
}
static inline bool is_of_node(struct fwnode_handle *fwnode) static inline bool is_of_node(struct fwnode_handle *fwnode)
{ {
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment