Skip to content

Commit

Permalink
Merge tag 'driver-core-4.1-rc7' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
Linus Torvalds committed Jun 7, 2015
2 parents eadc21f + 3370e13 commit 37ef164
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/base/cacheinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static int detect_cache_attributes(unsigned int cpu)
{
int ret;

if (init_cache_level(cpu))
if (init_cache_level(cpu) || !cache_leaves(cpu))
return -ENOENT;

per_cpu_cacheinfo(cpu) = kcalloc(cache_leaves(cpu),
Expand Down
2 changes: 2 additions & 0 deletions drivers/base/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/device.h>
#include <linux/init.h>
#include <linux/memory.h>
#include <linux/of.h>

#include "base.h"

Expand All @@ -34,4 +35,5 @@ void __init driver_init(void)
cpu_dev_init();
memory_dev_init();
container_dev_init();
of_core_init();
}
8 changes: 3 additions & 5 deletions drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ int __of_attach_node_sysfs(struct device_node *np)
return 0;
}

static int __init of_init(void)
void __init of_core_init(void)
{
struct device_node *np;

Expand All @@ -198,7 +198,8 @@ static int __init of_init(void)
of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj);
if (!of_kset) {
mutex_unlock(&of_mutex);
return -ENOMEM;
pr_err("devicetree: failed to register existing nodes\n");
return;
}
for_each_of_allnodes(np)
__of_attach_node_sysfs(np);
Expand All @@ -207,10 +208,7 @@ static int __init of_init(void)
/* Symlink in /proc as required by userspace ABI */
if (of_root)
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,
const char *name, int *lenp)
Expand Down
6 changes: 6 additions & 0 deletions include/linux/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ extern struct device_node *of_stdout;
extern raw_spinlock_t devtree_lock;

#ifdef CONFIG_OF
void of_core_init(void);

static inline bool is_of_node(struct fwnode_handle *fwnode)
{
return fwnode && fwnode->type == FWNODE_OF;
Expand Down Expand Up @@ -376,6 +378,10 @@ bool of_console_check(struct device_node *dn, char *name, int index);

#else /* CONFIG_OF */

static inline void of_core_init(void)
{
}

static inline bool is_of_node(struct fwnode_handle *fwnode)
{
return false;
Expand Down

0 comments on commit 37ef164

Please sign in to comment.