From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Rohit Agarwal <quic_rohiagar@quicinc.com>
Cc: agross@kernel.org, andersson@kernel.org,
konrad.dybcio@linaro.org, linus.walleij@linaro.org,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
richardcochran@gmail.com, manivannan.sadhasivam@linaro.org,
linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH v5 2/3] pinctrl: qcom: Refactor target specific pinctrl driver
Date: Wed, 3 May 2023 12:41:56 +0300 [thread overview]
Message-ID: <CAHp75VegxMgAamS3ORiJ2=D4MH7asD9PiWrM+3JAm-QOuEgcrg@mail.gmail.com> (raw)
In-Reply-To: <1683092380-29551-3-git-send-email-quic_rohiagar@quicinc.com>
On Wed, May 3, 2023 at 8:39 AM Rohit Agarwal <quic_rohiagar@quicinc.com> wrote:
>
> Update the msm_function and msm_pingroup structure to reuse the generic
structures
> pinfunction and pingroup structures. Also refactor pinctrl drivers to adjust
> the new macro and updated structure defined in pinctrl.h and pinctrl_msm.h
> respectively.
Thanks for this, my comments below.
...
> #define FUNCTION(fname) \
> [APQ_MUX_##fname] = { \
> - .name = #fname, \
> - .groups = fname##_groups, \
> - .ngroups = ARRAY_SIZE(fname##_groups), \
> - }
> + .func = PINCTRL_PINFUNCTION(#fname, \
> + fname##_groups, \
> + ARRAY_SIZE(fname##_groups)) \
> + }
Does it really make sense to keep an additional wrapper data type that
does not add any value? Can't we simply have
#define FUNCTION(fname) [...fname] = PINCTRL_PINFUNCTION(...)
?
...
> + .grp = PINCTRL_PINGROUP("gpio"#id, gpio##id##_pins, \
> + (unsigned int)ARRAY_SIZE(gpio##id##_pins)), \
Why do you need this casting? Same Q to all the rest of the similar cases.
...
> +#include <linux/pinctrl/pinctrl.h>
Keep it separate, and below the generic ones...
> #include <linux/pm.h>
> #include <linux/types.h>
>
...like here (note also a blank line).
...
> /**
> * struct msm_function - a pinmux function
> - * @name: Name of the pinmux function.
> - * @groups: List of pingroups for this function.
> - * @ngroups: Number of entries in @groups.
> + * @func: Generic data of the pin function (name and groups of pins)
> */
> struct msm_function {
> - const char *name;
> - const char * const *groups;
> - unsigned ngroups;
> + struct pinfunction func;
> };
But why? Just kill the entire structure.
...
> #define FUNCTION(fname) \
This definition appears in many files, instead you can make a generic
to this drivers one and use it here
#define QCOM_FUNCTION(_prefix_, _fname_)
[_prefix_##_fname_] = PINCTRL_PINFUNCTION(...)
#define FUNCTION(fname) QCOM_FUNCTION(msm_mux, fname)
(this just a pseudocode, might not even be compilable)
> [msm_mux_##fname] = { \
> - .name = #fname, \
> - .groups = fname##_groups, \
> - .ngroups = ARRAY_SIZE(fname##_groups), \
> + .func = PINCTRL_PINFUNCTION(#fname, \
> + fname##_groups, \
> + ARRAY_SIZE(fname##_groups)) \
> }
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-05-03 9:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-03 5:39 [PATCH v5 0/3] Add pinctrl support for SDX75 Rohit Agarwal
2023-05-03 5:39 ` [PATCH v5 1/3] dt-bindings: pinctrl: qcom: Add SDX75 pinctrl devicetree compatible Rohit Agarwal
2023-05-03 5:39 ` [PATCH v5 2/3] pinctrl: qcom: Refactor target specific pinctrl driver Rohit Agarwal
2023-05-03 9:41 ` Andy Shevchenko [this message]
2023-05-03 11:14 ` Rohit Agarwal
2023-05-03 13:53 ` Andy Shevchenko
2023-05-05 6:56 ` Rohit Agarwal
2023-05-03 5:39 ` [PATCH v5 3/3] pinctrl: qcom: Add SDX75 pincontrol driver Rohit Agarwal
2023-05-03 9:47 ` 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='CAHp75VegxMgAamS3ORiJ2=D4MH7asD9PiWrM+3JAm-QOuEgcrg@mail.gmail.com' \
--to=andy.shevchenko@gmail.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=quic_rohiagar@quicinc.com \
--cc=richardcochran@gmail.com \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).