Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / clk / uniphier / clk-uniphier-fixed-rate.c
blob3bc55ab75314bf8d87e05490d95ae0c1c0c4c174
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.flags = 0;
28 init.parent_names = NULL;
29 init.num_parents = 0;
31 fixed->fixed_rate = data->fixed_rate;
32 fixed->hw.init = &init;
34 ret = devm_clk_hw_register(dev, &fixed->hw);
35 if (ret)
36 return ERR_PTR(ret);
38 return &fixed->hw;