mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
Merge patch series "pinctrl: intel: Export intel_gpio_add_pin_ranges() and use it"
Andy Shevchenko <andriy.shevchenko@linux.intel.com> says: Deduplicate more code with help of being exported intel_gpio_add_pin_ranges(). Link: https://patch.msgid.link/20251118123444.1217863-1-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
commit
8daf70e6aa
|
|
@ -1511,24 +1511,6 @@ static int chv_gpio_irq_init_hw(struct gpio_chip *chip)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int chv_gpio_add_pin_ranges(struct gpio_chip *chip)
|
||||
{
|
||||
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
|
||||
struct device *dev = pctrl->dev;
|
||||
const struct intel_community *community = &pctrl->communities[0];
|
||||
const struct intel_padgroup *gpp;
|
||||
int ret, i;
|
||||
|
||||
for (i = 0; i < community->ngpps; i++) {
|
||||
gpp = &community->gpps[i];
|
||||
ret = gpiochip_add_pin_range(chip, dev_name(dev), gpp->base, gpp->base, gpp->size);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to add GPIO pin range\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int chv_gpio_probe(struct intel_pinctrl *pctrl, int irq)
|
||||
{
|
||||
const struct intel_community *community = &pctrl->communities[0];
|
||||
|
|
@ -1542,7 +1524,7 @@ static int chv_gpio_probe(struct intel_pinctrl *pctrl, int irq)
|
|||
|
||||
chip->ngpio = pctrl->soc->pins[pctrl->soc->npins - 1].number + 1;
|
||||
chip->label = dev_name(dev);
|
||||
chip->add_pin_ranges = chv_gpio_add_pin_ranges;
|
||||
chip->add_pin_ranges = intel_gpio_add_pin_ranges;
|
||||
chip->parent = dev;
|
||||
chip->base = -1;
|
||||
|
||||
|
|
|
|||
|
|
@ -1345,7 +1345,16 @@ static int intel_gpio_irq_init_hw(struct gpio_chip *gc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int intel_gpio_add_pin_ranges(struct gpio_chip *gc)
|
||||
/**
|
||||
* intel_gpio_add_pin_ranges - add GPIO pin ranges for all groups in all communities
|
||||
* @gc: GPIO chip structure
|
||||
*
|
||||
* This function iterates over all communities and all groups and adds the respective
|
||||
* GPIO pin ranges, so the GPIO library will correctly map a GPIO offset to a pin number.
|
||||
*
|
||||
* Return: 0, or negative error code if range can't be added.
|
||||
*/
|
||||
int intel_gpio_add_pin_ranges(struct gpio_chip *gc)
|
||||
{
|
||||
struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
|
||||
const struct intel_community *community;
|
||||
|
|
@ -1362,6 +1371,7 @@ static int intel_gpio_add_pin_ranges(struct gpio_chip *gc)
|
|||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(intel_gpio_add_pin_ranges, "PINCTRL_INTEL");
|
||||
|
||||
static unsigned int intel_gpio_ngpio(const struct intel_pinctrl *pctrl)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -276,6 +276,8 @@ extern const struct dev_pm_ops intel_pinctrl_pm_ops;
|
|||
const struct intel_community *intel_get_community(const struct intel_pinctrl *pctrl,
|
||||
unsigned int pin);
|
||||
|
||||
int intel_gpio_add_pin_ranges(struct gpio_chip *gc);
|
||||
|
||||
int intel_get_groups_count(struct pinctrl_dev *pctldev);
|
||||
const char *intel_get_group_name(struct pinctrl_dev *pctldev, unsigned int group);
|
||||
int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user