*参照元 [#sa975bb1]
#backlinks

*説明 [#j7853fdd]
-パス: [[linux-4.4.1/drivers/gpio/gpiolib-of.c]]

-FIXME: これは何?
--説明


**引数 [#p80cb2d1]
-struct device_node *np
--
--[[linux-4.4.1/device_node]]
-struct of_mm_gpio_chip *mm_gc
--
--[[linux-4.4.1/of_mm_gpio_chip]]


**返り値 [#n06533ad]
-int
--


**参考 [#f420523e]


*実装 [#s96ca144]
 /**
  * of_mm_gpiochip_add - Add memory mapped GPIO chip (bank)
  * @np:         device node of the GPIO chip
  * @mm_gc:      pointer to the of_mm_gpio_chip allocated structure
  *
  * To use this function you should allocate and fill mm_gc with:
  *
  * 1) In the gpio_chip structure:
  *    - all the callbacks
  *    - of_gpio_n_cells
  *    - of_xlate callback (optional)
  *
  * 3) In the of_mm_gpio_chip structure:
  *    - save_regs callback (optional)
  *
  * If succeeded, this function will map bank's memory and will
  * do all necessary work for you. Then you'll able to use .regs
  * to manage GPIOs from the callbacks.
  */
 int of_mm_gpiochip_add(struct device_node *np,
                        struct of_mm_gpio_chip *mm_gc)
 {
         int ret = -ENOMEM;
         struct gpio_chip *gc = &mm_gc->gc;
 
-
--[[linux-4.4.1/gpio_chip]]

         gc->label = kstrdup(np->full_name, GFP_KERNEL);
         if (!gc->label)
                 goto err0;
 
-
--[[linux-4.4.1/kstrdup()]]

         mm_gc->regs = of_iomap(np, 0);
         if (!mm_gc->regs)
                 goto err1;
 
-
--[[linux-4.4.1/of_iomap()]]

         gc->base = -1;
 
         if (mm_gc->save_regs)
                 mm_gc->save_regs(mm_gc);
 
         mm_gc->gc.of_node = np;
 
         ret = gpiochip_add(gc);
         if (ret)
                 goto err2;
 
-
--[[linux-4.4.1/gpiochip_add()]]

         return 0;
 err2:
         iounmap(mm_gc->regs);
-
--[[linux-4.4.1/iounmap()]]

 err1:
         kfree(gc->label);
-
--[[linux-4.4.1/kfree()]]

 err0:
         pr_err("%s: GPIO chip registration failed with status %d\n",
                np->full_name, ret);
-
--[[linux-4.4.1/pr_err()]]

         return ret;
 }
 EXPORT_SYMBOL(of_mm_gpiochip_add);
-
--[[linux-4.4.1/EXPORT_SYMBOL()]]


*コメント [#e014db24]


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS