From: Mathias Krause <minipli@googlemail.com>
To: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
David Woodhouse <dwmw2@infradead.org>
Cc: linux-kernel@vger.kernel.org,
Mathias Krause <minipli@googlemail.com>,
PaX Team <pageexec@freemail.hu>, Felipe Balbi <balbi@ti.com>,
Anton Vorontsov <anton@enomsg.org>
Subject: [PATCH 1/2] pda_power: Statically initialize notifier block
Date: Sun, 30 Mar 2014 15:34:14 +0200 [thread overview]
Message-ID: <1396186455-3276-2-git-send-email-minipli@googlemail.com> (raw)
In-Reply-To: <1396186455-3276-1-git-send-email-minipli@googlemail.com>
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(-)
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
next prev parent reply other threads:[~2014-03-30 13:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-30 13:34 [PATCH 0/2] pda_power: USB notifier fixes Mathias Krause
2014-03-30 13:34 ` Mathias Krause [this message]
2014-03-30 13:34 ` [PATCH 2/2] pda_power: Unregister USB notifier in pda_power_remove() Mathias Krause
2014-04-14 21:35 ` Felipe Balbi
2014-04-14 22:07 ` Mathias Krause
2014-04-14 22:08 ` Felipe Balbi
2014-04-14 22:11 ` Mathias Krause
2014-04-14 19:51 ` [PATCH 0/2] pda_power: USB notifier fixes Mathias Krause
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1396186455-3276-2-git-send-email-minipli@googlemail.com \
--to=minipli@googlemail.com \
--cc=anton@enomsg.org \
--cc=balbi@ti.com \
--cc=dbaryshkov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pageexec@freemail.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).