linux/drivers/clk/loongson1/clk.c
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2012-2016 Zhang, Keguang <keguang.zhang@gmail.com>
   3 *
   4 * This program is free software; you can redistribute  it and/or modify it
   5 * under  the terms of  the GNU General  Public License as published by the
   6 * Free Software Foundation;  either version 2 of the  License, or (at your
   7 * option) any later version.
   8 */
   9
  10#include <linux/clk-provider.h>
  11#include <linux/slab.h>
  12
  13struct clk_hw *__init clk_hw_register_pll(struct device *dev,
  14                                          const char *name,
  15                                          const char *parent_name,
  16                                          const struct clk_ops *ops,
  17                                          unsigned long flags)
  18{
  19        int ret;
  20        struct clk_hw *hw;
  21        struct clk_init_data init;
  22
  23        /* allocate the divider */
  24        hw = kzalloc(sizeof(*hw), GFP_KERNEL);
  25        if (!hw)
  26                return ERR_PTR(-ENOMEM);
  27
  28        init.name = name;
  29        init.ops = ops;
  30        init.flags = flags | CLK_IS_BASIC;
  31        init.parent_names = (parent_name ? &parent_name : NULL);
  32        init.num_parents = (parent_name ? 1 : 0);
  33        hw->init = &init;
  34
  35        /* register the clock */
  36        ret = clk_hw_register(dev, hw);
  37        if (ret) {
  38                kfree(hw);
  39                hw = ERR_PTR(ret);
  40        }
  41
  42        return hw;
  43}
  44