[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240906113710.467716-3-andriy.shevchenko@linux.intel.com>
Date: Fri, 6 Sep 2024 14:36:07 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Andy Shevchenko <andy@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>
Subject: [PATCH v2 2/3] pinctrl: baytrail: Replace ifdeffery by pm_sleep_ptr() macro
Explicit ifdeffery is ugly and theoretically might be not synchronised
with the rest of functions that are assigned via pm_sleep_ptr() macro.
Replace ifdeffery by pm_sleep_ptr() macro to improve this.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/pinctrl/intel/pinctrl-baytrail.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 4533c4d0a9e7..44a77ec1c8ed 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1514,13 +1514,6 @@ static int byt_gpio_probe(struct intel_pinctrl *vg)
gc->parent = vg->dev;
gc->ngpio = vg->soc->npins;
-#ifdef CONFIG_PM_SLEEP
- vg->context.pads = devm_kcalloc(vg->dev, gc->ngpio, sizeof(*vg->context.pads),
- GFP_KERNEL);
- if (!vg->context.pads)
- return -ENOMEM;
-#endif
-
/* set up interrupts */
irq = platform_get_irq_optional(pdev, 0);
if (irq > 0) {
@@ -1581,6 +1574,16 @@ static const struct acpi_device_id byt_gpio_acpi_match[] = {
{ }
};
+static int byt_pinctrl_pm_init(struct intel_pinctrl *vg)
+{
+ vg->context.pads = devm_kcalloc(vg->dev, vg->soc->npins,
+ sizeof(*vg->context.pads), GFP_KERNEL);
+ if (!vg->context.pads)
+ return -ENOMEM;
+
+ return 0;
+}
+
static int byt_pinctrl_probe(struct platform_device *pdev)
{
const struct intel_pinctrl_soc_data *soc_data;
@@ -1603,6 +1606,10 @@ static int byt_pinctrl_probe(struct platform_device *pdev)
return ret;
}
+ ret = intel_pinctrl_context_alloc(vg, byt_pinctrl_pm_init);
+ if (ret)
+ return ret;
+
vg->pctldesc = byt_pinctrl_desc;
vg->pctldesc.name = dev_name(dev);
vg->pctldesc.pins = vg->soc->pins;
--
2.43.0.rc1.1336.g36b5255a03ac
Powered by blists - more mailing lists