[1/2] pda_power: Statically initialize notifier block
diff mbox series

Message ID 1396186455-3276-2-git-send-email-minipli@googlemail.com
State New, archived
Headers show
Series
  • pda_power: USB notifier fixes
Related show

Commit Message

Mathias Krause March 30, 2014, 1:34 p.m. UTC
Instead of initializing the notifier block in pda_power_probe(),
initialize it statically. This safes us some code.

Found in the PaX patch, written by the PaX Team.

Cc: PaX Team <pageexec@freemail.hu>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/power/pda_power.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index 0c52e2a0d9..87a963d0a8 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -37,7 +37,6 @@  static int polling;
 
 #if IS_ENABLED(CONFIG_USB_PHY)
 static struct usb_phy *transceiver;
-static struct notifier_block otg_nb;
 #endif
 
 static struct regulator *ac_draw;
@@ -258,6 +257,10 @@  static int otg_handle_notification(struct notifier_block *nb,
 
 	return NOTIFY_OK;
 }
+
+static struct notifier_block otg_nb = {
+	.notifier_call = otg_handle_notification,
+};
 #endif
 
 static int pda_power_probe(struct platform_device *pdev)
@@ -369,7 +372,6 @@  static int pda_power_probe(struct platform_device *pdev)
 
 #if IS_ENABLED(CONFIG_USB_PHY)
 	if (!IS_ERR_OR_NULL(transceiver) && pdata->use_otg_notifier) {
-		otg_nb.notifier_call = otg_handle_notification;
 		ret = usb_register_notifier(transceiver, &otg_nb);
 		if (ret) {
 			dev_err(dev, "failure to register otg notifier\n");