Skip to content

Commit

Permalink
[media] r820t: Invert bits for read ops
Browse files Browse the repository at this point in the history
On read, the bit order is inverted.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
  • Loading branch information
Mauro Carvalho Chehab committed Apr 17, 2013
1 parent 884655a commit 103fe2f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/media/tuners/r820t.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@
#include <linux/videodev2.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include "tuner-i2c.h"
#include <linux/bitrev.h>
#include <asm/div64.h>

#include "tuner-i2c.h"
#include "r820t.h"

/*
Expand Down Expand Up @@ -414,7 +416,7 @@ static int r820t_write_reg_mask(struct r820t_priv *priv, u8 reg, u8 val,

static int r820_read(struct r820t_priv *priv, u8 reg, u8 *val, int len)
{
int rc;
int rc, i;
u8 *p = &priv->buf[1];

priv->buf[0] = reg;
Expand All @@ -431,7 +433,8 @@ static int r820_read(struct r820t_priv *priv, u8 reg, u8 *val, int len)
__func__, reg, len, len, p);

/* Copy data to the output buffer */
memcpy(val, p, len);
for (i = 0; i < len; i++)
val[i] = bitrev8(p[i]);

return 0;
}
Expand Down

0 comments on commit 103fe2f

Please sign in to comment.