本文整理汇总了C++中write_unlock_irqrestore函数的典型用法代码示例。如果您正苦于以下问题:C++ write_unlock_irqrestore函数的具体用法?C++ write_unlock_irqrestore怎么用?C++ write_unlock_irqrestore使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_unlock_irqrestore函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hp_sdc_status_in8
/*************** primitives for use in any context *********************/
static inline uint8_t hp_sdc_status_in8 (void) {
uint8_t status;
unsigned long flags;
write_lock_irqsave(&hp_sdc.ibf_lock, flags);
status = sdc_readb(hp_sdc.status_io);
if (!(status & HP_SDC_STATUS_IBF)) hp_sdc.ibf = 0;
write_unlock_irqrestore(&hp_sdc.ibf_lock, flags);
return status;
}
示例2: OS_RWLockWriteRelease
OS_VOID OS_RWLockWriteRelease( OS_RWLOCK* aLock, OS_RWLOCK_FLAG* aFlag )
{
rwlock_t* lRWLock = ( rwlock_t * ) aLock->Space;
#ifdef OS_TAG_ENABLED
OS_ASSERT( aTag != OS_TAG_NOTAG );
aLock->Tag = OS_TAG_NOTAG;
#endif // OS_TAG_ENABLED
write_unlock_irqrestore( lRWLock, ( unsigned long ) *aFlag );
}
示例3: cpu_pm_unregister_notifier
/**
* cpu_pm_unregister_notifier - unregister a driver with cpu_pm
* @nb: notifier block to be unregistered
*
* Remove a driver from the CPU PM notifier list.
*
* This function may sleep, and has the same return conditions as
* raw_notifier_chain_unregister.
*/
int cpu_pm_unregister_notifier(struct notifier_block *nb)
{
unsigned long flags;
int ret;
write_lock_irqsave(&cpu_pm_notifier_lock, flags);
ret = raw_notifier_chain_unregister(&cpu_pm_notifier_chain, nb);
write_unlock_irqrestore(&cpu_pm_notifier_lock, flags);
return ret;
}
示例4: ptrace_attach
int ptrace_attach(struct task_struct *task)
{
int retval;
unsigned long flags;
audit_ptrace(task);
retval = -EPERM;
if (same_thread_group(task, current))
goto out;
repeat:
/*
* Nasty, nasty.
*
* We want to hold both the task-lock and the
* tasklist_lock for writing at the same time.
* But that's against the rules (tasklist_lock
* is taken for reading by interrupts on other
* cpu's that may have task_lock).
*/
task_lock(task);
if (!write_trylock_irqsave(&tasklist_lock, flags)) {
task_unlock(task);
do {
cpu_relax();
} while (!write_can_lock(&tasklist_lock));
goto repeat;
}
if (!task->mm)
goto bad;
/* the same process cannot be attached many times */
if (task->ptrace & PT_PTRACED)
goto bad;
retval = __ptrace_may_access(task, PTRACE_MODE_ATTACH);
if (retval)
goto bad;
/* Go */
task->ptrace |= PT_PTRACED;
if (capable_nolog(CAP_SYS_PTRACE))
task->ptrace |= PT_PTRACE_CAP;
__ptrace_link(task, current);
send_sig_info(SIGSTOP, SEND_SIG_FORCED, task);
bad:
write_unlock_irqrestore(&tasklist_lock, flags);
task_unlock(task);
out:
return retval;
}
示例5: psb_fence_handler
void psb_fence_handler(struct drm_device *dev, uint32_t fence_class)
{
struct drm_psb_private *dev_priv = psb_priv(dev);
struct ttm_fence_device *fdev = &dev_priv->fdev;
struct ttm_fence_class_manager *fc =
&fdev->fence_class[fence_class];
unsigned long irq_flags;
write_lock_irqsave(&fc->lock, irq_flags);
psb_fence_poll(fdev, fence_class, fc->waiting_types);
write_unlock_irqrestore(&fc->lock, irq_flags);
}
示例6: zfcp_erp_notify
/**
* zfcp_erp_notify - Trigger ERP action.
* @erp_action: ERP action to continue.
* @set_mask: ERP action status flags to set.
*/
void zfcp_erp_notify(struct zfcp_erp_action *erp_action, unsigned long set_mask)
{
struct zfcp_adapter *adapter = erp_action->adapter;
unsigned long flags;
write_lock_irqsave(&adapter->erp_lock, flags);
if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING) {
erp_action->status |= set_mask;
zfcp_erp_action_ready(erp_action);
}
write_unlock_irqrestore(&adapter->erp_lock, flags);
}
示例7: mlx4_en_phc_adjtime
/**
* mlx4_en_phc_adjtime - Shift the time of the hardware clock
* @ptp: ptp clock structure
* @delta: Desired change in nanoseconds
*
* Adjust the timer by resetting the timecounter structure.
**/
static int mlx4_en_phc_adjtime(struct ptp_clock_info *ptp, s64 delta)
{
struct mlx4_en_dev *mdev = container_of(ptp, struct mlx4_en_dev,
ptp_clock_info);
unsigned long flags;
write_lock_irqsave(&mdev->clock_lock, flags);
timecounter_adjtime(&mdev->clock, delta);
write_unlock_irqrestore(&mdev->clock_lock, flags);
return 0;
}
示例8: zfcp_erp_port_reopen
int zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id)
{
int retval;
unsigned long flags;
struct zfcp_adapter *adapter = port->adapter;
write_lock_irqsave(&adapter->erp_lock, flags);
retval = _zfcp_erp_port_reopen(port, clear, id);
write_unlock_irqrestore(&adapter->erp_lock, flags);
return retval;
}
示例9: mlx5e_ptp_adjtime
static int mlx5e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
{
struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp,
ptp_info);
unsigned long flags;
write_lock_irqsave(&tstamp->lock, flags);
timecounter_adjtime(&tstamp->clock, delta);
write_unlock_irqrestore(&tstamp->lock, flags);
return 0;
}
示例10: mlx5e_timestamp_overflow
static void mlx5e_timestamp_overflow(struct work_struct *work)
{
struct delayed_work *dwork = to_delayed_work(work);
struct mlx5e_tstamp *tstamp = container_of(dwork, struct mlx5e_tstamp,
overflow_work);
unsigned long flags;
write_lock_irqsave(&tstamp->lock, flags);
timecounter_read(&tstamp->clock);
write_unlock_irqrestore(&tstamp->lock, flags);
schedule_delayed_work(&tstamp->overflow_work, tstamp->overflow_period);
}
示例11: psb_fence_error
void psb_fence_error(struct drm_device *dev,
uint32_t fence_class,
uint32_t sequence, uint32_t type, int error)
{
struct drm_fence_manager *fm = &dev->fm;
unsigned long irq_flags;
BUG_ON(fence_class >= PSB_NUM_ENGINES);
write_lock_irqsave(&fm->lock, irq_flags);
drm_fence_handler(dev, fence_class, sequence, type, error);
write_unlock_irqrestore(&fm->lock, irq_flags);
}
示例12: nlm_common_free_msi_handler
void nlm_common_free_msi_handler(int *index)
{
unsigned long flags=0;
write_lock_irqsave(&nlm_msi_rw_lock, flags);
msi_desc[*index].valid = 0;
write_unlock_irqrestore(&nlm_msi_rw_lock, flags);
nlm_common_disable_msi(index);
Message("\nIndex %d Freed\n",*index);
return;
}
示例13: reg_mr_callback
static void reg_mr_callback(int status, void *context)
{
struct mlx5_ib_mr *mr = context;
struct mlx5_ib_dev *dev = mr->dev;
struct mlx5_mr_cache *cache = &dev->cache;
int c = order2idx(dev, mr->order);
struct mlx5_cache_ent *ent = &cache->ent[c];
u8 key;
unsigned long flags;
struct mlx5_mr_table *table = &dev->mdev->priv.mr_table;
int err;
spin_lock_irqsave(&ent->lock, flags);
ent->pending--;
spin_unlock_irqrestore(&ent->lock, flags);
if (status) {
mlx5_ib_warn(dev, "async reg mr failed. status %d\n", status);
kfree(mr);
dev->fill_delay = 1;
mod_timer(&dev->delay_timer, jiffies + HZ);
return;
}
if (mr->out.hdr.status) {
mlx5_ib_warn(dev, "failed - status %d, syndorme 0x%x\n",
mr->out.hdr.status,
be32_to_cpu(mr->out.hdr.syndrome));
kfree(mr);
dev->fill_delay = 1;
mod_timer(&dev->delay_timer, jiffies + HZ);
return;
}
spin_lock_irqsave(&dev->mdev->priv.mkey_lock, flags);
key = dev->mdev->priv.mkey_key++;
spin_unlock_irqrestore(&dev->mdev->priv.mkey_lock, flags);
mr->mmr.key = mlx5_idx_to_mkey(be32_to_cpu(mr->out.mkey) & 0xffffff) | key;
cache->last_add = jiffies;
spin_lock_irqsave(&ent->lock, flags);
list_add_tail(&mr->list, &ent->head);
ent->cur++;
ent->size++;
spin_unlock_irqrestore(&ent->lock, flags);
write_lock_irqsave(&table->lock, flags);
err = radix_tree_insert(&table->tree, mlx5_base_mkey(mr->mmr.key),
&mr->mmr);
if (err)
pr_err("Error inserting to mr tree. 0x%x\n", -err);
write_unlock_irqrestore(&table->lock, flags);
}
示例14: EvSetQLimit
/*
* Set maximum number of queued events for a userID.
*/
int
EvSetQLimit(EvUserID_t userID, unsigned int newQLimit)
{
EvKernelInfo_t *TmpUser;
unsigned long Flags;
write_lock_irqsave(&EvUsersLock, Flags);
TmpUser = EvUsersHead;
while (TmpUser) {
if (TmpUser->EkiID == userID) {
TmpUser->EkiQLimit = newQLimit;
write_unlock_irqrestore(&EvUsersLock, Flags);
return EV_NOERR;
}
TmpUser = TmpUser->EkiNext;
}
write_unlock_irqrestore(&EvUsersLock, Flags);
return -EV_ERROR_USER_EXISTS;
}
示例15: mlx5e_ptp_overflow_check
void mlx5e_ptp_overflow_check(struct mlx5e_priv *priv)
{
bool timeout = time_is_before_jiffies(priv->tstamp.last_overflow_check +
priv->tstamp.overflow_period);
unsigned long flags;
if (timeout) {
write_lock_irqsave(&priv->tstamp.lock, flags);
timecounter_read(&priv->tstamp.clock);
write_unlock_irqrestore(&priv->tstamp.lock, flags);
priv->tstamp.last_overflow_check = jiffies;
}
}