本文整理汇总了C++中idr_get_new函数的典型用法代码示例。如果您正苦于以下问题:C++ idr_get_new函数的具体用法?C++ idr_get_new怎么用?C++ idr_get_new使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了idr_get_new函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: add_client_resource
static int add_client_resource(struct client *client,
struct client_resource *resource, gfp_t gfp_mask)
{
unsigned long flags;
int ret;
retry:
if (idr_pre_get(&client->resource_idr, gfp_mask) == 0)
return -ENOMEM;
spin_lock_irqsave(&client->lock, flags);
if (client->in_shutdown)
ret = -ECANCELED;
else
ret = idr_get_new(&client->resource_idr, resource,
&resource->handle);
if (ret >= 0) {
client_get(client);
if (resource->release == release_iso_resource)
schedule_iso_resource(container_of(resource,
struct iso_resource, resource));
}
spin_unlock_irqrestore(&client->lock, flags);
if (ret == -EAGAIN)
goto retry;
return ret < 0 ? ret : 0;
}
开发者ID:mikeberkelaar,项目名称:grhardened,代码行数:29,代码来源:core-cdev.c
示例2: dca_sysfs_add_provider
int dca_sysfs_add_provider(struct dca_provider *dca, struct device *dev)
{
struct device *cd;
int err = 0;
idr_try_again:
if (!idr_pre_get(&dca_idr, GFP_KERNEL))
return -ENOMEM;
spin_lock(&dca_idr_lock);
err = idr_get_new(&dca_idr, dca, &dca->id);
spin_unlock(&dca_idr_lock);
switch (err) {
case 0:
break;
case -EAGAIN:
goto idr_try_again;
default:
return err;
}
cd = device_create(dca_class, dev, MKDEV(0, 0), NULL, "dca%d", dca->id);
if (IS_ERR(cd)) {
spin_lock(&dca_idr_lock);
idr_remove(&dca_idr, dca->id);
spin_unlock(&dca_idr_lock);
return PTR_ERR(cd);
}
dca->cd = cd;
return 0;
}
开发者ID:1111saeid,项目名称:jb_kernel_3.0.16_htc_golfu,代码行数:30,代码来源:dca-sysfs.c
示例3: ERR_PTR
/**
* hwmon_device_register - register w/ hwmon
* @dev: the device to register
*
* hwmon_device_unregister() must be called when the device is no
* longer needed.
*
* Returns the pointer to the new device.
*/
struct device *hwmon_device_register(struct device *dev)
{
struct device *hwdev;
int id, err;
again:
if (unlikely(idr_pre_get(&hwmon_idr, GFP_KERNEL) == 0))
return ERR_PTR(-ENOMEM);
spin_lock(&idr_lock);
err = idr_get_new(&hwmon_idr, NULL, &id);
spin_unlock(&idr_lock);
if (unlikely(err == -EAGAIN))
goto again;
else if (unlikely(err))
return ERR_PTR(err);
id = id & MAX_ID_MASK;
hwdev = device_create(hwmon_class, dev, MKDEV(0, 0), NULL,
HWMON_ID_FORMAT, id);
if (IS_ERR(hwdev)) {
spin_lock(&idr_lock);
idr_remove(&hwmon_idr, id);
spin_unlock(&idr_lock);
}
return hwdev;
}
开发者ID:debugevery,项目名称:android-kernel-samsung-dev,代码行数:39,代码来源:hwmon.c
示例4: next_free_minor
static int next_free_minor(struct mapped_device *md, int *minor)
{
int r, m;
r = idr_pre_get(&_minor_idr, GFP_KERNEL);
if (!r)
return -ENOMEM;
spin_lock(&_minor_lock);
r = idr_get_new(&_minor_idr, MINOR_ALLOCED, &m);
if (r) {
goto out;
}
if (m >= (1 << MINORBITS)) {
idr_remove(&_minor_idr, m);
r = -ENOSPC;
goto out;
}
*minor = m;
out:
spin_unlock(&_minor_lock);
return r;
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:27,代码来源:dm.c
示例5: new_bat_id
static int new_bat_id(void)
{
int ret;
while (1) {
int id;
ret = idr_pre_get(&bat_idr, GFP_KERNEL);
if (ret == 0)
return -ENOMEM;
mutex_lock(&bat_idr_lock);
ret = idr_get_new(&bat_idr, NULL, &id);
mutex_unlock(&bat_idr_lock);
if (ret == 0) {
ret = id & MAX_ID_MASK;
break;
} else if (ret == -EAGAIN) {
continue;
} else {
break;
}
}
return ret;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:27,代码来源:w1_ds2760.c
示例6: next_free_minor
static int next_free_minor(struct mapped_device *md, unsigned int *minor)
{
int r;
unsigned int m;
down(&_minor_lock);
r = idr_pre_get(&_minor_idr, GFP_KERNEL);
if (!r) {
r = -ENOMEM;
goto out;
}
r = idr_get_new(&_minor_idr, md, &m);
if (r) {
goto out;
}
if (m >= (1 << MINORBITS)) {
idr_remove(&_minor_idr, m);
r = -ENOSPC;
goto out;
}
*minor = m;
out:
up(&_minor_lock);
return r;
}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:30,代码来源:dm.c
示例7: uio_get_minor
static int uio_get_minor(struct uio_device *idev)
{
int retval = -ENOMEM;
int id;
mutex_lock(&minor_lock);
if (idr_pre_get(&uio_idr, GFP_KERNEL) == 0)
goto exit;
retval = idr_get_new(&uio_idr, idev, &id);
if (retval < 0) {
if (retval == -EAGAIN)
retval = -ENOMEM;
goto exit;
}
if (id < UIO_MAX_DEVICES) {
idev->minor = id;
} else {
dev_err(idev->dev, "too many uio devices\n");
retval = -EINVAL;
idr_remove(&uio_idr, id);
}
exit:
mutex_unlock(&minor_lock);
return retval;
}
开发者ID:civato,项目名称:9005-LL-DEV,代码行数:26,代码来源:uio.c
示例8: v9fs_get_idpool
int v9fs_get_idpool(struct v9fs_idpool *p)
{
int i = 0;
int error;
retry:
if (idr_pre_get(&p->pool, GFP_KERNEL) == 0)
return 0;
if (down_interruptible(&p->lock) == -EINTR) {
eprintk(KERN_WARNING, "Interrupted while locking\n");
return -1;
}
/* no need to store exactly p, we just need something non-null */
error = idr_get_new(&p->pool, p, &i);
up(&p->lock);
if (error == -EAGAIN)
goto retry;
else if (error)
return -1;
return i;
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:25,代码来源:v9fs.c
示例9: blk_alloc_devt
/**
* blk_alloc_devt - allocate a dev_t for a partition
* @part: partition to allocate dev_t for
* @devt: out parameter for resulting dev_t
*
* Allocate a dev_t for block device.
*
* RETURNS:
* 0 on success, allocated dev_t is returned in *@devt. -errno on
* failure.
*
* CONTEXT:
* Might sleep.
*/
int blk_alloc_devt(struct hd_struct *part, dev_t *devt)
{
struct gendisk *disk = part_to_disk(part);
int idx, rc;
/* in consecutive minor range? */
if (part->partno < disk->minors) {
*devt = MKDEV(disk->major, disk->first_minor + part->partno);
return 0;
}
/* allocate ext devt */
do {
if (!idr_pre_get(&ext_devt_idr, GFP_KERNEL))
return -ENOMEM;
rc = idr_get_new(&ext_devt_idr, part, &idx);
} while (rc == -EAGAIN);
if (rc)
return rc;
if (idx > MAX_EXT_DEVT) {
idr_remove(&ext_devt_idr, idx);
return -EBUSY;
}
*devt = MKDEV(BLOCK_EXT_MAJOR, blk_mangle_minor(idx));
return 0;
}
开发者ID:Vincentxiaojie,项目名称:xpenology,代码行数:43,代码来源:genhd.c
示例10: pps_register_cdev
int pps_register_cdev(struct pps_device *pps)
{
int err;
dev_t devt;
mutex_lock(&pps_idr_lock);
if (idr_pre_get(&pps_idr, GFP_KERNEL) == 0) {
mutex_unlock(&pps_idr_lock);
return -ENOMEM;
}
err = idr_get_new(&pps_idr, pps, &pps->id);
mutex_unlock(&pps_idr_lock);
if (err < 0)
return err;
pps->id &= MAX_ID_MASK;
if (pps->id >= PPS_MAX_SOURCES) {
pr_err("%s: too many PPS sources in the system\n",
pps->info.name);
err = -EBUSY;
goto free_idr;
}
devt = MKDEV(MAJOR(pps_devt), pps->id);
cdev_init(&pps->cdev, &pps_cdev_fops);
pps->cdev.owner = pps->info.owner;
err = cdev_add(&pps->cdev, devt, 1);
if (err) {
pr_err("%s: failed to add char device %d:%d\n",
pps->info.name, MAJOR(pps_devt), pps->id);
goto free_idr;
}
pps->dev = device_create(pps_class, pps->info.dev, devt, pps,
"pps%d", pps->id);
if (IS_ERR(pps->dev))
goto del_cdev;
pps->dev->release = pps_device_destruct;
pr_debug("source %s got cdev (%d:%d)\n", pps->info.name,
MAJOR(pps_devt), pps->id);
return 0;
del_cdev:
cdev_del(&pps->cdev);
free_idr:
mutex_lock(&pps_idr_lock);
idr_remove(&pps_idr, pps->id);
mutex_unlock(&pps_idr_lock);
return err;
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:59,代码来源:pps.c
示例11: bq27x00_battery_probe
static int bq27x00_battery_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
char *name;
struct bq27x00_device_info *di;
int num;
int retval = 0;
/* Get new ID for the new battery device */
retval = idr_pre_get(&battery_id, GFP_KERNEL);
if (retval == 0)
return -ENOMEM;
mutex_lock(&battery_mutex);
retval = idr_get_new(&battery_id, client, &num);
mutex_unlock(&battery_mutex);
if (retval < 0)
return retval;
name = kasprintf(GFP_KERNEL, "%s-%d", id->name, num);
if (!name) {
dev_err(&client->dev, "failed to allocate device name\n");
retval = -ENOMEM;
goto batt_failed_1;
}
di = kzalloc(sizeof(*di), GFP_KERNEL);
if (!di) {
dev_err(&client->dev, "failed to allocate device info data\n");
retval = -ENOMEM;
goto batt_failed_2;
}
di->id = num;
di->dev = &client->dev;
di->chip = id->driver_data;
di->bat.name = name;
di->bus.read = &bq27x00_read_i2c;
if (bq27x00_powersupply_init(di))
goto batt_failed_3;
i2c_set_clientdata(client, di);
return 0;
batt_failed_3:
kfree(di);
batt_failed_2:
kfree(name);
batt_failed_1:
mutex_lock(&battery_mutex);
idr_remove(&battery_id, num);
mutex_unlock(&battery_mutex);
return retval;
}
开发者ID:404992361,项目名称:mi1_kernel,代码行数:56,代码来源:bq27x00_battery.c
示例12: ctdb_reqid_new
uint32_t ctdb_reqid_new(struct ctdb_context *ctdb, void *state)
{
int id = idr_get_new_above(ctdb->idr, state, ctdb->lastid+1, INT_MAX);
if (id < 0) {
DEBUG(DEBUG_DEBUG, ("Reqid wrap!\n"));
id = idr_get_new(ctdb->idr, state, INT_MAX);
}
ctdb->lastid = id;
return id;
}
开发者ID:jrasamba,项目名称:samba,代码行数:10,代码来源:ctdb_util.c
示例13: ocrdma_get_instance
static int ocrdma_get_instance(void)
{
int instance = 0;
/* Assign an unused number */
if (!idr_pre_get(&ocrdma_dev_id, GFP_KERNEL))
return -1;
if (idr_get_new(&ocrdma_dev_id, NULL, &instance))
return -1;
return instance;
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:11,代码来源:ocrdma_main.c
示例14: talloc_zero
/*
make a remote ctdb call - async send. Called in daemon context.
This constructs a ctdb_call request and queues it for processing.
This call never blocks.
*/
struct ctdb_call_state *ctdb_daemon_call_send_remote(struct ctdb_db_context *ctdb_db,
struct ctdb_call *call,
struct ctdb_ltdb_header *header)
{
uint32_t len;
struct ctdb_call_state *state;
struct ctdb_context *ctdb = ctdb_db->ctdb;
state = talloc_zero(ctdb_db, struct ctdb_call_state);
CTDB_NO_MEMORY_NULL(ctdb, state);
len = offsetof(struct ctdb_req_call, data) + call->key.dsize + call->call_data.dsize;
state->c = ctdb->methods->allocate_pkt(state, len);
CTDB_NO_MEMORY_NULL(ctdb, state->c);
talloc_set_name_const(state->c, "req_call packet");
state->c->hdr.length = len;
state->c->hdr.ctdb_magic = CTDB_MAGIC;
state->c->hdr.ctdb_version = CTDB_VERSION;
state->c->hdr.operation = CTDB_REQ_CALL;
state->c->hdr.destnode = header->dmaster;
state->c->hdr.srcnode = ctdb->vnn;
/* this limits us to 16k outstanding messages - not unreasonable */
state->c->hdr.reqid = idr_get_new(ctdb->idr, state, 0xFFFF);
state->c->flags = call->flags;
state->c->db_id = ctdb_db->db_id;
state->c->callid = call->call_id;
state->c->keylen = call->key.dsize;
state->c->calldatalen = call->call_data.dsize;
memcpy(&state->c->data[0], call->key.dptr, call->key.dsize);
memcpy(&state->c->data[call->key.dsize],
call->call_data.dptr, call->call_data.dsize);
state->call = *call;
state->call.call_data.dptr = &state->c->data[call->key.dsize];
state->call.key.dptr = &state->c->data[0];
state->node = ctdb->nodes[header->dmaster];
state->state = CTDB_CALL_WAIT;
state->header = *header;
state->ctdb_db = ctdb_db;
talloc_set_destructor(state, ctdb_call_destructor);
ctdb_queue_packet(ctdb, &state->c->hdr);
event_add_timed(ctdb->ev, state, timeval_current_ofs(CTDB_REQ_TIMEOUT, 0),
ctdb_call_timeout, state);
return state;
}
开发者ID:technosaurus,项目名称:samba4-GPL2,代码行数:55,代码来源:ctdb_call.c
示例15: nfs_get_cb_ident_idr
/*
* Get a unique NFSv4.0 callback identifier which will be used
* by the V4.0 callback service to lookup the nfs_client struct
*/
static int nfs_get_cb_ident_idr(struct nfs_client *clp, int minorversion)
{
int ret = 0;
struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id);
if (clp->rpc_ops->version != 4 || minorversion != 0)
return ret;
retry:
if (!idr_pre_get(&nn->cb_ident_idr, GFP_KERNEL))
return -ENOMEM;
spin_lock(&nn->nfs_client_lock);
ret = idr_get_new(&nn->cb_ident_idr, clp, &clp->cl_cb_ident);
spin_unlock(&nn->nfs_client_lock);
if (ret == -EAGAIN)
goto retry;
return ret;
}
开发者ID:AllenDou,项目名称:linux,代码行数:21,代码来源:nfs4client.c
示例16: ERR_PTR
struct display_device *display_device_register(struct display_driver *driver,
struct device *parent, void *devdata)
{
struct display_device *new_dev = NULL;
int ret = -EINVAL;
if (unlikely(!driver))
return ERR_PTR(ret);
mutex_lock(&allocated_dsp_lock);
ret = idr_pre_get(&allocated_dsp, GFP_KERNEL);
mutex_unlock(&allocated_dsp_lock);
if (!ret)
return ERR_PTR(ret);
new_dev = kzalloc(sizeof(struct display_device), GFP_KERNEL);
if (likely(new_dev) && unlikely(driver->probe(new_dev, devdata))) {
// Reserve the index for this display
mutex_lock(&allocated_dsp_lock);
ret = idr_get_new(&allocated_dsp, new_dev, &new_dev->idx);
mutex_unlock(&allocated_dsp_lock);
if (!ret) {
new_dev->dev = device_create_drvdata(display_class,
parent,
MKDEV(0,0),
new_dev,
"display%d",
new_dev->idx);
if (!IS_ERR(new_dev->dev)) {
new_dev->parent = parent;
new_dev->driver = driver;
mutex_init(&new_dev->lock);
return new_dev;
}
mutex_lock(&allocated_dsp_lock);
idr_remove(&allocated_dsp, new_dev->idx);
mutex_unlock(&allocated_dsp_lock);
ret = -EINVAL;
}
}
kfree(new_dev);
return ERR_PTR(ret);
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:44,代码来源:display-sysfs.c
示例17: uio_get_minor
static int uio_get_minor(struct uio_device *idev)
{
int retval = -ENOMEM;
int id;
mutex_lock(&minor_lock);
if (idr_pre_get(&uio_idr, GFP_KERNEL) == 0)
goto exit;
retval = idr_get_new(&uio_idr, idev, &id);
if (retval < 0) {
if (retval == -EAGAIN)
retval = -ENOMEM;
goto exit;
}
idev->minor = id & MAX_ID_MASK;
exit:
mutex_unlock(&minor_lock);
return retval;
}
开发者ID:Stefan-Schmidt,项目名称:linux-2.6,代码行数:20,代码来源:uio.c
示例18: p9_idpool_get
int p9_idpool_get(struct p9_idpool *p)
{
int i = 0;
int error;
unsigned long flags;
retry:
if (idr_pre_get(&p->pool, GFP_KERNEL) == 0)
return 0;
spin_lock_irqsave(&p->lock, flags);
/* no need to store exactly p, we just need something non-null */
error = idr_get_new(&p->pool, p, &i);
spin_unlock_irqrestore(&p->lock, flags);
if (error == -EAGAIN)
goto retry;
else if (error)
return -1;
P9_DPRINTK(P9_DEBUG_MUX, " id %d pool %p\n", i, p);
return i;
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:24,代码来源:util.c
示例19: container_of
struct ib_qp *ehca_create_qp(struct ib_pd *pd,
struct ib_qp_init_attr *init_attr,
struct ib_udata *udata)
{
static int da_rc_msg_size[]={ 128, 256, 512, 1024, 2048, 4096 };
static int da_ud_sq_msg_size[]={ 128, 384, 896, 1920, 3968 };
struct ehca_qp *my_qp;
struct ehca_pd *my_pd = container_of(pd, struct ehca_pd, ib_pd);
struct ehca_shca *shca = container_of(pd->device, struct ehca_shca,
ib_device);
struct ib_ucontext *context = NULL;
u64 h_ret;
int max_send_sge, max_recv_sge, ret;
/* h_call's out parameters */
struct ehca_alloc_qp_parms parms;
u32 swqe_size = 0, rwqe_size = 0;
u8 daqp_completion, isdaqp;
unsigned long flags;
if (init_attr->sq_sig_type != IB_SIGNAL_REQ_WR &&
init_attr->sq_sig_type != IB_SIGNAL_ALL_WR) {
ehca_err(pd->device, "init_attr->sg_sig_type=%x not allowed",
init_attr->sq_sig_type);
return ERR_PTR(-EINVAL);
}
/* save daqp completion bits */
daqp_completion = init_attr->qp_type & 0x60;
/* save daqp bit */
isdaqp = (init_attr->qp_type & 0x80) ? 1 : 0;
init_attr->qp_type = init_attr->qp_type & 0x1F;
if (init_attr->qp_type != IB_QPT_UD &&
init_attr->qp_type != IB_QPT_SMI &&
init_attr->qp_type != IB_QPT_GSI &&
init_attr->qp_type != IB_QPT_UC &&
init_attr->qp_type != IB_QPT_RC) {
ehca_err(pd->device, "wrong QP Type=%x", init_attr->qp_type);
return ERR_PTR(-EINVAL);
}
if ((init_attr->qp_type != IB_QPT_RC && init_attr->qp_type != IB_QPT_UD)
&& isdaqp) {
ehca_err(pd->device, "unsupported LL QP Type=%x",
init_attr->qp_type);
return ERR_PTR(-EINVAL);
} else if (init_attr->qp_type == IB_QPT_RC && isdaqp &&
(init_attr->cap.max_send_wr > 255 ||
init_attr->cap.max_recv_wr > 255 )) {
ehca_err(pd->device, "Invalid Number of max_sq_wr =%x "
"or max_rq_wr=%x for QP Type=%x",
init_attr->cap.max_send_wr,
init_attr->cap.max_recv_wr,init_attr->qp_type);
return ERR_PTR(-EINVAL);
} else if (init_attr->qp_type == IB_QPT_UD && isdaqp &&
init_attr->cap.max_send_wr > 255) {
ehca_err(pd->device,
"Invalid Number of max_send_wr=%x for UD QP_TYPE=%x",
init_attr->cap.max_send_wr, init_attr->qp_type);
return ERR_PTR(-EINVAL);
}
if (pd->uobject && udata)
context = pd->uobject->context;
my_qp = kmem_cache_zalloc(qp_cache, GFP_KERNEL);
if (!my_qp) {
ehca_err(pd->device, "pd=%p not enough memory to alloc qp", pd);
return ERR_PTR(-ENOMEM);
}
memset (&parms, 0, sizeof(struct ehca_alloc_qp_parms));
spin_lock_init(&my_qp->spinlock_s);
spin_lock_init(&my_qp->spinlock_r);
my_qp->recv_cq =
container_of(init_attr->recv_cq, struct ehca_cq, ib_cq);
my_qp->send_cq =
container_of(init_attr->send_cq, struct ehca_cq, ib_cq);
my_qp->init_attr = *init_attr;
do {
if (!idr_pre_get(&ehca_qp_idr, GFP_KERNEL)) {
ret = -ENOMEM;
ehca_err(pd->device, "Can't reserve idr resources.");
goto create_qp_exit0;
}
spin_lock_irqsave(&ehca_qp_idr_lock, flags);
ret = idr_get_new(&ehca_qp_idr, my_qp, &my_qp->token);
spin_unlock_irqrestore(&ehca_qp_idr_lock, flags);
} while (ret == -EAGAIN);
if (ret) {
ret = -ENOMEM;
ehca_err(pd->device, "Can't allocate new idr entry.");
goto create_qp_exit0;
}
//.........这里部分代码省略.........
开发者ID:Mr-Aloof,项目名称:wl500g,代码行数:101,代码来源:ehca_qp.c
示例20: bq24196_probe
static int bq24196_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
char *name;
struct bq24196_device_info *di;
struct bq24196_access_methods *bus;
int num;
int retval = 0;
printk("lfc bq24196_probe\n");
if(!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
printk("lfc bq24196_probe,i2c_func error\n");
goto err_check_functionality_failed;
}
/* Get new ID for the new battery device */
retval = idr_pre_get(&bq24196_charger_id, GFP_KERNEL);
if (retval == 0)
return -ENOMEM;
retval = idr_get_new(&bq24196_charger_id, client, &num);
if (retval < 0)
return retval;
name = kasprintf(GFP_KERNEL, "%s-%d", id->name, num);
if (!name) {
dev_err(&client->dev, "failed to allocate device name\n");
retval = -ENOMEM;
goto bq24196_chg_failed_1;
}
di = kzalloc(sizeof(*di), GFP_KERNEL);
if (!di) {
dev_err(&client->dev, "failed to allocate device info data\n");
retval = -ENOMEM;
goto bq24196_chg_failed_2;
}
di->id = num;
bus = kzalloc(sizeof(*bus), GFP_KERNEL);
if (!bus) {
dev_err(&client->dev, "failed to allocate access method "
"data\n");
retval = -ENOMEM;
goto bq24196_chg_failed_3;
}
i2c_set_clientdata(client, di);
di->dev = &client->dev;
bus->read = &bq24196_read_i2c;
bus->write = &bq24196_write_i2c;
di->bus = bus;
di->client = client;
bq24196_client = client;
bq24196_di = di;
mutex_init(&di->i2c_lock);
bq24196_hw_config_init(di);
return 0;
err_check_functionality_failed:
printk("lfc bq24196_probe fail\n");
return 0;
bq24196_chg_failed_3:
kfree(di);
bq24196_chg_failed_2:
kfree(name);
bq24196_chg_failed_1:
idr_remove(&bq24196_charger_id,num);
return retval;
}
开发者ID:teamgummy,项目名称:android_kernel_oppo_find7,代码行数:69,代码来源:bq24196_charger.c
注:本文中的idr_get_new函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论