public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: David Yang <mmyangfl@gmail.com>, linux-clk@vger.kernel.org
Cc: David Yang <mmyangfl@gmail.com>,
	Michael Turquette <mturquette@baylibre.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/4] clk: hisilicon: Add helper functions for platform driver
Date: Wed, 05 Apr 2023 12:51:25 -0700	[thread overview]
Message-ID: <746f8ddc1036179c6f2569e0bc98033b.sboyd@kernel.org> (raw)
In-Reply-To: <20230329075104.165176-2-mmyangfl@gmail.com>

Quoting David Yang (2023-03-29 00:50:50)
> diff --git a/drivers/clk/hisilicon/clk.h b/drivers/clk/hisilicon/clk.h
> index 7a9b42e1b027..def94498e14d 100644
> --- a/drivers/clk/hisilicon/clk.h
> +++ b/drivers/clk/hisilicon/clk.h
> @@ -103,6 +105,38 @@ struct hisi_gate_clock {
>         const char              *alias;
>  };
>  
> +struct hisi_clocks {
> +       int nr;
> +
> +       int (*prologue)(struct device *dev, struct hisi_clock_data *data);
> +
> +       const struct hisi_fixed_rate_clock *fixed_rate_clks;
> +       int fixed_rate_clks_num;

size_t for all these num types and 'nr'?

> +
> +       const struct hisi_fixed_factor_clock *fixed_factor_clks;
> +       int fixed_factor_clks_num;
> +
> +       const struct hisi_mux_clock *mux_clks;
> +       int mux_clks_num;
> +
> +       const struct hisi_phase_clock *phase_clks;
> +       int phase_clks_num;
> +
> +       const struct hisi_divider_clock *divider_clks;
> +       int divider_clks_num;
> +
> +       const struct hisi_gate_clock *gate_clks;
> +       int gate_clks_num;
> +
> +       const struct hisi_gate_clock *gate_sep_clks;
> +       int gate_sep_clks_num;
> +
> +       const void *customized_clks;
> +       int customized_clks_num;
> +       int (*clk_register_customized)(struct device *dev, const void *clks,
> +                                      int num, struct hisi_clock_data *data);
> +};
> +
>  struct clk *hisi_register_clkgate_sep(struct device *, const char *,
>                                 const char *, unsigned long,
>                                 void __iomem *, u8,
> @@ -134,7 +169,16 @@ void hisi_clk_register_gate_sep(const struct hisi_gate_clock *,
>  void hi6220_clk_register_divider(const struct hi6220_divider_clock *,
>                                 int, struct hisi_clock_data *);
>  
> -#define hisi_clk_unregister(type) \
> +int hisi_clk_register(struct device *dev, const struct hisi_clocks *clks,
> +                     struct hisi_clock_data *data);
> +
> +/* helper functions for platform driver */
> +
> +int hisi_clk_early_init(struct device_node *np, const struct hisi_clocks *clks);
> +int hisi_clk_probe(struct platform_device *pdev);
> +int hisi_clk_remove(struct platform_device *pdev);
> +
> +#define hisi_clk_unregister_fn(type) \
>  static inline \
>  void hisi_clk_unregister_##type(const struct hisi_##type##_clock *clks, \
>                                 int nums, struct hisi_clock_data *data) \
> @@ -148,10 +192,10 @@ void hisi_clk_unregister_##type(const struct hisi_##type##_clock *clks, \
>         } \
>  }
>  
> -hisi_clk_unregister(fixed_rate)
> -hisi_clk_unregister(fixed_factor)
> -hisi_clk_unregister(mux)
> -hisi_clk_unregister(divider)
> -hisi_clk_unregister(gate)
> +hisi_clk_unregister_fn(fixed_rate)
> +hisi_clk_unregister_fn(fixed_factor)
> +hisi_clk_unregister_fn(mux)
> +hisi_clk_unregister_fn(divider)
> +hisi_clk_unregister_fn(gate)

What does this hunk have to do with the $subject patch? Can you break
this series down into smaller patches? This is probably clearing the way
for hisi_clk_unregister() being an actual function, but I don't know. It
can 

>  
>  #endif /* __HISI_CLK_H */
> diff --git a/drivers/clk/hisilicon/crg.h b/drivers/clk/hisilicon/crg.h
> index 803f6ba6d7a2..d9544f1f2625 100644
> --- a/drivers/clk/hisilicon/crg.h
> +++ b/drivers/clk/hisilicon/crg.h
> @@ -22,4 +22,9 @@ struct hisi_crg_dev {
>         const struct hisi_crg_funcs *funcs;
>  };
>  
> +/* helper functions for platform driver */
> +
> +int hisi_crg_probe(struct platform_device *pdev);
> +int hisi_crg_remove(struct platform_device *pdev);
> +
>  #endif /* __HISI_CRG_H */
> diff --git a/drivers/clk/hisilicon/reset.c b/drivers/clk/hisilicon/reset.c
> index 93cee17db8b1..3464e3b4d708 100644
> --- a/drivers/clk/hisilicon/reset.c
> +++ b/drivers/clk/hisilicon/reset.c
> @@ -5,12 +5,16 @@
>   * Copyright (c) 2015-2016 HiSilicon Technologies Co., Ltd.
>   */
>  
> +#include <linux/device.h>
>  #include <linux/io.h>
> +#include <linux/kernel.h>
>  #include <linux/of_address.h>
> -#include <linux/platform_device.h>

Why?

> +#include <linux/of_device.h>

Why?

>  #include <linux/reset-controller.h>
> -#include <linux/slab.h>

Why?

>  #include <linux/spinlock.h>
> +
> +#include "clk.h"
> +#include "crg.h"
>  #include "reset.h"
>  
>  #define        HISI_RESET_BIT_MASK     0x1f

  reply	other threads:[~2023-04-05 19:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29  7:50 [PATCH v2 0/4] clk: hisilicon: Migrate devm APIs David Yang
2023-03-29  7:50 ` [PATCH v2 1/4] clk: hisilicon: Add helper functions for platform driver David Yang
2023-04-05 19:51   ` Stephen Boyd [this message]
2023-03-29  7:50 ` [PATCH v2 2/4] clk: hisilicon: Use helper functions David Yang
2023-04-05 21:06   ` Stephen Boyd
2023-03-29  7:50 ` [PATCH v2 3/4] clk: hisilicon: Convert to platform driver David Yang
2023-04-05 21:08   ` Stephen Boyd
2023-03-29  7:50 ` [PATCH v2 4/4] clk: hisilicon: Migrate devm APIs David Yang
2023-04-05 19:39 ` [PATCH v2 0/4] " Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=746f8ddc1036179c6f2569e0bc98033b.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmyangfl@gmail.com \
    --cc=mturquette@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox