[POWERPC] add check for initialized driver data to pmi driver
This patch adds a check for the private driver data to be initialized. The bug showed up, as the caller found a pmi device by it's type. Whereas the pmi driver probes for the type and the name. Since the name was not as the driver expected, it did not initialize. A more relaxed probing will be supplied with an extra patch, too. Signed-off-by: Christian Krafft <krafft@de.ibm.com> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
This commit is contained in:
committed by
Arnd Bergmann
parent
5050063c04
commit
79baf4a60e
@@ -279,6 +279,9 @@ void pmi_register_handler(struct of_device *device,
|
|||||||
struct pmi_data *data;
|
struct pmi_data *data;
|
||||||
data = device->dev.driver_data;
|
data = device->dev.driver_data;
|
||||||
|
|
||||||
|
if (!data)
|
||||||
|
return;
|
||||||
|
|
||||||
spin_lock(&data->handler_spinlock);
|
spin_lock(&data->handler_spinlock);
|
||||||
list_add_tail(&handler->node, &data->handler);
|
list_add_tail(&handler->node, &data->handler);
|
||||||
spin_unlock(&data->handler_spinlock);
|
spin_unlock(&data->handler_spinlock);
|
||||||
@@ -289,11 +292,13 @@ void pmi_unregister_handler(struct of_device *device,
|
|||||||
struct pmi_handler *handler)
|
struct pmi_handler *handler)
|
||||||
{
|
{
|
||||||
struct pmi_data *data;
|
struct pmi_data *data;
|
||||||
|
data = device->dev.driver_data;
|
||||||
|
|
||||||
|
if (!data)
|
||||||
|
return;
|
||||||
|
|
||||||
pr_debug("pmi: unregistering handler %p\n", handler);
|
pr_debug("pmi: unregistering handler %p\n", handler);
|
||||||
|
|
||||||
data = device->dev.driver_data;
|
|
||||||
|
|
||||||
spin_lock(&data->handler_spinlock);
|
spin_lock(&data->handler_spinlock);
|
||||||
list_del(&handler->node);
|
list_del(&handler->node);
|
||||||
spin_unlock(&data->handler_spinlock);
|
spin_unlock(&data->handler_spinlock);
|
||||||
|
Reference in New Issue
Block a user