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>
This commit is contained in:
Родитель
491215d810
Коммит
520ebe5f72
|
@ -79,11 +79,9 @@ static int check_fw_load(struct i2c_client *client, int size)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fw_write(struct i2c_client *client, u8 * data, int size)
|
static int fw_write(struct i2c_client *client, u8 *data, int size)
|
||||||
{
|
{
|
||||||
int sent;
|
if (i2c_master_send(client, data, size) < size) {
|
||||||
|
|
||||||
if ((sent = i2c_master_send(client, data, size)) < size) {
|
|
||||||
v4l_err(client, "firmware load i2c failure\n");
|
v4l_err(client, "firmware load i2c failure\n");
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +94,7 @@ int cx25840_loadfw(struct i2c_client *client)
|
||||||
struct cx25840_state *state = i2c_get_clientdata(client);
|
struct cx25840_state *state = i2c_get_clientdata(client);
|
||||||
const struct firmware *fw = NULL;
|
const struct firmware *fw = NULL;
|
||||||
u8 buffer[4], *ptr;
|
u8 buffer[4], *ptr;
|
||||||
int size, send, retval;
|
int size, retval;
|
||||||
|
|
||||||
if (state->is_cx23885)
|
if (state->is_cx23885)
|
||||||
firmware = FWFILE_CX23885;
|
firmware = FWFILE_CX23885;
|
||||||
|
@ -124,8 +122,7 @@ int cx25840_loadfw(struct i2c_client *client)
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
ptr[0] = 0x08;
|
ptr[0] = 0x08;
|
||||||
ptr[1] = 0x02;
|
ptr[1] = 0x02;
|
||||||
send = size > (FWSEND - 2) ? FWSEND : size + 2;
|
retval = fw_write(client, ptr, min(FWSEND, size + 2));
|
||||||
retval = fw_write(client, ptr, send);
|
|
||||||
|
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
release_firmware(fw);
|
release_firmware(fw);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче