Skip to content

Commit

Permalink
spmi: do not use bus internal data
Browse files Browse the repository at this point in the history
The variable p is a data structure which is used by the driver core
internally and it is not expected that busses will be directly accessing
these driver core internal only data.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Sudip Mukherjee authored and Greg Kroah-Hartman committed Apr 30, 2016
1 parent 7ff4bdd commit 47f55b7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/spmi/spmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define CREATE_TRACE_POINTS
#include <trace/events/spmi.h>

static bool is_registered;
static DEFINE_IDA(ctrl_ida);

static void spmi_dev_release(struct device *dev)
Expand Down Expand Up @@ -507,7 +508,7 @@ int spmi_controller_add(struct spmi_controller *ctrl)
int ret;

/* Can't register until after driver model init */
if (WARN_ON(!spmi_bus_type.p))
if (WARN_ON(!is_registered))
return -EAGAIN;

ret = device_add(&ctrl->dev);
Expand Down Expand Up @@ -576,7 +577,14 @@ module_exit(spmi_exit);

static int __init spmi_init(void)
{
return bus_register(&spmi_bus_type);
int ret;

ret = bus_register(&spmi_bus_type);
if (ret)
return ret;

is_registered = true;
return 0;
}
postcore_initcall(spmi_init);

Expand Down

0 comments on commit 47f55b7

Please sign in to comment.