mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 08:31:13 +00:00
clk: max77686: Remove unnecessary NULL checking for container_of()
container_of() never returns NULL, thus remove the NULL checking for it. Also rename get_max77686_clk() to to_max77686_clk() for better readability. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mike Turquette <mturquette@linaro.org>
This commit is contained in:
parent
bddca8944a
commit
3fe296cf5a
1 changed files with 7 additions and 21 deletions
|
@ -44,33 +44,23 @@ struct max77686_clk {
|
||||||
struct clk_lookup *lookup;
|
struct clk_lookup *lookup;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct max77686_clk *get_max77686_clk(struct clk_hw *hw)
|
static struct max77686_clk *to_max77686_clk(struct clk_hw *hw)
|
||||||
{
|
{
|
||||||
return container_of(hw, struct max77686_clk, hw);
|
return container_of(hw, struct max77686_clk, hw);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int max77686_clk_prepare(struct clk_hw *hw)
|
static int max77686_clk_prepare(struct clk_hw *hw)
|
||||||
{
|
{
|
||||||
struct max77686_clk *max77686;
|
struct max77686_clk *max77686 = to_max77686_clk(hw);
|
||||||
int ret;
|
|
||||||
|
|
||||||
max77686 = get_max77686_clk(hw);
|
return regmap_update_bits(max77686->iodev->regmap,
|
||||||
if (!max77686)
|
MAX77686_REG_32KHZ, max77686->mask,
|
||||||
return -ENOMEM;
|
max77686->mask);
|
||||||
|
|
||||||
ret = regmap_update_bits(max77686->iodev->regmap,
|
|
||||||
MAX77686_REG_32KHZ, max77686->mask, max77686->mask);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void max77686_clk_unprepare(struct clk_hw *hw)
|
static void max77686_clk_unprepare(struct clk_hw *hw)
|
||||||
{
|
{
|
||||||
struct max77686_clk *max77686;
|
struct max77686_clk *max77686 = to_max77686_clk(hw);
|
||||||
|
|
||||||
max77686 = get_max77686_clk(hw);
|
|
||||||
if (!max77686)
|
|
||||||
return;
|
|
||||||
|
|
||||||
regmap_update_bits(max77686->iodev->regmap,
|
regmap_update_bits(max77686->iodev->regmap,
|
||||||
MAX77686_REG_32KHZ, max77686->mask, ~max77686->mask);
|
MAX77686_REG_32KHZ, max77686->mask, ~max77686->mask);
|
||||||
|
@ -78,14 +68,10 @@ static void max77686_clk_unprepare(struct clk_hw *hw)
|
||||||
|
|
||||||
static int max77686_clk_is_enabled(struct clk_hw *hw)
|
static int max77686_clk_is_enabled(struct clk_hw *hw)
|
||||||
{
|
{
|
||||||
struct max77686_clk *max77686;
|
struct max77686_clk *max77686 = to_max77686_clk(hw);
|
||||||
int ret;
|
int ret;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
max77686 = get_max77686_clk(hw);
|
|
||||||
if (!max77686)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
ret = regmap_read(max77686->iodev->regmap,
|
ret = regmap_read(max77686->iodev->regmap,
|
||||||
MAX77686_REG_32KHZ, &val);
|
MAX77686_REG_32KHZ, &val);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue