当前位置: 首页>>代码示例>>C++>>正文


C++ dev_get函数代码示例

本文整理汇总了C++中dev_get函数的典型用法代码示例。如果您正苦于以下问题:C++ dev_get函数的具体用法?C++ dev_get怎么用?C++ dev_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dev_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: eql_emancipate

static int eql_emancipate(struct device *dev, slaving_request_t *srqp)
{
	struct device *master_dev;
	struct device *slave_dev;
	slaving_request_t srq;
	int err;

	err = verify_area(VERIFY_READ, (void *)srqp, sizeof (slaving_request_t));
	if (err) 
		return err;

	memcpy_fromfs (&srq, srqp, sizeof (slaving_request_t));
#ifdef EQL_DEBUG
	if (eql_debug >= 20)
		printk ("%s: emancipate `%s`\n", dev->name, srq.slave_name);
#endif
	master_dev = dev;		/* for "clarity" */
	slave_dev  = dev_get (srq.slave_name);

	if ( eql_is_slave (slave_dev) )	/* really is a slave */
	{
		equalizer_t *eql = (equalizer_t *) master_dev->priv;
		slave_dev->flags = slave_dev->flags & ~IFF_SLAVE;
		eql_remove_slave_dev (eql->queue, slave_dev);
		return 0;
	}
	return -EINVAL;
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:28,代码来源:eql.c

示例2: eql_s_slave_cfg

static int eql_s_slave_cfg(struct device *dev, slave_config_t *scp)
{
	slave_t *slave;
	equalizer_t *eql;
	struct device *slave_dev;
	slave_config_t sc;
	int err;

	err = verify_area(VERIFY_READ, (void *)scp, sizeof (slave_config_t));
	if (err) 
		return err;

#ifdef EQL_DEBUG
	if (eql_debug >= 20)
		printk ("%s: set config for slave `%s'\n", dev->name, sc.slave_name);
#endif
  
	memcpy_fromfs (&sc, scp, sizeof (slave_config_t));

	eql = (equalizer_t *) dev->priv;
	slave_dev = dev_get (sc.slave_name);

	if ( eql_is_slave (slave_dev) )
	{
		slave = eql_find_slave_dev (eql->queue, slave_dev);
		if (slave != 0)
		{
			slave->priority = sc.priority;
			slave->priority_bps = sc.priority;
			slave->priority_Bps = sc.priority / 8;
			return 0;
		}
	}
	return -EINVAL;
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:35,代码来源:eql.c

示例3: exynos_drm_hdmi_probe

static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct exynos_drm_subdrv *subdrv;
	struct drm_hdmi_context *ctx;

	DRM_DEBUG_KMS("%s\n", __FILE__);

	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
	if (!ctx) {
		DRM_LOG_KMS("failed to alloc common hdmi context.\n");
		return -ENOMEM;
	}

	subdrv = &ctx->subdrv;

	subdrv->dev = dev;
	subdrv->manager = &hdmi_manager;
	subdrv->probe = hdmi_subdrv_probe;
	subdrv->open = hdmi_subdrv_open;
	subdrv->close = hdmi_subdrv_close;

#if defined(CONFIG_BUSFREQ_OPP) || defined(CONFIG_BUSFREQ_LOCK_WRAPPER)
	/* To lock bus frequency in OPP mode */
	ctx->bus_dev = dev_get("exynos-busfreq");
#endif

	platform_set_drvdata(pdev, subdrv);

	exynos_drm_subdrv_register(subdrv);

	return 0;
}
开发者ID:InhyukYee,项目名称:PeanutButterWolf,代码行数:33,代码来源:exynos_drm_hdmi.c

示例4: exynos_frequency_unlock

static int exynos_frequency_unlock(struct device *dev)
{
	int ret = 0;
	struct device *busdev = dev_get("exynos-busfreq");

	if (atomic_read(&umts_link_pm_data.freqlock) == 1) {
		/* cpu frequency unlock */
		exynos_cpufreq_lock_free(DVFS_LOCK_ID_USB_IF);

		/* bus frequency unlock */
		ret = dev_unlock(busdev, dev);
		if (ret < 0) {
			mif_err("ERR: dev_unlock error: %d\n", ret);
			goto exit;
		}

		/* unlock minimum number of cpu cores */
		cpufreq_pegasusq_min_cpu_unlock();

		atomic_set(&umts_link_pm_data.freqlock, 0);
		mif_debug("success\n");
	}
exit:
	return ret;
}
开发者ID:BigBot96,项目名称:android_kernel_samsung_konawifixx,代码行数:25,代码来源:board-c1-modems.c

示例5: lapbeth_check_devices

/*
 *	Sanity check: remove all devices that ceased to exists and
 *	return '1' if the given LAPB device was affected.
 */
static int lapbeth_check_devices(struct net_device *dev)
{
	struct lapbethdev *lapbeth, *lapbeth_prev;
	int result = 0;
	unsigned long flags;
	
	save_flags(flags);
	cli();

	lapbeth_prev = NULL;

	for (lapbeth = lapbeth_devices; lapbeth != NULL; lapbeth = lapbeth->next) {
		if (!dev_get(lapbeth->ethname)) {
			if (lapbeth_prev)
				lapbeth_prev->next = lapbeth->next;
			else
				lapbeth_devices = lapbeth->next;
				
			if (&lapbeth->axdev == dev)
				result = 1;

			unregister_netdev(&lapbeth->axdev);
			dev_put(lapbeth->ethdev);
			kfree(lapbeth);
		}

		lapbeth_prev = lapbeth;
	}
	
	restore_flags(flags);
	
	return result;
}
开发者ID:dmgerman,项目名称:original,代码行数:37,代码来源:lapbether.c

示例6: ipip_tunnel_locate

struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int create)
{
	u32 remote = parms->iph.daddr;
	u32 local = parms->iph.saddr;
	struct ip_tunnel *t, **tp, *nt;
	struct device *dev;
	unsigned h = 0;
	int prio = 0;

	if (remote) {
		prio |= 2;
		h ^= HASH(remote);
	}
	if (local) {
		prio |= 1;
		h ^= HASH(local);
	}
	for (tp = &tunnels[prio][h]; (t = *tp) != NULL; tp = &t->next) {
		if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr)
			return t;
	}
	if (!create)
		return NULL;

	MOD_INC_USE_COUNT;
	dev = kmalloc(sizeof(*dev) + sizeof(*t), GFP_KERNEL);
	if (dev == NULL) {
		MOD_DEC_USE_COUNT;
		return NULL;
	}
	memset(dev, 0, sizeof(*dev) + sizeof(*t));
	dev->priv = (void*)(dev+1);
	nt = (struct ip_tunnel*)dev->priv;
	nt->dev = dev;
	dev->name = nt->parms.name;
	dev->init = ipip_tunnel_init;
	memcpy(&nt->parms, parms, sizeof(*parms));
	if (dev->name[0] == 0) {
		int i;
		for (i=1; i<100; i++) {
			sprintf(dev->name, "tunl%d", i);
			if (dev_get(dev->name) == NULL)
				break;
		}
		if (i==100)
			goto failed;
		memcpy(parms->name, dev->name, IFNAMSIZ);
	}
	if (register_netdevice(dev) < 0)
		goto failed;

	ipip_tunnel_link(nt);
	/* Do not decrement MOD_USE_COUNT here. */
	return nt;

failed:
	kfree(dev);
	MOD_DEC_USE_COUNT;
	return NULL;
}
开发者ID:GNUHurdTR,项目名称:hurd,代码行数:60,代码来源:ipip.c

示例7: exynos_frequency_lock

static int exynos_frequency_lock(struct device *dev)
{
	unsigned int level, cpufreq = 600; /* 200 ~ 1400 */
	unsigned int busfreq = 400200; /* 100100 ~ 400200 */
	int ret = 0, lock_id;
	atomic_t *freqlock;
	struct device *busdev = dev_get("exynos-busfreq");

	if (!strcmp(dev->bus->name, "usb")) {
		lock_id = DVFS_LOCK_ID_USB_IF;
		cpufreq = 600;
		freqlock = &umts_link_pm_data.freqlock;
	} else if (!strcmp(dev->bus->name, "platform")) { // for dpram lock
		lock_id = DVFS_LOCK_ID_DPRAM_IF;
		cpufreq = 800;
		freqlock = &umts_link_pm_data.freq_dpramlock;
	} else {
		mif_err("ERR: Unkown unlock ID (%s)\n", dev->bus->name);
		goto exit;
	}
	
	if (atomic_read(freqlock) == 0) {
		/* cpu frequency lock */
		ret = exynos_cpufreq_get_level(cpufreq * 1000, &level);
		if (ret < 0) {
			mif_err("ERR: exynos_cpufreq_get_level fail: %d\n",
					ret);
			goto exit;
		}

		ret = exynos_cpufreq_lock(lock_id, level);
		if (ret < 0) {
			mif_err("ERR: exynos_cpufreq_lock fail: %d\n", ret);
			goto exit;
		}

		/* bus frequncy lock */
		if (!busdev) {
			mif_err("ERR: busdev is not exist\n");
			ret = -ENODEV;
			goto exit;
		}

		ret = dev_lock(busdev, dev, busfreq);
		if (ret < 0) {
			mif_err("ERR: dev_lock error: %d\n", ret);
			goto exit;
		}

		/* lock minimum number of cpu cores */
		cpufreq_pegasusq_min_cpu_lock(2);

		atomic_set(freqlock, 1);
		mif_info("level=%d, cpufreq=%d MHz, busfreq=%06d\n",
				level, cpufreq, busfreq);
	}
exit:
	return ret;
}
开发者ID:CyanideL,项目名称:android_kernel_samsung_smdk4x12,代码行数:59,代码来源:board-c1lgt-modems.c

