Subject: Re: linux-next: build failure after merge of the battery tree

From: Anton Vorontsov <[email-masked]>
Date: Thu, 5 Jan 2012 19:25:36 +0400

On Thu, Jan 05, 2012 at 02:40:42PM +1100, Stephen Rothwell wrote:
> Hi Anton,
> 
> After merging the battery tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
> 
> ERROR: "sysfs_create_link_nowarn" [drivers/power/power_supply.ko] undefined!
> 
> Caused by commit 8351665195ce ("power_supply: allow a power supply to
> explicitly point to powered device").  That symbol is not exported to
> modules.
> 
> I have used the battery tree from next-20120104 for today.

Thanks for catching this, Stephen!

I wonder why do we need to use _nowarn variant?..

Something tells me that we actually want a warning.

Jeremy, are you OK with the patch down below?

- - - -
From: Anton Vorontsov <[email-masked]>
Subject: power_supply: Drop usage of nowarn variant of sysfs_create_link()

The function is not exported to modules, plus we do want to catch anyone
who tries to create complex hierarchy (in that case we'd need to change
'powers' symlink to a directory, probably under a different name to not
break ABI).

This patch fixes the following build error:

 ERROR: "sysfs_create_link_nowarn" [drivers/power/power_supply.ko] undefined!

Reported-by: Stephen Rothwell <[email-masked]>
Signed-off-by: Anton Vorontsov <[email-masked]>
---
 drivers/power/power_supply_core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
index b10c121..47f4e11 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(power_supply_get_by_name);
 
 int power_supply_powers(struct power_supply *psy, struct device *dev)
 {
-	return sysfs_create_link_nowarn(&psy->dev->kobj, &dev->kobj, "powers");
+	return sysfs_create_link(&psy->dev->kobj, &dev->kobj, "powers");
 }
 EXPORT_SYMBOL_GPL(power_supply_powers);
 
-- 
1.7.7.3