aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-s3c/pwm-clock.c
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2009-11-30 20:24:37 -0500
committerBen Dooks <ben-linux@fluff.org>2010-01-15 03:10:10 -0500
commitb3bf41be06634d69959a68a2b53e1ffc92f0d103 (patch)
tree7575fc3d60e9a2f99e74b2862e1b3a43b7df1f92 /arch/arm/plat-s3c/pwm-clock.c
parent13bbd88504bfa0d205fa4121322869d8d7e083d0 (diff)
ARM: SAMSUNG: Reduce size of struct clk.
Reduce the size of struct clk by 12 bytes and make defining clocks with common implementation functions easier by moving the set_rate, get_rate, round_rate and set_parent calls into a new structure called 'struct clk_ops' and using that instead. This change does make a few clocks larger as they need their own clk_ops, but this is outweighed by the number of clocks with either no ops or having a common set of ops. Update all the users of this. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/plat-s3c/pwm-clock.c')
-rw-r--r--arch/arm/plat-s3c/pwm-clock.c94
1 files changed, 48 insertions, 46 deletions
diff --git a/arch/arm/plat-s3c/pwm-clock.c b/arch/arm/plat-s3c/pwm-clock.c
index a318215ab535..1808fa88609a 100644
--- a/arch/arm/plat-s3c/pwm-clock.c
+++ b/arch/arm/plat-s3c/pwm-clock.c
@@ -130,20 +130,22 @@ static int clk_pwm_scaler_set_rate(struct clk *clk, unsigned long rate)
130 return 0; 130 return 0;
131} 131}
132 132
133static struct clk_ops clk_pwm_scaler_ops = {
134 .get_rate = clk_pwm_scaler_get_rate,
135 .set_rate = clk_pwm_scaler_set_rate,
136 .round_rate = clk_pwm_scaler_round_rate,
137};
138
133static struct clk clk_timer_scaler[] = { 139static struct clk clk_timer_scaler[] = {
134 [0] = { 140 [0] = {
135 .name = "pwm-scaler0", 141 .name = "pwm-scaler0",
136 .id = -1, 142 .id = -1,
137 .get_rate = clk_pwm_scaler_get_rate, 143 .ops = &clk_pwm_scaler_ops,
138 .set_rate = clk_pwm_scaler_set_rate,
139 .round_rate = clk_pwm_scaler_round_rate,
140 }, 144 },
141 [1] = { 145 [1] = {
142 .name = "pwm-scaler1", 146 .name = "pwm-scaler1",
143 .id = -1, 147 .id = -1,
144 .get_rate = clk_pwm_scaler_get_rate, 148 .ops = &clk_pwm_scaler_ops,
145 .set_rate = clk_pwm_scaler_set_rate,
146 .round_rate = clk_pwm_scaler_round_rate,
147 }, 149 },
148}; 150};
149 151
@@ -256,50 +258,46 @@ static int clk_pwm_tdiv_set_rate(struct clk *clk, unsigned long rate)
256 return 0; 258 return 0;
257} 259}
258 260
261static struct clk_ops clk_tdiv_ops = {
262 .get_rate = clk_pwm_tdiv_get_rate,
263 .set_rate = clk_pwm_tdiv_set_rate,
264 .round_rate = clk_pwm_tdiv_round_rate,
265};
266
259static struct pwm_tdiv_clk clk_timer_tdiv[] = { 267static struct pwm_tdiv_clk clk_timer_tdiv[] = {
260 [0] = { 268 [0] = {
261 .clk = { 269 .clk = {
262 .name = "pwm-tdiv", 270 .name = "pwm-tdiv",
263 .parent = &clk_timer_scaler[0], 271 .ops = &clk_tdiv_ops,
264 .get_rate = clk_pwm_tdiv_get_rate, 272 .parent = &clk_timer_scaler[0],
265 .set_rate = clk_pwm_tdiv_set_rate,
266 .round_rate = clk_pwm_tdiv_round_rate,
267 }, 273 },
268 }, 274 },
269 [1] = { 275 [1] = {
270 .clk = { 276 .clk = {
271 .name = "pwm-tdiv", 277 .name = "pwm-tdiv",
272 .parent = &clk_timer_scaler[0], 278 .ops = &clk_tdiv_ops,
273 .get_rate = clk_pwm_tdiv_get_rate, 279 .parent = &clk_timer_scaler[0],
274 .set_rate = clk_pwm_tdiv_set_rate,
275 .round_rate = clk_pwm_tdiv_round_rate,
276 } 280 }
277 }, 281 },
278 [2] = { 282 [2] = {
279 .clk = { 283 .clk = {
280 .name = "pwm-tdiv", 284 .name = "pwm-tdiv",
281 .parent = &clk_timer_scaler[1], 285 .ops = &clk_tdiv_ops,
282 .get_rate = clk_pwm_tdiv_get_rate, 286 .parent = &clk_timer_scaler[1],
283 .set_rate = clk_pwm_tdiv_set_rate,
284 .round_rate = clk_pwm_tdiv_round_rate,
285 }, 287 },
286 }, 288 },
287 [3] = { 289 [3] = {
288 .clk = { 290 .clk = {
289 .name = "pwm-tdiv", 291 .name = "pwm-tdiv",
290 .parent = &clk_timer_scaler[1], 292 .ops = &clk_tdiv_ops,
291 .get_rate = clk_pwm_tdiv_get_rate, 293 .parent = &clk_timer_scaler[1],
292 .set_rate = clk_pwm_tdiv_set_rate,
293 .round_rate = clk_pwm_tdiv_round_rate,
294 }, 294 },
295 }, 295 },
296 [4] = { 296 [4] = {
297 .clk = { 297 .clk = {
298 .name = "pwm-tdiv", 298 .name = "pwm-tdiv",
299 .parent = &clk_timer_scaler[1], 299 .ops = &clk_tdiv_ops,
300 .get_rate = clk_pwm_tdiv_get_rate, 300 .parent = &clk_timer_scaler[1],
301 .set_rate = clk_pwm_tdiv_set_rate,
302 .round_rate = clk_pwm_tdiv_round_rate,
303 }, 301 },
304 }, 302 },
305}; 303};
@@ -356,31 +354,35 @@ static int clk_pwm_tin_set_parent(struct clk *clk, struct clk *parent)
356 return 0; 354 return 0;
357} 355}
358 356
357static struct clk_ops clk_tin_ops = {
358 .set_parent = clk_pwm_tin_set_parent,
359};
360
359static struct clk clk_tin[] = { 361static struct clk clk_tin[] = {
360 [0] = { 362 [0] = {
361 .name = "pwm-tin", 363 .name = "pwm-tin",
362 .id = 0, 364 .id = 0,
363 .set_parent = clk_pwm_tin_set_parent, 365 .ops = &clk_tin_ops,
364 }, 366 },
365 [1] = { 367 [1] = {
366 .name = "pwm-tin", 368 .name = "pwm-tin",
367 .id = 1, 369 .id = 1,
368 .set_parent = clk_pwm_tin_set_parent, 370 .ops = &clk_tin_ops,
369 }, 371 },
370 [2] = { 372 [2] = {
371 .name = "pwm-tin", 373 .name = "pwm-tin",
372 .id = 2, 374 .id = 2,
373 .set_parent = clk_pwm_tin_set_parent, 375 .ops = &clk_tin_ops,
374 }, 376 },
375 [3] = { 377 [3] = {
376 .name = "pwm-tin", 378 .name = "pwm-tin",
377 .id = 3, 379 .id = 3,
378 .set_parent = clk_pwm_tin_set_parent, 380 .ops = &clk_tin_ops,
379 }, 381 },
380 [4] = { 382 [4] = {
381 .name = "pwm-tin", 383 .name = "pwm-tin",
382 .id = 4, 384 .id = 4,
383 .set_parent = clk_pwm_tin_set_parent, 385 .ops = &clk_tin_ops,
384 }, 386 },
385}; 387};
386 388