*参照元 [#m0fec2be]
#backlinks

*説明 [#bb8393af]
-パス: [[linux-4.4.1/drivers/base/class.c]]

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


**引数 [#ode30e81]
-struct module *owner
--
--[[linux-4.4.1/module]]
-const char *name
--
-struct lock_class_key *key
--
--[[linux-4.4.1/lock_class_key]]


**返り値 [#zd69b705]
-struct class *
--
--[[linux-4.4.1/class]]


**参考 [#j4ab1999]


*実装 [#q5d7dcbc]
 /**
  * class_create - create a struct class structure
  * @owner: pointer to the module that is to "own" this struct class
  * @name: pointer to a string for the name of this class.
  * @key: the lock_class_key for this class; used by mutex lock debugging
  *
  * This is used to create a struct class pointer that can then be used
  * in calls to device_create().
  *
  * Returns &struct class pointer on success, or ERR_PTR() on error.
  *
  * Note, the pointer created here is to be destroyed when finished by
  * making a call to class_destroy().
  */
 struct class *__class_create(struct module *owner, const char *name,
                              struct lock_class_key *key)
 {
         struct class *cls;
         int retval;
 
-
--[[linux-4.4.1/class]]

         cls = kzalloc(sizeof(*cls), GFP_KERNEL);
         if (!cls) {
                 retval = -ENOMEM;
                 goto error;
         }
 
-
--[[linux-4.4.1/kzalloc()]]

         cls->name = name;
         cls->owner = owner;
         cls->class_release = class_create_release;
 
-
--[[linux-4.4.1/class_create_release()]]

         retval = __class_register(cls, key);
         if (retval)
                 goto error;
 
-
--[[linux-4.4.1/__class_register()]]

         return cls;
 
 error:
         kfree(cls);
         return ERR_PTR(retval);
-
--[[linux-4.4.1/kfree()]]
--[[linux-4.4.1/ERR_PTR()]]

 }
 EXPORT_SYMBOL_GPL(__class_create);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]


*コメント [#g3d84b2f]


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