本文整理汇总了C++中dev_lock函数的典型用法代码示例。如果您正苦于以下问题:C++ dev_lock函数的具体用法?C++ dev_lock怎么用?C++ dev_lock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dev_lock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drm_mixer_qos_ctrl
static void drm_mixer_qos_ctrl(struct device *dev)
{
struct drm_hdmi_context *ctx = to_context(dev);
int win, val, count = 0;
DRM_DEBUG_KMS("%s\n", __func__);
for (win = 0; win < MIXER_WIN_NR; win++)
if (ctx->enabled[win])
count++;
switch (count) {
case 1:
val = 160160;
break;
case 2 ... MIXER_WIN_NR:
val = 267160;
break;
default:
val = 0;
break;
}
DRM_DEBUG_KMS("%s:count[%d]val[%d]\n", __func__, count, val);
#if defined(CONFIG_BUSFREQ_OPP) || defined(CONFIG_BUSFREQ_LOCK_WRAPPER)
if (val == 0)
dev_unlock(ctx->bus_dev, dev);
else
dev_lock(ctx->bus_dev, dev, val);
#endif
}
示例2: ctty_clone
static void
ctty_clone(void *arg, struct ucred *cred, char *name, int namelen,
struct cdev **dev)
{
if (*dev != NULL)
return;
if (strcmp(name, "tty"))
return;
sx_sunlock(&clone_drain_lock);
sx_slock(&proctree_lock);
sx_slock(&clone_drain_lock);
dev_lock();
if (!(curthread->td_proc->p_flag & P_CONTROLT))
*dev = ctty;
else if (curthread->td_proc->p_session->s_ttyvp == NULL)
*dev = ctty;
else if (curthread->td_proc->p_session->s_ttyvp->v_type == VBAD ||
curthread->td_proc->p_session->s_ttyvp->v_rdev == NULL) {
/* e.g. s_ttyvp was revoked */
*dev = ctty;
} else
*dev = curthread->td_proc->p_session->s_ttyvp->v_rdev;
dev_refl(*dev);
dev_unlock();
sx_sunlock(&proctree_lock);
}
示例3: busfreq_late_resume
static void busfreq_late_resume(struct early_suspend *h)
{
struct busfreq_data *data = container_of(h, struct busfreq_data,
busfreq_early_suspend_handler);
/* Request min MIF/INT 300MHz */
dev_lock(data->dev[PPMU_MIF], data->dev[PPMU_MIF], 300150);
}
示例4: s3cfb_enable_window
int s3cfb_enable_window(struct s3cfb_global *fbdev, int id)
{
struct s3cfb_window *win = fbdev->fb[id]->par;
#ifdef FEATURE_BUSFREQ_LOCK
int enabled_win = 0;
#endif
#if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412)
#ifdef CONFIG_BUSFREQ_OPP
if (id != CONFIG_FB_S5P_DEFAULT_WINDOW)
dev_lock(fbdev->bus_dev, fbdev->dev, 133133);
#endif
#endif
if (!win->enabled)
atomic_inc(&fbdev->enabled_win);
#ifdef FEATURE_BUSFREQ_LOCK
enabled_win = atomic_read(&fbdev->enabled_win);
if (enabled_win >= 2)
s3cfb_busfreq_lock(fbdev, 1);
#endif
if (s3cfb_window_on(fbdev, id)) {
win->enabled = 0;
return -EFAULT;
} else {
win->enabled = 1;
return 0;
}
}
示例5: gp_port_usbdiskdirect_lock
static int
gp_port_usbdiskdirect_lock (GPPort *port, const char *path)
{
#ifdef HAVE_LOCKDEV
int pid;
GP_LOG_D ("Trying to lock '%s'...", path);
pid = dev_lock (path);
if (pid) {
if (port) {
if (pid > 0)
gp_port_set_error (port, _("Device '%s' is "
"locked by pid %d"), path, pid);
else
gp_port_set_error (port, _("Device '%s' could "
"not be locked (dev_lock returned "
"%d)"), path, pid);
}
return GP_ERROR_IO_LOCK;
}
#else
# ifdef __GCC__
# warning No locking library found.
# warning You will run into problems if you use
# warning gphoto2 with a usbdiskdirect picframe in
# warning combination with Konqueror (KDE) or Nautilus (GNOME).
# warning This will *not* concern USB cameras.
# endif
#endif
return GP_OK;
}
示例6: jpeg_m2m_open
static int jpeg_m2m_open(struct file *file)
{
struct jpeg_dev *dev = video_drvdata(file);
struct jpeg_ctx *ctx = NULL;
int ret = 0;
enum jpeg_node_type node;
node = jpeg_get_node_type(file);
if (node == JPEG_NODE_INVALID) {
jpeg_err("cannot specify node type\n");
ret = -ENOENT;
goto err_node_type;
}
ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
if (!ctx)
return -ENOMEM;
file->private_data = ctx;
ctx->dev = dev;
spin_lock_init(&ctx->slock);
if (node == JPEG_NODE_DECODER)
ctx->m2m_ctx =
v4l2_m2m_ctx_init(dev->m2m_dev_dec, ctx,
queue_init_dec);
else
ctx->m2m_ctx =
v4l2_m2m_ctx_init(dev->m2m_dev_enc, ctx,
queue_init_enc);
if (IS_ERR(ctx->m2m_ctx)) {
int err = PTR_ERR(ctx->m2m_ctx);
kfree(ctx);
return err;
}
clk_enable(dev->clk);
#ifdef CONFIG_PM_RUNTIME
#if defined (CONFIG_CPU_EXYNOS5250)
dev->vb2->resume(dev->alloc_ctx);
#ifdef CONFIG_BUSFREQ_OPP
/* lock bus frequency */
dev_lock(dev->bus_dev, &dev->plat_dev->dev, BUSFREQ_400MHZ);
#endif
#else
pm_runtime_get_sync(&dev->plat_dev->dev);
#endif
#endif
return 0;
err_node_type:
kfree(ctx);
return ret;
}
示例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;
}
示例8: busfreq_early_suspend
static void busfreq_early_suspend(struct early_suspend *h)
{
unsigned long freq;
struct busfreq_data *data = container_of(h, struct busfreq_data,
busfreq_early_suspend_handler);
freq = data->min_freq[PPMU_MIF] + data->min_freq[PPMU_INT] / 1000;
dev_lock(data->dev[PPMU_MIF], data->dev[PPMU_MIF], freq);
}
示例9: exynos_tc_volt
/**
* exynos_tc_volt - locks or frees vdd_arm, vdd_mif/int and vdd_g3d for
* temperature compensation.
*
* This function limits or free voltage of cpufreq, busfreq, and mali driver
* according to 2nd arguments.
*/
static int exynos_tc_volt(struct s5p_tmu_info *info, int enable)
{
struct s5p_platform_tmu *data;
static int usage;
int ret = 0;
if (!info || !(info->dev))
return -EPERM;
data = info->dev->platform_data;
if (enable == usage) {
pr_debug("TMU: already is %s.\n",
enable ? "locked" : "unlocked");
return 0;
}
if (enable) {
ret = exynos_cpufreq_lock(DVFS_LOCK_ID_TMU, info->cpulevel_tc);
if (ret)
goto err_lock;
#ifdef CONFIG_BUSFREQ_OPP
ret = dev_lock(info->bus_dev, info->dev, info->busfreq_tc);
if (ret)
goto err_lock;
#endif
#if defined(CONFIG_VIDEO_MALI400MP)
ret = mali_voltage_lock_push(data->temp_compensate.g3d_volt);
if (ret < 0) {
pr_err("TMU: g3d_push error: %u uV\n",
data->temp_compensate.g3d_volt);
goto err_lock;
}
#endif
} else {
exynos_cpufreq_lock_free(DVFS_LOCK_ID_TMU);
#ifdef CONFIG_BUSFREQ_OPP
ret = dev_unlock(info->bus_dev, info->dev);
if (ret)
goto err_unlock;
#endif
#if defined(CONFIG_VIDEO_MALI400MP)
ret = mali_voltage_lock_pop();
if (ret < 0) {
pr_err("TMU: g3d_pop error\n");
goto err_unlock;
}
#endif
}
usage = enable;
pr_info("TMU: %s is ok!\n", enable ? "lock" : "unlock");
return ret;
err_lock:
err_unlock:
pr_err("TMU: %s is fail.\n", enable ? "lock" : "unlock");
return ret;
}
示例10: jpeg_runtime_resume
static int jpeg_runtime_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct jpeg_dev *jpeg_drv = platform_get_drvdata(pdev);
#ifdef CONFIG_BUSFREQ_OPP
/* lock bus frequency */
dev_lock(jpeg_drv->bus_dev, &jpeg_drv->plat_dev->dev, BUSFREQ_400MHZ);
#endif
clk_enable(jpeg_drv->clk);
jpeg_drv->vb2->resume(jpeg_drv->alloc_ctx);
return 0;
}
示例11: s3cfb_extdsp_enable_window
int s3cfb_extdsp_enable_window(struct s3cfb_extdsp_global *fbdev, int id)
{
struct s3cfb_extdsp_window *win = fbdev->fb[id]->par;
#ifdef CONFIG_BUSFREQ_OPP
dev_lock(fbdev->bus_dev, fbdev->dev, 133133);
#endif
if (!win->enabled)
atomic_inc(&fbdev->enabled_win);
win->enabled = 1;
return 0;
}
示例12: free_dvfs_lock
void free_dvfs_lock(struct work_struct *work)
{
struct wacom_i2c *wac_i2c =
container_of(work, struct wacom_i2c, dvfs_work.work);
if (wac_i2c->dvfs_lock_status)
dev_lock(wac_i2c->bus_dev,
wac_i2c->dev, SEC_BUS_LOCK_FREQ);
else {
dev_unlock(wac_i2c->bus_dev, wac_i2c->dev);
exynos_cpufreq_lock_free(DVFS_LOCK_ID_PEN);
}
}
示例13: fimc_is_runtime_resume
static int fimc_is_runtime_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct v4l2_subdev *sd = platform_get_drvdata(pdev);
struct fimc_is_dev *is_dev = to_fimc_is_dev(sd);
printk(KERN_INFO "FIMC-IS runtime resume\n");
#ifdef CONFIG_REGULATOR
regulator_enable(is_dev->r_vdd18_cam);
regulator_enable(is_dev->r_vddio18_cam);
regulator_enable(is_dev->r_vdd28_af_cam);
regulator_enable(is_dev->r_vadd28_cam);
#endif
if (is_dev->pdata->clk_cfg) {
is_dev->pdata->clk_cfg(pdev);
} else {
printk(KERN_ERR "#### failed to Clock CONFIG ####\n");
return -EINVAL;
}
if (is_dev->pdata->clk_on) {
is_dev->pdata->clk_on(pdev);
} else {
printk(KERN_ERR "#### failed to Clock On ####\n");
return -EINVAL;
}
is_dev->frame_count = 0;
#if defined(CONFIG_VIDEOBUF2_ION)
if (is_dev->alloc_ctx)
fimc_is_mem_resume(is_dev->alloc_ctx);
#endif
#if defined(CONFIG_BUSFREQ_OPP) || defined(CONFIG_BUSFREQ_LOCK_WRAPPER)
/* lock bus frequency */
dev_lock(is_dev->bus_dev, dev, BUS_LOCK_FREQ_L0);
pm_qos_add_request(&bus_qos_pm_qos_req, PM_QOS_BUS_QOS, 1);
#endif
#ifdef CONFIG_EXYNOS4_CPUFREQ
if (exynos_cpufreq_lock(DVFS_LOCK_ID_CAM, L8)) {
printk(KERN_ERR "ISP: failed to cpufreq lock for L0");
}
#endif
mutex_lock(&is_dev->lock);
clear_bit(IS_PWR_ST_POWEROFF, &is_dev->power);
clear_bit(IS_PWR_SUB_IP_POWER_OFF, &is_dev->power);
set_bit(IS_PWR_ST_POWERON, &is_dev->power);
mutex_unlock(&is_dev->lock);
printk(KERN_INFO "FIMC-IS runtime resume end\n");
return 0;
}
示例14: jpeg_runtime_resume
static int jpeg_runtime_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct jpeg_dev *jpeg_drv = platform_get_drvdata(pdev);
#if defined(CONFIG_MACH_P11) || defined(CONFIG_MACH_P10)
return 0;
#endif
#ifdef CONFIG_BUSFREQ_OPP
/* lock bus frequency */
dev_lock(jpeg_drv->bus_dev, dev, BUSFREQ_400MHZ);
#endif
jpeg_drv->vb2->resume(jpeg_drv->alloc_ctx);
return 0;
}
示例15: gp_port_serial_lock
static int
gp_port_serial_lock (GPPort *dev, const char *path)
{
#if defined(HAVE_LOCKDEV)
int pid;
#endif
gp_log (GP_LOG_DEBUG, "gphoto2-port-serial",
"Trying to lock '%s'...", path);
#if defined(HAVE_TTYLOCK)
if (ttylock ((char*) path)) {
if (dev)
gp_port_set_error (dev, _("Could not lock device "
"'%s'"), path);
return (GP_ERROR_IO_LOCK);
}
#define __HAVE_LOCKING
#elif defined(HAVE_LOCKDEV)
pid = dev_lock (path);
if (pid) {
if (dev) {
if (pid > 0)
gp_port_set_error (dev, _("Device '%s' is "
"locked by pid %d"), path, pid);
else
gp_port_set_error (dev, _("Device '%s' could "
"not be locked (dev_lock returned "
"%d)"), path, pid);
}
return (GP_ERROR_IO_LOCK);
}
#define __HAVE_LOCKING
#endif
#ifndef __HAVE_LOCKING
# ifdef __GCC__
# warning No locking library found.
# warning You will run into problems if you use
# warning gphoto2 with a serial (RS232) camera in
# warning combination with Konqueror (KDE) or Nautilus (GNOME).
# warning This will *not* concern USB cameras.
# endif
#endif
return (GP_OK);
}