* [PATCH] pinctrl: intel: hide unused intel_pin_to_gpio
@ 2019-09-06 15:26 Arnd Bergmann
2019-09-06 16:59 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2019-09-06 15:26 UTC (permalink / raw)
To: Mika Westerberg, Andy Shevchenko, Linus Walleij
Cc: Arnd Bergmann, Chris Chiu, Kai-Heng Feng, linux-gpio, linux-kernel
The intel_pin_to_gpio() function is only called by the
PM support functions and causes a warning when those are disabled:
drivers/pinctrl/intel/pinctrl-intel.c:841:12: error: unused function 'intel_pin_to_gpio' [-Werror,-Wunused-function]
As we cannot change the PM functions themselves to use __maybe_unused,
add another #ifdef here for consistency.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/pinctrl/intel/pinctrl-intel.c | 46 +++++++++++++--------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index d66fe2b4221b..67f392174090 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -831,29 +831,6 @@ static int intel_gpio_to_pin(struct intel_pinctrl *pctrl, unsigned int offset,
return -EINVAL;
}
-/**
- * intel_pin_to_gpio() - Translate from pin number to GPIO offset
- * @pctrl: Pinctrl structure
- * @pin: pin number
- *
- * Translate the pin number of pinctrl to GPIO offset
- */
-static int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin)
-{
- const struct intel_community *community;
- const struct intel_padgroup *padgrp;
-
- community = intel_get_community(pctrl, pin);
- if (!community)
- return -EINVAL;
-
- padgrp = intel_community_get_padgroup(community, pin);
- if (!padgrp)
- return -EINVAL;
-
- return pin - padgrp->base + padgrp->gpio_base;
-}
-
static int intel_gpio_get(struct gpio_chip *chip, unsigned int offset)
{
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
@@ -1477,6 +1454,29 @@ int intel_pinctrl_probe_by_uid(struct platform_device *pdev)
EXPORT_SYMBOL_GPL(intel_pinctrl_probe_by_uid);
#ifdef CONFIG_PM_SLEEP
+/**
+ * intel_pin_to_gpio() - Translate from pin number to GPIO offset
+ * @pctrl: Pinctrl structure
+ * @pin: pin number
+ *
+ * Translate the pin number of pinctrl to GPIO offset
+ */
+static int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin)
+{
+ const struct intel_community *community;
+ const struct intel_padgroup *padgrp;
+
+ community = intel_get_community(pctrl, pin);
+ if (!community)
+ return -EINVAL;
+
+ padgrp = intel_community_get_padgroup(community, pin);
+ if (!padgrp)
+ return -EINVAL;
+
+ return pin - padgrp->base + padgrp->gpio_base;
+}
+
static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned int pin)
{
const struct pin_desc *pd = pin_desc_get(pctrl->pctldev, pin);
--
2.20.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: intel: hide unused intel_pin_to_gpio
2019-09-06 15:26 [PATCH] pinctrl: intel: hide unused intel_pin_to_gpio Arnd Bergmann
@ 2019-09-06 16:59 ` Andy Shevchenko
2019-09-06 18:52 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2019-09-06 16:59 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Mika Westerberg, Linus Walleij, Chris Chiu, Kai-Heng Feng,
linux-gpio, linux-kernel
On Fri, Sep 06, 2019 at 05:26:01PM +0200, Arnd Bergmann wrote:
> The intel_pin_to_gpio() function is only called by the
> PM support functions and causes a warning when those are disabled:
>
> drivers/pinctrl/intel/pinctrl-intel.c:841:12: error: unused function 'intel_pin_to_gpio' [-Werror,-Wunused-function]
>
> As we cannot change the PM functions themselves to use __maybe_unused,
> add another #ifdef here for consistency.
It's not adding another #ifdef here...
Nevertheless, I'm afraid that in the future we might need this in other
place(s). Can we add __maybe_unused to this function exclusively?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: intel: hide unused intel_pin_to_gpio
2019-09-06 16:59 ` Andy Shevchenko
@ 2019-09-06 18:52 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2019-09-06 18:52 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Mika Westerberg, Linus Walleij, Chris Chiu, Kai-Heng Feng,
open list:GPIO SUBSYSTEM, linux-kernel
On Fri, Sep 6, 2019 at 6:59 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Fri, Sep 06, 2019 at 05:26:01PM +0200, Arnd Bergmann wrote:
> > The intel_pin_to_gpio() function is only called by the
> > PM support functions and causes a warning when those are disabled:
> >
> > drivers/pinctrl/intel/pinctrl-intel.c:841:12: error: unused function 'intel_pin_to_gpio' [-Werror,-Wunused-function]
> >
> > As we cannot change the PM functions themselves to use __maybe_unused,
> > add another #ifdef here for consistency.
>
> It's not adding another #ifdef here...
>
> Nevertheless, I'm afraid that in the future we might need this in other
> place(s). Can we add __maybe_unused to this function exclusively?
Ok, sending v2 now.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-06 18:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 15:26 [PATCH] pinctrl: intel: hide unused intel_pin_to_gpio Arnd Bergmann
2019-09-06 16:59 ` Andy Shevchenko
2019-09-06 18:52 ` Arnd Bergmann
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.