From: andy.shevchenko@gmail.com
To: Esteban Blanc <eblanc@baylibre.com>
Cc: linus.walleij@linaro.org, lgirdwood@gmail.com,
broonie@kernel.org, a.zummo@towertech.it,
alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org,
jpanis@baylibre.com, jneanne@baylibre.com,
aseketeli@baylibre.com, u-kumar1@ti.com
Subject: Re: [PATCH v5 2/3] pinctrl: tps6594: Add driver for TPS6594 pinctrl and GPIOs
Date: Tue, 23 May 2023 22:14:34 +0300 [thread overview]
Message-ID: <ZG0QmjZwvzWbNwA4@surfacebook> (raw)
In-Reply-To: <20230522163115.2592883-3-eblanc@baylibre.com>
Mon, May 22, 2023 at 06:31:14PM +0200, Esteban Blanc kirjoitti:
> TI TPS6594 PMIC has 11 GPIOs which can be used
> for different functions.
>
> This patch adds a pinctrl and GPIO drivers in
> order to use those functions.
...
> +#define FUNCTION(n, g, v) \
> + { \
> + .pinfunction = PINCTRL_PINFUNCTION((n), (g), ARRAY_SIZE(g)), \
> + .muxval = v, \
> + }
It seems you have used SPACEs before \, can you move to TABs?
...
> +static int tps6594_gpio_regmap_xlate(struct gpio_regmap *gpio,
> + unsigned int base, unsigned int offset,
> + unsigned int *reg, unsigned int *mask)
> +{
> + unsigned int line = offset % 8;
> + unsigned int stride = offset / 8;
> +
> + switch (base) {
> + case TPS6594_REG_GPIO1_CONF:
> + *reg = TPS6594_REG_GPIOX_CONF(offset);
> + *mask = TPS6594_BIT_GPIO_DIR;
> + break;
> + case TPS6594_REG_GPIO_IN_1:
> + case TPS6594_REG_GPIO_OUT_1:
> + *reg = base + stride;
> + *mask = BIT(line);
> + break;
> + default:
> + return -EINVAL;
> + }
> + return 0;
You can return directly instead of breaking.
> +}
> + pinctrl->pins = tps6594_pins;
> + pinctrl->pctl_dev =
> + devm_pinctrl_register(&pdev->dev, pctrl_desc, pinctrl);
With
struct device *dev = &pdev->dev;
the above becomes a single line. This may help other similar uses.
> + if (IS_ERR(pinctrl->pctl_dev)) {
> + return dev_err_probe(&pdev->dev, PTR_ERR(pinctrl->pctl_dev),
> + "Couldn't register pinctrl driver\n");
> + }
Also the {} can be dropped.
...
> + pinctrl->gpio_regmap = devm_gpio_regmap_register(&pdev->dev, &config);
> + if (IS_ERR(pinctrl->gpio_regmap)) {
> + return dev_err_probe(&pdev->dev, PTR_ERR(pinctrl->gpio_regmap),
> + "Couldn't register gpio_regmap driver\n");
> + }
Ditto.
...
> +static struct platform_driver tps6594_pinctrl_driver = {
> + .driver = { .name = "tps6594-pinctrl" },
Can you use more standard way of style here, i.e.
.driver = {
.name = "tps6594-pinctrl",
},
In case someone is going to add something there in the future it will become
just as cleaner as possible.
> + .probe = tps6594_pinctrl_probe,
> +};
> +
> +module_platform_driver(tps6594_pinctrl_driver);
Move the above blank line here.
> +MODULE_ALIAS("platform:tps6594-pinctrl");
> +MODULE_AUTHOR("Esteban Blanc <eblanc@baylibre.com>");
...
> +// Used to compute register address of GPIO1_CONF to GPIO11_CONF
This is good.
> -#define TPS6594_REG_GPIOX_CONF(gpio_inst) (0x31 + (gpio_inst))
> +#define TPS6594_REG_GPIOX_CONF(gpio_inst) (0x31 + (gpio_inst))
But why this?!
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-05-23 19:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 16:31 [PATCH v5 0/3] TI TPS6594 PMIC support (RTC, pinctrl, regulators) Esteban Blanc
2023-05-22 16:31 ` [PATCH v5 1/3] rtc: tps6594: Add driver for TPS6594 RTC Esteban Blanc
2023-05-23 13:36 ` andy.shevchenko
2023-05-23 14:32 ` Alexandre Belloni
2023-05-25 13:56 ` Esteban Blanc
2023-05-22 16:31 ` [PATCH v5 2/3] pinctrl: tps6594: Add driver for TPS6594 pinctrl and GPIOs Esteban Blanc
2023-05-23 19:14 ` andy.shevchenko [this message]
2023-05-25 14:07 ` Esteban Blanc
2023-05-26 18:43 ` Andy Shevchenko
2023-05-31 7:58 ` Esteban Blanc
2023-05-22 16:31 ` [PATCH v5 3/3] regulator: tps6594-regulator: Add driver for TI TPS6594 regulators Esteban Blanc
2023-05-23 19:33 ` andy.shevchenko
2023-06-07 11:44 ` jerome Neanne
2023-06-07 14:52 ` Andy Shevchenko
2023-06-06 16:51 ` [PATCH v5 0/3] TI TPS6594 PMIC support (RTC, pinctrl, regulators) Mark Brown
2023-06-07 12:40 ` (subset) " Mark Brown
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=ZG0QmjZwvzWbNwA4@surfacebook \
--to=andy.shevchenko@gmail.com \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=aseketeli@baylibre.com \
--cc=broonie@kernel.org \
--cc=eblanc@baylibre.com \
--cc=jneanne@baylibre.com \
--cc=jpanis@baylibre.com \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=u-kumar1@ti.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