From: Stephen Boyd <sboyd@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
Michael Turquette <mturquette@baylibre.com>
Subject: Re: [PATCH v1 1/2] clk: x86: lpss-atom: Use predefined constants from units.h
Date: Wed, 28 Aug 2024 11:38:59 -0700 [thread overview]
Message-ID: <b3f983207d74a3fcf40d9615260912c5.sboyd@kernel.org> (raw)
In-Reply-To: <Zs8iGy8zLG2zs34J@smile.fi.intel.com>
Quoting Andy Shevchenko (2024-08-28 06:11:55)
> On Tue, Aug 27, 2024 at 05:21:00PM -0700, Stephen Boyd wrote:
> > Quoting Andy Shevchenko (2024-08-22 09:14:07)
>
> ...
>
> > > static int lpss_atom_clk_probe(struct platform_device *pdev)
> > > {
> > > struct lpss_clk_data *drvdata;
> > > struct clk *clk;
> > > + u32 rate;
> >
> > Do we need a local variable?
>
> Hmm... The idea was to allow retrieving this via device properties, that's why
> a separate variable, but that patch wasn't included here.
>
> Nevertheless, despite above the separate variable makes code a bit better to
> read as we can see what is this value about.
>
> > > drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
> > > if (!drvdata)
> > > return -ENOMEM;
> > >
> > > + /* Default frequency is 100MHz */
> > > + rate = 100 * HZ_PER_MHZ;
> > > +
> > > /* LPSS free running clock */
> > > drvdata->name = "lpss_clk";
> > > - clk = clk_register_fixed_rate(&pdev->dev, drvdata->name, NULL,
> > > - 0, 100000000);
> > > + clk = clk_register_fixed_rate(&pdev->dev, drvdata->name, NULL, 0, rate);
> >
> > This should be a one line patch.
>
> I don't get this. You mean the entire thingy?
Yes.
>
> It's possible, but as I mentioned above there is a rationale for making it with
> a temporary variable.
The rationale looks like future code will want a local variable. When
that happens the local variable would make sense.
next prev parent reply other threads:[~2024-08-28 18:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 16:14 [PATCH v1 0/2] clk: x86: lpss-atom: A couple of cleanups Andy Shevchenko
2024-08-22 16:14 ` [PATCH v1 1/2] clk: x86: lpss-atom: Use predefined constants from units.h Andy Shevchenko
2024-08-28 0:21 ` Stephen Boyd
2024-08-28 13:11 ` Andy Shevchenko
2024-08-28 18:38 ` Stephen Boyd [this message]
2024-08-22 16:14 ` [PATCH v1 2/2] clk: x86: lpss-atom: Use temporary variable for struct device Andy Shevchenko
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=b3f983207d74a3fcf40d9615260912c5.sboyd@kernel.org \
--to=sboyd@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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