kent: change param order of kent_init
This commit is contained in:
parent
b8c4593fc5
commit
b7abbf1cf7
4 changed files with 19 additions and 6 deletions
|
@ -44,11 +44,11 @@ extern struct kent *kent_root;
|
|||
/**
|
||||
* Initialize a kent and increment its refcounter by one.
|
||||
*
|
||||
* @param parent: The parent kent.
|
||||
* @param kent: The kent.
|
||||
* @param parent: The parent kent.
|
||||
* @returns A nonzero value on failure
|
||||
*/
|
||||
int kent_init(struct kent *parent, struct kent *kent);
|
||||
int kent_init(struct kent *kent, struct kent *parent);
|
||||
|
||||
/**
|
||||
* Increment the reference counter.
|
||||
|
|
|
@ -12,6 +12,16 @@
|
|||
|
||||
struct kent *devices_kent = NULL;
|
||||
|
||||
static void device_destroy(struct kent *kent)
|
||||
{
|
||||
struct device *dev = to_device(kent);
|
||||
free(dev);
|
||||
}
|
||||
|
||||
struct kent_ops devices_kent_ops = {
|
||||
.destroy = &device_destroy,
|
||||
};
|
||||
|
||||
/** Initialize the devices subsystem. */
|
||||
int devices_init(void)
|
||||
{
|
||||
|
@ -22,7 +32,10 @@ int devices_init(void)
|
|||
if (devices_kent == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
return kent_init(NULL, devices_kent);
|
||||
/* we don't need that because the root device kent lives forever */
|
||||
devices_kent->operations = NULL;
|
||||
|
||||
return kent_init(devices_kent, NULL);
|
||||
}
|
||||
|
||||
int device_init(struct device *dev, struct device *parent)
|
||||
|
@ -30,7 +43,7 @@ int device_init(struct device *dev, struct device *parent)
|
|||
if (devices_kent == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
return kent_init(devices_kent, &dev->kent);
|
||||
return kent_init(&dev->kent, devices_kent);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -29,7 +29,7 @@ struct dmabuf *dmabuf_create(struct device *dev, size_t len)
|
|||
|
||||
buf->kent.operations = &dma_kent_ops;
|
||||
|
||||
err = kent_init(&dev->kent, &buf->kent);
|
||||
err = kent_init(&buf->kent, &dev->kent);
|
||||
if (err != 0) {
|
||||
free(buf);
|
||||
return NULL;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
struct kent *kent_root;
|
||||
|
||||
int kent_init(struct kent *parent, struct kent *kent)
|
||||
int kent_init(struct kent *kent, struct kent *parent)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue