From: Ray Chi <raychi@google.com>
To: balbi@kernel.org, gregkh@linuxfoundation.org, sre@kernel.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
kyletso@google.com, badhri@google.com,
Ray Chi <raychi@google.com>, kernel test robot <lkp@intel.com>
Subject: [PATCH 2/2] power: supply: Fix build error when CONFIG_POWER_SUPPLY is not enabled.
Date: Sun, 28 Mar 2021 02:28:09 +0800 [thread overview]
Message-ID: <20210327182809.1814480-3-raychi@google.com> (raw)
In-Reply-To: <20210327182809.1814480-1-raychi@google.com>
The build error happens when CONFIG_POWER_SUPPLY is not enabled.
h8300-linux-ld: drivers/usb/dwc3/gadget.o: in function `.L59':
>> gadget.c:(.text+0x655): undefined reference to `power_supply_set_property'
Fixes: 99288de36020 ("usb: dwc3: add an alternate path in vbus_draw callback")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Ray Chi <raychi@google.com>
---
include/linux/power_supply.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 81a55e974feb..b495b4374cd0 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -426,9 +426,16 @@ static inline int power_supply_is_system_supplied(void) { return -ENOSYS; }
extern int power_supply_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val);
+#if IS_ENABLED(CONFIG_POWER_SUPPLY)
extern int power_supply_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val);
+#else
+static inline int power_supply_set_property(struct power_supply *psy,
+ enum power_supply_property psp,
+ const union power_supply_propval *val)
+{ return 0; }
+#endif
extern int power_supply_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp);
extern void power_supply_external_power_changed(struct power_supply *psy);
--
2.31.0.291.g576ba9dcdaf-goog
prev parent reply other threads:[~2021-03-27 18:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-27 18:28 [PATCH 0/2] modify power_supply usage in dwc3 Ray Chi
2021-03-27 18:28 ` [PATCH 1/2] usb: dwc3: gadget: modify the scale in vbus_draw callback Ray Chi
2021-03-27 18:28 ` Ray Chi [this message]
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=20210327182809.1814480-3-raychi@google.com \
--to=raychi@google.com \
--cc=badhri@google.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kyletso@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lkp@intel.com \
--cc=sre@kernel.org \
/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