2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
8 #include <linux/device.h>
9 #include <linux/export.h>
10 #include <linux/gfp.h>
12 static void devm_clk_release(struct device
*dev
, void *res
)
14 clk_put(*(struct clk
**)res
);
17 struct clk
*devm_clk_get(struct device
*dev
, const char *id
)
19 struct clk
**ptr
, *clk
;
21 ptr
= devres_alloc(devm_clk_release
, sizeof(*ptr
), GFP_KERNEL
);
23 return ERR_PTR(-ENOMEM
);
25 clk
= clk_get(dev
, id
);
35 EXPORT_SYMBOL(devm_clk_get
);
37 static int devm_clk_match(struct device
*dev
, void *res
, void *data
)
47 void devm_clk_put(struct device
*dev
, struct clk
*clk
)
51 ret
= devres_release(dev
, devm_clk_release
, devm_clk_match
, clk
);
55 EXPORT_SYMBOL(devm_clk_put
);