示例8: eql_enslave

static int eql_enslave(struct device *dev, slaving_request_t *srqp)
{
	struct device *master_dev;
	struct device *slave_dev;
	slaving_request_t srq;
	int err;

	err = verify_area(VERIFY_READ, (void *)srqp, sizeof (slaving_request_t));
	if (err)  
	  {
#ifdef EQL_DEBUG
	if (eql_debug >= 20)
		printk ("EQL enslave: error detected by verify_area\n");
#endif  
		return err;
	  }
	memcpy_fromfs (&srq, srqp, sizeof (slaving_request_t));

#ifdef EQL_DEBUG
	if (eql_debug >= 20)
		printk ("%s: enslave '%s' %ld bps\n", dev->name, 
			srq.slave_name, srq.priority);
#endif  
	master_dev = dev;		/* for "clarity" */
	slave_dev  = dev_get (srq.slave_name);

	if (master_dev != 0 && slave_dev != 0)
	{
		if (! eql_is_master (slave_dev)  &&   /* slave is not a master */
			! eql_is_slave (slave_dev)      ) /* slave is not already a slave */
		{
			slave_t *s = eql_new_slave ();
			equalizer_t *eql = (equalizer_t *) master_dev->priv;
			s->dev = slave_dev;
			s->priority = srq.priority;
			s->priority_bps = srq.priority;
			s->priority_Bps = srq.priority / 8;
			slave_dev->flags |= IFF_SLAVE;
			eql_insert_slave (eql->queue, s);
			return 0;
		}
#ifdef EQL_DEBUG
	if (eql_debug >= 20)
		printk ("EQL enslave: slave is master or slave is already slave\n");
#endif  

		return -EINVAL;
	}
#ifdef EQL_DEBUG
	if (eql_debug >= 20)
		printk ("EQL enslave: master or slave are NULL");
#endif  
	return -EINVAL;
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:54,代码来源:eql.c

示例9:

/*
 *	Check that the device given is a valid AX.25 interface that is "up".
 */
struct device *rose_ax25_dev_get(char *devname)
{
	struct device *dev;

	if ((dev = dev_get(devname)) == NULL)
		return NULL;

	if ((dev->flags & IFF_UP) && dev->type == ARPHRD_AX25)
		return dev;

	return NULL;
}
开发者ID:shattered,项目名称:linux-m68k,代码行数:15,代码来源:rose_route.c

示例10: dev_load

extern __inline__ void dev_load(const char *name)
{
	if(!dev_get(name) && suser()) {
#ifdef CONFIG_NET_ALIAS
		const char *sptr;
 
		for (sptr=name ; *sptr ; sptr++) if(*sptr==':') break;
		if (!(*sptr && *(sptr+1)))
#endif
		request_module(name);
	}
}
开发者ID:0xffea,项目名称:gnumach,代码行数:12,代码来源:dev.c

示例11: init_module

int init_module(void)
{
	dev_ethertap.base_addr=unit+NETLINK_TAPBASE;
	sprintf(devicename,"tap%d",unit);
	if (dev_get(devicename))
	{
		printk(KERN_INFO "%s already loaded.\n", devicename);
		return -EBUSY;
	}
	if (register_netdev(&dev_ethertap) != 0)
		return -EIO;
	return 0;
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:13,代码来源:ethertap.c

示例12: init_module

int init_module(void)
{
	/* Find a name for this unit */
	int ct= 1;
	
	while(dev_get(dev_dummy.name)!=NULL && ct<100)
	{
		sprintf(dev_dummy.name,"dummy%d",ct);
		ct++;
	}
	if(ct==100)
		return -ENFILE;
	
	if (register_netdev(&dev_dummy) != 0)
		return -EIO;
	return 0;
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:17,代码来源:dummy.c

示例13: exynos_frequency_lock

static int exynos_frequency_lock(struct device *dev)
{
	unsigned int level, cpufreq = 600; /* 200 ~ 1400 */
	unsigned int busfreq = 400200; /* 100100 ~ 400200 */
	int ret = 0;
	struct device *busdev = dev_get("exynos-busfreq");

	if (atomic_read(&umts_link_pm_data.freqlock) == 0) {
		/* cpu frequency lock */
		ret = exynos_cpufreq_get_level(cpufreq * 1000, &level);
		if (ret < 0) {
			mif_err("ERR: exynos_cpufreq_get_level fail: %d\n",
					ret);
			goto exit;
		}

		ret = exynos_cpufreq_lock(DVFS_LOCK_ID_USB_IF, level);
		if (ret < 0) {
			mif_err("ERR: exynos_cpufreq_lock fail: %d\n", ret);
			goto exit;
		}

		/* bus frequncy lock */
		if (!busdev) {
			mif_err("ERR: busdev is not exist\n");
			ret = -ENODEV;
			goto exit;
		}

		ret = dev_lock(busdev, dev, busfreq);
		if (ret < 0) {
			mif_err("ERR: dev_lock error: %d\n", ret);
			goto exit;
		}

		/* lock minimum number of cpu cores */
		cpufreq_pegasusq_min_cpu_lock(2);

		atomic_set(&umts_link_pm_data.freqlock, 1);
		mif_debug("level=%d, cpufreq=%d MHz, busfreq=%06d\n",
				level, cpufreq, busfreq);
	}
exit:
	return ret;
}
开发者ID:BigBot96,项目名称:android_kernel_samsung_konawifixx,代码行数:45,代码来源:board-c1-modems.c

示例14: dlci_del

int dlci_del(struct dlci_add *dlci)
{
   struct dlci_local *dlp;
   struct frad_local *flp;
   struct device     *master, *slave;
   int               i, err;

   /* validate slave device */
   master = dev_get(dlci->devname);
   if (!master)
      return(-ENODEV);

   if (master->start)
      return(-EBUSY);

   dlp = master->priv;
   slave = dlp->slave;
   flp = slave->priv;

   err = (*flp->deassoc)(slave, master);
   if (err)
      return(err);

   unregister_netdev(master);

   for(i=0;i<CONFIG_DLCI_COUNT;i++)
      if (master == open_dev[i])
         break;

   if (i<CONFIG_DLCI_COUNT)
      open_dev[i] = NULL;

   kfree(master->priv);
   kfree(master->name);
   kfree(master);

   MOD_DEC_USE_COUNT;

   return(0);
}
开发者ID:rohsaini,项目名称:mkunity,代码行数:40,代码来源:dlci.c

示例15: bpq_check_devices

/*
 *	Sanity check: remove all devices that ceased to exists and
 *	return '1' if the given BPQ device was affected.
 */
static int bpq_check_devices(struct net_device *dev)
{
	struct bpqdev *bpq, *bpq_prev, *bpq_next;
	int result = 0;
	unsigned long flags;

	save_flags(flags);
	cli();

	bpq_prev = NULL;

	for (bpq = bpq_devices; bpq != NULL; bpq = bpq_next) {
		bpq_next = bpq->next;
		if (!dev_get(bpq->ethname)) {
			if (bpq_prev)
				bpq_prev->next = bpq->next;
			else
				bpq_devices = bpq->next;

			if (&bpq->axdev == dev)
				result = 1;

			/* We should be locked, call 
			 * unregister_netdevice directly 
			 */

			unregister_netdevice(&bpq->axdev);
			kfree(bpq);
		}
		else
			bpq_prev = bpq;
	}

	restore_flags(flags);

	return result;
}
开发者ID:GunioRobot,项目名称:MI424WR_GEN2_Rev_E-F,代码行数:41,代码来源:bpqether.c


注:本文中的dev_get函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。