本文整理汇总了C++中dev_get函数的典型用法代码示例。如果您正苦于以下问题:C++ dev_get函数的具体用法?C++ dev_get怎么用?C++ dev_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dev_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: exynos_frequency_unlock
static int exynos_frequency_unlock(struct device *dev)
{
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;
freqlock = &umts_link_pm_data.freqlock;
} else if (!strcmp(dev->bus->name, "platform")) { // for dpram lock
lock_id = DVFS_LOCK_ID_DPRAM_IF;
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) == 1) {
/* cpu frequency unlock */
exynos_cpufreq_lock_free(lock_id);
/* 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(freqlock, 0);
mif_info("success\n");
}
exit:
return ret;
}
开发者ID:CyanideL,项目名称:android_kernel_samsung_smdk4x12,代码行数:37,代码来源:board-c1lgt-modems.c
示例17: init_module
int
init_module(void)
{
int i;
for (i = 0; i < 100; i++) {
sprintf(dev_sb1000.name, "cm%d", i);
if (dev_get(dev_sb1000.name) == 0) break;
}
if (i == 100) {
printk(KERN_ERR "sb1000: can't register any device cm<n>\n");
return -ENFILE;
}
dev_sb1000.init = sb1000_probe;
dev_sb1000.base_addr = io[0];
/* rmem_end holds the second I/O address - fv */
dev_sb1000.rmem_end = io[1];
dev_sb1000.irq = irq;
if (register_netdev(&dev_sb1000) != 0) {
printk(KERN_ERR "sb1000: failed to register device (io: %03x,%03x "
"irq: %d)\n", io[0], io[1], irq);
return -EIO;
}
return 0;
}
开发者ID:archith,项目名称:camera_project,代码行数:24,代码来源:sb1000.c
示例18: fimc_is_probe
//.........这里部分代码省略.........
vb2_queue_init(isp_q);
ret = video_register_device(&dev->video[FIMC_IS_VIDEO_NUM_BAYER].vd,
VFL_TYPE_GRABBER, 30);
if (ret) {
v4l2_err(v4l2_dev, "Failed to register video device\n");
goto err_vd_reg;
}
printk(KERN_INFO "FIMC-IS Video node :: ISP %d minor : %d\n",
dev->video[FIMC_IS_VIDEO_NUM_BAYER].vd.num,
dev->video[FIMC_IS_VIDEO_NUM_BAYER].vd.minor);
#endif
/*
* initialize memory manager
*/
ret = fimc_is_init_mem_mgr(dev);
if (ret) {
dev_err(&pdev->dev,
"failed to fimc_is_init_mem_mgr (%d)\n", ret);
goto p_err_init_mem;
}
dbg("Parameter region = 0x%08x\n", (unsigned int)dev->is_p_region);
/*
* Get related clock for FIMC-IS
*/
if (dev->pdata->clk_get) {
dev->pdata->clk_get(pdev);
} else {
err("#### failed to Get Clock####\n");
goto p_err_init_mem;
}
/* Init v4l2 sub device */
v4l2_subdev_init(&dev->sd, &fimc_is_subdev_ops);
dev->sd.owner = THIS_MODULE;
strcpy(dev->sd.name, MODULE_NAME);
v4l2_set_subdevdata(&dev->sd, pdev);
platform_set_drvdata(pdev, &dev->sd);
pm_runtime_enable(&pdev->dev);
#if defined(CONFIG_BUSFREQ_OPP) || defined(CONFIG_BUSFREQ_LOCK_WRAPPER)
/* To lock bus frequency in OPP mode */
dev->bus_dev = dev_get("exynos-busfreq");
#endif
dev->power = 0;
dev->state = 0;
dev->sensor_num = FIMC_IS_SENSOR_NUM;
dev->sensor.id = 0;
dev->p_region_index1 = 0;
dev->p_region_index2 = 0;
dev->sensor.offset_x = 16;
dev->sensor.offset_y = 12;
dev->sensor.framerate_update = false;
atomic_set(&dev->p_region_num, 0);
set_bit(IS_ST_IDLE, &dev->state);
set_bit(IS_PWR_ST_POWEROFF, &dev->power);
dev->af.af_state = FIMC_IS_AF_IDLE;
dev->af.mode = IS_FOCUS_MODE_IDLE;
dev->low_power_mode = false;
dev->fw.state = 0;
dev->setfile.state = 0;
#if defined(M0)
s5k6a3_dev = device_create(camera_class, NULL, 0, NULL, "front");
if (IS_ERR(s5k6a3_dev)) {
printk(KERN_ERR "failed to create device!\n");
} else {
if (device_create_file(s5k6a3_dev, &dev_attr_front_camtype)
< 0) {
printk(KERN_ERR "failed to create device file, %s\n",
dev_attr_front_camtype.attr.name);
}
if (device_create_file(s5k6a3_dev, &dev_attr_front_camfw) < 0) {
printk(KERN_ERR "failed to create device file, %s\n",
dev_attr_front_camfw.attr.name);
}
}
#endif
printk(KERN_INFO "FIMC-IS probe completed\n");
return 0;
p_err_init_mem:
free_irq(dev->irq1, dev);
#if defined(CONFIG_VIDEO_EXYNOS_FIMC_IS_BAYER)
err_vd_reg:
video_device_release(&dev->video[FIMC_IS_VIDEO_NUM_BAYER].vd);
#endif
p_err_req_irq:
p_err_get_irq:
iounmap(dev->regs);
p_err_req_region:
release_mem_region(regs_res->start, resource_size(regs_res));
p_err_info:
dev_err(&dev->pdev->dev, "failed to install\n");
kfree(dev);
return ret;
}
开发者ID:ugur2323,项目名称:Whispermehmet_VE,代码行数:101,代码来源:fimc-is-core.c
示例19: dev_ifsioc
static int dev_ifsioc(void *arg, unsigned int getset)
{
struct ifreq ifr;
struct device *dev;
int ret;
/*
* Fetch the caller's info block into kernel space
*/
int err=verify_area(VERIFY_WRITE, arg, sizeof(struct ifreq));
if(err)
return err;
memcpy_fromfs(&ifr, arg, sizeof(struct ifreq));
/*
* See which interface the caller is talking about.
*/
if ((dev = dev_get(ifr.ifr_name)) == NULL)
return(-ENODEV);
switch(getset)
{
case SIOCGIFFLAGS: /* Get interface flags */
ifr.ifr_flags = dev->flags;
memcpy_tofs(arg, &ifr, sizeof(struct ifreq));
ret = 0;
break;
case SIOCSIFFLAGS: /* Set interface flags */
{
int old_flags = dev->flags;
#ifdef CONFIG_SLAVE_BALANCING
if(dev->flags&IFF_SLAVE)
return -EBUSY;
#endif
dev->flags = ifr.ifr_flags & (
IFF_UP | IFF_BROADCAST | IFF_DEBUG | IFF_LOOPBACK |
IFF_POINTOPOINT | IFF_NOTRAILERS | IFF_RUNNING |
IFF_NOARP | IFF_PROMISC | IFF_ALLMULTI | IFF_SLAVE | IFF_MASTER
| IFF_MULTICAST);
#ifdef CONFIG_SLAVE_BALANCING
if(!(dev->flags&IFF_MASTER) && dev->slave)
{
dev->slave->flags&=~IFF_SLAVE;
dev->slave=NULL;
}
#endif
/*
* Load in the correct multicast list now the flags have changed.
*/
dev_mc_upload(dev);
#if 0
if( dev->set_multicast_list!=NULL)
{
/*
* Has promiscuous mode been turned off
*/
if ( (old_flags & IFF_PROMISC) && ((dev->flags & IFF_PROMISC) == 0))
dev->set_multicast_list(dev,0,NULL);
/*
* Has it been turned on
*/
if ( (dev->flags & IFF_PROMISC) && ((old_flags & IFF_PROMISC) == 0))
dev->set_multicast_list(dev,-1,NULL);
}
#endif
/*
* Have we downed the interface
*/
if ((old_flags & IFF_UP) && ((dev->flags & IFF_UP) == 0))
{
ret = dev_close(dev);
}
else
{
/*
* Have we upped the interface
*/
ret = (! (old_flags & IFF_UP) && (dev->flags & IFF_UP))
? dev_open(dev) : 0;
/*
* Check the flags.
*/
if(ret<0)
dev->flags&=~IFF_UP; /* Didn't open so down the if */
}
}
break;
case SIOCGIFADDR: /* Get interface address (and family) */
(*(struct sockaddr_in *)
//.........这里部分代码省略.........
开发者ID:TaoAndHua,项目名称:linux-1.2.13,代码行数:101,代码来源:dev.c
示例20: exynos_tmu_init
static int exynos_tmu_init(struct tmu_info *info)
{
struct tmu_data *data = info->dev->platform_data;
unsigned int te_temp, con;
unsigned int temp_throttle, temp_warning, temp_trip;
unsigned int hw_temp_trip;
unsigned int rising_thr = 0, cooling_thr = 0;
/* must reload for using efuse value at EXYNOS4212 */
__raw_writel(TRIMINFO_RELOAD, info->tmu_base + TRIMINFO_CON);
/* get the compensation parameter */
te_temp = __raw_readl(info->tmu_base + TRIMINFO);
info->te1 = te_temp & TRIM_INFO_MASK;
info->te2 = ((te_temp >> 8) & TRIM_INFO_MASK);
if ((EFUSE_MIN_VALUE > info->te1) || (info->te1 > EFUSE_MAX_VALUE)
|| (info->te2 != 0))
info->te1 = data->efuse_value;
/*Get rising Threshold and Set interrupt level*/
temp_throttle = data->ts.start_throttle
+ info->te1 - TMU_DC_VALUE;
temp_warning = data->ts.start_warning
+ info->te1 - TMU_DC_VALUE;
temp_trip = data->ts.start_tripping
+ info->te1 - TMU_DC_VALUE;
hw_temp_trip = data->ts.start_hw_tripping
+ info->te1 - TMU_DC_VALUE;
rising_thr = (temp_throttle | (temp_warning<<8) | \
(temp_trip<<16) | (hw_temp_trip<<24));
__raw_writel(rising_thr, info->tmu_base + THD_TEMP_RISE);
#if defined(CONFIG_TC_VOLTAGE)
/* Get set temperature for tc_voltage and set falling interrupt
* trigger level
*/
cooling_thr = data->ts.start_tc
+ info->te1 - TMU_DC_VALUE;
#endif
__raw_writel(cooling_thr, info->tmu_base + THD_TEMP_FALL);
/* Set TMU status */
info->tmu_state = TMU_STATUS_INIT;
/* Set frequecny level */
exynos_cpufreq_get_level(data->cpulimit.throttle_freq,
&info->throttle_freq);
exynos_cpufreq_get_level(data->cpulimit.warning_freq,
&info->warning_freq);
/* Map auto_refresh_rate of normal & tq0 mode */
info->auto_refresh_tq0 =
get_refresh_interval(FREQ_IN_PLL, AUTO_REFRESH_PERIOD_TQ0);
info->auto_refresh_normal =
get_refresh_interval(FREQ_IN_PLL, AUTO_REFRESH_PERIOD_NORMAL);
/* To poll current temp, set sampling rate */
info->sampling_rate = usecs_to_jiffies(200 * 1000);
#if defined(CONFIG_TC_VOLTAGE) /* Temperature compensated voltage */
if (exynos_find_cpufreq_level_by_volt(data->temp_compensate.arm_volt,
&info->cpulevel_tc) < 0) {
pr_err("cpufreq_get_level error\n");
return -EINVAL;
}
#ifdef CONFIG_BUSFREQ_OPP
/* To lock bus frequency in OPP mode */
info->bus_dev = dev_get("exynos-busfreq");
if (info->bus_dev < 0) {
pr_err("Failed to get_dev\n");
return -EINVAL;
}
if (exynos4x12_find_busfreq_by_volt(data->temp_compensate.bus_volt,
&info->busfreq_tc)) {
pr_err("get_busfreq_value error\n");
}
#endif
if (mali_voltage_lock_init()) {
pr_err("Failed to initialize mail voltage lock.\n");
return -EINVAL;
}
pr_info("%s: cpufreq_level[%d], busfreq_value[%d]\n",
__func__, info->cpulevel_tc, info->busfreq_tc);
#endif
/* Need to initail regsiter setting after getting parameter info */
/* [28:23] vref [11:8] slope - Tunning parameter */
__raw_writel(data->slope, info->tmu_base + TMU_CON);
__raw_writel((CLEAR_RISE_INT | CLEAR_FALL_INT), \
info->tmu_base + INTCLEAR);
/* TMU core enable and HW trpping enable */
con = __raw_readl(info->tmu_base + TMU_CON);
con &= ~(HW_TRIP_MODE);
con |= (HW_TRIPPING_EN | MUX_ADDR_VALUE<<20 | CORE_EN);
__raw_writel(con, info->tmu_base + TMU_CON);
//.........这里部分代码省略.........
开发者ID:EthanRS,项目名称:Odroid-X2-Android-OS-4.1-Kernel,代码行数:101,代码来源:tmu-exynos.c
注:本文中的dev_get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论