public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Turquette <mturquette@baylibre.com>
To: David Lechner <david@lechnology.com>, Stephen Boyd <sboyd@kernel.org>
Cc: David Lechner <david@lechnology.com>,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Sekhar Nori <nsekhar@ti.com>, Kevin Hilman <khilman@kernel.org>,
	linux-kernel@vger.kernel.org, brgl@bgdev.pl
Subject: Re: [PATCH 6/9] clk: davinci: pll: allow dev == NULL
Date: Wed, 30 May 2018 12:46:02 -0700	[thread overview]
Message-ID: <20180530194559.982.42844@harbor.lan> (raw)
In-Reply-To: <20180525181150.17873-7-david@lechnology.com>

Hi David,

Quoting David Lechner (2018-05-25 11:11:47)
> This modifies the TI Davinci PLL clock driver to allow for the case
> when dev == NULL. On some (most) SoCs that use this driver, the PLL
> clock needs to be registered during early boot because it is used
> for clocksource/clkevent and there will be no platform device available.

A lot of this stuff feels like a step backwards. E.g:

> diff --git a/drivers/clk/davinci/pll.c b/drivers/clk/davinci/pll.c
> index 23a24c944f1d..2eb981e61185 100644
> --- a/drivers/clk/davinci/pll.c
> +++ b/drivers/clk/davinci/pll.c
> @@ -11,6 +11,7 @@
>  
>  #include <linux/clk-provider.h>
>  #include <linux/clk.h>
> +#include <linux/clk/davinci.h>
>  #include <linux/delay.h>
>  #include <linux/err.h>
>  #include <linux/io.h>
> @@ -223,6 +224,7 @@ static const struct clk_ops dm365_pll_ops = {
>  
>  /**
>   * davinci_pll_div_register - common *DIV clock implementation
> + * @dev: The PLL platform device or NULL
>   * @name: the clock name
>   * @parent_name: the parent clock name
>   * @reg: the *DIV register
> @@ -240,17 +242,21 @@ static struct clk *davinci_pll_div_register(struct device *dev,
>         const struct clk_ops *divider_ops = &clk_divider_ops;
>         struct clk_gate *gate;
>         struct clk_divider *divider;
> +       struct clk *clk;
> +       int ret;
>  
> -       gate = devm_kzalloc(dev, sizeof(*gate), GFP_KERNEL);
> +       gate = kzalloc(sizeof(*gate), GFP_KERNEL);
>         if (!gate)
>                 return ERR_PTR(-ENOMEM);
>  
>         gate->reg = reg;
>         gate->bit_idx = DIV_ENABLE_SHIFT;
>  
> -       divider = devm_kzalloc(dev, sizeof(*divider), GFP_KERNEL);
> -       if (!divider)
> -               return ERR_PTR(-ENOMEM);
> +       divider = kzalloc(sizeof(*divider), GFP_KERNEL);
> +       if (!divider) {
> +               ret = -ENOMEM;
> +               goto err_free_gate;
> +       }
>  
>         divider->reg = reg;
>         divider->shift = DIV_RATIO_SHIFT;

Oh no my poor devm_ helpers!

I understand that we need to support early boot drivers better, so this
patch can be merged.

However I'm curious if you're tracking Bartosz's early_platform_driver
efforts? Converting to that if it is ever merged would likely be
cleaner:

https://lkml.kernel.org/r/20180511162028.20616-1-brgl@bgdev.pl

Best regards,
Mike

  reply	other threads:[~2018-05-30 19:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-25 18:11 [PATCH 0/9] clk: davinci: outstanding fixes David Lechner
2018-05-25 18:11 ` [PATCH 1/9] clk: davinci: pll-dm355: drop pll2_sysclk2 David Lechner
2018-05-25 18:11 ` [PATCH 2/9] clk: davinci: pll-dm355: fix SYSCLKn parent names David Lechner
2018-05-25 18:11 ` [PATCH 3/9] clk: davinci: psc-dm355: fix ASP0/1 clkdev lookups David Lechner
2018-05-25 18:11 ` [PATCH 4/9] clk: davinci: pll-dm646x: keep PLL2 SYSCLK1 always enabled David Lechner
2018-05-30 17:22   ` Michael Turquette
2018-05-30 19:20     ` David Lechner
2018-05-25 18:11 ` [PATCH 5/9] clk: davinci: psc-dm365: fix few clocks David Lechner
2018-05-25 18:11 ` [PATCH 6/9] clk: davinci: pll: allow dev == NULL David Lechner
2018-05-30 19:46   ` Michael Turquette [this message]
2018-05-30 19:59     ` David Lechner
2018-05-25 18:11 ` [PATCH 7/9] clk: davinci: da850-pll: change PLL0 to CLK_OF_DECLARE David Lechner
2018-05-25 18:11 ` [PATCH 8/9] clk: davinci: psc: allow for dev == NULL David Lechner
2018-05-25 18:11 ` [PATCH 9/9] clk: davinci: Fix link errors when not all SoCs are enabled David Lechner
2018-05-28 13:43   ` Sekhar Nori
2018-05-28 16:54     ` David Lechner
2018-05-30 20:09 ` [PATCH 0/9] clk: davinci: outstanding fixes Michael Turquette
2018-05-31  4:43   ` Sekhar Nori

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=20180530194559.982.42844@harbor.lan \
    --to=mturquette@baylibre.com \
    --cc=brgl@bgdev.pl \
    --cc=david@lechnology.com \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=sboyd@kernel.org \
    /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