The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] pda_power: fix build error if !CONFIG_USB_OTG_UTILS
@ 2011-08-23 12:34 Axel Lin
  2011-08-23 13:30 ` Anton Vorontsov
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-08-23 12:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: Anton Vorontsov, Dima Zavin

commit 9ad63986c606c60e2e916b1b96f22991f966d9cc
"pda_power: Add support for using otg transceiver events"
introduces below build error if !CONFIG_USB_OTG_UTILS.

  CC      drivers/power/pda_power.o
drivers/power/pda_power.c: In function 'pda_power_probe':
drivers/power/pda_power.c:322: error: 'otg_is_usb_online' undeclared (first use in this function)
drivers/power/pda_power.c:322: error: (Each undeclared identifier is reported only once
drivers/power/pda_power.c:322: error: for each function it appears in.)
drivers/power/pda_power.c:325: error: 'otg_is_ac_online' undeclared (first use in this function)
drivers/power/pda_power.c:371: error: 'otg_handle_notification' undeclared (first use in this function)
make[2]: *** [drivers/power/pda_power.o] Error 1
make[1]: *** [drivers/power] Error 2
make: *** [drivers] Error 2

This patch adds #ifdef CONFIG_USB_OTG_UTILS guards at necessary places to fix
build errors.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/power/pda_power.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index 81b7201..87be679 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -39,8 +39,11 @@ static struct timer_list supply_timer;
 static struct timer_list polling_timer;
 static int polling;
 
+#ifdef CONFIG_USB_OTG_UTILS
 static struct otg_transceiver *transceiver;
 static struct notifier_block otg_nb;
+#endif
+
 static struct regulator *ac_draw;
 
 enum {
@@ -317,6 +320,7 @@ static int pda_power_probe(struct platform_device *pdev)
 		ret = PTR_ERR(ac_draw);
 	}
 
+#ifdef CONFIG_USB_OTG_UTILS
 	transceiver = otg_get_transceiver();
 	if (transceiver && !pdata->is_usb_online) {
 		pdata->is_usb_online = otg_is_usb_online;
@@ -324,6 +328,7 @@ static int pda_power_probe(struct platform_device *pdev)
 	if (transceiver && !pdata->is_ac_online) {
 		pdata->is_ac_online = otg_is_ac_online;
 	}
+#endif
 
 	if (pdata->is_ac_online) {
 		ret = power_supply_register(&pdev->dev, &pda_psy_ac);
@@ -367,6 +372,7 @@ static int pda_power_probe(struct platform_device *pdev)
 		}
 	}
 
+#ifdef CONFIG_USB_OTG_UTILS
 	if (transceiver && pdata->use_otg_notifier) {
 		otg_nb.notifier_call = otg_handle_notification;
 		ret = otg_register_notifier(transceiver, &otg_nb);
@@ -376,6 +382,7 @@ static int pda_power_probe(struct platform_device *pdev)
 		}
 		polling = 0;
 	}
+#endif
 
 	if (polling) {
 		dev_dbg(dev, "will poll for status\n");
@@ -389,17 +396,21 @@ static int pda_power_probe(struct platform_device *pdev)
 
 	return 0;
 
+#ifdef CONFIG_USB_OTG_UTILS
 otg_reg_notifier_failed:
 	if (pdata->is_usb_online && usb_irq)
 		free_irq(usb_irq->start, &pda_psy_usb);
+#endif
 usb_irq_failed:
 	if (pdata->is_usb_online)
 		power_supply_unregister(&pda_psy_usb);
 usb_supply_failed:
 	if (pdata->is_ac_online && ac_irq)
 		free_irq(ac_irq->start, &pda_psy_ac);
+#ifdef CONFIG_USB_OTG_UTILS
 	if (transceiver)
 		otg_put_transceiver(transceiver);
+#endif
 ac_irq_failed:
 	if (pdata->is_ac_online)
 		power_supply_unregister(&pda_psy_ac);
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pda_power: fix build error if !CONFIG_USB_OTG_UTILS
  2011-08-23 12:34 [PATCH] pda_power: fix build error if !CONFIG_USB_OTG_UTILS Axel Lin
@ 2011-08-23 13:30 ` Anton Vorontsov
  0 siblings, 0 replies; 2+ messages in thread
From: Anton Vorontsov @ 2011-08-23 13:30 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Dima Zavin

On Tue, Aug 23, 2011 at 08:34:33PM +0800, Axel Lin wrote:
> commit 9ad63986c606c60e2e916b1b96f22991f966d9cc
> "pda_power: Add support for using otg transceiver events"
> introduces below build error if !CONFIG_USB_OTG_UTILS.
> 
>   CC      drivers/power/pda_power.o
> drivers/power/pda_power.c: In function 'pda_power_probe':
> drivers/power/pda_power.c:322: error: 'otg_is_usb_online' undeclared (first use in this function)
> drivers/power/pda_power.c:322: error: (Each undeclared identifier is reported only once
> drivers/power/pda_power.c:322: error: for each function it appears in.)
> drivers/power/pda_power.c:325: error: 'otg_is_ac_online' undeclared (first use in this function)
> drivers/power/pda_power.c:371: error: 'otg_handle_notification' undeclared (first use in this function)
> make[2]: *** [drivers/power/pda_power.o] Error 1
> make[1]: *** [drivers/power] Error 2
> make: *** [drivers] Error 2
> 
> This patch adds #ifdef CONFIG_USB_OTG_UTILS guards at necessary places to fix
> build errors.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---

Applied, thanks!

Dima,

I wonder if it is possible to get rid of most #ifdefs by moving
the pda_power's USB_OTG stuff into a function?

Thanks,

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-23 13:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-23 12:34 [PATCH] pda_power: fix build error if !CONFIG_USB_OTG_UTILS Axel Lin
2011-08-23 13:30 ` Anton Vorontsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox