From: Bjorn Andersson <bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Vivek Gautam <vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
robh+dt <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
kishon <kishon-l0cyMroinI0@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
Srinivas Kandagatla
<srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 4/4] phy: qcom-qmp: new qmp phy driver for qcom-chipsets
Date: Tue, 3 Jan 2017 11:24:29 -0800 [thread overview]
Message-ID: <20170103192429.GL10531@minitux> (raw)
In-Reply-To: <CAFp+6iF0FQjt3bt1d_HjYmpMb8cTkg+BudoNR7yzThd+EgZfQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Wed 28 Dec 23:39 PST 2016, Vivek Gautam wrote:
> >> + *
> >> + */
> >> +static int phy_pipe_clk_register(struct qcom_qmp_phy *qphy, int id)
> >> +{
> >> + char clk_name[MAX_PROP_NAME];
> >
> > I'm not sure MAX_PROP_NAME is the same as some max clk name but
> > ok. We should be able to calculate that the maximum is length of
> > usb3_phy_pipe_clk_src for now though?
>
> Yea, i thought of using the same macro, considering that it provides
> 32 characters :-)
> Will rather use the length of usb3_phy_pipe_clk_src for now. May be
> #define MAX_CLK_NAME 24
>
Using a macro indicates that the size have some global meaning, but as
far as I can see it doesn't. Just write 24 and you will have enough
space for 100k pcie pipe clocks. And then use sizeof(clk_name) below.
> >
> >> + struct clk *clk;
> >> +
> >> + memset(&clk_name, 0, sizeof(clk_name));
There's no point in clearing clk_name, as it will be overwritten
and nul-terminated below.
> >> + switch (qphy->cfg->type) {
> >> + case PHY_TYPE_USB3:
> >> + snprintf(clk_name, MAX_PROP_NAME, "usb3_phy_pipe_clk_src");
> >> + break;
> >> + case PHY_TYPE_PCIE:
> >> + snprintf(clk_name, MAX_PROP_NAME, "pcie_%d_pipe_clk_src", id);
> >> + break;
> >> + default:
> >> + return -EINVAL;
> >> + }
> >> +
> >> + /* controllers using QMP phys use 125MHz pipe clock interface */
> >> + clk = clk_register_fixed_rate(qphy->dev, clk_name, NULL, 0, 125000000);
Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Vivek Gautam <vivek.gautam@codeaurora.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>, robh+dt <robh+dt@kernel.org>,
kishon <kishon@ti.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v3 4/4] phy: qcom-qmp: new qmp phy driver for qcom-chipsets
Date: Tue, 3 Jan 2017 11:24:29 -0800 [thread overview]
Message-ID: <20170103192429.GL10531@minitux> (raw)
In-Reply-To: <CAFp+6iF0FQjt3bt1d_HjYmpMb8cTkg+BudoNR7yzThd+EgZfQg@mail.gmail.com>
On Wed 28 Dec 23:39 PST 2016, Vivek Gautam wrote:
> >> + *
> >> + */
> >> +static int phy_pipe_clk_register(struct qcom_qmp_phy *qphy, int id)
> >> +{
> >> + char clk_name[MAX_PROP_NAME];
> >
> > I'm not sure MAX_PROP_NAME is the same as some max clk name but
> > ok. We should be able to calculate that the maximum is length of
> > usb3_phy_pipe_clk_src for now though?
>
> Yea, i thought of using the same macro, considering that it provides
> 32 characters :-)
> Will rather use the length of usb3_phy_pipe_clk_src for now. May be
> #define MAX_CLK_NAME 24
>
Using a macro indicates that the size have some global meaning, but as
far as I can see it doesn't. Just write 24 and you will have enough
space for 100k pcie pipe clocks. And then use sizeof(clk_name) below.
> >
> >> + struct clk *clk;
> >> +
> >> + memset(&clk_name, 0, sizeof(clk_name));
There's no point in clearing clk_name, as it will be overwritten
and nul-terminated below.
> >> + switch (qphy->cfg->type) {
> >> + case PHY_TYPE_USB3:
> >> + snprintf(clk_name, MAX_PROP_NAME, "usb3_phy_pipe_clk_src");
> >> + break;
> >> + case PHY_TYPE_PCIE:
> >> + snprintf(clk_name, MAX_PROP_NAME, "pcie_%d_pipe_clk_src", id);
> >> + break;
> >> + default:
> >> + return -EINVAL;
> >> + }
> >> +
> >> + /* controllers using QMP phys use 125MHz pipe clock interface */
> >> + clk = clk_register_fixed_rate(qphy->dev, clk_name, NULL, 0, 125000000);
Regards,
Bjorn
next prev parent reply other threads:[~2017-01-03 19:24 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-20 17:03 [PATCH v3 0/4] phy: USB and PCIe phy drivers for Qcom chipsets Vivek Gautam
2016-12-20 17:03 ` Vivek Gautam
2016-12-20 17:03 ` [PATCH v3 1/4] dt-bindings: phy: Add support for QUSB2 phy Vivek Gautam
[not found] ` <1482253431-23160-2-git-send-email-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-12-22 21:16 ` Rob Herring
2016-12-22 21:16 ` Rob Herring
2016-12-23 4:52 ` Vivek Gautam
2016-12-28 1:13 ` Stephen Boyd
2016-12-28 5:40 ` Vivek Gautam
2016-12-20 17:03 ` [PATCH v3 2/4] phy: qcom-qusb2: New driver for QUSB2 PHY on Qcom chips Vivek Gautam
[not found] ` <1482253431-23160-3-git-send-email-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-12-28 23:01 ` Stephen Boyd
2016-12-28 23:01 ` Stephen Boyd
2016-12-29 6:57 ` Vivek Gautam
2016-12-29 7:00 ` Vivek Gautam
2016-12-20 17:03 ` [PATCH v3 3/4] dt-bindings: phy: Add support for QMP phy Vivek Gautam
[not found] ` <1482253431-23160-4-git-send-email-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-12-28 23:04 ` Stephen Boyd
2016-12-28 23:04 ` Stephen Boyd
[not found] ` <20161228230412.GC17126-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-12-29 5:05 ` Vivek Gautam
2016-12-29 5:05 ` Vivek Gautam
2016-12-20 17:03 ` [PATCH v3 4/4] phy: qcom-qmp: new qmp phy driver for qcom-chipsets Vivek Gautam
2016-12-28 23:16 ` Stephen Boyd
2016-12-29 7:39 ` Vivek Gautam
[not found] ` <CAFp+6iF0FQjt3bt1d_HjYmpMb8cTkg+BudoNR7yzThd+EgZfQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-03 19:24 ` Bjorn Andersson [this message]
2017-01-03 19:24 ` Bjorn Andersson
2017-01-05 9:13 ` Vivek Gautam
2017-01-05 9:13 ` Vivek Gautam
2017-01-06 7:18 ` Bjorn Andersson
2017-01-06 9:47 ` Vivek Gautam
2017-01-06 21:17 ` Bjorn Andersson
2017-01-07 18:41 ` vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ
2017-01-07 18:41 ` vivek.gautam
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=20170103192429.GL10531@minitux \
--to=bjorn.andersson-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=kishon-l0cyMroinI0@public.gmane.org \
--cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.