diff mbox series

pinctrl: intel: hide unused intel_pin_to_gpio

Message ID 20190906152609.1603386-1-arnd@arndb.de
State New
Headers show
Series pinctrl: intel: hide unused intel_pin_to_gpio | expand

Commit Message

Arnd Bergmann Sept. 6, 2019, 3:26 p.m. UTC
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(-)

-- 
2.20.0

Comments

Andy Shevchenko Sept. 6, 2019, 4:59 p.m. UTC | #1
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
Arnd Bergmann Sept. 6, 2019, 6:52 p.m. UTC | #2
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
diff mbox series

Patch

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);