aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorTyler Trafford <ttrafford@gmail.com>2008-04-22 13:42:14 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:07:44 -0400
commit520ebe5f72ff450d7a73e8f669190254a5836093 (patch)
treec7791a545fb27972a9e7fc8a72de9977e662547d /drivers/media/video
parent491215d81049bfda749ebda007ecd3ae8bee19e3 (diff)
V4L/DVB (7241): cx25840: code cleanup
- Use min() - Eliminate extraneous variables Signed-off-by: Tyler Trafford <ttrafford@gmail.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/cx25840/cx25840-firmware.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/media/video/cx25840/cx25840-firmware.c b/drivers/media/video/cx25840/cx25840-firmware.c
index 1ddf724a2c74..620d295947ab 100644
--- a/drivers/media/video/cx25840/cx25840-firmware.c
+++ b/drivers/media/video/cx25840/cx25840-firmware.c
@@ -79,11 +79,9 @@ static int check_fw_load(struct i2c_client *client, int size)
79 return 0; 79 return 0;
80} 80}
81 81
82static int fw_write(struct i2c_client *client, u8 * data, int size) 82static int fw_write(struct i2c_client *client, u8 *data, int size)
83{ 83{
84 int sent; 84 if (i2c_master_send(client, data, size) < size) {
85
86 if ((sent = i2c_master_send(client, data, size)) < size) {
87 v4l_err(client, "firmware load i2c failure\n"); 85 v4l_err(client, "firmware load i2c failure\n");
88 return -ENOSYS; 86 return -ENOSYS;
89 } 87 }
@@ -96,7 +94,7 @@ int cx25840_loadfw(struct i2c_client *client)
96 struct cx25840_state *state = i2c_get_clientdata(client); 94 struct cx25840_state *state = i2c_get_clientdata(client);
97 const struct firmware *fw = NULL; 95 const struct firmware *fw = NULL;
98 u8 buffer[4], *ptr; 96 u8 buffer[4], *ptr;
99 int size, send, retval; 97 int size, retval;
100 98
101 if (state->is_cx23885) 99 if (state->is_cx23885)
102 firmware = FWFILE_CX23885; 100 firmware = FWFILE_CX23885;
@@ -124,8 +122,7 @@ int cx25840_loadfw(struct i2c_client *client)
124 while (size > 0) { 122 while (size > 0) {
125 ptr[0] = 0x08; 123 ptr[0] = 0x08;
126 ptr[1] = 0x02; 124 ptr[1] = 0x02;
127 send = size > (FWSEND - 2) ? FWSEND : size + 2; 125 retval = fw_write(client, ptr, min(FWSEND, size + 2));
128 retval = fw_write(client, ptr, send);
129 126
130 if (retval < 0) { 127 if (retval < 0) {
131 release_firmware(fw); 128 release_firmware(fw);