Revert "clk: fixed-rate: add devm_clk_hw_register_fixed_rate"
This reverts commit 764b78b927
.
It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.
Bug: 161946584
Change-Id: If12736ba2358ad17e36a3e3461aa19d10edd0ba7
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -49,24 +49,12 @@ const struct clk_ops clk_fixed_rate_ops = {
|
|||||||
};
|
};
|
||||||
EXPORT_SYMBOL_GPL(clk_fixed_rate_ops);
|
EXPORT_SYMBOL_GPL(clk_fixed_rate_ops);
|
||||||
|
|
||||||
static void devm_clk_hw_register_fixed_rate_release(struct device *dev, void *res)
|
|
||||||
{
|
|
||||||
struct clk_fixed_rate *fix = res;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We can not use clk_hw_unregister_fixed_rate, since it will kfree()
|
|
||||||
* the hw, resulting in double free. Just unregister the hw and let
|
|
||||||
* devres code kfree() it.
|
|
||||||
*/
|
|
||||||
clk_hw_unregister(&fix->hw);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
|
struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
|
||||||
struct device_node *np, const char *name,
|
struct device_node *np, const char *name,
|
||||||
const char *parent_name, const struct clk_hw *parent_hw,
|
const char *parent_name, const struct clk_hw *parent_hw,
|
||||||
const struct clk_parent_data *parent_data, unsigned long flags,
|
const struct clk_parent_data *parent_data, unsigned long flags,
|
||||||
unsigned long fixed_rate, unsigned long fixed_accuracy,
|
unsigned long fixed_rate, unsigned long fixed_accuracy,
|
||||||
unsigned long clk_fixed_flags, bool devm)
|
unsigned long clk_fixed_flags)
|
||||||
{
|
{
|
||||||
struct clk_fixed_rate *fixed;
|
struct clk_fixed_rate *fixed;
|
||||||
struct clk_hw *hw;
|
struct clk_hw *hw;
|
||||||
@@ -74,10 +62,6 @@ struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
|
|||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* allocate fixed-rate clock */
|
/* allocate fixed-rate clock */
|
||||||
if (devm)
|
|
||||||
fixed = devres_alloc(devm_clk_hw_register_fixed_rate_release,
|
|
||||||
sizeof(*fixed), GFP_KERNEL);
|
|
||||||
else
|
|
||||||
fixed = kzalloc(sizeof(*fixed), GFP_KERNEL);
|
fixed = kzalloc(sizeof(*fixed), GFP_KERNEL);
|
||||||
if (!fixed)
|
if (!fixed)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
@@ -106,13 +90,9 @@ struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
|
|||||||
else if (np)
|
else if (np)
|
||||||
ret = of_clk_hw_register(np, hw);
|
ret = of_clk_hw_register(np, hw);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (devm)
|
|
||||||
devres_free(fixed);
|
|
||||||
else
|
|
||||||
kfree(fixed);
|
kfree(fixed);
|
||||||
hw = ERR_PTR(ret);
|
hw = ERR_PTR(ret);
|
||||||
} else if (devm)
|
}
|
||||||
devres_add(dev, fixed);
|
|
||||||
|
|
||||||
return hw;
|
return hw;
|
||||||
}
|
}
|
||||||
|
@@ -364,7 +364,7 @@ struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
|
|||||||
const char *parent_name, const struct clk_hw *parent_hw,
|
const char *parent_name, const struct clk_hw *parent_hw,
|
||||||
const struct clk_parent_data *parent_data, unsigned long flags,
|
const struct clk_parent_data *parent_data, unsigned long flags,
|
||||||
unsigned long fixed_rate, unsigned long fixed_accuracy,
|
unsigned long fixed_rate, unsigned long fixed_accuracy,
|
||||||
unsigned long clk_fixed_flags, bool devm);
|
unsigned long clk_fixed_flags);
|
||||||
struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
|
struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
|
||||||
const char *parent_name, unsigned long flags,
|
const char *parent_name, unsigned long flags,
|
||||||
unsigned long fixed_rate);
|
unsigned long fixed_rate);
|
||||||
@@ -379,20 +379,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
|
|||||||
*/
|
*/
|
||||||
#define clk_hw_register_fixed_rate(dev, name, parent_name, flags, fixed_rate) \
|
#define clk_hw_register_fixed_rate(dev, name, parent_name, flags, fixed_rate) \
|
||||||
__clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), NULL, \
|
__clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), NULL, \
|
||||||
NULL, (flags), (fixed_rate), 0, 0, false)
|
NULL, (flags), (fixed_rate), 0, 0)
|
||||||
|
|
||||||
/**
|
|
||||||
* devm_clk_hw_register_fixed_rate - register fixed-rate clock with the clock
|
|
||||||
* framework
|
|
||||||
* @dev: device that is registering this clock
|
|
||||||
* @name: name of this clock
|
|
||||||
* @parent_name: name of clock's parent
|
|
||||||
* @flags: framework-specific flags
|
|
||||||
* @fixed_rate: non-adjustable clock rate
|
|
||||||
*/
|
|
||||||
#define devm_clk_hw_register_fixed_rate(dev, name, parent_name, flags, fixed_rate) \
|
|
||||||
__clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), NULL, \
|
|
||||||
NULL, (flags), (fixed_rate), 0, 0, true)
|
|
||||||
/**
|
/**
|
||||||
* clk_hw_register_fixed_rate_parent_hw - register fixed-rate clock with
|
* clk_hw_register_fixed_rate_parent_hw - register fixed-rate clock with
|
||||||
* the clock framework
|
* the clock framework
|
||||||
@@ -405,7 +392,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
|
|||||||
#define clk_hw_register_fixed_rate_parent_hw(dev, name, parent_hw, flags, \
|
#define clk_hw_register_fixed_rate_parent_hw(dev, name, parent_hw, flags, \
|
||||||
fixed_rate) \
|
fixed_rate) \
|
||||||
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, (parent_hw), \
|
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, (parent_hw), \
|
||||||
NULL, (flags), (fixed_rate), 0, 0, false)
|
NULL, (flags), (fixed_rate), 0, 0)
|
||||||
/**
|
/**
|
||||||
* clk_hw_register_fixed_rate_parent_data - register fixed-rate clock with
|
* clk_hw_register_fixed_rate_parent_data - register fixed-rate clock with
|
||||||
* the clock framework
|
* the clock framework
|
||||||
@@ -419,7 +406,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
|
|||||||
fixed_rate) \
|
fixed_rate) \
|
||||||
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \
|
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \
|
||||||
(parent_data), (flags), (fixed_rate), 0, \
|
(parent_data), (flags), (fixed_rate), 0, \
|
||||||
0, false)
|
0)
|
||||||
/**
|
/**
|
||||||
* clk_hw_register_fixed_rate_with_accuracy - register fixed-rate clock with
|
* clk_hw_register_fixed_rate_with_accuracy - register fixed-rate clock with
|
||||||
* the clock framework
|
* the clock framework
|
||||||
@@ -435,7 +422,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
|
|||||||
fixed_accuracy) \
|
fixed_accuracy) \
|
||||||
__clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), \
|
__clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), \
|
||||||
NULL, NULL, (flags), (fixed_rate), \
|
NULL, NULL, (flags), (fixed_rate), \
|
||||||
(fixed_accuracy), 0, false)
|
(fixed_accuracy), 0)
|
||||||
/**
|
/**
|
||||||
* clk_hw_register_fixed_rate_with_accuracy_parent_hw - register fixed-rate
|
* clk_hw_register_fixed_rate_with_accuracy_parent_hw - register fixed-rate
|
||||||
* clock with the clock framework
|
* clock with the clock framework
|
||||||
@@ -450,7 +437,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
|
|||||||
parent_hw, flags, fixed_rate, fixed_accuracy) \
|
parent_hw, flags, fixed_rate, fixed_accuracy) \
|
||||||
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, (parent_hw) \
|
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, (parent_hw) \
|
||||||
NULL, NULL, (flags), (fixed_rate), \
|
NULL, NULL, (flags), (fixed_rate), \
|
||||||
(fixed_accuracy), 0, false)
|
(fixed_accuracy), 0)
|
||||||
/**
|
/**
|
||||||
* clk_hw_register_fixed_rate_with_accuracy_parent_data - register fixed-rate
|
* clk_hw_register_fixed_rate_with_accuracy_parent_data - register fixed-rate
|
||||||
* clock with the clock framework
|
* clock with the clock framework
|
||||||
@@ -465,7 +452,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
|
|||||||
parent_data, flags, fixed_rate, fixed_accuracy) \
|
parent_data, flags, fixed_rate, fixed_accuracy) \
|
||||||
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \
|
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \
|
||||||
(parent_data), NULL, (flags), \
|
(parent_data), NULL, (flags), \
|
||||||
(fixed_rate), (fixed_accuracy), 0, false)
|
(fixed_rate), (fixed_accuracy), 0)
|
||||||
/**
|
/**
|
||||||
* clk_hw_register_fixed_rate_parent_accuracy - register fixed-rate clock with
|
* clk_hw_register_fixed_rate_parent_accuracy - register fixed-rate clock with
|
||||||
* the clock framework
|
* the clock framework
|
||||||
@@ -479,7 +466,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
|
|||||||
flags, fixed_rate) \
|
flags, fixed_rate) \
|
||||||
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \
|
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \
|
||||||
(parent_data), (flags), (fixed_rate), 0, \
|
(parent_data), (flags), (fixed_rate), 0, \
|
||||||
CLK_FIXED_RATE_PARENT_ACCURACY, false)
|
CLK_FIXED_RATE_PARENT_ACCURACY)
|
||||||
|
|
||||||
void clk_unregister_fixed_rate(struct clk *clk);
|
void clk_unregister_fixed_rate(struct clk *clk);
|
||||||
void clk_hw_unregister_fixed_rate(struct clk_hw *hw);
|
void clk_hw_unregister_fixed_rate(struct clk_hw *hw);
|
||||||
|
Reference in New Issue
Block a user