* [PATCH 02/17] staging: as102: Fix CodingStyle errors in file as102_drv.c
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
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_drv.c.
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_drv.c | 100 ++++++++++++++++---------------
1 files changed, 52 insertions(+), 48 deletions(-)
diff --git a/drivers/staging/media/as102/as102_drv.c b/drivers/staging/media/as102/as102_drv.c
index c334bff..9e5d81b 100644
--- a/drivers/staging/media/as102/as102_drv.c
+++ b/drivers/staging/media/as102/as102_drv.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
@@ -36,23 +37,23 @@
#warning >>> DVB_CORE not defined !!! <<<
#endif
-int debug = 0;
+int debug;
module_param_named(debug, debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off debugging (default: off)");
-int dual_tuner = 0;
+int dual_tuner;
module_param_named(dual_tuner, dual_tuner, int, 0644);
-MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner configuration (default: off)");
+MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner config (default: off)");
static int fw_upload = 1;
module_param_named(fw_upload, fw_upload, int, 0644);
MODULE_PARM_DESC(fw_upload, "Turn on/off default FW upload (default: on)");
-static int pid_filtering = 0;
+static int pid_filtering;
module_param_named(pid_filtering, pid_filtering, int, 0644);
MODULE_PARM_DESC(pid_filtering, "Activate HW PID filtering (default: off)");
-static int ts_auto_disable = 0;
+static int ts_auto_disable;
module_param_named(ts_auto_disable, ts_auto_disable, int, 0644);
MODULE_PARM_DESC(ts_auto_disable, "Stream Auto Enable on FW (default: off)");
@@ -65,7 +66,8 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
#endif
#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
-static void as102_stop_stream(struct as102_dev_t *dev) {
+static void as102_stop_stream(struct as102_dev_t *dev)
+{
struct as102_bus_adapter_t *bus_adap;
if (dev != NULL)
@@ -80,16 +82,15 @@ static void as102_stop_stream(struct as102_dev_t *dev) {
if (mutex_lock_interruptible(&dev->bus_adap.lock))
return;
- if (as10x_cmd_stop_streaming(bus_adap) < 0) {
+ if (as10x_cmd_stop_streaming(bus_adap) < 0)
dprintk(debug, "as10x_cmd_stop_streaming failed\n");
- }
mutex_unlock(&dev->bus_adap.lock);
}
}
-static int as102_start_stream(struct as102_dev_t *dev) {
-
+static int as102_start_stream(struct as102_dev_t *dev)
+{
struct as102_bus_adapter_t *bus_adap;
int ret = -EFAULT;
@@ -98,9 +99,8 @@ static int as102_start_stream(struct as102_dev_t *dev) {
else
return ret;
- if (bus_adap->ops->start_stream != NULL) {
+ if (bus_adap->ops->start_stream != NULL)
ret = bus_adap->ops->start_stream(dev);
- }
if (ts_auto_disable) {
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -127,25 +127,25 @@ static int as10x_pid_filter(struct as102_dev_t *dev,
return -EBUSY;
}
- switch(onoff) {
- case 0:
- ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid);
- dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n",
- index, pid, ret);
- break;
- case 1:
- {
- struct as10x_ts_filter filter;
-
- filter.type = TS_PID_TYPE_TS;
- filter.idx = 0xFF;
- filter.pid = pid;
-
- ret = as10x_cmd_add_PID_filter(bus_adap, &filter);
- dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n",
- index, filter.idx, filter.pid, ret);
- break;
- }
+ switch (onoff) {
+ case 0:
+ ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid);
+ dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n",
+ index, pid, ret);
+ break;
+ case 1:
+ {
+ struct as10x_ts_filter filter;
+
+ filter.type = TS_PID_TYPE_TS;
+ filter.idx = 0xFF;
+ filter.pid = pid;
+
+ ret = as10x_cmd_add_PID_filter(bus_adap, &filter);
+ dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n",
+ index, filter.idx, filter.pid, ret);
+ break;
+ }
}
mutex_unlock(&dev->bus_adap.lock);
@@ -154,7 +154,8 @@ static int as10x_pid_filter(struct as102_dev_t *dev,
return ret;
}
-static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed) {
+static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed)
+{
int ret = 0;
struct dvb_demux *demux = dvbdmxfeed->demux;
struct as102_dev_t *as102_dev = demux->priv;
@@ -169,16 +170,16 @@ static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed) {
dvbdmxfeed->index, dvbdmxfeed->pid, 1);
}
- if (as102_dev->streaming++ == 0) {
+ if (as102_dev->streaming++ == 0)
ret = as102_start_stream(as102_dev);
- }
mutex_unlock(&as102_dev->sem);
LEAVE();
return ret;
}
-static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed) {
+static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
+{
struct dvb_demux *demux = dvbdmxfeed->demux;
struct as102_dev_t *as102_dev = demux->priv;
@@ -187,9 +188,8 @@ static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed) {
if (mutex_lock_interruptible(&as102_dev->sem))
return -ERESTARTSYS;
- if (--as102_dev->streaming == 0) {
+ if (--as102_dev->streaming == 0)
as102_stop_stream(as102_dev);
- }
if (pid_filtering) {
as10x_pid_filter(as102_dev,
@@ -202,7 +202,8 @@ static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed) {
}
#endif
-int as102_dvb_register(struct as102_dev_t *as102_dev) {
+int as102_dvb_register(struct as102_dev_t *as102_dev)
+{
int ret = 0;
ENTER();
@@ -223,7 +224,7 @@ int as102_dvb_register(struct as102_dev_t *as102_dev) {
);
if (ret < 0) {
err("%s: dvb_register_adapter() failed (errno = %d)",
- __FUNCTION__, ret);
+ __func__, ret);
goto failed;
}
@@ -240,23 +241,23 @@ int as102_dvb_register(struct as102_dev_t *as102_dev) {
as102_dev->dvb_dmxdev.demux = &as102_dev->dvb_dmx.dmx;
as102_dev->dvb_dmxdev.capabilities = 0;
- if ((ret = dvb_dmx_init(&as102_dev->dvb_dmx)) < 0) {
- err("%s: dvb_dmx_init() failed (errno = %d)",
- __FUNCTION__, ret);
+ ret = dvb_dmx_init(&as102_dev->dvb_dmx);
+ if (ret < 0) {
+ err("%s: dvb_dmx_init() failed (errno = %d)", __func__, ret);
goto failed;
}
ret = dvb_dmxdev_init(&as102_dev->dvb_dmxdev, &as102_dev->dvb_adap);
if (ret < 0) {
- err("%s: dvb_dmxdev_init() failed (errno = %d)",
- __FUNCTION__, ret);
+ err("%s: dvb_dmxdev_init() failed (errno = %d)", __func__,
+ ret);
goto failed;
}
ret = as102_dvb_register_fe(as102_dev, &as102_dev->dvb_fe);
if (ret < 0) {
err("%s: as102_dvb_register_frontend() failed (errno = %d)",
- __FUNCTION__, ret);
+ __func__, ret);
goto failed;
}
#endif
@@ -283,7 +284,8 @@ failed:
return ret;
}
-void as102_dvb_unregister(struct as102_dev_t *as102_dev) {
+void as102_dvb_unregister(struct as102_dev_t *as102_dev)
+{
ENTER();
#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
@@ -300,7 +302,8 @@ void as102_dvb_unregister(struct as102_dev_t *as102_dev) {
LEAVE();
}
-static int __init as102_driver_init(void) {
+static int __init as102_driver_init(void)
+{
int ret = 0;
ENTER();
@@ -331,7 +334,8 @@ module_init(as102_driver_init);
* \brief as102 driver exit point. This function is called when device has
* to be removed.
*/
-static void __exit as102_driver_exit(void) {
+static void __exit as102_driver_exit(void)
+{
ENTER();
/* deregister this driver with the low level bus subsystem */
#if defined(CONFIG_AS102_USB)
--
1.7.4.1
^ permalink raw reply related
* [PATCH 03/17] staging: as102: Fix CodingStyle errors in file as102_fw.c
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
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
^ permalink raw reply related
* [PATCH 04/17] staging: as102: Fix CodingStyle errors in file as10x_cmd.c
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
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 as10x_cmd.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/as10x_cmd.c | 573 ++++++++++++++++---------------
1 files changed, 288 insertions(+), 285 deletions(-)
diff --git a/drivers/staging/media/as102/as10x_cmd.c b/drivers/staging/media/as102/as10x_cmd.c
index cecb809..222e703 100644
--- a/drivers/staging/media/as102/as10x_cmd.c
+++ b/drivers/staging/media/as102/as10x_cmd.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
@@ -21,7 +22,8 @@
#include <linux/kernel.h>
#include "as102_drv.h"
#elif defined(WIN32)
- #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */
+ #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)
+ /* win32 ddk implementation */
#include "wdm.h"
#include "Device.h"
#include "endian_mgmt.h" /* FIXME */
@@ -51,43 +53,42 @@
*/
int as10x_cmd_turn_on(as10x_handle_t *phandle)
{
- int error;
- struct as10x_cmd_t *pcmd, *prsp;
+ int error;
+ struct as10x_cmd_t *pcmd, *prsp;
- ENTER();
+ ENTER();
- pcmd = phandle->cmd;
- prsp = phandle->rsp;
+ pcmd = phandle->cmd;
+ prsp = phandle->rsp;
- /* prepare command */
- as10x_cmd_build(pcmd,(++phandle->cmd_xid), sizeof(pcmd->body.turn_on.req));
+ /* prepare command */
+ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ sizeof(pcmd->body.turn_on.req));
- /* fill command */
- pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON);
+ /* fill command */
+ pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON);
- /* send command */
- if(phandle->ops->xfer_cmd) {
- error = phandle->ops->xfer_cmd(
- phandle,
- (uint8_t *) pcmd,
- sizeof(pcmd->body.turn_on.req) + HEADER_SIZE,
- (uint8_t *) prsp,
- sizeof(prsp->body.turn_on.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd,
+ sizeof(pcmd->body.turn_on.req) +
+ HEADER_SIZE,
+ (uint8_t *) prsp,
+ sizeof(prsp->body.turn_on.rsp) +
+ HEADER_SIZE);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
- if(error < 0) {
- goto out;
- }
+ if (error < 0)
+ goto out;
- /* parse response */
- error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP);
+ /* parse response */
+ error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP);
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
/**
@@ -98,42 +99,41 @@ out:
*/
int as10x_cmd_turn_off(as10x_handle_t *phandle)
{
- int error;
- struct as10x_cmd_t *pcmd, *prsp;
+ int error;
+ struct as10x_cmd_t *pcmd, *prsp;
- ENTER();
+ ENTER();
- pcmd = phandle->cmd;
- prsp = phandle->rsp;
+ pcmd = phandle->cmd;
+ prsp = phandle->rsp;
- /* prepare command */
- as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.turn_off.req));
+ /* prepare command */
+ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ sizeof(pcmd->body.turn_off.req));
- /* fill command */
- pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF);
+ /* fill command */
+ pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF);
- /* send command */
- if(phandle->ops->xfer_cmd) {
- error = phandle->ops->xfer_cmd(
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(
phandle, (uint8_t *) pcmd,
sizeof(pcmd->body.turn_off.req) + HEADER_SIZE,
- (uint8_t *) prsp,
+ (uint8_t *) prsp,
sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
- if(error < 0) {
- goto out;
- }
+ if (error < 0)
+ goto out;
- /* parse response */
- error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP);
+ /* parse response */
+ error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP);
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
/**
@@ -145,50 +145,54 @@ out:
*/
int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune)
{
- int error;
- struct as10x_cmd_t *preq, *prsp;
-
- ENTER();
-
- preq = phandle->cmd;
- prsp = phandle->rsp;
-
- /* prepare command */
- as10x_cmd_build(preq,(++phandle->cmd_xid),sizeof(preq->body.set_tune.req));
-
- /* fill command */
- preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE);
- preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq);
- preq->body.set_tune.req.args.bandwidth = ptune->bandwidth;
- preq->body.set_tune.req.args.hier_select = ptune->hier_select;
- preq->body.set_tune.req.args.constellation = ptune->constellation;
- preq->body.set_tune.req.args.hierarchy = ptune->hierarchy;
- preq->body.set_tune.req.args.interleaving_mode = ptune->interleaving_mode;
- preq->body.set_tune.req.args.code_rate = ptune->code_rate;
- preq->body.set_tune.req.args.guard_interval = ptune->guard_interval;
- preq->body.set_tune.req.args.transmission_mode = ptune->transmission_mode;
-
- /* send command */
- if(phandle->ops->xfer_cmd) {
- error = phandle->ops->xfer_cmd(phandle,
- (uint8_t *) preq,
- sizeof(preq->body.set_tune.req) + HEADER_SIZE,
- (uint8_t *) prsp,
- sizeof(prsp->body.set_tune.rsp) + HEADER_SIZE);
- } else{
- error = AS10X_CMD_ERROR;
- }
-
- if(error < 0) {
- goto out;
- }
-
- /* parse response */
- error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP);
+ int error;
+ struct as10x_cmd_t *preq, *prsp;
+
+ ENTER();
+
+ preq = phandle->cmd;
+ prsp = phandle->rsp;
+
+ /* prepare command */
+ as10x_cmd_build(preq, (++phandle->cmd_xid),
+ sizeof(preq->body.set_tune.req));
+
+ /* fill command */
+ preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE);
+ preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq);
+ preq->body.set_tune.req.args.bandwidth = ptune->bandwidth;
+ preq->body.set_tune.req.args.hier_select = ptune->hier_select;
+ preq->body.set_tune.req.args.constellation = ptune->constellation;
+ preq->body.set_tune.req.args.hierarchy = ptune->hierarchy;
+ preq->body.set_tune.req.args.interleaving_mode =
+ ptune->interleaving_mode;
+ preq->body.set_tune.req.args.code_rate = ptune->code_rate;
+ preq->body.set_tune.req.args.guard_interval = ptune->guard_interval;
+ preq->body.set_tune.req.args.transmission_mode =
+ ptune->transmission_mode;
+
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(phandle,
+ (uint8_t *) preq,
+ sizeof(preq->body.set_tune.req)
+ + HEADER_SIZE,
+ (uint8_t *) prsp,
+ sizeof(prsp->body.set_tune.rsp)
+ + HEADER_SIZE);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
+
+ if (error < 0)
+ goto out;
+
+ /* parse response */
+ error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP);
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
/**
@@ -198,57 +202,55 @@ out:
\return 0 when no error, < 0 in case of error.
\callgraph
*/
-int as10x_cmd_get_tune_status(as10x_handle_t *phandle, struct as10x_tune_status *pstatus)
+int as10x_cmd_get_tune_status(as10x_handle_t *phandle,
+ struct as10x_tune_status *pstatus)
{
- int error;
- struct as10x_cmd_t *preq, *prsp;
+ int error;
+ struct as10x_cmd_t *preq, *prsp;
- ENTER();
+ ENTER();
- preq = phandle->cmd;
- prsp = phandle->rsp;
+ preq = phandle->cmd;
+ prsp = phandle->rsp;
- /* prepare command */
- as10x_cmd_build(preq,(++phandle->cmd_xid),
- sizeof(preq->body.get_tune_status.req));
+ /* prepare command */
+ as10x_cmd_build(preq, (++phandle->cmd_xid),
+ sizeof(preq->body.get_tune_status.req));
- /* fill command */
- preq->body.get_tune_status.req.proc_id =
- cpu_to_le16(CONTROL_PROC_GETTUNESTAT);
+ /* fill command */
+ preq->body.get_tune_status.req.proc_id =
+ cpu_to_le16(CONTROL_PROC_GETTUNESTAT);
- /* send command */
- if (phandle->ops->xfer_cmd) {
- error = phandle->ops->xfer_cmd(
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(
phandle,
(uint8_t *) preq,
sizeof(preq->body.get_tune_status.req) + HEADER_SIZE,
(uint8_t *) prsp,
sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
-
- if (error < 0) {
- goto out;
- }
-
- /* parse response */
- error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP);
- if (error < 0) {
- goto out;
- }
-
- /* Response OK -> get response data */
- pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state;
- pstatus->signal_strength =
- le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength);
- pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER);
- pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
+
+ if (error < 0)
+ goto out;
+
+ /* parse response */
+ error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP);
+ if (error < 0)
+ goto out;
+
+ /* Response OK -> get response data */
+ pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state;
+ pstatus->signal_strength =
+ le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength);
+ pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER);
+ pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER);
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
/**
@@ -260,56 +262,58 @@ out:
*/
int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps)
{
-
- int error;
- struct as10x_cmd_t *pcmd, *prsp;
-
- ENTER();
-
- pcmd = phandle->cmd;
- prsp = phandle->rsp;
-
- /* prepare command */
- as10x_cmd_build(pcmd, (++phandle->cmd_xid),sizeof(pcmd->body.get_tps.req));
-
- /* fill command */
- pcmd->body.get_tune_status.req.proc_id = cpu_to_le16(CONTROL_PROC_GETTPS);
-
- /* send command */
- if(phandle->ops->xfer_cmd) {
- error = phandle->ops->xfer_cmd(phandle,
- (uint8_t *) pcmd, sizeof(pcmd->body.get_tps.req) + HEADER_SIZE,
- (uint8_t *) prsp, sizeof(prsp->body.get_tps.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
-
- if(error < 0) {
- goto out;
- }
-
- /* parse response */
- error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP);
- if (error < 0) {
- goto out;
- }
-
- /* Response OK -> get response data */
- ptps->constellation = prsp->body.get_tps.rsp.tps.constellation;
- ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy;
- ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode;
- ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP;
- ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP;
- ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval;
- ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode;
- ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP;
- ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP;
- ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID);
+ int error;
+ struct as10x_cmd_t *pcmd, *prsp;
+
+ ENTER();
+
+ pcmd = phandle->cmd;
+ prsp = phandle->rsp;
+
+ /* prepare command */
+ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ sizeof(pcmd->body.get_tps.req));
+
+ /* fill command */
+ pcmd->body.get_tune_status.req.proc_id =
+ cpu_to_le16(CONTROL_PROC_GETTPS);
+
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(phandle,
+ (uint8_t *) pcmd,
+ sizeof(pcmd->body.get_tps.req) +
+ HEADER_SIZE,
+ (uint8_t *) prsp,
+ sizeof(prsp->body.get_tps.rsp) +
+ HEADER_SIZE);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
+
+ if (error < 0)
+ goto out;
+
+ /* parse response */
+ error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP);
+ if (error < 0)
+ goto out;
+
+ /* Response OK -> get response data */
+ ptps->constellation = prsp->body.get_tps.rsp.tps.constellation;
+ ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy;
+ ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode;
+ ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP;
+ ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP;
+ ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval;
+ ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode;
+ ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP;
+ ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP;
+ ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID);
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
/**
@@ -322,59 +326,58 @@ out:
int as10x_cmd_get_demod_stats(as10x_handle_t *phandle,
struct as10x_demod_stats *pdemod_stats)
{
- int error;
- struct as10x_cmd_t *pcmd, *prsp;
-
- ENTER();
-
- pcmd = phandle->cmd;
- prsp = phandle->rsp;
-
- /* prepare command */
- as10x_cmd_build(pcmd, (++phandle->cmd_xid),
- sizeof(pcmd->body.get_demod_stats.req));
-
- /* fill command */
- pcmd->body.get_demod_stats.req.proc_id =
- cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS);
-
- /* send command */
- if(phandle->ops->xfer_cmd) {
- error = phandle->ops->xfer_cmd(phandle,
- (uint8_t *) pcmd,
- sizeof(pcmd->body.get_demod_stats.req) + HEADER_SIZE,
- (uint8_t *) prsp,
- sizeof(prsp->body.get_demod_stats.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
-
- if(error < 0) {
- goto out;
- }
-
- /* parse response */
- error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_DEMOD_STATS_RSP);
- if (error < 0) {
- goto out;
- }
-
- /* Response OK -> get response data */
- pdemod_stats->frame_count =
- le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count);
- pdemod_stats->bad_frame_count =
- le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count);
- pdemod_stats->bytes_fixed_by_rs =
- le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs);
- pdemod_stats->mer =
- le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer);
- pdemod_stats->has_started =
- prsp->body.get_demod_stats.rsp.stats.has_started;
+ int error;
+ struct as10x_cmd_t *pcmd, *prsp;
+
+ ENTER();
+
+ pcmd = phandle->cmd;
+ prsp = phandle->rsp;
+
+ /* prepare command */
+ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ sizeof(pcmd->body.get_demod_stats.req));
+
+ /* fill command */
+ pcmd->body.get_demod_stats.req.proc_id =
+ cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS);
+
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(phandle,
+ (uint8_t *) pcmd,
+ sizeof(pcmd->body.get_demod_stats.req)
+ + HEADER_SIZE,
+ (uint8_t *) prsp,
+ sizeof(prsp->body.get_demod_stats.rsp)
+ + HEADER_SIZE);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
+
+ if (error < 0)
+ goto out;
+
+ /* parse response */
+ error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_DEMOD_STATS_RSP);
+ if (error < 0)
+ goto out;
+
+ /* Response OK -> get response data */
+ pdemod_stats->frame_count =
+ le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count);
+ pdemod_stats->bad_frame_count =
+ le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count);
+ pdemod_stats->bytes_fixed_by_rs =
+ le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs);
+ pdemod_stats->mer =
+ le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer);
+ pdemod_stats->has_started =
+ prsp->body.get_demod_stats.rsp.stats.has_started;
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
/**
@@ -388,50 +391,49 @@ out:
int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle,
uint8_t *is_ready)
{
- int error;
- struct as10x_cmd_t *pcmd, *prsp;
-
- ENTER();
-
- pcmd = phandle->cmd;
- prsp = phandle->rsp;
-
- /* prepare command */
- as10x_cmd_build(pcmd, (++phandle->cmd_xid),
- sizeof(pcmd->body.get_impulse_rsp.req));
-
- /* fill command */
- pcmd->body.get_impulse_rsp.req.proc_id =
- cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP);
-
- /* send command */
- if(phandle->ops->xfer_cmd) {
- error = phandle->ops->xfer_cmd(phandle,
- (uint8_t *) pcmd,
- sizeof(pcmd->body.get_impulse_rsp.req) + HEADER_SIZE,
- (uint8_t *) prsp,
- sizeof(prsp->body.get_impulse_rsp.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
-
- if(error < 0) {
- goto out;
- }
-
- /* parse response */
- error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_IMPULSE_RESP_RSP);
- if (error < 0) {
- goto out;
- }
-
- /* Response OK -> get response data */
- *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready;
+ int error;
+ struct as10x_cmd_t *pcmd, *prsp;
+
+ ENTER();
+
+ pcmd = phandle->cmd;
+ prsp = phandle->rsp;
+
+ /* prepare command */
+ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ sizeof(pcmd->body.get_impulse_rsp.req));
+
+ /* fill command */
+ pcmd->body.get_impulse_rsp.req.proc_id =
+ cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP);
+
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(phandle,
+ (uint8_t *) pcmd,
+ sizeof(pcmd->body.get_impulse_rsp.req)
+ + HEADER_SIZE,
+ (uint8_t *) prsp,
+ sizeof(prsp->body.get_impulse_rsp.rsp)
+ + HEADER_SIZE);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
+
+ if (error < 0)
+ goto out;
+
+ /* parse response */
+ error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_IMPULSE_RESP_RSP);
+ if (error < 0)
+ goto out;
+
+ /* Response OK -> get response data */
+ *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready;
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
@@ -447,10 +449,10 @@ out:
void as10x_cmd_build(struct as10x_cmd_t *pcmd,
uint16_t xid, uint16_t cmd_len)
{
- pcmd->header.req_id = cpu_to_le16(xid);
- pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID);
- pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION);
- pcmd->header.data_len = cpu_to_le16(cmd_len);
+ pcmd->header.req_id = cpu_to_le16(xid);
+ pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID);
+ pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION);
+ pcmd->header.data_len = cpu_to_le16(cmd_len);
}
/**
@@ -463,16 +465,17 @@ void as10x_cmd_build(struct as10x_cmd_t *pcmd,
*/
int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id)
{
- int error;
+ int error;
- /* extract command error code */
- error = prsp->body.common.rsp.error;
+ /* extract command error code */
+ error = prsp->body.common.rsp.error;
- if((error == 0) && (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) {
- return 0;
- }
+ if ((error == 0) &&
+ (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) {
+ return 0;
+ }
- return AS10X_CMD_ERROR;
+ return AS10X_CMD_ERROR;
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 05/17] staging: as102: Fix CodingStyle errors in file as10x_cmd_stream.c
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
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 as10x_cmd_stream.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/as10x_cmd_stream.c | 280 ++++++++++++------------
1 files changed, 136 insertions(+), 144 deletions(-)
diff --git a/drivers/staging/media/as102/as10x_cmd_stream.c b/drivers/staging/media/as102/as10x_cmd_stream.c
index 4dfacf4..8705894 100644
--- a/drivers/staging/media/as102/as10x_cmd_stream.c
+++ b/drivers/staging/media/as102/as10x_cmd_stream.c
@@ -2,8 +2,6 @@
\file as10x_cmd_stream.c
- \version $Id$
-
\author: S. Martinelli
----------------------------------------------------------------------------\n
@@ -53,57 +51,57 @@
\return 0 when no error, < 0 in case of error.
\callgraph
*/
-int as10x_cmd_add_PID_filter(as10x_handle_t* phandle,
- struct as10x_ts_filter *filter) {
- int error;
- struct as10x_cmd_t *pcmd, *prsp;
-
- ENTER();
-
- pcmd = phandle->cmd;
- prsp = phandle->rsp;
-
- /* prepare command */
- as10x_cmd_build(pcmd, (++phandle->cmd_xid),
- sizeof(pcmd->body.add_pid_filter.req));
-
- /* fill command */
- pcmd->body.add_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_SETFILTER);
- pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid);
- pcmd->body.add_pid_filter.req.stream_type = filter->type;
-
- if(filter->idx < 16)
- pcmd->body.add_pid_filter.req.idx = filter->idx;
- else
- pcmd->body.add_pid_filter.req.idx = 0xFF;
-
- /* send command */
- if(phandle->ops->xfer_cmd) {
- error = phandle->ops->xfer_cmd(phandle,
- (uint8_t *) pcmd,
- sizeof(pcmd->body.add_pid_filter.req) + HEADER_SIZE,
- (uint8_t *) prsp,
- sizeof(prsp->body.add_pid_filter.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
-
- if(error < 0) {
- goto out;
- }
-
- /* parse response */
- error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP);
-
- if(error == 0) {
- /* Response OK -> get response data */
- filter->idx = prsp->body.add_pid_filter.rsp.filter_id;
- }
+int as10x_cmd_add_PID_filter(as10x_handle_t *phandle,
+ struct as10x_ts_filter *filter)
+{
+ int error;
+ struct as10x_cmd_t *pcmd, *prsp;
+
+ ENTER();
+
+ pcmd = phandle->cmd;
+ prsp = phandle->rsp;
+
+ /* prepare command */
+ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ sizeof(pcmd->body.add_pid_filter.req));
+
+ /* fill command */
+ pcmd->body.add_pid_filter.req.proc_id =
+ cpu_to_le16(CONTROL_PROC_SETFILTER);
+ pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid);
+ pcmd->body.add_pid_filter.req.stream_type = filter->type;
+
+ if (filter->idx < 16)
+ pcmd->body.add_pid_filter.req.idx = filter->idx;
+ else
+ pcmd->body.add_pid_filter.req.idx = 0xFF;
+
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd,
+ sizeof(pcmd->body.add_pid_filter.req)
+ + HEADER_SIZE, (uint8_t *) prsp,
+ sizeof(prsp->body.add_pid_filter.rsp)
+ + HEADER_SIZE);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
+
+ if (error < 0)
+ goto out;
+
+ /* parse response */
+ error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP);
+
+ if (error == 0) {
+ /* Response OK -> get response data */
+ filter->idx = prsp->body.add_pid_filter.rsp.filter_id;
+ }
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
/**
@@ -113,144 +111,138 @@ out:
\return 0 when no error, < 0 in case of error.
\callgraph
*/
-int as10x_cmd_del_PID_filter(as10x_handle_t* phandle,
+int as10x_cmd_del_PID_filter(as10x_handle_t *phandle,
uint16_t pid_value)
{
+ int error;
+ struct as10x_cmd_t *pcmd, *prsp;
- int error;
- struct as10x_cmd_t *pcmd, *prsp;
-
- ENTER();
+ ENTER();
- pcmd = phandle->cmd;
- prsp = phandle->rsp;
+ pcmd = phandle->cmd;
+ prsp = phandle->rsp;
- /* prepare command */
- as10x_cmd_build(pcmd, (++phandle->cmd_xid),
- sizeof(pcmd->body.del_pid_filter.req));
+ /* prepare command */
+ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ sizeof(pcmd->body.del_pid_filter.req));
- /* fill command */
- pcmd->body.del_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_REMOVEFILTER);
- pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value);
+ /* fill command */
+ pcmd->body.del_pid_filter.req.proc_id =
+ cpu_to_le16(CONTROL_PROC_REMOVEFILTER);
+ pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value);
- /* send command */
- if(phandle->ops->xfer_cmd){
- error = phandle->ops->xfer_cmd(phandle,
- (uint8_t *) pcmd,
- sizeof(pcmd->body.del_pid_filter.req) + HEADER_SIZE,
- (uint8_t *) prsp,
- sizeof(prsp->body.del_pid_filter.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd,
+ sizeof(pcmd->body.del_pid_filter.req)
+ + HEADER_SIZE, (uint8_t *) prsp,
+ sizeof(prsp->body.del_pid_filter.rsp)
+ + HEADER_SIZE);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
- if(error < 0) {
- goto out;
- }
+ if (error < 0)
+ goto out;
- /* parse response */
- error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP);
+ /* parse response */
+ error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP);
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
/**
\brief Send start streaming command to AS10x
\param phandle: pointer to AS10x handle
- \return 0 when no error, < 0 in case of error.
+ \return 0 when no error, < 0 in case of error.
\callgraph
*/
-int as10x_cmd_start_streaming(as10x_handle_t* phandle)
+int as10x_cmd_start_streaming(as10x_handle_t *phandle)
{
- int error;
- struct as10x_cmd_t *pcmd, *prsp;
+ int error;
+ struct as10x_cmd_t *pcmd, *prsp;
- ENTER();
+ ENTER();
- pcmd = phandle->cmd;
- prsp = phandle->rsp;
+ pcmd = phandle->cmd;
+ prsp = phandle->rsp;
- /* prepare command */
- as10x_cmd_build(pcmd, (++phandle->cmd_xid),
- sizeof(pcmd->body.start_streaming.req));
+ /* prepare command */
+ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ sizeof(pcmd->body.start_streaming.req));
- /* fill command */
- pcmd->body.start_streaming.req.proc_id =
- cpu_to_le16(CONTROL_PROC_START_STREAMING);
+ /* fill command */
+ pcmd->body.start_streaming.req.proc_id =
+ cpu_to_le16(CONTROL_PROC_START_STREAMING);
- /* send command */
- if(phandle->ops->xfer_cmd){
- error = phandle->ops->xfer_cmd(phandle,
- (uint8_t *) pcmd,
- sizeof(pcmd->body.start_streaming.req) + HEADER_SIZE,
- (uint8_t *) prsp,
- sizeof(prsp->body.start_streaming.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd,
+ sizeof(pcmd->body.start_streaming.req)
+ + HEADER_SIZE, (uint8_t *) prsp,
+ sizeof(prsp->body.start_streaming.rsp)
+ + HEADER_SIZE);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
- if(error < 0) {
- goto out;
- }
+ if (error < 0)
+ goto out;
- /* parse response */
- error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP);
+ /* parse response */
+ error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP);
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
/**
\brief Send stop streaming command to AS10x
\param phandle: pointer to AS10x handle
- \return 0 when no error, < 0 in case of error.
+ \return 0 when no error, < 0 in case of error.
\callgraph
*/
-int as10x_cmd_stop_streaming(as10x_handle_t* phandle)
+int as10x_cmd_stop_streaming(as10x_handle_t *phandle)
{
- int8_t error;
- struct as10x_cmd_t *pcmd, *prsp;
+ int8_t error;
+ struct as10x_cmd_t *pcmd, *prsp;
- ENTER();
+ ENTER();
- pcmd = phandle->cmd;
- prsp = phandle->rsp;
+ pcmd = phandle->cmd;
+ prsp = phandle->rsp;
- /* prepare command */
- as10x_cmd_build(pcmd, (++phandle->cmd_xid),
- sizeof(pcmd->body.stop_streaming.req));
+ /* prepare command */
+ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ sizeof(pcmd->body.stop_streaming.req));
- /* fill command */
- pcmd->body.stop_streaming.req.proc_id =
- cpu_to_le16(CONTROL_PROC_STOP_STREAMING);
+ /* fill command */
+ pcmd->body.stop_streaming.req.proc_id =
+ cpu_to_le16(CONTROL_PROC_STOP_STREAMING);
- /* send command */
- if(phandle->ops->xfer_cmd){
- error = phandle->ops->xfer_cmd(phandle,
- (uint8_t *) pcmd,
- sizeof(pcmd->body.stop_streaming.req) + HEADER_SIZE,
- (uint8_t *) prsp,
- sizeof(prsp->body.stop_streaming.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd,
+ sizeof(pcmd->body.stop_streaming.req)
+ + HEADER_SIZE, (uint8_t *) prsp,
+ sizeof(prsp->body.stop_streaming.rsp)
+ + HEADER_SIZE);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
- if(error < 0) {
- goto out;
- }
+ if (error < 0)
+ goto out;
- /* parse response */
- error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP);
+ /* parse response */
+ error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP);
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 06/17] staging: as102: Fix CodingStyle errors in file as102_fe.c
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
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_fe.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_fe.c | 476 +++++++++++++++++---------------
1 files changed, 252 insertions(+), 224 deletions(-)
diff --git a/drivers/staging/media/as102/as102_fe.c b/drivers/staging/media/as102/as102_fe.c
index 3e6f497..e9f7188 100644
--- a/drivers/staging/media/as102/as102_fe.c
+++ b/drivers/staging/media/as102/as102_fe.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,12 +32,14 @@ static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst,
static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst,
struct dvb_frontend_parameters *src);
-static void as102_fe_release(struct dvb_frontend *fe) {
+static void as102_fe_release(struct dvb_frontend *fe)
+{
struct as102_dev_t *dev;
ENTER();
- if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+ dev = (struct as102_dev_t *) fe->tuner_priv;
+ if (dev == NULL)
return;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
@@ -64,13 +67,15 @@ static void as102_fe_release(struct dvb_frontend *fe) {
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
-static int as102_fe_init(struct dvb_frontend *fe) {
+static int as102_fe_init(struct dvb_frontend *fe)
+{
int ret = 0;
struct as102_dev_t *dev;
ENTER();
- if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+ dev = (struct as102_dev_t *) fe->tuner_priv;
+ if (dev == NULL)
return -ENODEV;
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -90,14 +95,16 @@ static int as102_fe_init(struct dvb_frontend *fe) {
#endif
static int as102_fe_set_frontend(struct dvb_frontend *fe,
- struct dvb_frontend_parameters *params) {
+ struct dvb_frontend_parameters *params)
+{
int ret = 0;
struct as102_dev_t *dev;
struct as10x_tune_args tune_args = { 0 };
ENTER();
- if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+ dev = (struct as102_dev_t *) fe->tuner_priv;
+ if (dev == NULL)
return -ENODEV;
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -107,9 +114,8 @@ static int as102_fe_set_frontend(struct dvb_frontend *fe,
/* send abilis command: SET_TUNE */
ret = as10x_cmd_set_tune(&dev->bus_adap, &tune_args);
- if(ret != 0) {
+ if (ret != 0)
dprintk(debug, "as10x_cmd_set_tune failed. (err = %d)\n", ret);
- }
mutex_unlock(&dev->bus_adap.lock);
@@ -117,7 +123,7 @@ static int as102_fe_set_frontend(struct dvb_frontend *fe,
return (ret < 0) ? -EINVAL : 0;
}
-static int as102_fe_get_frontend(struct dvb_frontend* fe,
+static int as102_fe_get_frontend(struct dvb_frontend *fe,
struct dvb_frontend_parameters *p) {
int ret = 0;
struct as102_dev_t *dev;
@@ -125,7 +131,8 @@ static int as102_fe_get_frontend(struct dvb_frontend* fe,
ENTER();
- if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+ dev = (struct as102_dev_t *) fe->tuner_priv;
+ if (dev == NULL)
return -EINVAL;
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -150,7 +157,8 @@ static int as102_fe_get_tune_settings(struct dvb_frontend *fe,
#if 0
dprintk(debug, "step_size = %d\n", settings->step_size);
dprintk(debug, "max_drift = %d\n", settings->max_drift);
- dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, 1000);
+ dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms,
+ 1000);
#endif
settings->min_delay_ms = 1000;
@@ -160,14 +168,16 @@ static int as102_fe_get_tune_settings(struct dvb_frontend *fe,
}
-static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) {
+static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status)
+{
int ret = 0;
struct as102_dev_t *dev;
struct as10x_tune_status tstate = { 0 };
ENTER();
- if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+ dev = (struct as102_dev_t *) fe->tuner_priv;
+ if (dev == NULL)
return -ENODEV;
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -176,48 +186,47 @@ static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) {
/* send abilis command: GET_TUNE_STATUS */
ret = as10x_cmd_get_tune_status(&dev->bus_adap, &tstate);
if (ret < 0) {
- dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n", ret);
+ dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n",
+ ret);
goto out;
}
dev->signal_strength = tstate.signal_strength;
dev->ber = tstate.BER;
- switch(tstate.tune_state) {
- case TUNE_STATUS_SIGNAL_DVB_OK:
- *status = FE_HAS_SIGNAL |
- FE_HAS_CARRIER;
- break;
- case TUNE_STATUS_STREAM_DETECTED:
- *status = FE_HAS_SIGNAL |
- FE_HAS_CARRIER |
- FE_HAS_SYNC;
- break;
- case TUNE_STATUS_STREAM_TUNED:
- *status = FE_HAS_SIGNAL |
- FE_HAS_CARRIER |
- FE_HAS_SYNC |
- FE_HAS_LOCK;
- break;
- default:
- *status = TUNE_STATUS_NOT_TUNED;
+ switch (tstate.tune_state) {
+ case TUNE_STATUS_SIGNAL_DVB_OK:
+ *status = FE_HAS_SIGNAL | FE_HAS_CARRIER;
+ break;
+ case TUNE_STATUS_STREAM_DETECTED:
+ *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC;
+ break;
+ case TUNE_STATUS_STREAM_TUNED:
+ *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC |
+ FE_HAS_LOCK;
+ break;
+ default:
+ *status = TUNE_STATUS_NOT_TUNED;
}
- dprintk(debug, "tuner status: 0x%02x , strength %d , per: %d , ber: %d\n",
+ dprintk(debug, "tuner status: 0x%02x, strength %d, per: %d, ber: %d\n",
tstate.tune_state, tstate.signal_strength,
tstate.PER, tstate.BER);
if (*status & FE_HAS_LOCK) {
if (as10x_cmd_get_demod_stats(&dev->bus_adap,
- (struct as10x_demod_stats *) &dev->demod_stats) < 0) {
+ (struct as10x_demod_stats *) &dev->demod_stats) < 0) {
memset(&dev->demod_stats, 0, sizeof(dev->demod_stats));
- dprintk(debug, "as10x_cmd_get_demod_stats failed (probably not tuned)\n");
+ dprintk(debug, "as10x_cmd_get_demod_stats failed "
+ "(probably not tuned)\n");
} else {
- dprintk(debug, "demod status: fc: 0x%08x , bad fc: 0x%08x , bytes corrected: 0x%08x , MER: 0x%04x\n",
- dev->demod_stats.frame_count,
- dev->demod_stats.bad_frame_count,
- dev->demod_stats.bytes_fixed_by_rs,
- dev->demod_stats.mer);
+ dprintk(debug,
+ "demod status: fc: 0x%08x, bad fc: 0x%08x, "
+ "bytes corrected: 0x%08x , MER: 0x%04x\n",
+ dev->demod_stats.frame_count,
+ dev->demod_stats.bad_frame_count,
+ dev->demod_stats.bytes_fixed_by_rs,
+ dev->demod_stats.mer);
}
} else {
memset(&dev->demod_stats, 0, sizeof(dev->demod_stats));
@@ -236,12 +245,14 @@ out:
* - the accuracy equals ±2dB for a SNR range from 4dB to 30dB
* - the accuracy is >2dB for SNR values outside this range
*/
-static int as102_fe_read_snr(struct dvb_frontend* fe, u16* snr) {
+static int as102_fe_read_snr(struct dvb_frontend *fe, u16 *snr)
+{
struct as102_dev_t *dev;
ENTER();
- if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+ dev = (struct as102_dev_t *) fe->tuner_priv;
+ if (dev == NULL)
return -ENODEV;
*snr = dev->demod_stats.mer;
@@ -250,12 +261,14 @@ static int as102_fe_read_snr(struct dvb_frontend* fe, u16* snr) {
return 0;
}
-static int as102_fe_read_ber(struct dvb_frontend* fe, u32* ber) {
+static int as102_fe_read_ber(struct dvb_frontend *fe, u32 *ber)
+{
struct as102_dev_t *dev;
ENTER();
- if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+ dev = (struct as102_dev_t *) fe->tuner_priv;
+ if (dev == NULL)
return -ENODEV;
*ber = dev->ber;
@@ -264,12 +277,15 @@ static int as102_fe_read_ber(struct dvb_frontend* fe, u32* ber) {
return 0;
}
-static int as102_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength) {
+static int as102_fe_read_signal_strength(struct dvb_frontend *fe,
+ u16 *strength)
+{
struct as102_dev_t *dev;
ENTER();
- if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+ dev = (struct as102_dev_t *) fe->tuner_priv;
+ if (dev == NULL)
return -ENODEV;
*strength = (((0xffff * 400) * dev->signal_strength + 41000) * 2);
@@ -278,12 +294,14 @@ static int as102_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength)
return 0;
}
-static int as102_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) {
+static int as102_fe_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
+{
struct as102_dev_t *dev;
ENTER();
- if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+ dev = (struct as102_dev_t *) fe->tuner_priv;
+ if (dev == NULL)
return -ENODEV;
if (dev->demod_stats.has_started)
@@ -296,13 +314,15 @@ static int as102_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) {
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
-static int as102_fe_ts_bus_ctrl(struct dvb_frontend* fe, int acquire) {
+static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire)
+{
struct as102_dev_t *dev;
int ret;
ENTER();
- if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+ dev = (struct as102_dev_t *) fe->tuner_priv;
+ if (dev == NULL)
return -ENODEV;
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -362,8 +382,8 @@ static struct dvb_frontend_ops as102_fe_ops = {
#endif
};
-int as102_dvb_unregister_fe(struct dvb_frontend *fe) {
-
+int as102_dvb_unregister_fe(struct dvb_frontend *fe)
+{
/* unregister frontend */
dvb_unregister_frontend(fe);
@@ -374,11 +394,13 @@ int as102_dvb_unregister_fe(struct dvb_frontend *fe) {
return 0;
}
-int as102_dvb_register_fe(struct as102_dev_t *as102_dev, struct dvb_frontend *dvb_fe) {
+int as102_dvb_register_fe(struct as102_dev_t *as102_dev,
+ struct dvb_frontend *dvb_fe)
+{
int errno;
struct dvb_adapter *dvb_adap;
- if(as102_dev == NULL)
+ if (as102_dev == NULL)
return -EINVAL;
/* extract dvb_adapter */
@@ -389,140 +411,143 @@ int as102_dvb_register_fe(struct as102_dev_t *as102_dev, struct dvb_frontend *dv
/* register dbvb frontend */
errno = dvb_register_frontend(dvb_adap, dvb_fe);
- if(errno == 0)
+ if (errno == 0)
dvb_fe->tuner_priv = as102_dev;
return errno;
}
static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst,
- struct as10x_tps *as10x_tps) {
+ struct as10x_tps *as10x_tps)
+{
struct dvb_ofdm_parameters *fe_tps = &dst->u.ofdm;
/* extract consteallation */
- switch(as10x_tps->constellation) {
- case CONST_QPSK:
- fe_tps->constellation = QPSK;
- break;
- case CONST_QAM16:
- fe_tps->constellation = QAM_16;
- break;
- case CONST_QAM64:
- fe_tps->constellation = QAM_64;
- break;
+ switch (as10x_tps->constellation) {
+ case CONST_QPSK:
+ fe_tps->constellation = QPSK;
+ break;
+ case CONST_QAM16:
+ fe_tps->constellation = QAM_16;
+ break;
+ case CONST_QAM64:
+ fe_tps->constellation = QAM_64;
+ break;
}
/* extract hierarchy */
- switch(as10x_tps->hierarchy) {
- case HIER_NONE:
- fe_tps->hierarchy_information = HIERARCHY_NONE;
- break;
- case HIER_ALPHA_1:
- fe_tps->hierarchy_information = HIERARCHY_1;
- break;
- case HIER_ALPHA_2:
- fe_tps->hierarchy_information = HIERARCHY_2;
- break;
- case HIER_ALPHA_4:
- fe_tps->hierarchy_information = HIERARCHY_4;
- break;
+ switch (as10x_tps->hierarchy) {
+ case HIER_NONE:
+ fe_tps->hierarchy_information = HIERARCHY_NONE;
+ break;
+ case HIER_ALPHA_1:
+ fe_tps->hierarchy_information = HIERARCHY_1;
+ break;
+ case HIER_ALPHA_2:
+ fe_tps->hierarchy_information = HIERARCHY_2;
+ break;
+ case HIER_ALPHA_4:
+ fe_tps->hierarchy_information = HIERARCHY_4;
+ break;
}
/* extract code rate HP */
- switch(as10x_tps->code_rate_HP) {
- case CODE_RATE_1_2:
- fe_tps->code_rate_HP = FEC_1_2;
- break;
- case CODE_RATE_2_3:
- fe_tps->code_rate_HP = FEC_2_3;
- break;
- case CODE_RATE_3_4:
- fe_tps->code_rate_HP = FEC_3_4;
- break;
- case CODE_RATE_5_6:
- fe_tps->code_rate_HP = FEC_5_6;
- break;
- case CODE_RATE_7_8:
- fe_tps->code_rate_HP = FEC_7_8;
- break;
+ switch (as10x_tps->code_rate_HP) {
+ case CODE_RATE_1_2:
+ fe_tps->code_rate_HP = FEC_1_2;
+ break;
+ case CODE_RATE_2_3:
+ fe_tps->code_rate_HP = FEC_2_3;
+ break;
+ case CODE_RATE_3_4:
+ fe_tps->code_rate_HP = FEC_3_4;
+ break;
+ case CODE_RATE_5_6:
+ fe_tps->code_rate_HP = FEC_5_6;
+ break;
+ case CODE_RATE_7_8:
+ fe_tps->code_rate_HP = FEC_7_8;
+ break;
}
/* extract code rate LP */
- switch(as10x_tps->code_rate_LP) {
- case CODE_RATE_1_2:
- fe_tps->code_rate_LP = FEC_1_2;
- break;
- case CODE_RATE_2_3:
- fe_tps->code_rate_LP = FEC_2_3;
- break;
- case CODE_RATE_3_4:
- fe_tps->code_rate_LP = FEC_3_4;
- break;
- case CODE_RATE_5_6:
- fe_tps->code_rate_LP = FEC_5_6;
- break;
- case CODE_RATE_7_8:
- fe_tps->code_rate_LP = FEC_7_8;
- break;
+ switch (as10x_tps->code_rate_LP) {
+ case CODE_RATE_1_2:
+ fe_tps->code_rate_LP = FEC_1_2;
+ break;
+ case CODE_RATE_2_3:
+ fe_tps->code_rate_LP = FEC_2_3;
+ break;
+ case CODE_RATE_3_4:
+ fe_tps->code_rate_LP = FEC_3_4;
+ break;
+ case CODE_RATE_5_6:
+ fe_tps->code_rate_LP = FEC_5_6;
+ break;
+ case CODE_RATE_7_8:
+ fe_tps->code_rate_LP = FEC_7_8;
+ break;
}
/* extract guard interval */
- switch(as10x_tps->guard_interval) {
- case GUARD_INT_1_32:
- fe_tps->guard_interval = GUARD_INTERVAL_1_32;
- break;
- case GUARD_INT_1_16:
- fe_tps->guard_interval = GUARD_INTERVAL_1_16;
- break;
- case GUARD_INT_1_8:
- fe_tps->guard_interval = GUARD_INTERVAL_1_8;
- break;
- case GUARD_INT_1_4:
- fe_tps->guard_interval = GUARD_INTERVAL_1_4;
- break;
+ switch (as10x_tps->guard_interval) {
+ case GUARD_INT_1_32:
+ fe_tps->guard_interval = GUARD_INTERVAL_1_32;
+ break;
+ case GUARD_INT_1_16:
+ fe_tps->guard_interval = GUARD_INTERVAL_1_16;
+ break;
+ case GUARD_INT_1_8:
+ fe_tps->guard_interval = GUARD_INTERVAL_1_8;
+ break;
+ case GUARD_INT_1_4:
+ fe_tps->guard_interval = GUARD_INTERVAL_1_4;
+ break;
}
/* extract transmission mode */
- switch(as10x_tps->transmission_mode) {
- case TRANS_MODE_2K:
- fe_tps->transmission_mode = TRANSMISSION_MODE_2K;
- break;
- case TRANS_MODE_8K:
- fe_tps->transmission_mode = TRANSMISSION_MODE_8K;
- break;
+ switch (as10x_tps->transmission_mode) {
+ case TRANS_MODE_2K:
+ fe_tps->transmission_mode = TRANSMISSION_MODE_2K;
+ break;
+ case TRANS_MODE_8K:
+ fe_tps->transmission_mode = TRANSMISSION_MODE_8K;
+ break;
}
}
-static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg) {
+static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg)
+{
uint8_t c;
- switch(arg) {
- case FEC_1_2:
- c = CODE_RATE_1_2;
- break;
- case FEC_2_3:
- c = CODE_RATE_2_3;
- break;
- case FEC_3_4:
- c = CODE_RATE_3_4;
- break;
- case FEC_5_6:
- c = CODE_RATE_5_6;
- break;
- case FEC_7_8:
- c = CODE_RATE_7_8;
- break;
- default:
- c = CODE_RATE_UNKNOWN;
- break;
+ switch (arg) {
+ case FEC_1_2:
+ c = CODE_RATE_1_2;
+ break;
+ case FEC_2_3:
+ c = CODE_RATE_2_3;
+ break;
+ case FEC_3_4:
+ c = CODE_RATE_3_4;
+ break;
+ case FEC_5_6:
+ c = CODE_RATE_5_6;
+ break;
+ case FEC_7_8:
+ c = CODE_RATE_7_8;
+ break;
+ default:
+ c = CODE_RATE_UNKNOWN;
+ break;
}
return c;
}
static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
- struct dvb_frontend_parameters *params) {
+ struct dvb_frontend_parameters *params)
+{
/* set frequency */
tune_args->freq = params->frequency / 1000;
@@ -530,81 +555,81 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
/* fix interleaving_mode */
tune_args->interleaving_mode = INTLV_NATIVE;
- switch(params->u.ofdm.bandwidth) {
- case BANDWIDTH_8_MHZ:
- tune_args->bandwidth = BW_8_MHZ;
- break;
- case BANDWIDTH_7_MHZ:
- tune_args->bandwidth = BW_7_MHZ;
- break;
- case BANDWIDTH_6_MHZ:
- tune_args->bandwidth = BW_6_MHZ;
- break;
- default:
- tune_args->bandwidth = BW_8_MHZ;
+ switch (params->u.ofdm.bandwidth) {
+ case BANDWIDTH_8_MHZ:
+ tune_args->bandwidth = BW_8_MHZ;
+ break;
+ case BANDWIDTH_7_MHZ:
+ tune_args->bandwidth = BW_7_MHZ;
+ break;
+ case BANDWIDTH_6_MHZ:
+ tune_args->bandwidth = BW_6_MHZ;
+ break;
+ default:
+ tune_args->bandwidth = BW_8_MHZ;
}
- switch(params->u.ofdm.guard_interval) {
- case GUARD_INTERVAL_1_32:
- tune_args->guard_interval = GUARD_INT_1_32;
- break;
- case GUARD_INTERVAL_1_16:
- tune_args->guard_interval = GUARD_INT_1_16;
- break;
- case GUARD_INTERVAL_1_8:
- tune_args->guard_interval = GUARD_INT_1_8;
- break;
- case GUARD_INTERVAL_1_4:
- tune_args->guard_interval = GUARD_INT_1_4;
- break;
- case GUARD_INTERVAL_AUTO:
- default:
- tune_args->guard_interval = GUARD_UNKNOWN;
- break;
+ switch (params->u.ofdm.guard_interval) {
+ case GUARD_INTERVAL_1_32:
+ tune_args->guard_interval = GUARD_INT_1_32;
+ break;
+ case GUARD_INTERVAL_1_16:
+ tune_args->guard_interval = GUARD_INT_1_16;
+ break;
+ case GUARD_INTERVAL_1_8:
+ tune_args->guard_interval = GUARD_INT_1_8;
+ break;
+ case GUARD_INTERVAL_1_4:
+ tune_args->guard_interval = GUARD_INT_1_4;
+ break;
+ case GUARD_INTERVAL_AUTO:
+ default:
+ tune_args->guard_interval = GUARD_UNKNOWN;
+ break;
}
- switch(params->u.ofdm.constellation) {
- case QPSK:
- tune_args->constellation = CONST_QPSK;
- break;
- case QAM_16:
- tune_args->constellation = CONST_QAM16;
- break;
- case QAM_64:
- tune_args->constellation = CONST_QAM64;
- break;
- default:
- tune_args->constellation = CONST_UNKNOWN;
- break;
+ switch (params->u.ofdm.constellation) {
+ case QPSK:
+ tune_args->constellation = CONST_QPSK;
+ break;
+ case QAM_16:
+ tune_args->constellation = CONST_QAM16;
+ break;
+ case QAM_64:
+ tune_args->constellation = CONST_QAM64;
+ break;
+ default:
+ tune_args->constellation = CONST_UNKNOWN;
+ break;
}
- switch(params->u.ofdm.transmission_mode) {
- case TRANSMISSION_MODE_2K:
- tune_args->transmission_mode = TRANS_MODE_2K;
- break;
- case TRANSMISSION_MODE_8K:
- tune_args->transmission_mode = TRANS_MODE_8K;
- break;
- default:
- tune_args->transmission_mode = TRANS_MODE_UNKNOWN;
+ switch (params->u.ofdm.transmission_mode) {
+ case TRANSMISSION_MODE_2K:
+ tune_args->transmission_mode = TRANS_MODE_2K;
+ break;
+ case TRANSMISSION_MODE_8K:
+ tune_args->transmission_mode = TRANS_MODE_8K;
+ break;
+ default:
+ tune_args->transmission_mode = TRANS_MODE_UNKNOWN;
}
- switch(params->u.ofdm.hierarchy_information) {
- case HIERARCHY_NONE:
- tune_args->hierarchy = HIER_NONE;
- break;
- case HIERARCHY_1:
- tune_args->hierarchy = HIER_ALPHA_1;
- break;
- case HIERARCHY_2:
- tune_args->hierarchy = HIER_ALPHA_2;
- break;
- case HIERARCHY_4:
- tune_args->hierarchy = HIER_ALPHA_4;
- break;
- case HIERARCHY_AUTO:
- tune_args->hierarchy = HIER_UNKNOWN;
- break;
+ switch (params->u.ofdm.hierarchy_information) {
+ case HIERARCHY_NONE:
+ tune_args->hierarchy = HIER_NONE;
+ break;
+ case HIERARCHY_1:
+ tune_args->hierarchy = HIER_ALPHA_1;
+ break;
+ case HIERARCHY_2:
+ tune_args->hierarchy = HIER_ALPHA_2;
+ break;
+ case HIERARCHY_4:
+ tune_args->hierarchy = HIER_ALPHA_4;
+ break;
+ case HIERARCHY_AUTO:
+ tune_args->hierarchy = HIER_UNKNOWN;
+ break;
}
dprintk(debug, "tuner parameters: freq: %d bw: 0x%02x gi: 0x%02x\n",
@@ -623,23 +648,26 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
if (params->u.ofdm.code_rate_LP == FEC_NONE) {
tune_args->hier_select = HIER_HIGH_PRIORITY;
tune_args->code_rate =
- as102_fe_get_code_rate(params->u.ofdm.code_rate_HP);
+ as102_fe_get_code_rate(params->u.ofdm.code_rate_HP);
}
if (params->u.ofdm.code_rate_HP == FEC_NONE) {
tune_args->hier_select = HIER_LOW_PRIORITY;
tune_args->code_rate =
- as102_fe_get_code_rate(params->u.ofdm.code_rate_LP);
+ as102_fe_get_code_rate(params->u.ofdm.code_rate_LP);
}
dprintk(debug, "\thierarchy: 0x%02x "
"selected: %s code_rate_%s: 0x%02x\n",
tune_args->hierarchy,
- tune_args->hier_select == HIER_HIGH_PRIORITY ? "HP" : "LP",
- tune_args->hier_select == HIER_HIGH_PRIORITY ? "HP" : "LP",
+ tune_args->hier_select == HIER_HIGH_PRIORITY ?
+ "HP" : "LP",
+ tune_args->hier_select == HIER_HIGH_PRIORITY ?
+ "HP" : "LP",
tune_args->code_rate);
} else {
- tune_args->code_rate = as102_fe_get_code_rate(params->u.ofdm.code_rate_HP);
+ tune_args->code_rate =
+ as102_fe_get_code_rate(params->u.ofdm.code_rate_HP);
}
}
#endif
--
1.7.4.1
^ permalink raw reply related
* [PATCH 07/17] staging: as102: Fix CodingStyle errors in file as102_usb_drv.c
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
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_usb_drv.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_usb_drv.c | 118 ++++++++++++++++-----------
drivers/staging/media/as102/as102_usb_drv.h | 3 +-
2 files changed, 72 insertions(+), 49 deletions(-)
diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c
index ee99396..6e79719 100644
--- a/drivers/staging/media/as102/as102_usb_drv.c
+++ b/drivers/staging/media/as102/as102_usb_drv.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
@@ -49,7 +50,7 @@ struct usb_driver as102_usb_driver = {
.id_table = as102_usb_id_table
};
-struct file_operations as102_dev_fops = {
+static const struct file_operations as102_dev_fops = {
.owner = THIS_MODULE,
.open = as102_open,
.release = as102_release,
@@ -63,46 +64,48 @@ static struct usb_class_driver as102_usb_class_driver = {
static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap,
unsigned char *send_buf, int send_buf_len,
- unsigned char *recv_buf, int recv_buf_len) {
-
+ unsigned char *recv_buf, int recv_buf_len)
+{
int ret = 0;
ENTER();
- if(send_buf != NULL) {
+ if (send_buf != NULL) {
ret = usb_control_msg(bus_adap->usb_dev,
usb_sndctrlpipe(bus_adap->usb_dev, 0),
AS102_USB_DEVICE_TX_CTRL_CMD,
- USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ USB_DIR_OUT | USB_TYPE_VENDOR |
+ USB_RECIP_DEVICE,
bus_adap->cmd_xid, /* value */
0, /* index */
send_buf, send_buf_len,
USB_CTRL_SET_TIMEOUT /* 200 */);
- if(ret < 0) {
+ if (ret < 0) {
dprintk(debug, "usb_control_msg(send) failed, err %i\n",
ret);
return ret;
}
- if(ret != send_buf_len) {
+ if (ret != send_buf_len) {
dprintk(debug, "only wrote %d of %d bytes\n",
ret, send_buf_len);
return -1;
}
}
- if(recv_buf != NULL) {
+ if (recv_buf != NULL) {
#ifdef TRACE
dprintk(debug, "want to read: %d bytes\n", recv_buf_len);
#endif
ret = usb_control_msg(bus_adap->usb_dev,
usb_rcvctrlpipe(bus_adap->usb_dev, 0),
AS102_USB_DEVICE_RX_CTRL_CMD,
- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ USB_DIR_IN | USB_TYPE_VENDOR |
+ USB_RECIP_DEVICE,
bus_adap->cmd_xid, /* value */
0, /* index */
recv_buf, recv_buf_len,
USB_CTRL_GET_TIMEOUT /* 200 */);
- if(ret < 0) {
+ if (ret < 0) {
dprintk(debug, "usb_control_msg(recv) failed, err %i\n",
ret);
return ret;
@@ -119,18 +122,19 @@ static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap,
static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap,
unsigned char *send_buf,
int send_buf_len,
- int swap32) {
-
+ int swap32)
+{
int ret = 0, actual_len;
- ret = usb_bulk_msg(bus_adap->usb_dev, usb_sndbulkpipe(bus_adap->usb_dev, 1),
+ ret = usb_bulk_msg(bus_adap->usb_dev,
+ usb_sndbulkpipe(bus_adap->usb_dev, 1),
send_buf, send_buf_len, &actual_len, 200);
- if(ret) {
+ if (ret) {
dprintk(debug, "usb_bulk_msg(send) failed, err %i\n", ret);
return ret;
}
- if(actual_len != send_buf_len) {
+ if (actual_len != send_buf_len) {
dprintk(debug, "only wrote %d of %d bytes\n",
actual_len, send_buf_len);
return -1;
@@ -139,21 +143,22 @@ static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap,
}
static int as102_read_ep2(struct as102_bus_adapter_t *bus_adap,
- unsigned char *recv_buf, int recv_buf_len) {
-
+ unsigned char *recv_buf, int recv_buf_len)
+{
int ret = 0, actual_len;
- if(recv_buf == NULL)
+ if (recv_buf == NULL)
return -EINVAL;
- ret = usb_bulk_msg(bus_adap->usb_dev, usb_rcvbulkpipe(bus_adap->usb_dev, 2),
+ ret = usb_bulk_msg(bus_adap->usb_dev,
+ usb_rcvbulkpipe(bus_adap->usb_dev, 2),
recv_buf, recv_buf_len, &actual_len, 200);
- if(ret) {
+ if (ret) {
dprintk(debug, "usb_bulk_msg(recv) failed, err %i\n", ret);
return ret;
}
- if(actual_len != recv_buf_len) {
+ if (actual_len != recv_buf_len) {
dprintk(debug, "only read %d of %d bytes\n",
actual_len, recv_buf_len);
return -1;
@@ -169,7 +174,8 @@ struct as102_priv_ops_t as102_priv_ops = {
.stop_stream = as102_usb_stop_stream,
};
-static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb) {
+static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb)
+{
int err;
usb_fill_bulk_urb(urb,
@@ -180,8 +186,9 @@ static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb) {
as102_urb_stream_irq,
dev);
- if ((err = usb_submit_urb(urb, GFP_ATOMIC)))
- dprintk(debug, "%s: usb_submit_urb failed\n", __FUNCTION__);
+ err = usb_submit_urb(urb, GFP_ATOMIC);
+ if (err)
+ dprintk(debug, "%s: usb_submit_urb failed\n", __func__);
return err;
}
@@ -203,7 +210,7 @@ void as102_urb_stream_irq(struct urb *urb)
/* do nothing ? */
#endif
} else {
- if(urb->actual_length == 0)
+ if (urb->actual_length == 0)
memset(urb->transfer_buffer, 0, AS102_USB_BUF_SIZE);
}
@@ -212,7 +219,8 @@ void as102_urb_stream_irq(struct urb *urb)
as102_submit_urb_stream(as102_dev, urb);
}
-static void as102_free_usb_stream_buffer(struct as102_dev_t *dev) {
+static void as102_free_usb_stream_buffer(struct as102_dev_t *dev)
+{
int i;
ENTER();
@@ -227,7 +235,8 @@ static void as102_free_usb_stream_buffer(struct as102_dev_t *dev) {
LEAVE();
}
-static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) {
+static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev)
+{
int i, ret = 0;
ENTER();
@@ -237,7 +246,7 @@ static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) {
GFP_KERNEL,
&dev->dma_addr);
if (!dev->stream) {
- dprintk(debug, "%s: usb_buffer_alloc failed\n", __FUNCTION__);
+ dprintk(debug, "%s: usb_buffer_alloc failed\n", __func__);
return -ENOMEM;
}
@@ -247,8 +256,9 @@ static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) {
for (i = 0; i < MAX_STREAM_URB; i++) {
struct urb *urb;
- if (!(urb = usb_alloc_urb(0, GFP_ATOMIC))) {
- dprintk(debug, "%s: usb_alloc_urb failed\n", __FUNCTION__);
+ urb = usb_alloc_urb(0, GFP_ATOMIC);
+ if (urb == NULL) {
+ dprintk(debug, "%s: usb_alloc_urb failed\n", __func__);
as102_free_usb_stream_buffer(dev);
return -ENOMEM;
}
@@ -262,18 +272,21 @@ static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) {
return ret;
}
-static void as102_usb_stop_stream(struct as102_dev_t *dev) {
+static void as102_usb_stop_stream(struct as102_dev_t *dev)
+{
int i;
for (i = 0; i < MAX_STREAM_URB; i++)
usb_kill_urb(dev->stream_urb[i]);
}
-static int as102_usb_start_stream(struct as102_dev_t *dev) {
+static int as102_usb_start_stream(struct as102_dev_t *dev)
+{
int i, ret = 0;
for (i = 0; i < MAX_STREAM_URB; i++) {
- if ((ret = as102_submit_urb_stream(dev, dev->stream_urb[i]))) {
+ ret = as102_submit_urb_stream(dev, dev->stream_urb[i]);
+ if (ret) {
as102_usb_stop_stream(dev);
return ret;
}
@@ -282,7 +295,8 @@ static int as102_usb_start_stream(struct as102_dev_t *dev) {
return 0;
}
-static void as102_usb_release(struct kref *kref) {
+static void as102_usb_release(struct kref *kref)
+{
struct as102_dev_t *as102_dev;
ENTER();
@@ -296,7 +310,8 @@ static void as102_usb_release(struct kref *kref) {
LEAVE();
}
-static void as102_usb_disconnect(struct usb_interface *intf) {
+static void as102_usb_disconnect(struct usb_interface *intf)
+{
struct as102_dev_t *as102_dev;
ENTER();
@@ -324,14 +339,16 @@ static void as102_usb_disconnect(struct usb_interface *intf) {
}
static int as102_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id) {
+ const struct usb_device_id *id)
+{
int ret;
struct as102_dev_t *as102_dev;
ENTER();
- if(!(as102_dev = kzalloc(sizeof(struct as102_dev_t), GFP_KERNEL))) {
- err("%s: kzalloc failed", __FUNCTION__);
+ as102_dev = kzalloc(sizeof(struct as102_dev_t), GFP_KERNEL);
+ if (as102_dev == NULL) {
+ err("%s: kzalloc failed", __func__);
return -ENOMEM;
}
@@ -352,17 +369,19 @@ static int as102_usb_probe(struct usb_interface *intf,
as102_dev->bus_adap.usb_dev = usb_get_dev(interface_to_usbdev(intf));
/* we can register the device now, as it is ready */
- if((ret = usb_register_dev(intf, &as102_usb_class_driver)) < 0) {;
+ ret = usb_register_dev(intf, &as102_usb_class_driver);
+ if (ret < 0) {
/* something prevented us from registering this driver */
err("%s: usb_register_dev() failed (errno = %d)",
- __FUNCTION__, ret);
+ __func__, ret);
goto failed;
}
printk(KERN_INFO "%s: device has been detected\n", DRIVER_NAME);
/* request buffer allocation for streaming */
- if ((ret = as102_alloc_usb_stream_buffer(as102_dev)) != 0)
+ ret = as102_alloc_usb_stream_buffer(as102_dev);
+ if (ret != 0)
goto failed;
/* register dvb layer */
@@ -377,7 +396,8 @@ failed:
return ret;
}
-static int as102_open(struct inode *inode, struct file *file) {
+static int as102_open(struct inode *inode, struct file *file)
+{
int ret = 0, minor = 0;
struct usb_interface *intf = NULL;
struct as102_dev_t *dev = NULL;
@@ -388,15 +408,17 @@ static int as102_open(struct inode *inode, struct file *file) {
minor = iminor(inode);
/* fetch device from usb interface */
- if((intf = usb_find_interface(&as102_usb_driver, minor)) == NULL) {
+ intf = usb_find_interface(&as102_usb_driver, minor);
+ if (intf == NULL) {
printk(KERN_ERR "%s: can't find device for minor %d\n",
- __FUNCTION__, minor);
+ __func__, minor);
ret = -ENODEV;
goto exit;
}
/* get our device */
- if((dev = usb_get_intfdata(intf)) == NULL) {
+ dev = usb_get_intfdata(intf);
+ if (dev == NULL) {
ret = -EFAULT;
goto exit;
}
@@ -412,13 +434,15 @@ exit:
return ret;
}
-static int as102_release(struct inode *inode, struct file *file) {
+static int as102_release(struct inode *inode, struct file *file)
+{
int ret = 0;
struct as102_dev_t *dev = NULL;
ENTER();
- if((dev = file->private_data) != NULL ) {
+ dev = file->private_data;
+ if (dev != NULL) {
/* decrement the count on our device */
kref_put(&dev->kref, as102_usb_release);
}
diff --git a/drivers/staging/media/as102/as102_usb_drv.h b/drivers/staging/media/as102/as102_usb_drv.h
index abb858e..3abab6c 100644
--- a/drivers/staging/media/as102/as102_usb_drv.h
+++ b/drivers/staging/media/as102/as102_usb_drv.h
@@ -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
@@ -35,8 +36,6 @@
#define PCTV_74E_USB_VID 0x2013
#define PCTV_74E_USB_PID 0x0246
-extern struct file_operations as102_dev_fops;
-
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs);
#else
--
1.7.4.1
^ permalink raw reply related
* [PATCH 08/17] staging: as102: Fix CodingStyle errors in file as10x_cmd_cfg.c
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
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 as10x_cmd_cfg.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/as10x_cmd_cfg.c | 262 +++++++++++++--------------
1 files changed, 130 insertions(+), 132 deletions(-)
diff --git a/drivers/staging/media/as102/as10x_cmd_cfg.c b/drivers/staging/media/as102/as10x_cmd_cfg.c
index e3a0f90..7b22e19 100644
--- a/drivers/staging/media/as102/as10x_cmd_cfg.c
+++ b/drivers/staging/media/as102/as10x_cmd_cfg.c
@@ -2,8 +2,6 @@
\file as10x_cmd_cfg.c
- \version $Id$
-
\author: S. Martinelli
----------------------------------------------------------------------------\n
@@ -22,7 +20,8 @@
#include <linux/kernel.h>
#include "as102_drv.h"
#elif defined(WIN32)
- #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */
+ #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)
+ /* win32 ddk implementation */
#include "wdm.h"
#include "Device.h"
#include "endian_mgmt.h" /* FIXME */
@@ -59,52 +58,52 @@
int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag,
uint32_t *pvalue)
{
- int error;
- struct as10x_cmd_t *pcmd, *prsp;
-
- ENTER();
-
- pcmd = phandle->cmd;
- prsp = phandle->rsp;
-
- /* prepare command */
- as10x_cmd_build(pcmd, (++phandle->cmd_xid),
- sizeof(pcmd->body.context.req));
-
- /* fill command */
- pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT);
- pcmd->body.context.req.tag = cpu_to_le16(tag);
- pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA);
-
- /* send command */
- if(phandle->ops->xfer_cmd) {
- error = phandle->ops->xfer_cmd(phandle,
- (uint8_t *) pcmd,
- sizeof(pcmd->body.context.req) + HEADER_SIZE,
- (uint8_t *) prsp,
- sizeof(prsp->body.context.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
-
- if(error < 0) {
- goto out;
- }
-
- /* parse response: context command do not follow the common response */
- /* structure -> specific handling response parse required */
- error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP);
-
- if(error == 0) {
- /* Response OK -> get response data */
- *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32);
- /* value returned is always a 32-bit value */
- }
+ int error;
+ struct as10x_cmd_t *pcmd, *prsp;
+
+ ENTER();
+
+ pcmd = phandle->cmd;
+ prsp = phandle->rsp;
+
+ /* prepare command */
+ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ sizeof(pcmd->body.context.req));
+
+ /* fill command */
+ pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT);
+ pcmd->body.context.req.tag = cpu_to_le16(tag);
+ pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA);
+
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(phandle,
+ (uint8_t *) pcmd,
+ sizeof(pcmd->body.context.req)
+ + HEADER_SIZE,
+ (uint8_t *) prsp,
+ sizeof(prsp->body.context.rsp)
+ + HEADER_SIZE);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
+
+ if (error < 0)
+ goto out;
+
+ /* parse response: context command do not follow the common response */
+ /* structure -> specific handling response parse required */
+ error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP);
+
+ if (error == 0) {
+ /* Response OK -> get response data */
+ *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32);
+ /* value returned is always a 32-bit value */
+ }
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
/**
@@ -118,47 +117,48 @@ out:
int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag,
uint32_t value)
{
- int error;
- struct as10x_cmd_t *pcmd, *prsp;
-
- ENTER();
-
- pcmd = phandle->cmd;
- prsp = phandle->rsp;
-
- /* prepare command */
- as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.context.req));
-
- /* fill command */
- pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT);
- /* pcmd->body.context.req.reg_val.mode initialization is not required */
- pcmd->body.context.req.reg_val.u.value32 = cpu_to_le32(value);
- pcmd->body.context.req.tag = cpu_to_le16(tag);
- pcmd->body.context.req.type = cpu_to_le16(SET_CONTEXT_DATA);
-
- /* send command */
- if(phandle->ops->xfer_cmd){
- error = phandle->ops->xfer_cmd(phandle,
- (uint8_t *) pcmd,
- sizeof(pcmd->body.context.req) + HEADER_SIZE,
- (uint8_t *) prsp,
- sizeof(prsp->body.context.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
-
- if(error < 0) {
- goto out;
- }
-
- /* parse response: context command do not follow the common response */
- /* structure -> specific handling response parse required */
- error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP);
+ int error;
+ struct as10x_cmd_t *pcmd, *prsp;
+
+ ENTER();
+
+ pcmd = phandle->cmd;
+ prsp = phandle->rsp;
+
+ /* prepare command */
+ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ sizeof(pcmd->body.context.req));
+
+ /* fill command */
+ pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT);
+ /* pcmd->body.context.req.reg_val.mode initialization is not required */
+ pcmd->body.context.req.reg_val.u.value32 = cpu_to_le32(value);
+ pcmd->body.context.req.tag = cpu_to_le16(tag);
+ pcmd->body.context.req.type = cpu_to_le16(SET_CONTEXT_DATA);
+
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(phandle,
+ (uint8_t *) pcmd,
+ sizeof(pcmd->body.context.req)
+ + HEADER_SIZE,
+ (uint8_t *) prsp,
+ sizeof(prsp->body.context.rsp)
+ + HEADER_SIZE);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
+
+ if (error < 0)
+ goto out;
+
+ /* parse response: context command do not follow the common response */
+ /* structure -> specific handling response parse required */
+ error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP);
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
/**
@@ -175,45 +175,43 @@ out:
*/
int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode)
{
- int error;
- struct as10x_cmd_t *pcmd, *prsp;
-
- ENTER();
-
- pcmd = phandle->cmd;
- prsp = phandle->rsp;
-
- /* prepare command */
- as10x_cmd_build(pcmd, (++phandle->cmd_xid),
- sizeof(pcmd->body.cfg_change_mode.req));
-
- /* fill command */
- pcmd->body.cfg_change_mode.req.proc_id =
- cpu_to_le16(CONTROL_PROC_ELNA_CHANGE_MODE);
- pcmd->body.cfg_change_mode.req.mode = mode;
-
- /* send command */
- if(phandle->ops->xfer_cmd){
- error = phandle->ops->xfer_cmd(phandle,
- (uint8_t *) pcmd,
- sizeof(pcmd->body.cfg_change_mode.req) + HEADER_SIZE,
- (uint8_t *) prsp,
- sizeof(prsp->body.cfg_change_mode.rsp) + HEADER_SIZE);
- }
- else{
- error = AS10X_CMD_ERROR;
- }
-
- if(error < 0) {
- goto out;
- }
-
- /* parse response */
- error = as10x_rsp_parse(prsp, CONTROL_PROC_ELNA_CHANGE_MODE_RSP);
+ int error;
+ struct as10x_cmd_t *pcmd, *prsp;
+
+ ENTER();
+
+ pcmd = phandle->cmd;
+ prsp = phandle->rsp;
+
+ /* prepare command */
+ as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ sizeof(pcmd->body.cfg_change_mode.req));
+
+ /* fill command */
+ pcmd->body.cfg_change_mode.req.proc_id =
+ cpu_to_le16(CONTROL_PROC_ELNA_CHANGE_MODE);
+ pcmd->body.cfg_change_mode.req.mode = mode;
+
+ /* send command */
+ if (phandle->ops->xfer_cmd) {
+ error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd,
+ sizeof(pcmd->body.cfg_change_mode.req)
+ + HEADER_SIZE, (uint8_t *) prsp,
+ sizeof(prsp->body.cfg_change_mode.rsp)
+ + HEADER_SIZE);
+ } else {
+ error = AS10X_CMD_ERROR;
+ }
+
+ if (error < 0)
+ goto out;
+
+ /* parse response */
+ error = as10x_rsp_parse(prsp, CONTROL_PROC_ELNA_CHANGE_MODE_RSP);
out:
- LEAVE();
- return(error);
+ LEAVE();
+ return error;
}
/**
@@ -225,15 +223,15 @@ out:
ABILIS_RC_NOK
\callgraph
*/
-int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) {
-
- int err;
+int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id)
+{
+ int err;
- err = prsp->body.context.rsp.error;
+ err = prsp->body.context.rsp.error;
- if((err == 0) &&
- (le16_to_cpu(prsp->body.context.rsp.proc_id) == proc_id)) {
- return 0;
- }
- return AS10X_CMD_ERROR;
+ if ((err == 0) &&
+ (le16_to_cpu(prsp->body.context.rsp.proc_id) == proc_id)) {
+ return 0;
+ }
+ return AS10X_CMD_ERROR;
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 09/17] staging: as102: Add Elgato EyeTV DTT Deluxe
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
In-Reply-To: <1320078295-3379-1-git-send-email-snjw23@gmail.com>
From: Devin Heitmueller <dheitmueller@kernellabs.com>
Add support for the Elgato EyeTV DTT Deluxe. Note that the product name
field has not yet been abstracted out, so it will still identify itself
as a PCTV 74e. The driver was originally built by the chipset manufacturer
so that the product vendor can specify the device name via a #define, but
wasn't setup to support multiple products from the same build of the driver.
Thanks to Joerg Unglaub for suggesting this change.
Suggested-by: Joerg Unglaub <joerg.unglaub@gmail.com>
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_usb_drv.c | 1 +
drivers/staging/media/as102/as102_usb_drv.h | 5 +++++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c
index 6e79719..d749e06 100644
--- a/drivers/staging/media/as102/as102_usb_drv.c
+++ b/drivers/staging/media/as102/as102_usb_drv.c
@@ -40,6 +40,7 @@ static int as102_release(struct inode *inode, struct file *file);
static struct usb_device_id as102_usb_id_table[] = {
{ USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) },
{ USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) },
+ { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) },
{ } /* Terminating entry */
};
diff --git a/drivers/staging/media/as102/as102_usb_drv.h b/drivers/staging/media/as102/as102_usb_drv.h
index 3abab6c..a81a895 100644
--- a/drivers/staging/media/as102/as102_usb_drv.h
+++ b/drivers/staging/media/as102/as102_usb_drv.h
@@ -36,6 +36,11 @@
#define PCTV_74E_USB_VID 0x2013
#define PCTV_74E_USB_PID 0x0246
+/* Elgato: EyeTV DTT Deluxe */
+#define ELGATO_EYETV_DTT_NAME "Elgato EyeTV DTT Deluxe"
+#define ELGATO_EYETV_DTT_USB_VID 0x0fd9
+#define ELGATO_EYETV_DTT_USB_PID 0x002c
+
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs);
#else
--
1.7.4.1
^ permalink raw reply related
* [PATCH 10/17] staging: as102: Properly handle multiple product names
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
In-Reply-To: <1320078295-3379-1-git-send-email-snjw23@gmail.com>
From: Devin Heitmueller <dheitmueller@kernellabs.com>
Properly handle the case where the driver can be associated with
multiple different products (as opposed to always saying the device
is named after the value in a #define).
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_drv.c | 2 +-
drivers/staging/media/as102/as102_drv.h | 1 +
drivers/staging/media/as102/as102_fe.c | 4 +++-
drivers/staging/media/as102/as102_usb_drv.c | 27 +++++++++++++++++++++++++++
drivers/staging/media/as102/as102_usb_drv.h | 5 +++--
5 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/media/as102/as102_drv.c b/drivers/staging/media/as102/as102_drv.c
index 9e5d81b..e1e32be 100644
--- a/drivers/staging/media/as102/as102_drv.c
+++ b/drivers/staging/media/as102/as102_drv.c
@@ -209,7 +209,7 @@ int as102_dvb_register(struct as102_dev_t *as102_dev)
#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
ret = dvb_register_adapter(&as102_dev->dvb_adap,
- DEVICE_FULL_NAME,
+ as102_dev->name,
THIS_MODULE,
#if defined(CONFIG_AS102_USB)
&as102_dev->bus_adap.usb_dev->dev
diff --git a/drivers/staging/media/as102/as102_drv.h b/drivers/staging/media/as102/as102_drv.h
index f50bb9f..cd11b16 100644
--- a/drivers/staging/media/as102/as102_drv.h
+++ b/drivers/staging/media/as102/as102_drv.h
@@ -106,6 +106,7 @@ struct as102_bus_adapter_t {
};
struct as102_dev_t {
+ const char *name;
struct as102_bus_adapter_t bus_adap;
struct list_head device_entry;
struct kref kref;
diff --git a/drivers/staging/media/as102/as102_fe.c b/drivers/staging/media/as102/as102_fe.c
index e9f7188..0495486 100644
--- a/drivers/staging/media/as102/as102_fe.c
+++ b/drivers/staging/media/as102/as102_fe.c
@@ -346,7 +346,7 @@ static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire)
static struct dvb_frontend_ops as102_fe_ops = {
.info = {
- .name = DEVICE_FULL_NAME,
+ .name = "Unknown AS102 device",
.type = FE_OFDM,
.frequency_min = 174000000,
.frequency_max = 862000000,
@@ -408,6 +408,8 @@ int as102_dvb_register_fe(struct as102_dev_t *as102_dev,
/* init frontend callback ops */
memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops));
+ strncpy(dvb_fe->ops.info.name, as102_dev->name,
+ sizeof(dvb_fe->ops.info.name));
/* register dbvb frontend */
errno = dvb_register_frontend(dvb_adap, dvb_fe);
diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c
index d749e06..3a3dd77 100644
--- a/drivers/staging/media/as102/as102_usb_drv.c
+++ b/drivers/staging/media/as102/as102_usb_drv.c
@@ -44,6 +44,15 @@ static struct usb_device_id as102_usb_id_table[] = {
{ } /* Terminating entry */
};
+/* Note that this table must always have the same number of entries as the
+ as102_usb_id_table struct */
+static const char *as102_device_names[] = {
+ AS102_REFERENCE_DESIGN,
+ AS102_PCTV_74E,
+ AS102_ELGATO_EYETV_DTT_NAME,
+ NULL /* Terminating entry */
+};
+
struct usb_driver as102_usb_driver = {
.name = DRIVER_FULL_NAME,
.probe = as102_usb_probe,
@@ -344,6 +353,7 @@ static int as102_usb_probe(struct usb_interface *intf,
{
int ret;
struct as102_dev_t *as102_dev;
+ int i;
ENTER();
@@ -353,6 +363,23 @@ static int as102_usb_probe(struct usb_interface *intf,
return -ENOMEM;
}
+ /* This should never actually happen */
+ if ((sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)) !=
+ (sizeof(as102_device_names) / sizeof(const char *))) {
+ printk(KERN_ERR "Device names table invalid size");
+ return -EINVAL;
+ }
+
+ /* Assign the user-friendly device name */
+ for (i = 0; i < (sizeof(as102_usb_id_table) /
+ sizeof(struct usb_device_id)); i++) {
+ if (id == &as102_usb_id_table[i])
+ as102_dev->name = as102_device_names[i];
+ }
+
+ if (as102_dev->name == NULL)
+ as102_dev->name = "Unknown AS102 device";
+
/* set private callback functions */
as102_dev->bus_adap.ops = &as102_priv_ops;
diff --git a/drivers/staging/media/as102/as102_usb_drv.h b/drivers/staging/media/as102/as102_usb_drv.h
index a81a895..a741462 100644
--- a/drivers/staging/media/as102/as102_usb_drv.h
+++ b/drivers/staging/media/as102/as102_usb_drv.h
@@ -28,16 +28,17 @@
/* define these values to match the supported devices */
/* Abilis system: "TITAN" */
+#define AS102_REFERENCE_DESIGN "Abilis Systems DVB-Titan"
#define AS102_USB_DEVICE_VENDOR_ID 0x1BA6
#define AS102_USB_DEVICE_PID_0001 0x0001
/* PCTV Systems: PCTV picoStick (74e) */
-#define DEVICE_FULL_NAME "PCTV Systems : PCTV picoStick (74e)"
+#define AS102_PCTV_74E "PCTV Systems picoStick (74e)"
#define PCTV_74E_USB_VID 0x2013
#define PCTV_74E_USB_PID 0x0246
/* Elgato: EyeTV DTT Deluxe */
-#define ELGATO_EYETV_DTT_NAME "Elgato EyeTV DTT Deluxe"
+#define AS102_ELGATO_EYETV_DTT_NAME "Elgato EyeTV DTT Deluxe"
#define ELGATO_EYETV_DTT_USB_VID 0x0fd9
#define ELGATO_EYETV_DTT_USB_PID 0x002c
--
1.7.4.1
^ permalink raw reply related
* [PATCH 11/17] staging: as102: Fix licensing oversight
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH, Pierrick Hascoet
In-Reply-To: <1320078295-3379-1-git-send-email-snjw23@gmail.com>
From: Pierrick Hascoet <pierrick.hascoet@abilis.com>
Fix a couple of files which were supposed by be relicensed as GPL
but were overlooked.
Signed-off-by: Pierrick Hascoet <pierrick.hascoet@abilis.com>
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/as10x_cmd_cfg.c | 35 +++++++++++-----------
drivers/staging/media/as102/as10x_cmd_stream.c | 37 +++++++++++------------
2 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/drivers/staging/media/as102/as10x_cmd_cfg.c b/drivers/staging/media/as102/as10x_cmd_cfg.c
index 7b22e19..0635797 100644
--- a/drivers/staging/media/as102/as10x_cmd_cfg.c
+++ b/drivers/staging/media/as102/as10x_cmd_cfg.c
@@ -1,20 +1,21 @@
-/**
-
- \file as10x_cmd_cfg.c
-
- \author: S. Martinelli
-
- ----------------------------------------------------------------------------\n
- (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n
- www.abilis.com \n
- ----------------------------------------------------------------------------\n
-
- \brief AS10x API, configuration services
-
- AS10x cmd management: build command buffer, send command through
- selected port and wait for the response when required.
-
-*/
+/*
+ * Abilis Systems Single DVB-T Receiver
+ * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
#if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */
#include <linux/kernel.h>
diff --git a/drivers/staging/media/as102/as10x_cmd_stream.c b/drivers/staging/media/as102/as10x_cmd_stream.c
index 8705894..b5e6254 100644
--- a/drivers/staging/media/as102/as10x_cmd_stream.c
+++ b/drivers/staging/media/as102/as10x_cmd_stream.c
@@ -1,22 +1,21 @@
-/**
-
- \file as10x_cmd_stream.c
-
- \author: S. Martinelli
-
- ----------------------------------------------------------------------------\n
- (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n
- www.abilis.com \n
- ----------------------------------------------------------------------------\n
-
- \brief AS10x CMD, stream services
-
- AS10x CMD management: build command buffer, send command through
- selected port and wait for the response when required.
-
-*/
-
-
+/*
+ * Abilis Systems Single DVB-T Receiver
+ * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
#if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */
#include <linux/kernel.h>
#include "as102_drv.h"
--
1.7.4.1
^ permalink raw reply related
* [PATCH 12/17] staging: as102: Remove non-linux headers inclusion
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
In-Reply-To: <1320078295-3379-1-git-send-email-snjw23@gmail.com>
From: Piotr Chmura <chmooreck@poczta.onet.pl>
Remove inclusion of Windows and other not linux related headers.
[snjw23@gmail.com: edited changelog, folded long line in Makefile]
Cc: 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/Makefile | 5 +++--
drivers/staging/media/as102/as10x_cmd.c | 22 ----------------------
drivers/staging/media/as102/as10x_cmd_cfg.c | 22 ----------------------
drivers/staging/media/as102/as10x_cmd_stream.c | 22 +---------------------
4 files changed, 4 insertions(+), 67 deletions(-)
diff --git a/drivers/staging/media/as102/Makefile b/drivers/staging/media/as102/Makefile
index c2334c6..e7dbb6f 100644
--- a/drivers/staging/media/as102/Makefile
+++ b/drivers/staging/media/as102/Makefile
@@ -1,5 +1,6 @@
-dvb-as102-objs := as102_drv.o as102_fw.o as10x_cmd.o as10x_cmd_stream.o as102_fe.o as102_usb_drv.o as10x_cmd_cfg.o
+dvb-as102-objs := as102_drv.o as102_fw.o as10x_cmd.o as10x_cmd_stream.o \
+ as102_fe.o as102_usb_drv.o as10x_cmd_cfg.o
obj-$(CONFIG_DVB_AS102) += dvb-as102.o
-EXTRA_CFLAGS += -DLINUX -DCONFIG_AS102_USB -Idrivers/media/dvb/dvb-core
+EXTRA_CFLAGS += -DCONFIG_AS102_USB -Idrivers/media/dvb/dvb-core
diff --git a/drivers/staging/media/as102/as10x_cmd.c b/drivers/staging/media/as102/as10x_cmd.c
index 222e703..77aae39 100644
--- a/drivers/staging/media/as102/as10x_cmd.c
+++ b/drivers/staging/media/as102/as10x_cmd.c
@@ -18,30 +18,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */
#include <linux/kernel.h>
#include "as102_drv.h"
-#elif defined(WIN32)
- #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)
- /* win32 ddk implementation */
- #include "wdm.h"
- #include "Device.h"
- #include "endian_mgmt.h" /* FIXME */
- #else /* win32 sdk implementation */
- #include <windows.h>
- #include "types.h"
- #include "util.h"
- #include "as10x_handle.h"
- #include "endian_mgmt.h"
- #endif
-#else /* all other cases */
- #include <string.h>
- #include "types.h"
- #include "util.h"
- #include "as10x_handle.h"
- #include "endian_mgmt.h" /* FIXME */
-#endif /* __KERNEL__ */
-
#include "as10x_types.h"
#include "as10x_cmd.h"
diff --git a/drivers/staging/media/as102/as10x_cmd_cfg.c b/drivers/staging/media/as102/as10x_cmd_cfg.c
index 0635797..dca2cbf 100644
--- a/drivers/staging/media/as102/as10x_cmd_cfg.c
+++ b/drivers/staging/media/as102/as10x_cmd_cfg.c
@@ -17,30 +17,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */
#include <linux/kernel.h>
#include "as102_drv.h"
-#elif defined(WIN32)
- #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)
- /* win32 ddk implementation */
- #include "wdm.h"
- #include "Device.h"
- #include "endian_mgmt.h" /* FIXME */
- #else /* win32 sdk implementation */
- #include <windows.h>
- #include "types.h"
- #include "util.h"
- #include "as10x_handle.h"
- #include "endian_mgmt.h"
- #endif
-#else /* all other cases */
- #include <string.h>
- #include "types.h"
- #include "util.h"
- #include "as10x_handle.h"
- #include "endian_mgmt.h" /* FIXME */
-#endif /* __KERNEL__ */
-
#include "as10x_types.h"
#include "as10x_cmd.h"
diff --git a/drivers/staging/media/as102/as10x_cmd_stream.c b/drivers/staging/media/as102/as10x_cmd_stream.c
index b5e6254..e8c668c 100644
--- a/drivers/staging/media/as102/as10x_cmd_stream.c
+++ b/drivers/staging/media/as102/as10x_cmd_stream.c
@@ -16,29 +16,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */
+
#include <linux/kernel.h>
#include "as102_drv.h"
-#elif defined(WIN32)
- #if defined(DDK) /* win32 ddk implementation */
- #include "wdm.h"
- #include "Device.h"
- #include "endian_mgmt.h" /* FIXME */
- #else /* win32 sdk implementation */
- #include <windows.h>
- #include "types.h"
- #include "util.h"
- #include "as10x_handle.h"
- #include "endian_mgmt.h"
- #endif
-#else /* all other cases */
- #include <string.h>
- #include "types.h"
- #include "util.h"
- #include "as10x_handle.h"
- #include "endian_mgmt.h" /* FIXME */
-#endif /* __KERNEL__ */
-
#include "as10x_cmd.h"
--
1.7.4.1
^ permalink raw reply related
* [PATCH 13/17] staging: as102: Convert the comments to kernel-doc style
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
In-Reply-To: <1320078295-3379-1-git-send-email-snjw23@gmail.com>
Also amend some mismatched comments.
Cc: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Sylwester Nawrocki <snjw23@gmail.com>
---
drivers/staging/media/as102/as102_drv.c | 5 +-
drivers/staging/media/as102/as10x_cmd.c | 105 +++++++++++-------------
drivers/staging/media/as102/as10x_cmd_cfg.c | 65 +++++++--------
drivers/staging/media/as102/as10x_cmd_stream.c | 48 +++++------
4 files changed, 106 insertions(+), 117 deletions(-)
diff --git a/drivers/staging/media/as102/as102_drv.c b/drivers/staging/media/as102/as102_drv.c
index e1e32be..27a1571 100644
--- a/drivers/staging/media/as102/as102_drv.c
+++ b/drivers/staging/media/as102/as102_drv.c
@@ -331,8 +331,9 @@ static int __init as102_driver_init(void)
module_init(as102_driver_init);
/**
- * \brief as102 driver exit point. This function is called when device has
- * to be removed.
+ * as102_driver_exit - as102 driver exit point
+ *
+ * This function is called when device has to be removed.
*/
static void __exit as102_driver_exit(void)
{
diff --git a/drivers/staging/media/as102/as10x_cmd.c b/drivers/staging/media/as102/as10x_cmd.c
index 77aae39..0dcba80 100644
--- a/drivers/staging/media/as102/as10x_cmd.c
+++ b/drivers/staging/media/as102/as10x_cmd.c
@@ -24,11 +24,11 @@
#include "as10x_cmd.h"
/**
- \brief send turn on command to AS10x
- \param phandle: pointer to AS10x handle
- \return 0 when no error, < 0 in case of error.
- \callgraph
-*/
+ * as10x_cmd_turn_on - send turn on command to AS10x
+ * @phandle: pointer to AS10x handle
+ *
+ * Return 0 when no error, < 0 in case of error.
+ */
int as10x_cmd_turn_on(as10x_handle_t *phandle)
{
int error;
@@ -70,11 +70,11 @@ out:
}
/**
- \brief send turn off command to AS10x
- \param phandle: pointer to AS10x handle
- \return 0 when no error, < 0 in case of error.
- \callgraph
-*/
+ * as10x_cmd_turn_off - send turn off command to AS10x
+ * @phandle: pointer to AS10x handle
+ *
+ * Return 0 on success or negative value in case of error.
+ */
int as10x_cmd_turn_off(as10x_handle_t *phandle)
{
int error;
@@ -115,11 +115,11 @@ out:
}
/**
- \brief send set tune command to AS10x
- \param phandle: pointer to AS10x handle
- \param ptune: tune parameters
- \return 0 when no error, < 0 in case of error.
- \callgraph
+ * as10x_cmd_set_tune - send set tune command to AS10x
+ * @phandle: pointer to AS10x handle
+ * @ptune: tune parameters
+ *
+ * Return 0 on success or negative value in case of error.
*/
int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune)
{
@@ -174,11 +174,11 @@ out:
}
/**
- \brief send get tune status command to AS10x
- \param phandle: pointer to AS10x handle
- \param pstatus: pointer to updated status structure of the current tune
- \return 0 when no error, < 0 in case of error.
- \callgraph
+ * as10x_cmd_get_tune_status - send get tune status command to AS10x
+ * @phandle: pointer to AS10x handle
+ * @pstatus: pointer to updated status structure of the current tune
+ *
+ * Return 0 on success or negative value in case of error.
*/
int as10x_cmd_get_tune_status(as10x_handle_t *phandle,
struct as10x_tune_status *pstatus)
@@ -232,11 +232,11 @@ out:
}
/**
- \brief send get TPS command to AS10x
- \param phandle: pointer to AS10x handle
- \param ptps: pointer to TPS parameters structure
- \return 0 when no error, < 0 in case of error.
- \callgraph
+ * send get TPS command to AS10x
+ * @phandle: pointer to AS10x handle
+ * @ptps: pointer to TPS parameters structure
+ *
+ * Return 0 on success or negative value in case of error.
*/
int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps)
{
@@ -295,12 +295,12 @@ out:
}
/**
- \brief send get demod stats command to AS10x
- \param phandle: pointer to AS10x handle
- \param pdemod_stats: pointer to demod stats parameters structure
- \return 0 when no error, < 0 in case of error.
- \callgraph
-*/
+ * as10x_cmd_get_demod_stats - send get demod stats command to AS10x
+ * @phandle: pointer to AS10x handle
+ * @pdemod_stats: pointer to demod stats parameters structure
+ *
+ * Return 0 on success or negative value in case of error.
+ */
int as10x_cmd_get_demod_stats(as10x_handle_t *phandle,
struct as10x_demod_stats *pdemod_stats)
{
@@ -359,13 +359,13 @@ out:
}
/**
- \brief send get impulse response command to AS10x
- \param phandle: pointer to AS10x handle
- \param is_ready: pointer to value indicating when impulse
- response data is ready
- \return 0 when no error, < 0 in case of error.
- \callgraph
-*/
+ * as10x_cmd_get_impulse_resp - send get impulse response command to AS10x
+ * @phandle: pointer to AS10x handle
+ * @is_ready: pointer to value indicating when impulse
+ * response data is ready
+ *
+ * Return 0 on success or negative value in case of error.
+ */
int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle,
uint8_t *is_ready)
{
@@ -414,16 +414,12 @@ out:
return error;
}
-
-
/**
- \brief build AS10x command header
- \param pcmd: pointer to AS10x command buffer
- \param xid: sequence id of the command
- \param cmd_len: lenght of the command
- \return -
- \callgraph
-*/
+ * as10x_cmd_build - build AS10x command header
+ * @pcmd: pointer to AS10x command buffer
+ * @xid: sequence id of the command
+ * @cmd_len: length of the command
+ */
void as10x_cmd_build(struct as10x_cmd_t *pcmd,
uint16_t xid, uint16_t cmd_len)
{
@@ -434,13 +430,12 @@ void as10x_cmd_build(struct as10x_cmd_t *pcmd,
}
/**
- \brief Parse command response
- \param pcmd: pointer to AS10x command buffer
- \param cmd_seqid: sequence id of the command
- \param cmd_len: lenght of the command
- \return 0 when no error, < 0 in case of error
- \callgraph
-*/
+ * as10x_rsp_parse - Parse command response
+ * @prsp: pointer to AS10x command buffer
+ * @proc_id: id of the command
+ *
+ * Return 0 on success or negative value in case of error.
+ */
int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id)
{
int error;
@@ -455,5 +450,3 @@ int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id)
return AS10X_CMD_ERROR;
}
-
-
diff --git a/drivers/staging/media/as102/as10x_cmd_cfg.c b/drivers/staging/media/as102/as10x_cmd_cfg.c
index dca2cbf..ec6f69f 100644
--- a/drivers/staging/media/as102/as10x_cmd_cfg.c
+++ b/drivers/staging/media/as102/as10x_cmd_cfg.c
@@ -27,13 +27,13 @@
/***************************/
/**
- \brief send get context command to AS10x
- \param phandle: pointer to AS10x handle
- \param tag: context tag
- \param pvalue: pointer where to store context value read
- \return 0 when no error, < 0 in case of error.
- \callgraph
-*/
+ * as10x_cmd_get_context - Send get context command to AS10x
+ * @phandle: pointer to AS10x handle
+ * @tag: context tag
+ * @pvalue: pointer where to store context value read
+ *
+ * Return 0 on success or negative value in case of error.
+ */
int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag,
uint32_t *pvalue)
{
@@ -86,13 +86,13 @@ out:
}
/**
- \brief send set context command to AS10x
- \param phandle: pointer to AS10x handle
- \param tag: context tag
- \param value: value to set in context
- \return 0 when no error, < 0 in case of error.
- \callgraph
-*/
+ * as10x_cmd_set_context - send set context command to AS10x
+ * @phandle: pointer to AS10x handle
+ * @tag: context tag
+ * @value: value to set in context
+ *
+ * Return 0 on success or negative value in case of error.
+ */
int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag,
uint32_t value)
{
@@ -141,17 +141,16 @@ out:
}
/**
- \brief send eLNA change mode command to AS10x
- \param phandle: pointer to AS10x handle
- \param tag: context tag
- \param mode: mode selected:
- - ON : 0x0 => eLNA always ON
- - OFF : 0x1 => eLNA always OFF
- - AUTO : 0x2 => eLNA follow hysteresis parameters to be
- ON or OFF
- \return 0 when no error, < 0 in case of error.
- \callgraph
-*/
+ * as10x_cmd_eLNA_change_mode - send eLNA change mode command to AS10x
+ * @phandle: pointer to AS10x handle
+ * @mode: mode selected:
+ * - ON : 0x0 => eLNA always ON
+ * - OFF : 0x1 => eLNA always OFF
+ * - AUTO : 0x2 => eLNA follow hysteresis parameters
+ * to be ON or OFF
+ *
+ * Return 0 on success or negative value in case of error.
+ */
int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode)
{
int error;
@@ -194,14 +193,14 @@ out:
}
/**
- \brief Parse context command response. Since this command does not follow
- the common response, a specific parse function is required.
- \param prsp: pointer to AS10x command response buffer
- \param proc_id: id of the command
- \return 0 when no error, < 0 in case of error.
- ABILIS_RC_NOK
- \callgraph
-*/
+ * as10x_context_rsp_parse - Parse context command response
+ * @prsp: pointer to AS10x command response buffer
+ * @proc_id: id of the command
+ *
+ * Since the contex command reponse does not follow the common
+ * response, a specific parse function is required.
+ * Return 0 on success or negative value in case of error.
+ */
int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id)
{
int err;
diff --git a/drivers/staging/media/as102/as10x_cmd_stream.c b/drivers/staging/media/as102/as10x_cmd_stream.c
index e8c668c..045c706 100644
--- a/drivers/staging/media/as102/as10x_cmd_stream.c
+++ b/drivers/staging/media/as102/as10x_cmd_stream.c
@@ -21,15 +21,13 @@
#include "as102_drv.h"
#include "as10x_cmd.h"
-
/**
- \brief send add filter command to AS10x
- \param phandle: pointer to AS10x handle
- \param filter: TSFilter filter for DVB-T
- \param pfilter_handle: pointer where to store filter handle
- \return 0 when no error, < 0 in case of error.
- \callgraph
-*/
+ * as10x_cmd_add_PID_filter - send add filter command to AS10x
+ * @phandle: pointer to AS10x handle
+ * @filter: TSFilter filter for DVB-T
+ *
+ * Return 0 on success or negative value in case of error.
+ */
int as10x_cmd_add_PID_filter(as10x_handle_t *phandle,
struct as10x_ts_filter *filter)
{
@@ -84,12 +82,12 @@ out:
}
/**
- \brief Send delete filter command to AS10x
- \param phandle: pointer to AS10x handle
- \param filter_handle: filter handle
- \return 0 when no error, < 0 in case of error.
- \callgraph
-*/
+ * as10x_cmd_del_PID_filter - Send delete filter command to AS10x
+ * @phandle: pointer to AS10x handle
+ * @pid_value: PID to delete
+ *
+ * Return 0 on success or negative value in case of error.
+ */
int as10x_cmd_del_PID_filter(as10x_handle_t *phandle,
uint16_t pid_value)
{
@@ -133,11 +131,11 @@ out:
}
/**
- \brief Send start streaming command to AS10x
- \param phandle: pointer to AS10x handle
- \return 0 when no error, < 0 in case of error.
- \callgraph
-*/
+ * as10x_cmd_start_streaming - Send start streaming command to AS10x
+ * @phandle: pointer to AS10x handle
+ *
+ * Return 0 on success or negative value in case of error.
+ */
int as10x_cmd_start_streaming(as10x_handle_t *phandle)
{
int error;
@@ -179,11 +177,11 @@ out:
}
/**
- \brief Send stop streaming command to AS10x
- \param phandle: pointer to AS10x handle
- \return 0 when no error, < 0 in case of error.
- \callgraph
-*/
+ * as10x_cmd_stop_streaming - Send stop streaming command to AS10x
+ * @phandle: pointer to AS10x handle
+ *
+ * Return 0 on success or negative value in case of error.
+ */
int as10x_cmd_stop_streaming(as10x_handle_t *phandle)
{
int8_t error;
@@ -223,5 +221,3 @@ out:
LEAVE();
return error;
}
-
-
--
1.7.4.1
^ permalink raw reply related
* [PATCH 14/17] staging: as102: Enable compilation
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
In-Reply-To: <1320078295-3379-1-git-send-email-snjw23@gmail.com>
From: Piotr Chmura <chmooreck@poczta.onet.pl>
Fix compilation errors in the USB driver by replacing usb_buffer_free(),
usb_buffer_alloc() with usb_free_coherent() and usb_alloc_coherent().
Add entries for the driver in parent Makefile and Kconfig.
[snjw23@gmail.com: minor edit to changelog]
Cc: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl>
Signed-off-by: Sylwester Nawrocki <snjw23@gmail.com>
---
drivers/staging/Kconfig | 2 ++
drivers/staging/Makefile | 1 +
drivers/staging/media/as102/as102_usb_drv.c | 4 ++--
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index a329613..19bd99f 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -148,4 +148,6 @@ source "drivers/staging/mei/Kconfig"
source "drivers/staging/nvec/Kconfig"
+source "drivers/staging/media/as102/Kconfig"
+
endif # STAGING
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index d7a5a04..0baceb6 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -65,3 +65,4 @@ obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/
obj-$(CONFIG_DRM_PSB) += gma500/
obj-$(CONFIG_INTEL_MEI) += mei/
obj-$(CONFIG_MFD_NVEC) += nvec/
+obj-$(CONFIG_DVB_AS102) += media/as102/
diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c
index 3a3dd77..2586d55 100644
--- a/drivers/staging/media/as102/as102_usb_drv.c
+++ b/drivers/staging/media/as102/as102_usb_drv.c
@@ -238,7 +238,7 @@ static void as102_free_usb_stream_buffer(struct as102_dev_t *dev)
for (i = 0; i < MAX_STREAM_URB; i++)
usb_free_urb(dev->stream_urb[i]);
- usb_buffer_free(dev->bus_adap.usb_dev,
+ usb_free_coherent(dev->bus_adap.usb_dev,
MAX_STREAM_URB * AS102_USB_BUF_SIZE,
dev->stream,
dev->dma_addr);
@@ -251,7 +251,7 @@ static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev)
ENTER();
- dev->stream = usb_buffer_alloc(dev->bus_adap.usb_dev,
+ dev->stream = usb_alloc_coherent(dev->bus_adap.usb_dev,
MAX_STREAM_URB * AS102_USB_BUF_SIZE,
GFP_KERNEL,
&dev->dma_addr);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 15/17] staging: as102: Add nBox Tuner Dongle support
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
In-Reply-To: <1320078295-3379-1-git-send-email-snjw23@gmail.com>
From: Piotr Chmura <chmooreck@poczta.onet.pl>
Add support for nBox Tuner Dongle based on the same chip.
Cc: 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_usb_drv.c | 2 ++
drivers/staging/media/as102/as102_usb_drv.h | 5 +++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c
index 2586d55..70b21f3 100644
--- a/drivers/staging/media/as102/as102_usb_drv.c
+++ b/drivers/staging/media/as102/as102_usb_drv.c
@@ -41,6 +41,7 @@ static struct usb_device_id as102_usb_id_table[] = {
{ USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) },
{ USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) },
{ USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) },
+ { USB_DEVICE(NBOX_DVBT_DONGLE_USB_VID, NBOX_DVBT_DONGLE_USB_PID) },
{ } /* Terminating entry */
};
@@ -50,6 +51,7 @@ static const char *as102_device_names[] = {
AS102_REFERENCE_DESIGN,
AS102_PCTV_74E,
AS102_ELGATO_EYETV_DTT_NAME,
+ AS102_NBOX_DVBT_DONGLE_NAME,
NULL /* Terminating entry */
};
diff --git a/drivers/staging/media/as102/as102_usb_drv.h b/drivers/staging/media/as102/as102_usb_drv.h
index a741462..da34d32 100644
--- a/drivers/staging/media/as102/as102_usb_drv.h
+++ b/drivers/staging/media/as102/as102_usb_drv.h
@@ -42,6 +42,11 @@
#define ELGATO_EYETV_DTT_USB_VID 0x0fd9
#define ELGATO_EYETV_DTT_USB_PID 0x002c
+/* nBox: nBox DVB-T Dongle */
+#define AS102_NBOX_DVBT_DONGLE_NAME "nBox DVB-T Dongle"
+#define NBOX_DVBT_DONGLE_USB_VID 0x0b89
+#define NBOX_DVBT_DONGLE_USB_PID 0x0007
+
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs);
#else
--
1.7.4.1
^ permalink raw reply related
* [PATCH 16/17] staging: as102: Unconditionally compile code dependent on DVB_CORE
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
In-Reply-To: <1320078295-3379-1-git-send-email-snjw23@gmail.com>
The driver depends on DVB_CORE so there is no need for conditional
compilation of parts of the code depending on CONFIG_DVB_CORE as
the driver is never compiled with CONFIG_DVB_CORE* disabled.
Cc: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Sylwester Nawrocki <snjw23@gmail.com>
---
drivers/staging/media/as102/as102_drv.c | 12 +-----------
drivers/staging/media/as102/as102_drv.h | 6 ------
drivers/staging/media/as102/as102_fe.c | 2 --
drivers/staging/media/as102/as102_usb_drv.c | 4 ----
4 files changed, 1 insertions(+), 23 deletions(-)
diff --git a/drivers/staging/media/as102/as102_drv.c b/drivers/staging/media/as102/as102_drv.c
index 27a1571..d335c7d 100644
--- a/drivers/staging/media/as102/as102_drv.c
+++ b/drivers/staging/media/as102/as102_drv.c
@@ -30,12 +30,7 @@
/* header file for Usb device driver*/
#include "as102_drv.h"
#include "as102_fw.h"
-
-#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
#include "dvbdev.h"
-#else
-#warning >>> DVB_CORE not defined !!! <<<
-#endif
int debug;
module_param_named(debug, debug, int, 0644);
@@ -65,7 +60,6 @@ MODULE_PARM_DESC(elna_enable, "Activate eLNA (default: on)");
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
#endif
-#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
static void as102_stop_stream(struct as102_dev_t *dev)
{
struct as102_bus_adapter_t *bus_adap;
@@ -200,14 +194,12 @@ static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
LEAVE();
return 0;
}
-#endif
int as102_dvb_register(struct as102_dev_t *as102_dev)
{
int ret = 0;
ENTER();
-#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
ret = dvb_register_adapter(&as102_dev->dvb_adap,
as102_dev->name,
THIS_MODULE,
@@ -260,7 +252,6 @@ int as102_dvb_register(struct as102_dev_t *as102_dev)
__func__, ret);
goto failed;
}
-#endif
/* init bus mutex for token locking */
mutex_init(&as102_dev->bus_adap.lock);
@@ -288,7 +279,6 @@ void as102_dvb_unregister(struct as102_dev_t *as102_dev)
{
ENTER();
-#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
/* unregister as102 frontend */
as102_dvb_unregister_fe(&as102_dev->dvb_fe);
@@ -298,7 +288,7 @@ void as102_dvb_unregister(struct as102_dev_t *as102_dev)
/* unregister dvb adapter */
dvb_unregister_adapter(&as102_dev->dvb_adap);
-#endif
+
LEAVE();
}
diff --git a/drivers/staging/media/as102/as102_drv.h b/drivers/staging/media/as102/as102_drv.h
index cd11b16..bcda635 100644
--- a/drivers/staging/media/as102/as102_drv.h
+++ b/drivers/staging/media/as102/as102_drv.h
@@ -30,11 +30,9 @@ extern struct usb_driver as102_usb_driver;
extern struct spi_driver as102_spi_driver;
#endif
-#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
#include "dvb_demux.h"
#include "dvb_frontend.h"
#include "dmxdev.h"
-#endif
#define DRIVER_FULL_NAME "Abilis Systems as10x usb driver"
#define DRIVER_NAME "as10x_usb"
@@ -112,12 +110,10 @@ struct as102_dev_t {
struct kref kref;
unsigned long minor;
-#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
struct dvb_adapter dvb_adap;
struct dvb_frontend dvb_fe;
struct dvb_demux dvb_dmx;
struct dmxdev dvb_dmxdev;
-#endif
/* demodulator stats */
struct as10x_demod_stats demod_stats;
@@ -139,9 +135,7 @@ struct as102_dev_t {
int as102_dvb_register(struct as102_dev_t *dev);
void as102_dvb_unregister(struct as102_dev_t *dev);
-#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
int as102_dvb_register_fe(struct as102_dev_t *dev, struct dvb_frontend *fe);
int as102_dvb_unregister_fe(struct dvb_frontend *dev);
-#endif
/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */
diff --git a/drivers/staging/media/as102/as102_fe.c b/drivers/staging/media/as102/as102_fe.c
index 0495486..874c698 100644
--- a/drivers/staging/media/as102/as102_fe.c
+++ b/drivers/staging/media/as102/as102_fe.c
@@ -25,7 +25,6 @@
extern int elna_enable;
-#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst,
struct as10x_tps *src);
@@ -672,6 +671,5 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
as102_fe_get_code_rate(params->u.ofdm.code_rate_HP);
}
}
-#endif
/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */
diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c
index 70b21f3..ae1d38d 100644
--- a/drivers/staging/media/as102/as102_usb_drv.c
+++ b/drivers/staging/media/as102/as102_usb_drv.c
@@ -214,13 +214,9 @@ void as102_urb_stream_irq(struct urb *urb)
struct as102_dev_t *as102_dev = urb->context;
if (urb->actual_length > 0) {
-#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
dvb_dmx_swfilter(&as102_dev->dvb_dmx,
urb->transfer_buffer,
urb->actual_length);
-#else
- /* do nothing ? */
-#endif
} else {
if (urb->actual_length == 0)
memset(urb->transfer_buffer, 0, AS102_USB_BUF_SIZE);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 17/17] staging: as102: Remove conditional compilation based on kernel version
From: Sylwester Nawrocki @ 2011-10-31 16:24 UTC (permalink / raw)
To: devel, linux-media
Cc: Piotr Chmura, Devin Heitmueller, Mauro Carvalho Chehab,
Sylwester Nawrocki, Stefan Richter, Greg KH
In-Reply-To: <1320078295-3379-1-git-send-email-snjw23@gmail.com>
Remove #if's related to kernel version and the code not applicable
to 3.2+ kernels.
Cc: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Sylwester Nawrocki <snjw23@gmail.com>
---
drivers/staging/media/as102/as102_fe.c | 74 +--------------------------
drivers/staging/media/as102/as102_usb_drv.c | 4 --
drivers/staging/media/as102/as102_usb_drv.h | 5 --
3 files changed, 1 insertions(+), 82 deletions(-)
diff --git a/drivers/staging/media/as102/as102_fe.c b/drivers/staging/media/as102/as102_fe.c
index 874c698..3550f90 100644
--- a/drivers/staging/media/as102/as102_fe.c
+++ b/drivers/staging/media/as102/as102_fe.c
@@ -31,68 +31,6 @@ static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst,
static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst,
struct dvb_frontend_parameters *src);
-static void as102_fe_release(struct dvb_frontend *fe)
-{
- struct as102_dev_t *dev;
-
- ENTER();
-
- dev = (struct as102_dev_t *) fe->tuner_priv;
- if (dev == NULL)
- return;
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
- if (mutex_lock_interruptible(&dev->bus_adap.lock))
- return;
-
- /* send abilis command: TURN_OFF */
- as10x_cmd_turn_off(&dev->bus_adap);
-
- mutex_unlock(&dev->bus_adap.lock);
-#endif
-
- /* release frontend callback ops */
- memset(&fe->ops, 0, sizeof(struct dvb_frontend_ops));
-
- /* flush statistics */
- memset(&dev->demod_stats, 0, sizeof(dev->demod_stats));
- dev->signal_strength = 0;
- dev->ber = -1;
-
- /* reset tuner private data */
-/* fe->tuner_priv = NULL; */
-
- LEAVE();
-}
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
-static int as102_fe_init(struct dvb_frontend *fe)
-{
- int ret = 0;
- struct as102_dev_t *dev;
-
- ENTER();
-
- dev = (struct as102_dev_t *) fe->tuner_priv;
- if (dev == NULL)
- return -ENODEV;
-
- if (mutex_lock_interruptible(&dev->bus_adap.lock))
- return -EBUSY;
-
- if (elna_enable)
- ret = as10x_cmd_set_context(&dev->bus_adap, 1010, 0xC0);
-
- /* send abilis command: TURN_ON */
- ret = as10x_cmd_turn_on(&dev->bus_adap);
-
- mutex_unlock(&dev->bus_adap.lock);
-
- LEAVE();
- return (ret < 0) ? -EINVAL : 0;
-}
-#endif
-
static int as102_fe_set_frontend(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params)
{
@@ -312,7 +250,6 @@ static int as102_fe_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
return 0;
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire)
{
struct as102_dev_t *dev;
@@ -341,7 +278,6 @@ static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire)
LEAVE();
return ret;
}
-#endif
static struct dvb_frontend_ops as102_fe_ops = {
.info = {
@@ -366,19 +302,12 @@ static struct dvb_frontend_ops as102_fe_ops = {
.get_frontend = as102_fe_get_frontend,
.get_tune_settings = as102_fe_get_tune_settings,
-
.read_status = as102_fe_read_status,
.read_snr = as102_fe_read_snr,
.read_ber = as102_fe_read_ber,
.read_signal_strength = as102_fe_read_signal_strength,
.read_ucblocks = as102_fe_read_ucblocks,
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
.ts_bus_ctrl = as102_fe_ts_bus_ctrl,
-#else
- .release = as102_fe_release,
- .init = as102_fe_init,
-#endif
};
int as102_dvb_unregister_fe(struct dvb_frontend *fe)
@@ -386,10 +315,9 @@ int as102_dvb_unregister_fe(struct dvb_frontend *fe)
/* unregister frontend */
dvb_unregister_frontend(fe);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
/* detach frontend */
dvb_frontend_detach(fe);
-#endif
+
return 0;
}
diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c
index ae1d38d..264be2d 100644
--- a/drivers/staging/media/as102/as102_usb_drv.c
+++ b/drivers/staging/media/as102/as102_usb_drv.c
@@ -205,11 +205,7 @@ static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb)
return err;
}
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
-void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs)
-#else
void as102_urb_stream_irq(struct urb *urb)
-#endif
{
struct as102_dev_t *as102_dev = urb->context;
diff --git a/drivers/staging/media/as102/as102_usb_drv.h b/drivers/staging/media/as102/as102_usb_drv.h
index da34d32..fb1fc41 100644
--- a/drivers/staging/media/as102/as102_usb_drv.h
+++ b/drivers/staging/media/as102/as102_usb_drv.h
@@ -47,12 +47,7 @@
#define NBOX_DVBT_DONGLE_USB_VID 0x0b89
#define NBOX_DVBT_DONGLE_USB_PID 0x0007
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
-void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs);
-#else
void as102_urb_stream_irq(struct urb *urb);
-#endif
-
struct as10x_usb_token_cmd_t {
/* token cmd */
--
1.7.4.1
^ permalink raw reply related
* [PATCH] drivers/i2c/busses/i2c-at91.c: fix brokeness
From: Voss, Nikolaus @ 2011-10-31 16:10 UTC (permalink / raw)
To: 'linux-arm-kernel@lists.infradead.org',
'Linux Kernel'
Cc: 'Nicolas Ferre',
'Jean-Christophe PLAGNIOL-VILLARD'
This patch contains the following fixes:
1. Support for multiple interfaces (there are usually two of them).
2. Remove busy waiting in favour of interrupt driven io.
3. No repeated start (Sr) was possible. This implementation supports one
repeated start condition which is enough for most real-world applications
including all SMBus transfer types.
Tested on Atmel G45 with BQ20Z80 battery SMBus client.
Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
---
drivers/i2c/busses/Kconfig | 11 +-
drivers/i2c/busses/i2c-at91.c | 415 +++++++++++++++++++++++++++--------------
2 files changed, 278 insertions(+), 148 deletions(-)
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 646068e..c4b6bdc 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -286,18 +286,15 @@ comment "I2C system bus drivers (mostly embedded / system-on-chip)"
config I2C_AT91
tristate "Atmel AT91 I2C Two-Wire interface (TWI)"
- depends on ARCH_AT91 && EXPERIMENTAL && BROKEN
+ depends on ARCH_AT91 && EXPERIMENTAL
help
This supports the use of the I2C interface on Atmel AT91
processors.
- This driver is BROKEN because the controller which it uses
- will easily trigger RX overrun and TX underrun errors. Using
- low I2C clock rates may partially work around those issues
- on some systems. Another serious problem is that there is no
- documented way to issue repeated START conditions, as needed
+ A serious problem is that there is no documented way to issue
+ repeated START conditions for more than two messages, as needed
to support combined I2C messages. Use the i2c-gpio driver
- unless your system can cope with those limitations.
+ unless your system can cope with this limitation.
config I2C_AU1550
tristate "Au1550/Au1200 SMBus interface"
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 305c075..a2c38ff 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -1,6 +1,10 @@
-/*
+/* -*- linux-c -*-
+
i2c Support for Atmel's AT91 Two-Wire Interface (TWI)
+ Copyright (C) 2011 Nikolaus Voss <n.voss@weinmann.de>
+
+ Evolved from original work by:
Copyright (C) 2004 Rick Bronson
Converted to 2.6 by Andrew Victor <andrew@sanpeople.com>
@@ -18,9 +22,9 @@
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/types.h>
-#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/init.h>
+#include <linux/interrupt.h>
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <linux/io.h>
@@ -29,29 +33,47 @@
#include <mach/board.h>
#include <mach/cpu.h>
-#define TWI_CLOCK 100000 /* Hz. max 400 Kbits/sec */
+#define TWI_CLOCK 30000 /* Hz. max 400 Kbits/sec */
+#define AT91_I2C_TIMEOUT (1 * HZ) /* transfer timeout */
+
+struct at91_i2c_dev {
+ struct device *dev;
+ void __iomem *base;
+ struct completion cmd_complete;
+ struct clk *clk;
+ u8 *buf;
+ size_t buf_len;
+ int irq;
+ unsigned transfer_status;
+ struct i2c_adapter adapter;
+};
+#define at91_twi_read(reg) __raw_readl(dev->base + (reg))
+#define at91_twi_write(reg, val) __raw_writel((val), dev->base + (reg))
-static struct clk *twi_clk;
-static void __iomem *twi_base;
-#define at91_twi_read(reg) __raw_readl(twi_base + (reg))
-#define at91_twi_write(reg, val) __raw_writel((val), twi_base + (reg))
+static inline void at91_disable_interrupts(struct at91_i2c_dev *dev)
+{
+ at91_twi_write(AT91_TWI_IDR,
+ AT91_TWI_TXCOMP | AT91_TWI_RXRDY | AT91_TWI_TXRDY);
+}
-/*
- * Initialize the TWI hardware registers.
- */
-static void __devinit at91_twi_hwinit(void)
+static void at91_init_bus(struct at91_i2c_dev *dev)
{
- unsigned long cdiv, ckdiv;
-
- at91_twi_write(AT91_TWI_IDR, 0xffffffff); /* Disable all interrupts */
+ at91_disable_interrupts(dev);
at91_twi_write(AT91_TWI_CR, AT91_TWI_SWRST); /* Reset peripheral */
at91_twi_write(AT91_TWI_CR, AT91_TWI_MSEN); /* Set Master mode */
+ at91_twi_write(AT91_TWI_CR, AT91_TWI_SVDIS); /* Disable Slave mode */
+}
+
+
+static void at91_set_clock(struct at91_i2c_dev *dev)
+{
+ unsigned long cdiv, ckdiv;
/* Calcuate clock dividers */
- cdiv = (clk_get_rate(twi_clk) / (2 * TWI_CLOCK)) - 3;
+ cdiv = (clk_get_rate(dev->clk) / (2 * TWI_CLOCK)) - 3;
cdiv = cdiv + 1; /* round up */
ckdiv = 0;
while (cdiv > 255) {
@@ -69,108 +91,178 @@ static void __devinit at91_twi_hwinit(void)
at91_twi_write(AT91_TWI_CWGR, (ckdiv << 16) | (cdiv << 8) | cdiv);
}
+
/*
- * Poll the i2c status register until the specified bit is set.
- * Returns 0 if timed out (100 msec).
+ * Initialize the TWI hardware registers.
*/
-static short at91_poll_status(unsigned long bit)
+static void __devinit at91_twi_hwinit(struct at91_i2c_dev *dev)
+{
+ at91_init_bus(dev);
+ at91_set_clock(dev);
+}
+
+
+static void at91_write_next_byte(struct at91_i2c_dev *dev)
+{
+ if (dev->buf_len > 0) {
+
+ const u8 c = *(dev->buf++);
+
+ at91_twi_write(AT91_TWI_THR, c);
+
+ /* send stop when last byte has been written */
+ if (--dev->buf_len == 0)
+ at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
+
+ dev_dbg(dev->dev, "wrote 0x%x, to go %d\n", c, dev->buf_len);
+ }
+}
+
+
+static void at91_read_next_byte(struct at91_i2c_dev *dev)
{
- int loop_cntr = 10000;
+ const u8 c = at91_twi_read(AT91_TWI_RHR) & 0xff;
- do {
- udelay(10);
- } while (!(at91_twi_read(AT91_TWI_SR) & bit) && (--loop_cntr > 0));
+ *(dev->buf)++ = c;
- return (loop_cntr > 0);
+ /* send stop if second but last byte has been read */
+ if (--dev->buf_len == 1)
+ at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
+
+ dev_dbg(dev->dev, "read 0x%x, to go %d\n", c, dev->buf_len);
}
-static int xfer_read(struct i2c_adapter *adap, unsigned char *buf, int length)
+
+static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id)
{
- /* Send Start */
- at91_twi_write(AT91_TWI_CR, AT91_TWI_START);
+ struct at91_i2c_dev *dev = dev_id;
+ const unsigned status = at91_twi_read(AT91_TWI_SR);
+ const unsigned irqstatus = status & at91_twi_read(AT91_TWI_IMR);
- /* Read data */
- while (length--) {
- if (!length) /* need to send Stop before reading last byte */
- at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
- if (!at91_poll_status(AT91_TWI_RXRDY)) {
- dev_dbg(&adap->dev, "RXRDY timeout\n");
- return -ETIMEDOUT;
- }
- *buf++ = (at91_twi_read(AT91_TWI_RHR) & 0xff);
+ if (irqstatus & AT91_TWI_TXCOMP) {
+ at91_disable_interrupts(dev);
+ dev->transfer_status = status;
+
+ complete(&dev->cmd_complete);
}
- return 0;
+ else if (irqstatus & AT91_TWI_RXRDY)
+
+ at91_read_next_byte(dev);
+
+ else if (irqstatus & AT91_TWI_TXRDY)
+
+ at91_write_next_byte(dev);
+
+ else
+ return IRQ_NONE;
+
+ return IRQ_HANDLED;
}
-static int xfer_write(struct i2c_adapter *adap, unsigned char *buf, int length)
+
+int at91_do_transfer(struct at91_i2c_dev *dev, bool is_read)
{
- /* Load first byte into transmitter */
- at91_twi_write(AT91_TWI_THR, *buf++);
+ int ret = 0;
- /* Send Start */
- at91_twi_write(AT91_TWI_CR, AT91_TWI_START);
+ INIT_COMPLETION(dev->cmd_complete);
- do {
- if (!at91_poll_status(AT91_TWI_TXRDY)) {
- dev_dbg(&adap->dev, "TXRDY timeout\n");
- return -ETIMEDOUT;
- }
+ if (is_read) {
+ if (!dev->buf_len)
+ at91_twi_write(AT91_TWI_CR,
+ AT91_TWI_START | AT91_TWI_STOP);
+ else
+ at91_twi_write(AT91_TWI_CR, AT91_TWI_START);
+
+ at91_twi_write(AT91_TWI_IER, AT91_TWI_TXCOMP | AT91_TWI_RXRDY);
- length--; /* byte was transmitted */
+ } else {
- if (length > 0) /* more data to send? */
- at91_twi_write(AT91_TWI_THR, *buf++);
- } while (length);
+ at91_write_next_byte(dev);
- /* Send Stop */
- at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
+ at91_twi_write(AT91_TWI_IER, AT91_TWI_TXCOMP | AT91_TWI_TXRDY);
+ }
+
+ ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
+ dev->adapter.timeout);
+
+ if (ret == 0) {
+ dev_err(dev->dev, "controller timed out\n");
+ at91_init_bus(dev);
+ return -ETIMEDOUT;
+ }
+
+ if (dev->transfer_status & AT91_TWI_NACK) {
+ dev_dbg(dev->dev, "received nack\n");
+ return -ENODEV;
+ }
+
+ if (dev->transfer_status & AT91_TWI_OVRE) {
+ dev_err(dev->dev, "overrun while reading\n");
+ return -EIO;
+ }
+
+ dev_dbg(dev->dev, "transfer complete\n");
return 0;
}
-/*
- * Generic i2c master transfer entrypoint.
- *
- * Note: We do not use Atmel's feature of storing the "internal device address".
- * Instead the "internal device address" has to be written using a separate
- * i2c message.
- * http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html
- */
+
static int at91_xfer(struct i2c_adapter *adap, struct i2c_msg *pmsg, int num)
{
- int i, ret;
+ struct at91_i2c_dev *dev = i2c_get_adapdata(adap);
+ int ret;
+ unsigned int_addr_flag = 0;
+ struct i2c_msg *m0 = pmsg;
+ struct i2c_msg *ma = m0;
dev_dbg(&adap->dev, "at91_xfer: processing %d messages:\n", num);
- for (i = 0; i < num; i++) {
- dev_dbg(&adap->dev, " #%d: %sing %d byte%s %s 0x%02x\n", i,
- pmsg->flags & I2C_M_RD ? "read" : "writ",
- pmsg->len, pmsg->len > 1 ? "s" : "",
- pmsg->flags & I2C_M_RD ? "from" : "to", pmsg->addr);
-
- at91_twi_write(AT91_TWI_MMR, (pmsg->addr << 16)
- | ((pmsg->flags & I2C_M_RD) ? AT91_TWI_MREAD : 0));
-
- if (pmsg->len && pmsg->buf) { /* sanity check */
- if (pmsg->flags & I2C_M_RD)
- ret = xfer_read(adap, pmsg->buf, pmsg->len);
- else
- ret = xfer_write(adap, pmsg->buf, pmsg->len);
-
- if (ret)
- return ret;
-
- /* Wait until transfer is finished */
- if (!at91_poll_status(AT91_TWI_TXCOMP)) {
- dev_dbg(&adap->dev, "TXCOMP timeout\n");
- return -ETIMEDOUT;
- }
+ /* the hardware can handle at most two messages concatenated by a
+ repeated start via it's internal address feature */
+
+ if (num > 2) {
+ dev_err(dev->dev,
+ "cannot handle more than two concatenated messages.\n");
+ return 0;
+
+ } else if (num == 2) {
+
+ int internal_address = 0;
+ int i;
+
+ ma = &pmsg[1];
+
+ if (m0->flags & I2C_M_RD) {
+ dev_err(dev->dev, "first transfer must be write.\n");
+ return 0;
}
- dev_dbg(&adap->dev, "transfer complete\n");
- pmsg++; /* next message */
+
+ if (m0->len > 3) {
+ dev_err(dev->dev, "first message size must be <= 3.\n");
+ return 0;
+ }
+
+ for (i = 0; i < m0->len; ++i) {
+ internal_address |= ((unsigned)m0->buf[i]) << (8 * i);
+ int_addr_flag += AT91_TWI_IADRSZ_1;
+ }
+
+ at91_twi_write(AT91_TWI_IADR, internal_address);
}
- return i;
+
+ at91_twi_write(AT91_TWI_MMR, (ma->addr << 16) | int_addr_flag
+ | ((ma->flags & I2C_M_RD) ? AT91_TWI_MREAD : 0));
+
+ dev->buf_len = ma->len;
+ dev->buf = ma->buf;
+
+ ret = at91_do_transfer(dev, ma->flags & I2C_M_RD);
+
+ if (ret < 0)
+ return ret;
+
+ return num;
}
/*
@@ -191,86 +283,115 @@ static struct i2c_algorithm at91_algorithm = {
*/
static int __devinit at91_i2c_probe(struct platform_device *pdev)
{
- struct i2c_adapter *adapter;
- struct resource *res;
+ struct at91_i2c_dev *dev;
+ struct resource *mem, *irq, *ioarea;
int rc;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENXIO;
+ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!mem)
+ return -ENODEV;
+
+ irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+ if (!irq)
+ return -ENODEV;
- if (!request_mem_region(res->start, resource_size(res), "at91_i2c"))
+ ioarea = request_mem_region(mem->start, resource_size(mem), pdev->name);
+ if (!ioarea)
return -EBUSY;
- twi_base = ioremap(res->start, resource_size(res));
- if (!twi_base) {
+ dev = kzalloc(sizeof(struct at91_i2c_dev), GFP_KERNEL);
+ if (!dev) {
rc = -ENOMEM;
- goto fail0;
+ goto err_release_region;
}
- twi_clk = clk_get(NULL, "twi_clk");
- if (IS_ERR(twi_clk)) {
+ init_completion(&dev->cmd_complete);
+
+ dev->dev = get_device(&pdev->dev);
+ dev->irq = irq->start;
+ platform_set_drvdata(pdev, dev);
+
+ dev->clk = clk_get(&pdev->dev, "twi_clk");
+ if (IS_ERR(dev->clk)) {
dev_err(&pdev->dev, "no clock defined\n");
rc = -ENODEV;
- goto fail1;
+ goto err_free_mem;
}
+ clk_enable(dev->clk);
- adapter = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL);
- if (adapter == NULL) {
- dev_err(&pdev->dev, "can't allocate inteface!\n");
- rc = -ENOMEM;
- goto fail2;
+ dev->base = ioremap(mem->start, resource_size(mem));
+ if (!dev->base) {
+ rc = -EBUSY;
+ goto err_mem_ioremap;
}
- snprintf(adapter->name, sizeof(adapter->name), "AT91");
- adapter->algo = &at91_algorithm;
- adapter->class = I2C_CLASS_HWMON;
- adapter->dev.parent = &pdev->dev;
- /* adapter->id == 0 ... only one TWI controller for now */
- platform_set_drvdata(pdev, adapter);
+ at91_twi_hwinit(dev);
+
+ rc = request_irq(dev->irq, atmel_twi_interrupt, 0,
+ dev_name(&pdev->dev), dev);
+ if (rc) {
+ dev_err(&pdev->dev, "Cannot get irq %d: %d\n", dev->irq, rc);
+ goto err_unuse_clocks;
+ }
- clk_enable(twi_clk); /* enable peripheral clock */
- at91_twi_hwinit(); /* initialize TWI controller */
+ snprintf(dev->adapter.name, sizeof(dev->adapter.name), "AT91");
+ i2c_set_adapdata(&dev->adapter, dev);
+ dev->adapter.owner = THIS_MODULE;
+ dev->adapter.class = I2C_CLASS_HWMON;
+ dev->adapter.algo = &at91_algorithm;
+ dev->adapter.dev.parent = &pdev->dev;
+ dev->adapter.nr = pdev->id;
+ dev->adapter.timeout = AT91_I2C_TIMEOUT;
- rc = i2c_add_numbered_adapter(adapter);
+ rc = i2c_add_numbered_adapter(&dev->adapter);
if (rc) {
dev_err(&pdev->dev, "Adapter %s registration failed\n",
- adapter->name);
- goto fail3;
+ dev->adapter.name);
+ goto err_free_irq;
}
dev_info(&pdev->dev, "AT91 i2c bus driver.\n");
return 0;
-fail3:
+err_free_irq:
+ free_irq(dev->irq, dev);
+err_unuse_clocks:
+ iounmap(dev->base);
+err_mem_ioremap:
+ clk_disable(dev->clk);
+ clk_put(dev->clk);
+ dev->clk = NULL;
+err_free_mem:
platform_set_drvdata(pdev, NULL);
- kfree(adapter);
- clk_disable(twi_clk);
-fail2:
- clk_put(twi_clk);
-fail1:
- iounmap(twi_base);
-fail0:
- release_mem_region(res->start, resource_size(res));
+ put_device(&pdev->dev);
+ kfree(dev);
+err_release_region:
+ release_mem_region(mem->start, resource_size(mem));
return rc;
}
static int __devexit at91_i2c_remove(struct platform_device *pdev)
{
- struct i2c_adapter *adapter = platform_get_drvdata(pdev);
- struct resource *res;
+ struct at91_i2c_dev *dev = platform_get_drvdata(pdev);
+ struct resource *mem;
int rc;
- rc = i2c_del_adapter(adapter);
platform_set_drvdata(pdev, NULL);
+ rc = i2c_del_adapter(&dev->adapter);
+ put_device(&pdev->dev);
+
+ clk_disable(dev->clk);
+ clk_put(dev->clk);
+ dev->clk = NULL;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- iounmap(twi_base);
- release_mem_region(res->start, resource_size(res));
+ free_irq(dev->irq, dev);
- clk_disable(twi_clk); /* disable peripheral clock */
- clk_put(twi_clk);
+ iounmap(dev->base);
+ kfree(dev);
+
+ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ release_mem_region(mem->start, resource_size(mem));
return rc;
}
@@ -279,33 +400,45 @@ static int __devexit at91_i2c_remove(struct platform_device *pdev)
/* NOTE: could save a few mA by keeping clock off outside of at91_xfer... */
-static int at91_i2c_suspend(struct platform_device *pdev, pm_message_t mesg)
+static int at91_i2c_suspend(struct device *dev)
{
- clk_disable(twi_clk);
+ struct platform_device *pdev = to_platform_device(dev);
+ struct at91_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
+
+ clk_disable(i2c_dev->clk);
+
return 0;
}
-static int at91_i2c_resume(struct platform_device *pdev)
+static int at91_i2c_resume(struct device *dev)
{
- return clk_enable(twi_clk);
+ struct platform_device *pdev = to_platform_device(dev);
+ struct at91_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
+
+ return clk_enable(i2c_dev->clk);
}
+static const struct dev_pm_ops at91_i2c_pm = {
+ .suspend = at91_i2c_suspend,
+ .resume = at91_i2c_resume,
+};
+
+#define at91_i2c_pm_ops (&at91_i2c_pm)
#else
-#define at91_i2c_suspend NULL
-#define at91_i2c_resume NULL
+#define at91_i2c_pm_ops NULL
#endif
+
/* work with "modprobe at91_i2c" from hotplugging or coldplugging */
MODULE_ALIAS("platform:at91_i2c");
static struct platform_driver at91_i2c_driver = {
.probe = at91_i2c_probe,
.remove = __devexit_p(at91_i2c_remove),
- .suspend = at91_i2c_suspend,
- .resume = at91_i2c_resume,
.driver = {
.name = "at91_i2c",
.owner = THIS_MODULE,
+ .pm = at91_i2c_pm_ops,
},
};
@@ -322,6 +455,6 @@ static void __exit at91_i2c_exit(void)
module_init(at91_i2c_init);
module_exit(at91_i2c_exit);
-MODULE_AUTHOR("Rick Bronson");
+MODULE_AUTHOR("Nikolaus Voss");
MODULE_DESCRIPTION("I2C (TWI) driver for Atmel AT91");
MODULE_LICENSE("GPL");
--
1.7.4.1
^ permalink raw reply related
* [meta-oe] opencv: import from oe-classic and upgrade to 2.3.1
From: Connor Abbott @ 2011-10-31 16:22 UTC (permalink / raw)
To: openembedded-devel
OpenCV <= 2.2 won't compile on oe-core due to the lack of v4l1 headers, and therefore wasn't included in this patch. Also, the support for newer cv2-style python bindings is a bit hacked up at the moment due to the way OpenCV detects the Python version and Numpy headers (see 0001-Fix-CMakeLists.txt-numpy-detection.patch). In particular, it requires the native & target python to be the same version and have similar site-packages directories, which is true at least for now in OE.
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
---
.../recipes-support/opencv/opencv-samples_2.3.bb | 42 +++++++++++
.../0001-Fix-CMakeLists.txt-numpy-detection.patch | 37 ++++++++++
meta-oe/recipes-support/opencv/opencv_2.3.bb | 75 ++++++++++++++++++++
3 files changed, 154 insertions(+), 0 deletions(-)
create mode 100644 meta-oe/recipes-support/opencv/opencv-samples_2.3.bb
create mode 100644 meta-oe/recipes-support/opencv/opencv/0001-Fix-CMakeLists.txt-numpy-detection.patch
create mode 100644 meta-oe/recipes-support/opencv/opencv_2.3.bb
diff --git a/meta-oe/recipes-support/opencv/opencv-samples_2.3.bb b/meta-oe/recipes-support/opencv/opencv-samples_2.3.bb
new file mode 100644
index 0000000..6664b3f
--- /dev/null
+++ b/meta-oe/recipes-support/opencv/opencv-samples_2.3.bb
@@ -0,0 +1,42 @@
+DESCRIPTION = "Opencv : The Open Computer Vision Library"
+HOMEPAGE = "http://opencv.willowgarage.com/wiki/"
+SECTION = "libs"
+LICENSE = "BSD"
+
+DEPENDS = "opencv"
+
+LIC_FILES_CHKSUM = "file://include/opencv2/opencv.hpp;endline=41;md5=6d690d8488a6fca7a2c192932466bb14 \
+"
+
+SRC_URI = "svn://code.ros.org/svn/opencv/tags/2.3.1;module=opencv;proto=https \
+"
+
+SRCREV = "6923"
+PV = "2.3.1"
+PR = "r0"
+
+S = "${WORKDIR}/opencv"
+
+do_install() {
+ cd samples/c
+ install -d ${D}/${bindir}
+ install -d ${D}/${datadir}/opencv/samples
+
+ cp * ${D}/${datadir}/opencv/samples || true
+
+ for i in *.c; do
+ echo "compiling $i"
+ ${CXX} ${CFLAGS} ${LDFLAGS} -ggdb `pkg-config --cflags opencv` -o `basename $i .c` $i `pkg-config --libs opencv` || true
+ install -m 0755 `basename $i .c` ${D}/${bindir} || true
+ rm ${D}/${datadir}/opencv/samples/`basename $i .c` || true
+ done
+ for i in *.cpp; do
+ echo "compiling $i"
+ ${CXX} ${CFLAGS} ${LDFLAGS} -ggdb `pkg-config --cflags opencv` -o `basename $i .cpp` $i `pkg-config --libs opencv` || true
+ install -m 0755 `basename $i .cpp` ${D}/${bindir} || true
+ rm ${D}/${datadir}/opencv/samples/`basename $i .cpp` || true
+ done
+}
+
+FILES_${PN}-dev += "${datadir}/opencv/samples/*.c* ${datadir}/opencv/samples/*.vcp* ${datadir}/opencv/samples/build*"
+FILES_${PN} += "${bindir} ${datadir}/opencv"
diff --git a/meta-oe/recipes-support/opencv/opencv/0001-Fix-CMakeLists.txt-numpy-detection.patch b/meta-oe/recipes-support/opencv/opencv/0001-Fix-CMakeLists.txt-numpy-detection.patch
new file mode 100644
index 0000000..dba00f8
--- /dev/null
+++ b/meta-oe/recipes-support/opencv/opencv/0001-Fix-CMakeLists.txt-numpy-detection.patch
@@ -0,0 +1,37 @@
+From a7301911a3cdf9196abd93ff894a9e86e0bcdc5e Mon Sep 17 00:00:00 2001
+From: Connor Abbott <cwabbott0@gmail.com>
+Date: Sun, 30 Oct 2011 20:00:03 -0400
+Subject: [PATCH] Fix CMakeLists.txt numpy detection
+
+Right now, the code opencv uses to detect where the numpy include files are doesn't work with cross-compiling because it uses the native python to determine the environment. To make this a little better, allow the user to explictly specify the path using -DPYTHON_NUMPY_INCLUDE_DIRS=path/to/numpy/include/dir .
+Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
+---
+ CMakeLists.txt | 12 ++++++++----
+ 1 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ff8f20c..8edbd78 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -715,10 +715,14 @@ IF ("${PYTHON_VERSION_MAJOR_MINOR}" VERSION_GREATER 2.4)
+ ENDIF()
+
+ # Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
+-execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
+- RESULT_VARIABLE PYTHON_NUMPY_PROCESS
+- OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIRS
+- OUTPUT_STRIP_TRAILING_WHITESPACE)
++if(NOT DEFINED PYTHON_NUMPY_INCLUDE_DIRS)
++ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
++ RESULT_VARIABLE PYTHON_NUMPY_PROCESS
++ OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIRS
++ OUTPUT_STRIP_TRAILING_WHITESPACE)
++else()
++ set(PYTHON_NUMPY_PROCESS 0)
++endif()
+
+ if(PYTHON_NUMPY_PROCESS EQUAL 0)
+ set(PYTHON_USE_NUMPY 1)
+--
+1.7.4.1
+
diff --git a/meta-oe/recipes-support/opencv/opencv_2.3.bb b/meta-oe/recipes-support/opencv/opencv_2.3.bb
new file mode 100644
index 0000000..ef0933c
--- /dev/null
+++ b/meta-oe/recipes-support/opencv/opencv_2.3.bb
@@ -0,0 +1,75 @@
+DESCRIPTION = "Opencv : The Open Computer Vision Library"
+HOMEPAGE = "http://opencv.willowgarage.com/wiki/"
+SECTION = "libs"
+LICENSE = "BSD"
+
+ARM_INSTRUCTION_SET = "arm"
+
+LIC_FILES_CHKSUM = "file://include/opencv2/opencv.hpp;endline=41;md5=6d690d8488a6fca7a2c192932466bb14 \
+"
+
+DEPENDS = "python-numpy ffmpeg gtk+ libtool swig swig-native python jpeg bzip2 zlib libpng tiff glib-2.0"
+
+SRC_URI = "svn://code.ros.org/svn/opencv/tags/2.3.1;module=opencv;proto=https \
+file://opencv/0001-Fix-CMakeLists.txt-numpy-detection.patch \
+"
+
+SRCREV = "6923"
+
+PV = "2.3.1"
+PR = "r0"
+
+S = "${WORKDIR}/opencv"
+
+EXTRA_OECMAKE = "-DPYTHON_NUMPY_INCLUDE_DIRS=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include \
+-DBUILD_PYTHON_SUPPORT=ON \
+"
+
+inherit distutils-base pkgconfig cmake
+
+export BUILD_SYS
+export HOST_SYS
+export PYTHON_CSPEC="-I${STAGING_INCDIR}/${PYTHON_DIR}"
+export PYTHON=${STAGING_BINDIR_NATIVE}/python
+
+TARGET_CC_ARCH += "-I${S}/include "
+
+PACKAGES += "${PN}-apps python-opencv"
+
+python populate_packages_prepend () {
+ cv_libdir = bb.data.expand('${libdir}', d)
+ cv_libdir_dbg = bb.data.expand('${libdir}/.debug', d)
+ do_split_packages(d, cv_libdir, '^lib(.*)\.so$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev', allow_links=True)
+ do_split_packages(d, cv_libdir, '^lib(.*)\.la$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
+ do_split_packages(d, cv_libdir, '^lib(.*)\.a$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
+ do_split_packages(d, cv_libdir, '^lib(.*)\.so\.*', 'lib%s', 'OpenCV %s library', extra_depends='', allow_links=True)
+
+ pn = bb.data.getVar('PN', d, 1)
+ metapkg = pn + '-dev'
+ bb.data.setVar('ALLOW_EMPTY_' + metapkg, "1", d)
+ blacklist = [ metapkg ]
+ metapkg_rdepends = [ ]
+ packages = bb.data.getVar('PACKAGES', d, 1).split()
+ for pkg in packages[1:]:
+ if not pkg in blacklist and not pkg in metapkg_rdepends and pkg.endswith('-dev'):
+ metapkg_rdepends.append(pkg)
+ bb.data.setVar('RRECOMMENDS_' + metapkg, ' '.join(metapkg_rdepends), d)
+}
+
+FILES_${PN} = ""
+FILES_${PN}-apps = "${bindir}/* ${datadir}/OpenCV"
+FILES_${PN}-dbg += "${libdir}/.debug"
+FILES_${PN}-dev = "${includedir} ${libdir}/pkgconfig"
+FILES_${PN}-doc = "${datadir}/OpenCV/doc"
+
+ALLOW_EMPTY_${PN} = "1"
+
+INSANE_SKIP_python-opencv = True
+DESCRIPTION_python-opencv = "Python bindings to opencv"
+FILES_python-opencv = "${PYTHON_SITEPACKAGES_DIR}/*"
+RDEPENDS_python-opencv = "python-core python-numpy"
+
+do_install_append() {
+ cp ${S}/include/opencv/*.h ${D}${includedir}/opencv/
+ sed -i '/blobtrack/d' ${D}${includedir}/opencv/cvaux.h
+}
\ No newline at end of file
--
1.7.4.1
^ permalink raw reply related
* Re: [meta-efl][meta-oe 05/12] id3lib: Import from openembedded classic
From: Paul Menzel @ 2011-10-31 16:23 UTC (permalink / raw)
To: openembedded-devel
In-Reply-To: <201110310955.28626.paul.eggleton@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 832 bytes --]
Am Montag, den 31.10.2011, 09:55 +0000 schrieb Paul Eggleton:
> On Saturday 29 October 2011 13:33:27 Paul Menzel wrote:
> > > +LIC_FILES_CHKSUM = "files://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7"
> > > +PR = "r0"
> >
> > According to Koen these are going away.
>
> Well, Koen might reject PR = "r0" in meta-oe, that's fine; however
> LIC_FILES_CHKSUM is mandatory or the recipe will not build, and I don't think
> that will be changing any time soon. I have considered if it would be
> desirable/possible to eliminate it for recipes that don't install any files
> (e.g. tasks), so far I haven't done any work on that. For normal recipes it is
> required however.
I meant »this is« instead of »these are«. (Or did I mean these
occurrences of `PR`.)I am sorry for the confusion.
Thanks,
Paul
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 205 bytes --]
^ permalink raw reply
* Re: [meta-efl][meta-oe 05/12] id3lib: Import from openembedded classic
From: Paul Menzel @ 2011-10-31 16:24 UTC (permalink / raw)
To: openembedded-devel
In-Reply-To: <j8luhk$7vb$3@dough.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 892 bytes --]
Am Montag, den 31.10.2011, 11:50 +0100 schrieb Koen Kooi:
> Op 29-10-11 14:33, Paul Menzel schreef:
> > Dear Martin, dear Denis,
> >
> >
> > Am Samstag, den 29.10.2011, 12:29 +0200 schrieb Martin Jansa:
> >> From: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
> >>
> >> Added LIC_FILES_CHKSUM, and fixed LICENSE
> >>
> >> Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
> >> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> >
> > NACK.
> >
> > please add the version you import and the commit ID you import from. This
> > is all written in the guide lines [1]!
>
> And as I've said before, meta-oe is not oe-dev, so you can't use take the
> old 'rules' and apply them to meta-oe 1:1!
The guide lines I referred to [1] have been written for OE-core. ;-)
Thanks,
Paul
[1] http://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 205 bytes --]
^ permalink raw reply
* [PATCH] i2c-gpio.c: correct logic of pdata->scl_is_open_drain
From: Voss, Nikolaus @ 2011-10-31 16:14 UTC (permalink / raw)
To: 'linux-arm-kernel@lists.infradead.org',
'Linux Kernel'
Cc: 'Haavard Skinnemoen'
If pdata->scl_is_open_drain was set, the driver used push-pull output
for SCL, not open-drain output.
Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
---
drivers/i2c/busses/i2c-gpio.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index a651779..b161335 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -104,7 +104,7 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
if (ret)
goto err_request_scl;
- if (pdata->sda_is_open_drain) {
+ if (!pdata->sda_is_open_drain) {
gpio_direction_output(pdata->sda_pin, 1);
bit_data->setsda = i2c_gpio_setsda_val;
} else {
@@ -112,7 +112,7 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
bit_data->setsda = i2c_gpio_setsda_dir;
}
- if (pdata->scl_is_open_drain || pdata->scl_is_output_only) {
+ if (!pdata->scl_is_open_drain || pdata->scl_is_output_only) {
gpio_direction_output(pdata->scl_pin, 1);
bit_data->setscl = i2c_gpio_setscl_val;
} else {
--
1.7.4.1
^ permalink raw reply related
* ceph build issues
From: Sage Weil @ 2011-10-31 16:32 UTC (permalink / raw)
To: Stefan.Fent; +Cc: ceph-devel
Hi Stefan,
Here's a quick summary of the issues right now with ceph rpm builds:
- Inconsistent use of insserv vs pkgconfig throughout. I'm not sure
if/when/where the init scripts should be configured. And the .spec file
needs to do the right thing for non-suse dists as well. I've gotten mixed
messages about what the right thing to do is here.
- sles failes with -lcurses. The weird thing is that -lcurses isn't part
of our Makefile. It's coming from a pkgconfig for something (i.e. the
build environment).
- The fedora environments in build.opensuse.org don't have the
redhat-rpm-config installed... see
http://www.spinics.net/lists/ceph-devel/msg03793.html
There is a workaround/hack in the .spec file right now that should be
removed at some point.
- There are a zillion rpmlint errors on the packages that do build
successfully. No idea how important those are.
The build results are at
https://build.opensuse.org/package/show?package=ceph&project=home%3Aliewegas
if you haven't found them already.
Also, I should also mention that most of the stuff in the build.opensuse
has been pulled back into the ceph.spec.in in git, but not everything.
Thanks!
sage
^ permalink raw reply
* Re: [PATCH 0/7] opensm: Add rate validation
From: Alex Netes @ 2011-10-31 16:32 UTC (permalink / raw)
To: Hal Rosenstock
Cc: Stan Smith,
linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org),
ofw-ZwoEplunGu1OwGhvXhtEPSCwEArCW2h5@public.gmane.org
In-Reply-To: <4E871267.2080508-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Hi Hal,
On 09:15 Sat 01 Oct , Hal Rosenstock wrote:
> The following patch series adds rate validation to SA and fixes some issues in the osmtest multicast flow. These issues prevented OpenSM from running when built with --enable-debug.
>
> A similar patch series will follow for MTU validation.
> --
Applied. Thanks.
--
-- Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: root paths in packages
From: McClintock Matthew-B29882 @ 2011-10-31 16:32 UTC (permalink / raw)
To: Mike Tsukerman; +Cc: yocto@yoctoproject.org
In-Reply-To: <CALs2vtdUjnMxtTfhqPB2Teui4ZKmzzxRWfBxgU=qG9giUFAwrg@mail.gmail.com>
On Mon, Oct 31, 2011 at 5:57 AM, Mike Tsukerman <miketsukerman@gmail.com> wrote:
> Hello,
> I've build rpm packages and met some interesting things.
> In the rpm all scripts and files include root paths from machine that i've
> build on.
> how can i change that?
Which package? Can you give some examples?
-M
^ permalink raw reply
* [PATCH v3 1/2] Add new strace-graph package to avoid making perl a dependecy for all of strace
From: Matthew McClintock @ 2011-10-31 16:26 UTC (permalink / raw)
To: openembedded-core
In-Reply-To: <201110310905.49436.paul.eggleton@linux.intel.com>
Signed-off-by: Matthew McClintock <msm@freescale.com>
---
v2: Change to use PACKAGES_prepend instead of explictly listing all packages
and also fixing the fact we missed the -dev and -dbg packages before
v3: Use += instead of _prepend to add strace-graph packages
meta/recipes-devtools/strace/strace_4.5.20.bb | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/meta/recipes-devtools/strace/strace_4.5.20.bb b/meta/recipes-devtools/strace/strace_4.5.20.bb
index b3d2aa5..53df067 100644
--- a/meta/recipes-devtools/strace/strace_4.5.20.bb
+++ b/meta/recipes-devtools/strace/strace_4.5.20.bb
@@ -5,7 +5,9 @@ LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=4535377ede62550fdeaf39f595fd550a"
PR = "r2"
-RDEPENDS = "perl"
+PACKAGES =+ "${PN}-graph "
+FILES_${PN}-graph = "${bindir}/strace-graph"
+RDEPENDS_${PN}-graph = "perl"
SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
file://sigmask.patch \
--
1.7.6.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
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.