From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>,
Linus Walleij <linus.walleij@linaro.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@microchip.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v3 2/5] pinctrl: at91: Don't mix non-devm calls with devm ones
Date: Wed, 15 Feb 2023 15:42:39 +0200 [thread overview]
Message-ID: <20230215134242.37618-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20230215134242.37618-1-andriy.shevchenko@linux.intel.com>
Replace devm_clk_get() by devm_clk_get_enabled() and drop
unneeded code pieces. This will make sure we keep the ordering
of the resource allocation correct.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
drivers/pinctrl/pinctrl-at91.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 5c01765c7a2a..6d9015ed8a3b 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1849,19 +1849,13 @@ static int at91_gpio_probe(struct platform_device *pdev)
at91_chip->pioc_virq = irq;
at91_chip->pioc_idx = alias_idx;
- at91_chip->clock = devm_clk_get(&pdev->dev, NULL);
+ at91_chip->clock = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(at91_chip->clock)) {
dev_err(&pdev->dev, "failed to get clock, ignoring.\n");
ret = PTR_ERR(at91_chip->clock);
goto err;
}
- ret = clk_prepare_enable(at91_chip->clock);
- if (ret) {
- dev_err(&pdev->dev, "failed to prepare and enable clock, ignoring.\n");
- goto clk_enable_err;
- }
-
at91_chip->chip = at91_gpio_template;
at91_chip->id = alias_idx;
@@ -1882,7 +1876,7 @@ static int at91_gpio_probe(struct platform_device *pdev)
names = devm_kasprintf_strarray(dev, "pio", chip->ngpio);
if (!names) {
ret = -ENOMEM;
- goto clk_enable_err;
+ goto err;
}
for (i = 0; i < chip->ngpio; i++)
@@ -1915,8 +1909,6 @@ static int at91_gpio_probe(struct platform_device *pdev)
return 0;
gpiochip_add_err:
-clk_enable_err:
- clk_disable_unprepare(at91_chip->clock);
err:
dev_err(&pdev->dev, "Failure %i for GPIO %i\n", ret, alias_idx);
--
2.39.1
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
Linus Walleij <linus.walleij@linaro.org>,
Ludovic Desroches <ludovic.desroches@microchip.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Claudiu Beznea <claudiu.beznea@microchip.com>
Subject: [PATCH v3 2/5] pinctrl: at91: Don't mix non-devm calls with devm ones
Date: Wed, 15 Feb 2023 15:42:39 +0200 [thread overview]
Message-ID: <20230215134242.37618-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20230215134242.37618-1-andriy.shevchenko@linux.intel.com>
Replace devm_clk_get() by devm_clk_get_enabled() and drop
unneeded code pieces. This will make sure we keep the ordering
of the resource allocation correct.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
drivers/pinctrl/pinctrl-at91.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 5c01765c7a2a..6d9015ed8a3b 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1849,19 +1849,13 @@ static int at91_gpio_probe(struct platform_device *pdev)
at91_chip->pioc_virq = irq;
at91_chip->pioc_idx = alias_idx;
- at91_chip->clock = devm_clk_get(&pdev->dev, NULL);
+ at91_chip->clock = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(at91_chip->clock)) {
dev_err(&pdev->dev, "failed to get clock, ignoring.\n");
ret = PTR_ERR(at91_chip->clock);
goto err;
}
- ret = clk_prepare_enable(at91_chip->clock);
- if (ret) {
- dev_err(&pdev->dev, "failed to prepare and enable clock, ignoring.\n");
- goto clk_enable_err;
- }
-
at91_chip->chip = at91_gpio_template;
at91_chip->id = alias_idx;
@@ -1882,7 +1876,7 @@ static int at91_gpio_probe(struct platform_device *pdev)
names = devm_kasprintf_strarray(dev, "pio", chip->ngpio);
if (!names) {
ret = -ENOMEM;
- goto clk_enable_err;
+ goto err;
}
for (i = 0; i < chip->ngpio; i++)
@@ -1915,8 +1909,6 @@ static int at91_gpio_probe(struct platform_device *pdev)
return 0;
gpiochip_add_err:
-clk_enable_err:
- clk_disable_unprepare(at91_chip->clock);
err:
dev_err(&pdev->dev, "Failure %i for GPIO %i\n", ret, alias_idx);
--
2.39.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-02-15 13:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 13:42 [PATCH v3 0/5] pinctrl: at91: Cleanups Andy Shevchenko
2023-02-15 13:42 ` Andy Shevchenko
2023-02-15 13:42 ` [PATCH v3 1/5] pinctrl: at91: use devm_kasprintf() to avoid potential leaks (part 2) Andy Shevchenko
2023-02-15 13:42 ` Andy Shevchenko
2023-02-15 13:42 ` Andy Shevchenko [this message]
2023-02-15 13:42 ` [PATCH v3 2/5] pinctrl: at91: Don't mix non-devm calls with devm ones Andy Shevchenko
2023-02-15 13:42 ` [PATCH v3 3/5] pinctrl: at91: Use of_device_get_match_data() Andy Shevchenko
2023-02-15 13:42 ` Andy Shevchenko
2023-02-15 13:42 ` [PATCH v3 4/5] pinctrl: at91: Use dev_err_probe() instead of custom messaging Andy Shevchenko
2023-02-15 13:42 ` Andy Shevchenko
2023-02-15 13:42 ` [PATCH v3 5/5] pinctrl: at91: Utilise temporary variable for struct device Andy Shevchenko
2023-02-15 13:42 ` Andy Shevchenko
2023-02-17 11:54 ` Claudiu.Beznea
2023-02-17 11:54 ` Claudiu.Beznea
2023-02-17 11:59 ` Andy Shevchenko
2023-02-17 11:59 ` Andy Shevchenko
2023-02-27 21:44 ` Linus Walleij
2023-02-27 21:44 ` Linus Walleij
2023-02-27 22:20 ` Andy Shevchenko
2023-02-27 22:20 ` 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=20230215134242.37618-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@microchip.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=nicolas.ferre@microchip.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 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.