Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spmi: do not use bus internal data

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>

authored by

Sudip Mukherjee and committed by
Greg Kroah-Hartman
47f55b74 7ff4bdd4

+10 -2
+10 -2
drivers/spmi/spmi.c
··· 25 25 #define CREATE_TRACE_POINTS 26 26 #include <trace/events/spmi.h> 27 27 28 + static bool is_registered; 28 29 static DEFINE_IDA(ctrl_ida); 29 30 30 31 static void spmi_dev_release(struct device *dev) ··· 508 507 int ret; 509 508 510 509 /* Can't register until after driver model init */ 511 - if (WARN_ON(!spmi_bus_type.p)) 510 + if (WARN_ON(!is_registered)) 512 511 return -EAGAIN; 513 512 514 513 ret = device_add(&ctrl->dev); ··· 577 576 578 577 static int __init spmi_init(void) 579 578 { 580 - return bus_register(&spmi_bus_type); 579 + int ret; 580 + 581 + ret = bus_register(&spmi_bus_type); 582 + if (ret) 583 + return ret; 584 + 585 + is_registered = true; 586 + return 0; 581 587 } 582 588 postcore_initcall(spmi_init); 583 589