Skip to contentSkip to conversation

pinctrl: intel: hide unused intel_pin_to_gpio

PATCH In review Arnd Bergmann 2 participants 3 messages Sep 6, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: intel: hide unused intel_pin_to_gpio

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.

---
 drivers/pinctrl/intel/pinctrl-intel.c | 46 +++++++++++++--------------
 1 file changed, 23 insertions(+), 23 deletions(-)
drivers/pinctrl/intel/pinctrl-intel.c +23 -23
index d66fe2b4221b..67f392174090 100644
@@ -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);
Signature · 1 line
2.20.0
#1 lore raw
Quoted 7 lines · Arnd Bergmann

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?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Arnd Bergmann

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]

Quoted 7 lines
Quoted 2 lines

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