blob: c41901465fb065f702083781d34b4c187473151d [file] [log] [blame]
Paul Mundt51a50062010-03-08 21:45:19 +09001/*
Jean-Christop PLAGNIOL-VILLARD6d803ba2010-11-17 10:04:33 +01002 * Copyright (C) 2010 Paul Mundt <lethal@linux-sh.org>
Paul Mundt51a50062010-03-08 21:45:19 +09003 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Helper for the clk API to assist looking up a struct clk.
9 */
Paul Mundt51a50062010-03-08 21:45:19 +090010
Jean-Christop PLAGNIOL-VILLARD6d803ba2010-11-17 10:04:33 +010011#ifndef __CLKDEV__H_
12#define __CLKDEV__H_
Paul Mundt51a50062010-03-08 21:45:19 +090013
Jean-Christop PLAGNIOL-VILLARD6d803ba2010-11-17 10:04:33 +010014#include <linux/bootmem.h>
15#include <linux/mm.h>
16#include <linux/slab.h>
Paul Mundt51a50062010-03-08 21:45:19 +090017
Jean-Christop PLAGNIOL-VILLARD6d803ba2010-11-17 10:04:33 +010018#include <asm/clock.h>
Paul Mundt51a50062010-03-08 21:45:19 +090019
Jean-Christop PLAGNIOL-VILLARD6d803ba2010-11-17 10:04:33 +010020static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
21{
22 if (!slab_is_available())
23 return alloc_bootmem_low_pages(size);
24 else
25 return kzalloc(size, GFP_KERNEL);
26}
Paul Mundt51a50062010-03-08 21:45:19 +090027
Sylwester Nawrockiac2df522013-08-24 20:10:41 +020028#ifndef CONFIG_COMMON_CLK
Jean-Christop PLAGNIOL-VILLARD6d803ba2010-11-17 10:04:33 +010029#define __clk_put(clk)
30#define __clk_get(clk) ({ 1; })
Sylwester Nawrockiac2df522013-08-24 20:10:41 +020031#endif
Paul Mundt51a50062010-03-08 21:45:19 +090032
Jean-Christop PLAGNIOL-VILLARD6d803ba2010-11-17 10:04:33 +010033#endif /* __CLKDEV_H__ */