linux-4.4.1/gpiochip_add_pin_range()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#ef2b5919]
#backlinks
*説明 [#pc72cba3]
-パス: [[linux-4.4.1/drivers/gpio/gpiolib.c]]
-FIXME: これは何?
--説明
**引数 [#d401e8e4]
-struct gpio_chip *chip
--
--[[linux-4.4.1/gpio_chip]]
-const char *pinctl_name
--
-unsigned int gpio_offset
--
-unsigned int pin_offset
--
-unsigned int npins
--
**返り値 [#v0e46793]
-int
--
**参考 [#a7f33214]
*実装 [#rf1b1181]
/**
* gpiochip_add_pin_range() - add a range for GPIO <-> p...
* @chip: the gpiochip to add the range for
* @pinctrl_name: the dev_name() of the pin controller t...
* @gpio_offset: the start offset in the current gpio_ch...
* @pin_offset: the start offset in the pin controller n...
* @npins: the number of pins from the offset of each pi...
* pin controller) to accumulate in this range
*/
int gpiochip_add_pin_range(struct gpio_chip *chip, const...
unsigned int gpio_offset, uns...
unsigned int npins)
{
struct gpio_pin_range *pin_range;
int ret;
-
--[[linux-4.4.1/gpio_pin_range]]
pin_range = kzalloc(sizeof(*pin_range), GFP_KERN...
if (!pin_range) {
chip_err(chip, "failed to allocate pin r...
return -ENOMEM;
}
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/chip_err()]]
/* Use local offset as range ID */
pin_range->range.id = gpio_offset;
pin_range->range.gc = chip;
pin_range->range.name = chip->label;
pin_range->range.base = chip->base + gpio_offset;
pin_range->range.pin_base = pin_offset;
pin_range->range.npins = npins;
pin_range->pctldev = pinctrl_find_and_add_gpio_r...
&pin_range->range);
if (IS_ERR(pin_range->pctldev)) {
ret = PTR_ERR(pin_range->pctldev);
chip_err(chip, "could not create pin ran...
kfree(pin_range);
return ret;
}
chip_dbg(chip, "created GPIO range %d->%d ==> %s...
gpio_offset, gpio_offset + npins - 1,
pinctl_name,
pin_offset, pin_offset + npins - 1);
-
--[[linux-4.4.1/pinctrl_find_and_add_gpio_range()]]
--[[linux-4.4.1/IS_ERR()]]
--[[linux-4.4.1/PTR_ERR()]]
--[[linux-4.4.1/chip_err()]]
--[[linux-4.4.1/kfree()]]
--[[linux-4.4.1/chip_dbg()]]
list_add_tail(&pin_range->node, &chip->pin_range...
-
--[[linux-4.4.1/list_add_tail()]]
return 0;
}
EXPORT_SYMBOL_GPL(gpiochip_add_pin_range);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]
*コメント [#f12a74c1]
終了行:
*参照元 [#ef2b5919]
#backlinks
*説明 [#pc72cba3]
-パス: [[linux-4.4.1/drivers/gpio/gpiolib.c]]
-FIXME: これは何?
--説明
**引数 [#d401e8e4]
-struct gpio_chip *chip
--
--[[linux-4.4.1/gpio_chip]]
-const char *pinctl_name
--
-unsigned int gpio_offset
--
-unsigned int pin_offset
--
-unsigned int npins
--
**返り値 [#v0e46793]
-int
--
**参考 [#a7f33214]
*実装 [#rf1b1181]
/**
* gpiochip_add_pin_range() - add a range for GPIO <-> p...
* @chip: the gpiochip to add the range for
* @pinctrl_name: the dev_name() of the pin controller t...
* @gpio_offset: the start offset in the current gpio_ch...
* @pin_offset: the start offset in the pin controller n...
* @npins: the number of pins from the offset of each pi...
* pin controller) to accumulate in this range
*/
int gpiochip_add_pin_range(struct gpio_chip *chip, const...
unsigned int gpio_offset, uns...
unsigned int npins)
{
struct gpio_pin_range *pin_range;
int ret;
-
--[[linux-4.4.1/gpio_pin_range]]
pin_range = kzalloc(sizeof(*pin_range), GFP_KERN...
if (!pin_range) {
chip_err(chip, "failed to allocate pin r...
return -ENOMEM;
}
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/chip_err()]]
/* Use local offset as range ID */
pin_range->range.id = gpio_offset;
pin_range->range.gc = chip;
pin_range->range.name = chip->label;
pin_range->range.base = chip->base + gpio_offset;
pin_range->range.pin_base = pin_offset;
pin_range->range.npins = npins;
pin_range->pctldev = pinctrl_find_and_add_gpio_r...
&pin_range->range);
if (IS_ERR(pin_range->pctldev)) {
ret = PTR_ERR(pin_range->pctldev);
chip_err(chip, "could not create pin ran...
kfree(pin_range);
return ret;
}
chip_dbg(chip, "created GPIO range %d->%d ==> %s...
gpio_offset, gpio_offset + npins - 1,
pinctl_name,
pin_offset, pin_offset + npins - 1);
-
--[[linux-4.4.1/pinctrl_find_and_add_gpio_range()]]
--[[linux-4.4.1/IS_ERR()]]
--[[linux-4.4.1/PTR_ERR()]]
--[[linux-4.4.1/chip_err()]]
--[[linux-4.4.1/kfree()]]
--[[linux-4.4.1/chip_dbg()]]
list_add_tail(&pin_range->node, &chip->pin_range...
-
--[[linux-4.4.1/list_add_tail()]]
return 0;
}
EXPORT_SYMBOL_GPL(gpiochip_add_pin_range);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]
*コメント [#f12a74c1]
ページ名: