mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
linuxkpi: Move class_create to .c file
class_create encodes the size of struct class into the generated code. Move from .h file to .c file to move this knowledge from the client modules that call this into the linuxkpi module. Sponsored by: Netflix Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D34769
This commit is contained in:
parent
702b687503
commit
1341ac9f9c
2 changed files with 21 additions and 19 deletions
|
|
@ -289,6 +289,8 @@ put_device(struct device *dev)
|
|||
kobject_put(&dev->kobj);
|
||||
}
|
||||
|
||||
struct class *class_create(struct module *owner, const char *name);
|
||||
|
||||
static inline int
|
||||
class_register(struct class *class)
|
||||
{
|
||||
|
|
@ -525,25 +527,6 @@ linux_class_kfree(struct class *class)
|
|||
kfree(class);
|
||||
}
|
||||
|
||||
static inline struct class *
|
||||
class_create(struct module *owner, const char *name)
|
||||
{
|
||||
struct class *class;
|
||||
int error;
|
||||
|
||||
class = kzalloc(sizeof(*class), M_WAITOK);
|
||||
class->owner = owner;
|
||||
class->name = name;
|
||||
class->class_release = linux_class_kfree;
|
||||
error = class_register(class);
|
||||
if (error) {
|
||||
kfree(class);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (class);
|
||||
}
|
||||
|
||||
static inline void
|
||||
class_destroy(struct class *class)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -496,6 +496,25 @@ error:
|
|||
return ERR_PTR(retval);
|
||||
}
|
||||
|
||||
struct class *
|
||||
class_create(struct module *owner, const char *name)
|
||||
{
|
||||
struct class *class;
|
||||
int error;
|
||||
|
||||
class = kzalloc(sizeof(*class), M_WAITOK);
|
||||
class->owner = owner;
|
||||
class->name = name;
|
||||
class->class_release = linux_class_kfree;
|
||||
error = class_register(class);
|
||||
if (error) {
|
||||
kfree(class);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (class);
|
||||
}
|
||||
|
||||
int
|
||||
kobject_init_and_add(struct kobject *kobj, const struct kobj_type *ktype,
|
||||
struct kobject *parent, const char *fmt, ...)
|
||||
|
|
|
|||
Loading…
Reference in a new issue