Merge tag 'trace-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[linux/fpc-iii.git] / drivers / clk / uniphier / clk-uniphier-fixed-rate.c
blob5319cd3804801f03bf181e0807b965ab4ee0c1fd
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (C) 2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
5 */
7 #include <linux/clk-provider.h>
8 #include <linux/device.h>
10 #include "clk-uniphier.h"
12 struct clk_hw *uniphier_clk_register_fixed_rate(struct device *dev,
13 const char *name,
14 const struct uniphier_clk_fixed_rate_data *data)
16 struct clk_fixed_rate *fixed;
17 struct clk_init_data init;
18 int ret;
20 /* allocate fixed-rate clock */
21 fixed = devm_kzalloc(dev, sizeof(*fixed), GFP_KERNEL);
22 if (!fixed)
23 return ERR_PTR(-ENOMEM);
25 init.name = name;
26 init.ops = &clk_fixed_rate_ops;
27 init.parent_names = NULL;
28 init.num_parents = 0;
30 fixed->fixed_rate = data->fixed_rate;
31 fixed->hw.init = &init;
33 ret = devm_clk_hw_register(dev, &fixed->hw);
34 if (ret)
35 return ERR_PTR(ret);
37 return &fixed->hw;