Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 367134
b: refs/heads/master
c: 8678b03
h: refs/heads/master
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Apr 17, 2013
1 parent f08d059 commit a6158c6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 75c1819e5e42064e66d4f88a5af628a1604ad52d
refs/heads/master: 8678b03428b6894d146695980f04f26af7b9b3ec
20 changes: 15 additions & 5 deletions trunk/drivers/media/tuners/r820t.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,25 @@ static int r820t_write_reg(struct r820t_priv *priv, u8 reg, u8 val)
return r820t_write(priv, reg, &val, 1);
}

static int r820t_write_reg_mask(struct r820t_priv *priv, u8 reg, u8 val,
u8 bit_mask)
static int r820t_read_cache_reg(struct r820t_priv *priv, int reg)
{
int r = reg - REG_SHADOW_START;
reg -= REG_SHADOW_START;

if (r >= 0 && r < NUM_REGS)
val = (priv->regs[r] & ~bit_mask) | (val & bit_mask);
if (reg >= 0 && reg < NUM_REGS)
return priv->regs[reg];
else
return -EINVAL;
}

static int r820t_write_reg_mask(struct r820t_priv *priv, u8 reg, u8 val,
u8 bit_mask)
{
int rc = r820t_read_cache_reg(priv, reg);

if (rc < 0)
return rc;

val = (rc & ~bit_mask) | (val & bit_mask);

return r820t_write(priv, reg, &val, 1);
}
Expand Down

0 comments on commit a6158c6

Please sign in to comment.