From: Sylwester Nawrocki <snjw23@gmail.com>
To: devel@driverdev.osuosl.org, linux-media@vger.kernel.org
Cc: Piotr Chmura <chmooreck@poczta.onet.pl>,
Devin Heitmueller <dheitmueller@kernellabs.com>,
Mauro Carvalho Chehab <mchehab@redhat.com>,
Sylwester Nawrocki <snjw23@gmail.com>,
Stefan Richter <stefanr@s5r6.in-berlin.de>,
Greg KH <gregkh@suse.de>
Subject: [PATCH 03/17] staging: as102: Fix CodingStyle errors in file as102_fw.c
Date: Mon, 31 Oct 2011 17:24:41 +0100 [thread overview]
Message-ID: <1320078295-3379-4-git-send-email-snjw23@gmail.com> (raw)
In-Reply-To: <1320078295-3379-1-git-send-email-snjw23@gmail.com>
From: Devin Heitmueller <dheitmueller@kernellabs.com>
Fix Linux kernel coding style (whitespace and indentation) errors
in file as102_fw.c. No functional changes.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl>
Signed-off-by: Sylwester Nawrocki <snjw23@gmail.com>
---
drivers/staging/media/as102/as102_fw.c | 101 ++++++++++++++++++--------------
1 files changed, 58 insertions(+), 43 deletions(-)
diff --git a/drivers/staging/media/as102/as102_fw.c b/drivers/staging/media/as102/as102_fw.c
index d921a6f..c019df9 100644
--- a/drivers/staging/media/as102/as102_fw.c
+++ b/drivers/staging/media/as102/as102_fw.c
@@ -1,6 +1,7 @@
/*
* Abilis Systems Single DVB-T Receiver
* Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com>
+ * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,15 +32,16 @@ char as102_st_fw2[] = "as102_data2_st.hex";
char as102_dt_fw1[] = "as102_data1_dt.hex";
char as102_dt_fw2[] = "as102_data2_dt.hex";
-static unsigned char atohx(unsigned char *dst, char *src) {
+static unsigned char atohx(unsigned char *dst, char *src)
+{
unsigned char value = 0;
char msb = tolower(*src) - '0';
- char lsb = tolower(*(src +1)) - '0';
+ char lsb = tolower(*(src + 1)) - '0';
- if (msb > 9 )
+ if (msb > 9)
msb -= 7;
- if (lsb > 9 )
+ if (lsb > 9)
lsb -= 7;
*dst = value = ((msb & 0xF) << 4) | (lsb & 0xF);
@@ -62,43 +64,42 @@ static int parse_hex_line(unsigned char *fw_data, unsigned char *addr,
}
/* locate end of line */
- for (src=fw_data; *src != '\n'; src += 2) {
+ for (src = fw_data; *src != '\n'; src += 2) {
atohx(&dst, src);
/* parse line to split addr / data */
switch (count) {
- case 0:
- *dataLength = dst;
- break;
- case 1:
- addr[2] = dst;
- break;
- case 2:
- addr[3] = dst;
- break;
- case 3:
- /* check if data is an address */
- if (dst == 0x04)
- *addr_has_changed = 1;
- else
- *addr_has_changed = 0;
- break;
- case 4:
- case 5:
- if (*addr_has_changed) {
- addr[(count - 4)] = dst;
- } else {
- data[(count - 4)] = dst;
- }
- break;
- default:
+ case 0:
+ *dataLength = dst;
+ break;
+ case 1:
+ addr[2] = dst;
+ break;
+ case 2:
+ addr[3] = dst;
+ break;
+ case 3:
+ /* check if data is an address */
+ if (dst == 0x04)
+ *addr_has_changed = 1;
+ else
+ *addr_has_changed = 0;
+ break;
+ case 4:
+ case 5:
+ if (*addr_has_changed)
+ addr[(count - 4)] = dst;
+ else
data[(count - 4)] = dst;
- break;
+ break;
+ default:
+ data[(count - 4)] = dst;
+ break;
}
count++;
}
/* return read value + ':' + '\n' */
- return ((count * 2) + 2);
+ return (count * 2) + 2;
}
static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap,
@@ -122,17 +123,20 @@ static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap,
&data_len,
&addr_has_changed);
- if (read_bytes <= 0) {
+ if (read_bytes <= 0)
goto error;
- }
/* detect the end of file */
- if ((total_read_bytes += read_bytes) == firmware->size) {
+ total_read_bytes += read_bytes;
+ if (total_read_bytes == firmware->size) {
fw_pkt.u.request[0] = 0x00;
fw_pkt.u.request[1] = 0x03;
/* send EOF command */
- if ((errno = bus_adap->ops->upload_fw_pkt(bus_adap,(uint8_t *) &fw_pkt, 2, 0)) < 0)
+ errno = bus_adap->ops->upload_fw_pkt(bus_adap,
+ (uint8_t *)
+ &fw_pkt, 2, 0);
+ if (errno < 0)
goto error;
} else {
if (!addr_has_changed) {
@@ -144,7 +148,12 @@ static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap,
data_len += sizeof(fw_pkt.raw.address);
/* send cmd to device */
- if ((errno = bus_adap->ops->upload_fw_pkt(bus_adap, (uint8_t *) &fw_pkt, data_len, 0)) < 0)
+ errno = bus_adap->ops->upload_fw_pkt(bus_adap,
+ (uint8_t *)
+ &fw_pkt,
+ data_len,
+ 0);
+ if (errno < 0)
goto error;
}
}
@@ -154,7 +163,8 @@ error:
return (errno == 0) ? total_read_bytes : errno;
}
-int as102_fw_upload(struct as102_bus_adapter_t *bus_adap) {
+int as102_fw_upload(struct as102_bus_adapter_t *bus_adap)
+{
int errno = -EFAULT;
const struct firmware *firmware;
unsigned char *cmd_buf = NULL;
@@ -179,20 +189,23 @@ int as102_fw_upload(struct as102_bus_adapter_t *bus_adap) {
#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
/* allocate buffer to store firmware upload command and data */
- if ((cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL)) == NULL) {
+ cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL);
+ if (cmd_buf == NULL) {
errno = -ENOMEM;
goto error;
}
/* request kernel to locate firmware file: part1 */
- if ((errno = request_firmware(&firmware, fw1, &dev->dev)) < 0) {
+ errno = request_firmware(&firmware, fw1, &dev->dev);
+ if (errno < 0) {
printk(KERN_ERR "%s: unable to locate firmware file: %s\n",
DRIVER_NAME, fw1);
goto error;
}
/* initiate firmware upload */
- if ((errno = as102_firmware_upload(bus_adap, cmd_buf, firmware)) < 0) {
+ errno = as102_firmware_upload(bus_adap, cmd_buf, firmware);
+ if (errno < 0) {
printk(KERN_ERR "%s: error during firmware upload part1\n",
DRIVER_NAME);
goto error;
@@ -206,14 +219,16 @@ int as102_fw_upload(struct as102_bus_adapter_t *bus_adap) {
mdelay(100);
/* request kernel to locate firmware file: part2 */
- if ((errno = request_firmware(&firmware, fw2, &dev->dev)) < 0) {
+ errno = request_firmware(&firmware, fw2, &dev->dev);
+ if (errno < 0) {
printk(KERN_ERR "%s: unable to locate firmware file: %s\n",
DRIVER_NAME, fw2);
goto error;
}
/* initiate firmware upload */
- if ((errno = as102_firmware_upload(bus_adap, cmd_buf, firmware)) < 0) {
+ errno = as102_firmware_upload(bus_adap, cmd_buf, firmware);
+ if (errno < 0) {
printk(KERN_ERR "%s: error during firmware upload part2\n",
DRIVER_NAME);
goto error;
--
1.7.4.1
next prev parent reply other threads:[~2011-10-31 16:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-31 16:24 [PATCH 00/17] Staging: Abilis Systems AS102 driver Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 01/17] staging: as102: Initial import from Abilis Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 02/17] staging: as102: Fix CodingStyle errors in file as102_drv.c Sylwester Nawrocki
2011-10-31 16:24 ` Sylwester Nawrocki [this message]
2011-10-31 16:24 ` [PATCH 04/17] staging: as102: Fix CodingStyle errors in file as10x_cmd.c Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 05/17] staging: as102: Fix CodingStyle errors in file as10x_cmd_stream.c Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 06/17] staging: as102: Fix CodingStyle errors in file as102_fe.c Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 07/17] staging: as102: Fix CodingStyle errors in file as102_usb_drv.c Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 08/17] staging: as102: Fix CodingStyle errors in file as10x_cmd_cfg.c Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 09/17] staging: as102: Add Elgato EyeTV DTT Deluxe Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 10/17] staging: as102: Properly handle multiple product names Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 11/17] staging: as102: Fix licensing oversight Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 12/17] staging: as102: Remove non-linux headers inclusion Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 13/17] staging: as102: Convert the comments to kernel-doc style Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 14/17] staging: as102: Enable compilation Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 15/17] staging: as102: Add nBox Tuner Dongle support Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 16/17] staging: as102: Unconditionally compile code dependent on DVB_CORE Sylwester Nawrocki
2011-10-31 16:24 ` [PATCH 17/17] staging: as102: Remove conditional compilation based on kernel version Sylwester Nawrocki
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=1320078295-3379-4-git-send-email-snjw23@gmail.com \
--to=snjw23@gmail.com \
--cc=chmooreck@poczta.onet.pl \
--cc=devel@driverdev.osuosl.org \
--cc=dheitmueller@kernellabs.com \
--cc=gregkh@suse.de \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.com \
--cc=stefanr@s5r6.in-berlin.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.