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 <pagee...@freemail.hu>
Cc: Felipe Balbi <ba...@ti.com>
Cc: Anton Vorontsov <an...@enomsg.org>
Signed-off-by: Mathias Krause <mini...@googlemail.com>
---
 drivers/power/pda_power.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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");
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to