From: "Frank Schäfer" <fschaefer.oss@googlemail.com>
To: mchehab@redhat.com
Cc: linux-media@vger.kernel.org, dheitmueller@kernellabs.com,
"Frank Schäfer" <fschaefer.oss@googlemail.com>
Subject: [PATCH 1/5] em28xx: clean up the data type mess of the i2c transfer function parameters
Date: Fri, 14 Dec 2012 17:28:49 +0100 [thread overview]
Message-ID: <1355502533-25636-2-git-send-email-fschaefer.oss@googlemail.com> (raw)
In-Reply-To: <1355502533-25636-1-git-send-email-fschaefer.oss@googlemail.com>
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
drivers/media/usb/em28xx/em28xx-i2c.c | 28 +++++++++++-----------------
1 Datei geändert, 11 Zeilen hinzugefügt(+), 17 Zeilen entfernt(-)
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
index 1683bd9..44533e4 100644
--- a/drivers/media/usb/em28xx/em28xx-i2c.c
+++ b/drivers/media/usb/em28xx/em28xx-i2c.c
@@ -53,12 +53,11 @@ do { \
* em2800_i2c_send_max4()
* send up to 4 bytes to the i2c device
*/
-static int em2800_i2c_send_max4(struct em28xx *dev, unsigned char addr,
- char *buf, int len)
+static int em2800_i2c_send_max4(struct em28xx *dev, u8 addr, u8 *buf, u16 len)
{
int ret;
int write_timeout;
- unsigned char b2[6];
+ u8 b2[6];
BUG_ON(len < 1 || len > 4);
b2[5] = 0x80 + len - 1;
b2[4] = addr;
@@ -89,15 +88,13 @@ static int em2800_i2c_send_max4(struct em28xx *dev, unsigned char addr,
/*
* em2800_i2c_send_bytes()
*/
-static int em2800_i2c_send_bytes(void *data, unsigned char addr, char *buf,
- short len)
+static int em2800_i2c_send_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len)
{
- char *bufPtr = buf;
+ u8 *bufPtr = buf;
int ret;
int wrcount = 0;
int count;
int maxLen = 4;
- struct em28xx *dev = (struct em28xx *)data;
while (len > 0) {
count = (len > maxLen) ? maxLen : len;
ret = em2800_i2c_send_max4(dev, addr, bufPtr, count);
@@ -115,9 +112,9 @@ static int em2800_i2c_send_bytes(void *data, unsigned char addr, char *buf,
* em2800_i2c_check_for_device()
* check if there is a i2c_device at the supplied address
*/
-static int em2800_i2c_check_for_device(struct em28xx *dev, unsigned char addr)
+static int em2800_i2c_check_for_device(struct em28xx *dev, u8 addr)
{
- char msg;
+ u8 msg;
int ret;
int write_timeout;
msg = addr;
@@ -150,8 +147,7 @@ static int em2800_i2c_check_for_device(struct em28xx *dev, unsigned char addr)
* em2800_i2c_recv_bytes()
* read from the i2c device
*/
-static int em2800_i2c_recv_bytes(struct em28xx *dev, unsigned char addr,
- char *buf, int len)
+static int em2800_i2c_recv_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len)
{
int ret;
/* check for the device and set i2c read address */
@@ -174,11 +170,10 @@ static int em2800_i2c_recv_bytes(struct em28xx *dev, unsigned char addr,
/*
* em28xx_i2c_send_bytes()
*/
-static int em28xx_i2c_send_bytes(void *data, unsigned char addr, char *buf,
- short len, int stop)
+static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf,
+ u16 len, int stop)
{
int wrcount = 0;
- struct em28xx *dev = (struct em28xx *)data;
int write_timeout, ret;
wrcount = dev->em28xx_write_regs_req(dev, stop ? 2 : 3, addr, buf, len);
@@ -199,8 +194,7 @@ static int em28xx_i2c_send_bytes(void *data, unsigned char addr, char *buf,
* em28xx_i2c_recv_bytes()
* read a byte from the i2c device
*/
-static int em28xx_i2c_recv_bytes(struct em28xx *dev, unsigned char addr,
- char *buf, int len)
+static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
{
int ret;
ret = dev->em28xx_read_reg_req_len(dev, 2, addr, buf, len);
@@ -217,7 +211,7 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, unsigned char addr,
* em28xx_i2c_check_for_device()
* check if there is a i2c_device at the supplied address
*/
-static int em28xx_i2c_check_for_device(struct em28xx *dev, unsigned char addr)
+static int em28xx_i2c_check_for_device(struct em28xx *dev, u16 addr)
{
int ret;
--
1.7.10.4
next prev parent reply other threads:[~2012-12-14 16:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-14 16:28 [PATCH 0/5] em28xx: i2c bug fixes and cleanups Frank Schäfer
2012-12-14 16:28 ` Frank Schäfer [this message]
2012-12-14 16:28 ` [PATCH 2/5] em28xx: respect the message size constraints for i2c transfers Frank Schäfer
2012-12-14 16:55 ` Antti Palosaari
2012-12-15 12:57 ` Frank Schäfer
2012-12-14 16:28 ` [PATCH 3/5] em28xx: fix two severe bugs in function em2800_i2c_recv_bytes() Frank Schäfer
2012-12-14 16:28 ` [PATCH 4/5] em28xx: fix the i2c adapter functionality flags Frank Schäfer
2012-12-14 16:28 ` [PATCH 5/5] em28xx: fix+improve+unify i2c error handling, debug messages and code comments Frank Schäfer
2012-12-14 17:03 ` Antti Palosaari
2012-12-15 13:01 ` Frank Schäfer
2012-12-15 13:46 ` Antti Palosaari
2012-12-15 16:25 ` Frank Schäfer
2012-12-15 17:16 ` Antti Palosaari
2012-12-16 18:20 ` Frank Schäfer
2012-12-15 17:18 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1355502533-25636-2-git-send-email-fschaefer.oss@googlemail.com \
--to=fschaefer.oss@googlemail.com \
--cc=dheitmueller@kernellabs.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).