s390/ctlreg: return old register contents when changing bits
Change local_ctl_set_bit() and local_ctl_clear_bit() so they return the previous value of the to be changed control register. This is useful if a bit is only changed temporarily and the previous content needs to be restored. Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
parent
207022d39d
commit
f88d368453
@ -141,22 +141,26 @@ static __always_inline void local_ctl_store(unsigned int cr, struct ctlreg *reg)
|
||||
: [cr] "i" (cr));
|
||||
}
|
||||
|
||||
static __always_inline void local_ctl_set_bit(unsigned int cr, unsigned int bit)
|
||||
static __always_inline struct ctlreg local_ctl_set_bit(unsigned int cr, unsigned int bit)
|
||||
{
|
||||
struct ctlreg reg;
|
||||
struct ctlreg new, old;
|
||||
|
||||
local_ctl_store(cr, ®);
|
||||
reg.val |= 1UL << bit;
|
||||
local_ctl_load(cr, ®);
|
||||
local_ctl_store(cr, &old);
|
||||
new = old;
|
||||
new.val |= 1UL << bit;
|
||||
local_ctl_load(cr, &new);
|
||||
return old;
|
||||
}
|
||||
|
||||
static __always_inline void local_ctl_clear_bit(unsigned int cr, unsigned int bit)
|
||||
static __always_inline struct ctlreg local_ctl_clear_bit(unsigned int cr, unsigned int bit)
|
||||
{
|
||||
struct ctlreg reg;
|
||||
struct ctlreg new, old;
|
||||
|
||||
local_ctl_store(cr, ®);
|
||||
reg.val &= ~(1UL << bit);
|
||||
local_ctl_load(cr, ®);
|
||||
local_ctl_store(cr, &old);
|
||||
new = old;
|
||||
new.val &= ~(1UL << bit);
|
||||
local_ctl_load(cr, &new);
|
||||
return old;
|
||||
}
|
||||
|
||||
struct lowcore;
|
||||
|
Loading…
Reference in New Issue
Block a user