mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
power: supply: core: rename power_supply_get_by_phandle to power_supply_get_by_reference
(devm_)power_supply_get_by_phandle now internally uses fwnode and are no longer DT specific. Thus drop the ifdef check for CONFIG_OF and rename to (devm_)power_supply_get_by_reference to avoid the DT terminology. Reviewed-by: Hans de Goede <hansg@kernel.org> Link: https://lore.kernel.org/r/20250430-psy-core-convert-to-fwnode-v2-5-f9643b958677@collabora.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
f368f87b22
commit
370643f45a
@ -754,7 +754,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (of_property_present(np, "usb0_vbus_power-supply")) {
|
if (of_property_present(np, "usb0_vbus_power-supply")) {
|
||||||
data->vbus_power_supply = devm_power_supply_get_by_phandle(dev,
|
data->vbus_power_supply = devm_power_supply_get_by_reference(dev,
|
||||||
"usb0_vbus_power-supply");
|
"usb0_vbus_power-supply");
|
||||||
if (IS_ERR(data->vbus_power_supply)) {
|
if (IS_ERR(data->vbus_power_supply)) {
|
||||||
dev_err(dev, "Couldn't get the VBUS power supply\n");
|
dev_err(dev, "Couldn't get the VBUS power supply\n");
|
||||||
|
@ -1674,7 +1674,7 @@ static int bq2415x_probe(struct i2c_client *client)
|
|||||||
/* Query for initial reported_mode and set it */
|
/* Query for initial reported_mode and set it */
|
||||||
if (bq->nb.notifier_call) {
|
if (bq->nb.notifier_call) {
|
||||||
if (np) {
|
if (np) {
|
||||||
notify_psy = power_supply_get_by_phandle(of_fwnode_handle(np),
|
notify_psy = power_supply_get_by_reference(of_fwnode_handle(np),
|
||||||
"ti,usb-charger-detection");
|
"ti,usb-charger-detection");
|
||||||
if (IS_ERR(notify_psy))
|
if (IS_ERR(notify_psy))
|
||||||
notify_psy = NULL;
|
notify_psy = NULL;
|
||||||
|
@ -496,14 +496,13 @@ void power_supply_put(struct power_supply *psy)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(power_supply_put);
|
EXPORT_SYMBOL_GPL(power_supply_put);
|
||||||
|
|
||||||
#ifdef CONFIG_OF
|
|
||||||
static int power_supply_match_device_fwnode(struct device *dev, const void *data)
|
static int power_supply_match_device_fwnode(struct device *dev, const void *data)
|
||||||
{
|
{
|
||||||
return dev->parent && dev_fwnode(dev->parent) == data;
|
return dev->parent && dev_fwnode(dev->parent) == data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* power_supply_get_by_phandle() - Search for a power supply and returns its ref
|
* power_supply_get_by_reference() - Search for a power supply and returns its ref
|
||||||
* @fwnode: Pointer to fwnode holding phandle property
|
* @fwnode: Pointer to fwnode holding phandle property
|
||||||
* @property: Name of property holding a power supply name
|
* @property: Name of property holding a power supply name
|
||||||
*
|
*
|
||||||
@ -514,8 +513,8 @@ static int power_supply_match_device_fwnode(struct device *dev, const void *data
|
|||||||
* Return: On success returns a reference to a power supply with
|
* Return: On success returns a reference to a power supply with
|
||||||
* matching name equals to value under @property, NULL or ERR_PTR otherwise.
|
* matching name equals to value under @property, NULL or ERR_PTR otherwise.
|
||||||
*/
|
*/
|
||||||
struct power_supply *power_supply_get_by_phandle(struct fwnode_handle *fwnode,
|
struct power_supply *power_supply_get_by_reference(struct fwnode_handle *fwnode,
|
||||||
const char *property)
|
const char *property)
|
||||||
{
|
{
|
||||||
struct fwnode_handle *power_supply_fwnode;
|
struct fwnode_handle *power_supply_fwnode;
|
||||||
struct power_supply *psy = NULL;
|
struct power_supply *psy = NULL;
|
||||||
@ -537,7 +536,7 @@ struct power_supply *power_supply_get_by_phandle(struct fwnode_handle *fwnode,
|
|||||||
|
|
||||||
return psy;
|
return psy;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(power_supply_get_by_phandle);
|
EXPORT_SYMBOL_GPL(power_supply_get_by_reference);
|
||||||
|
|
||||||
static void devm_power_supply_put(struct device *dev, void *res)
|
static void devm_power_supply_put(struct device *dev, void *res)
|
||||||
{
|
{
|
||||||
@ -547,16 +546,16 @@ static void devm_power_supply_put(struct device *dev, void *res)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* devm_power_supply_get_by_phandle() - Resource managed version of
|
* devm_power_supply_get_by_reference() - Resource managed version of
|
||||||
* power_supply_get_by_phandle()
|
* power_supply_get_by_reference()
|
||||||
* @dev: Pointer to device holding phandle property
|
* @dev: Pointer to device holding phandle property
|
||||||
* @property: Name of property holding a power supply phandle
|
* @property: Name of property holding a power supply phandle
|
||||||
*
|
*
|
||||||
* Return: On success returns a reference to a power supply with
|
* Return: On success returns a reference to a power supply with
|
||||||
* matching name equals to value under @property, NULL or ERR_PTR otherwise.
|
* matching name equals to value under @property, NULL or ERR_PTR otherwise.
|
||||||
*/
|
*/
|
||||||
struct power_supply *devm_power_supply_get_by_phandle(struct device *dev,
|
struct power_supply *devm_power_supply_get_by_reference(struct device *dev,
|
||||||
const char *property)
|
const char *property)
|
||||||
{
|
{
|
||||||
struct power_supply **ptr, *psy;
|
struct power_supply **ptr, *psy;
|
||||||
|
|
||||||
@ -567,7 +566,7 @@ struct power_supply *devm_power_supply_get_by_phandle(struct device *dev,
|
|||||||
if (!ptr)
|
if (!ptr)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
psy = power_supply_get_by_phandle(dev_fwnode(dev), property);
|
psy = power_supply_get_by_reference(dev_fwnode(dev), property);
|
||||||
if (IS_ERR_OR_NULL(psy)) {
|
if (IS_ERR_OR_NULL(psy)) {
|
||||||
devres_free(ptr);
|
devres_free(ptr);
|
||||||
} else {
|
} else {
|
||||||
@ -576,8 +575,7 @@ struct power_supply *devm_power_supply_get_by_phandle(struct device *dev,
|
|||||||
}
|
}
|
||||||
return psy;
|
return psy;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(devm_power_supply_get_by_phandle);
|
EXPORT_SYMBOL_GPL(devm_power_supply_get_by_reference);
|
||||||
#endif /* CONFIG_OF */
|
|
||||||
|
|
||||||
int power_supply_get_battery_info(struct power_supply *psy,
|
int power_supply_get_battery_info(struct power_supply *psy,
|
||||||
struct power_supply_battery_info **info_out)
|
struct power_supply_battery_info **info_out)
|
||||||
|
@ -807,19 +807,10 @@ static inline void power_supply_put(struct power_supply *psy) {}
|
|||||||
static inline struct power_supply *power_supply_get_by_name(const char *name)
|
static inline struct power_supply *power_supply_get_by_name(const char *name)
|
||||||
{ return NULL; }
|
{ return NULL; }
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_OF
|
extern struct power_supply *power_supply_get_by_reference(struct fwnode_handle *fwnode,
|
||||||
extern struct power_supply *power_supply_get_by_phandle(struct fwnode_handle *fwnode,
|
const char *property);
|
||||||
const char *property);
|
extern struct power_supply *devm_power_supply_get_by_reference(
|
||||||
extern struct power_supply *devm_power_supply_get_by_phandle(
|
|
||||||
struct device *dev, const char *property);
|
struct device *dev, const char *property);
|
||||||
#else /* !CONFIG_OF */
|
|
||||||
static inline struct power_supply *
|
|
||||||
power_supply_get_by_phandle(struct device_node *np, const char *property)
|
|
||||||
{ return NULL; }
|
|
||||||
static inline struct power_supply *
|
|
||||||
devm_power_supply_get_by_phandle(struct device *dev, const char *property)
|
|
||||||
{ return NULL; }
|
|
||||||
#endif /* CONFIG_OF */
|
|
||||||
|
|
||||||
extern const enum power_supply_property power_supply_battery_info_properties[];
|
extern const enum power_supply_property power_supply_battery_info_properties[];
|
||||||
extern const size_t power_supply_battery_info_properties_size;
|
extern const size_t power_supply_battery_info_properties_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user