To separate initialization and instance creation on resource driver,
the new ops create/delete are introduced. Now, each operation is
used as below:
- init: Setup the common contexts for resource (called once)
- exit: Clear the init-ed contexts (called once)
- create: Create resource instance with an individual context
- delete: Free own context and remove resource instance
Change-Id: I4987f26afd6de7e7ec0b1d8ed6a724acbf55e374
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
};
struct resource_driver_ops {
};
struct resource_driver_ops {
- int (*init)(struct resource *res);
- void (*exit)(struct resource *res);
+ int (*init)(void);
+ void (*exit)(void);
+ int (*create)(struct resource *res);
+ void (*delete)(struct resource *res);
/*
* If prepare_update is specified, it will be called
* at every update_resource_attrs().
/*
* If prepare_update is specified, it will be called
* at every update_resource_attrs().
- if (resource->driver && resource->driver->ops.exit)
- resource->driver->ops.exit(resource);
+ if (resource->driver && resource->driver->ops.delete)
+ resource->driver->ops.delete(resource);
unset_resource_attr_interest(resource, RESOURCE_ATTR_MASK);
unset_resource_attr_interest(resource, RESOURCE_ATTR_MASK);
resource->ctrls = driver->ctrls;
resource->num_ctrls = driver->num_ctrls;
resource->ctrls = driver->ctrls;
resource->num_ctrls = driver->num_ctrls;
- if (driver->ops.init) {
- ret = driver->ops.init(resource);
+ if (driver->ops.create) {
+ ret = driver->ops.create(resource);
if (ret < 0) {
_E("failed to initialize resource driver, res:type(%s)id(%d)\n",
resource->name, resource->id);
if (ret < 0) {
_E("failed to initialize resource driver, res:type(%s)id(%d)\n",
resource->name, resource->id);