diff options
author | Axel Lin <axel.lin@ingics.com> | 2012-12-18 02:54:52 -0500 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2013-01-15 19:16:23 -0500 |
commit | 3fe296cf5a66a82bc9077865b89075ce813f7f5d (patch) | |
tree | c2da0ea7d073f23fef070ff3936a7ac20fff1fa9 /drivers/clk/clk-max77686.c | |
parent | bddca8944a7ab6699984c4b1b677261eb1c8d819 (diff) |
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>
Diffstat (limited to 'drivers/clk/clk-max77686.c')
-rw-r--r-- | drivers/clk/clk-max77686.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c index 894421417000..90bf59cf9d25 100644 --- a/drivers/clk/clk-max77686.c +++ b/drivers/clk/clk-max77686.c | |||
@@ -44,33 +44,23 @@ struct max77686_clk { | |||
44 | struct clk_lookup *lookup; | 44 | struct clk_lookup *lookup; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static struct max77686_clk *get_max77686_clk(struct clk_hw *hw) | 47 | static struct max77686_clk *to_max77686_clk(struct clk_hw *hw) |
48 | { | 48 | { |
49 | return container_of(hw, struct max77686_clk, hw); | 49 | return container_of(hw, struct max77686_clk, hw); |
50 | } | 50 | } |
51 | 51 | ||
52 | static int max77686_clk_prepare(struct clk_hw *hw) | 52 | static int max77686_clk_prepare(struct clk_hw *hw) |
53 | { | 53 | { |
54 | struct max77686_clk *max77686; | 54 | struct max77686_clk *max77686 = to_max77686_clk(hw); |
55 | int ret; | ||
56 | |||
57 | max77686 = get_max77686_clk(hw); | ||
58 | if (!max77686) | ||
59 | return -ENOMEM; | ||
60 | |||
61 | ret = regmap_update_bits(max77686->iodev->regmap, | ||
62 | MAX77686_REG_32KHZ, max77686->mask, max77686->mask); | ||
63 | 55 | ||
64 | return ret; | 56 | return regmap_update_bits(max77686->iodev->regmap, |
57 | MAX77686_REG_32KHZ, max77686->mask, | ||
58 | max77686->mask); | ||
65 | } | 59 | } |
66 | 60 | ||
67 | static void max77686_clk_unprepare(struct clk_hw *hw) | 61 | static void max77686_clk_unprepare(struct clk_hw *hw) |
68 | { | 62 | { |
69 | struct max77686_clk *max77686; | 63 | struct max77686_clk *max77686 = to_max77686_clk(hw); |
70 | |||
71 | max77686 = get_max77686_clk(hw); | ||
72 | if (!max77686) | ||
73 | return; | ||
74 | 64 | ||
75 | regmap_update_bits(max77686->iodev->regmap, | 65 | regmap_update_bits(max77686->iodev->regmap, |
76 | MAX77686_REG_32KHZ, max77686->mask, ~max77686->mask); | 66 | MAX77686_REG_32KHZ, max77686->mask, ~max77686->mask); |
@@ -78,14 +68,10 @@ static void max77686_clk_unprepare(struct clk_hw *hw) | |||
78 | 68 | ||
79 | static int max77686_clk_is_enabled(struct clk_hw *hw) | 69 | static int max77686_clk_is_enabled(struct clk_hw *hw) |
80 | { | 70 | { |
81 | struct max77686_clk *max77686; | 71 | struct max77686_clk *max77686 = to_max77686_clk(hw); |
82 | int ret; | 72 | int ret; |
83 | u32 val; | 73 | u32 val; |
84 | 74 | ||
85 | max77686 = get_max77686_clk(hw); | ||
86 | if (!max77686) | ||
87 | return -ENOMEM; | ||
88 | |||
89 | ret = regmap_read(max77686->iodev->regmap, | 75 | ret = regmap_read(max77686->iodev->regmap, |
90 | MAX77686_REG_32KHZ, &val); | 76 | MAX77686_REG_32KHZ, &val); |
91 | 77 | ||