Remaining coding style clean up of AS102 driver
Subsystems (2)
cover Remaining coding style clean up of AS102 driver
Hello,
the following patch set is a further cleanup of the AS102 DVB-T receiver driver. I'm not sure if there are more issues to address before moving the driver to drivers/media/dvb/, but checkpatch.pl seems now to be fairly happy about the driver's state:
8<------
$ scripts/checkpatch.pl -f drivers/staging/media/as102/*.[ch] WARNING: line over 80 characters #137: FILE: staging/media/as102/as102_drv.c:137: + dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n",
total: 0 errors, 1 warnings, 319 lines checked
drivers/staging/media/as102/as102_drv.c has style problems, please review.
If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 106 lines checked
drivers/staging/media/as102/as102_drv.h has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 599 lines checked
drivers/staging/media/as102/as102_fe.c has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 241 lines checked
drivers/staging/media/as102/as102_fw.c has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 38 lines checked
drivers/staging/media/as102/as102_fw.h has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 476 lines checked
drivers/staging/media/as102/as102_usb_drv.c has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 58 lines checked
drivers/staging/media/as102/as102_usb_drv.h has no obvious style problems and is ready for submission.
WARNING: line over 80 characters
#349: FILE: staging/media/as102/as10x_cmd.c:349:
+ le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count);
WARNING: line over 80 characters
#351: FILE: staging/media/as102/as10x_cmd.c:351:
+ le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs);
total: 0 errors, 2 warnings, 453 lines checked
drivers/staging/media/as102/as10x_cmd.c has style problems, please review.
If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 215 lines checked
drivers/staging/media/as102/as10x_cmd_cfg.c has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 529 lines checked
drivers/staging/media/as102/as10x_cmd.h has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 223 lines checked
drivers/staging/media/as102/as10x_cmd_stream.c has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 54 lines checked
drivers/staging/media/as102/as10x_handle.h has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 194 lines checked
drivers/staging/media/as102/as10x_types.h has no obvious style problems and is ready for submission. ---->8
Thanks to Piotr Chmura for initially reviewing the series.
The patches can be pulled from:git://gitorious.org/linux-media/media_tree.git staging_media_as102_cleanup
The driver has been tested with PCTV picoStick (74e) DVB-T tuner.
The only issue I observed is at first run MeTV displays "Failed to lock channel" error instead of playing the last selected channel immediately.
I'm rather not planning to be doing much more work on this driver.
--
Thanks,
Sylwester
Piotr Chmura (1):
staging: as102: Remove comment tags for editors configuration
Sylwester Nawrocki (12):
staging: as102: Remove unnecessary typedefs
staging: as102: Remove leftovers of the SPI bus driver
staging: as102: Make the driver select CONFIG_FW_LOADER
staging: as102: Replace pragma(pack) with attribute __packed
staging: as102: Fix the dvb device registration error path
staging: as102: Whitespace and indentation cleanup
staging: as102: Replace printk(KERN_<LEVEL> witk pr_<level>
staging: as102: Remove linkage specifiers for C++
staging: as102: Use linux/uaccess.h instead of asm/uaccess.h
staging: as102: Move variable declarations to the header
staging: as102: Define device name string pointers constant
staging: as102: Eliminate as10x_handle_t alias
drivers/staging/media/as102/Kconfig | 1 + drivers/staging/media/as102/Makefile | 2 +- drivers/staging/media/as102/as102_drv.c | 126 ++--- drivers/staging/media/as102/as102_drv.h | 59 +-- drivers/staging/media/as102/as102_fe.c | 4 - drivers/staging/media/as102/as102_fw.c | 44 +- drivers/staging/media/as102/as102_fw.h | 10 +- drivers/staging/media/as102/as102_usb_drv.c | 34 +- drivers/staging/media/as102/as102_usb_drv.h | 1 - drivers/staging/media/as102/as10x_cmd.c | 139 ++-- drivers/staging/media/as102/as10x_cmd.h | 895 ++++++++++++------------ drivers/staging/media/as102/as10x_cmd_cfg.c | 66 +- drivers/staging/media/as102/as10x_cmd_stream.c | 56 +- drivers/staging/media/as102/as10x_handle.h | 26 +- drivers/staging/media/as102/as10x_types.h | 250 ++++---- 15 files changed, 804 insertions(+), 909 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/13 staging: as102: Remove comment tags for editors configuration
From: Piotr Chmura <[email protected]>
--- drivers/staging/media/as102/as102_drv.c | 2 -- drivers/staging/media/as102/as102_drv.h | 2 -- drivers/staging/media/as102/as102_fe.c | 2 -- drivers/staging/media/as102/as102_fw.c | 2 -- drivers/staging/media/as102/as102_fw.h | 2 -- drivers/staging/media/as102/as102_usb_drv.c | 2 -- drivers/staging/media/as102/as102_usb_drv.h | 1 - drivers/staging/media/as102/as10x_cmd.h | 1 - 8 files changed, 0 insertions(+), 14 deletions(-)
drivers/staging/media/as102/as102_drv.c +0 -2
@@ -347,5 +347,3 @@ module_exit(as102_driver_exit);MODULE_DESCRIPTION (DRIVER_FULL_NAME );MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Pierrick Hascoet <[email protected]>" ); - -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */
drivers/staging/media/as102/as102_drv.h +0 -2
@@ -137,5 +137,3 @@ void as102_dvb_unregister(struct as102_dev_t *dev);int as102_dvb_register_fe (struct as102_dev_t *dev,struct dvb_frontend *fe);int as102_dvb_unregister_fe (struct dvb_frontend *dev); - -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */
drivers/staging/media/as102/as102_fe.c +0 -2
@@ -599,5 +599,3 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,as102_fe_get_code_rate (params->u.ofdm.code_rate_HP); } } - -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */
drivers/staging/media/as102/as102_fw.c +0 -2
@@ -247,5 +247,3 @@ error: return errno; }#endif - -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */
drivers/staging/media/as102/as102_fw.h +0 -2
@@ -38,5 +38,3 @@ struct as10x_fw_pkt_t {#ifdef __KERNEL__int as102_fw_upload (struct as102_bus_adapter_t *bus_adap);#endif - -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */
drivers/staging/media/as102/as102_usb_drv.c +0 -2
@@ -474,5 +474,3 @@ static int as102_release(struct inode *inode, struct file *file) }MODULE_DEVICE_TABLE (usb, as102_usb_id_table); - -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */
drivers/staging/media/as102/as102_usb_drv.h +0 -1
@@ -56,4 +56,3 @@ struct as10x_usb_token_cmd_t { struct as10x_cmd_t r; };#endif -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */
drivers/staging/media/as102/as10x_cmd.h +0 -1
@@ -537,4 +537,3 @@ int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id); }#endif #endif -/* EOF - vim: set textwidth=80 ts=3 sw=3 sts=3 et: */
Signature · 1 line
1.7.5.4
PATCH 2/13 staging: as102: Remove unnecessary typedefs
In reply to Sylwester NawrockiAccording to the kernel coding rules typedefs should be avoided, so replace theit occurances with explicit enum/union types.
--- drivers/staging/media/as102/as10x_cmd.h | 127 +++++++++++++++---------------- 1 files changed, 63 insertions(+), 64 deletions(-)
drivers/staging/media/as102/as10x_cmd.h +63 -64
@@ -52,7 +52,7 @@/*********************************/ /* TYPE DEFINITION */ /*********************************/ -typedef enum { +enum control_proc {CONTROL_PROC_TURNON =0x0001 ,CONTROL_PROC_TURNON_RSP =0x0100 ,CONTROL_PROC_SET_REGISTER =0x0002 ,
@@ -92,11 +92,11 @@ typedef enum { CONTROL_PROC_DUMPLOG_MEMORY_RSP = 0xFE00, CONTROL_PROC_TURNOFF = 0x00FF,CONTROL_PROC_TURNOFF_RSP =0xFF00 -} control_proc; +};#pragma pack(1) -typedef union { +union as10x_turn_on {/* request */ struct {/* request identifier */
@@ -109,9 +109,9 @@ typedef union {/* error */ uint8_t error; } rsp; -}TURN_ON ; +}; -typedef union { +union as10x_turn_off {/* request */ struct {/* request identifier */
@@ -124,9 +124,9 @@ typedef union {/* error */ uint8_t err; } rsp; -}TURN_OFF ; +}; -typedef union { +union as10x_set_tune {/* request */ struct {/* request identifier */
@@ -141,9 +141,9 @@ typedef union {/* response error */ uint8_t error; } rsp; -}SET_TUNE ; +}; -typedef union { +union as10x_get_tune_status {/* request */ struct {/* request identifier */
@@ -158,9 +158,9 @@ typedef union {/* tune status */ struct as10x_tune_status sts; } rsp; -}GET_TUNE_STATUS ; +}; -typedef union { +union as10x_get_tps {/* request */ struct {/* request identifier */
@@ -175,9 +175,9 @@ typedef union {/* tps details */ struct as10x_tps tps; } rsp; -}GET_TPS ; +}; -typedef union { +union as10x_common {/* request */ struct {/* request identifier */
@@ -190,9 +190,9 @@ typedef union {/* response error */ uint8_t error; } rsp; -}COMMON ; +}; -typedef union { +union as10x_add_pid_filter {/* request */ struct {/* request identifier */
@@ -213,9 +213,9 @@ typedef union {/* Filter id */ uint8_t filter_id; } rsp; -}ADD_PID_FILTER ; +}; -typedef union { +union as10x_del_pid_filter {/* request */ struct {/* request identifier */
@@ -230,9 +230,9 @@ typedef union {/* response error */ uint8_t error; } rsp; -}DEL_PID_FILTER ; +}; -typedef union { +union as10x_start_streaming {/* request */ struct {/* request identifier */
@@ -245,9 +245,9 @@ typedef union {/* error */ uint8_t error; } rsp; -}START_STREAMING ; +}; -typedef union { +union as10x_stop_streaming {/* request */ struct {/* request identifier */
@@ -260,9 +260,9 @@ typedef union {/* error */ uint8_t error; } rsp; -}STOP_STREAMING ; +}; -typedef union { +union as10x_get_demod_stats {/* request */ struct {/* request identifier */
@@ -277,9 +277,9 @@ typedef union {/* demod stats */ struct as10x_demod_stats stats; } rsp; -}GET_DEMOD_STATS ; +}; -typedef union { +union as10x_get_impulse_resp {/* request */ struct {/* request identifier */
@@ -294,9 +294,9 @@ typedef union {/* impulse response ready */ uint8_t is_ready; } rsp; -}GET_IMPULSE_RESP ; +}; -typedef union { +union as10x_fw_context {/* request */ struct {/* request identifier */
@@ -319,9 +319,9 @@ typedef union {/* error */ uint8_t error; } rsp; -}FW_CONTEXT ; +}; -typedef union { +union as10x_set_register {/* request */ struct {/* response identifier */
@@ -338,9 +338,9 @@ typedef union {/* error */ uint8_t error; } rsp; -}SET_REGISTER ; +}; -typedef union { +union as10x_get_register {/* request */ struct {/* response identifier */
@@ -357,9 +357,9 @@ typedef union {/* register content */ struct as10x_register_value reg_val; } rsp; -}GET_REGISTER ; +}; -typedef union { +union as10x_cfg_change_mode {/* request */ struct {/* request identifier */
@@ -374,7 +374,7 @@ typedef union {/* error */ uint8_t error; } rsp; -}CFG_CHANGE_MODE ; +};struct as10x_cmd_header_t {uint16_t req_id;
@@ -384,7 +384,8 @@ struct as10x_cmd_header_t { };#define DUMP_BLOCK_SIZE 16 -typedef union { + +union as10x_dump_memory {/* request */ struct {/* request identifier */
@@ -411,9 +412,9 @@ typedef union {uint32_t data32[DUMP_BLOCK_SIZE /sizeof (uint32_t )]; } u; } rsp; -}DUMP_MEMORY ; +}; -typedef union { +union as10x_dumplog_memory {struct {/* request identifier */ uint16_t proc_id;
@@ -430,9 +431,9 @@ typedef union {/* dump data */ uint8_t data[DUMP_BLOCK_SIZE ]; } rsp; -}DUMPLOG_MEMORY ; +}; -typedef union { +union as10x_raw_data {/* request */ struct {uint16_t proc_id;
@@ -445,33 +446,31 @@ typedef union {uint8_t data[64 -sizeof (struct as10x_cmd_header_t )/* header */ -2 /* proc_id */ -1 /* rc */ ]; } rsp; -}RAW_DATA ; +};struct as10x_cmd_t { -/* header */ -struct as10x_cmd_header_t header; -/* body */ -union { -TURN_ON turn_on; -TURN_OFF turn_off; -SET_TUNE set_tune; -GET_TUNE_STATUS get_tune_status; -GET_TPS get_tps; -COMMON common; -ADD_PID_FILTER add_pid_filter; -DEL_PID_FILTER del_pid_filter; -START_STREAMING start_streaming; -STOP_STREAMING stop_streaming; -GET_DEMOD_STATS get_demod_stats; -GET_IMPULSE_RESP get_impulse_rsp; -FW_CONTEXT context; -SET_REGISTER set_register; -GET_REGISTER get_register; -CFG_CHANGE_MODE cfg_change_mode; -DUMP_MEMORY dump_memory; -DUMPLOG_MEMORY dumplog_memory; -RAW_DATA raw_data; - } body; +struct as10x_cmd_header_t header; +union { +union as10x_turn_on turn_on; +union as10x_turn_off turn_off; +union as10x_set_tune set_tune; +union as10x_get_tune_status get_tune_status; +union as10x_get_tps get_tps; +union as10x_common common; +union as10x_add_pid_filter add_pid_filter; +union as10x_del_pid_filter del_pid_filter; +union as10x_start_streaming start_streaming; +union as10x_stop_streaming stop_streaming; +union as10x_get_demod_stats get_demod_stats; +union as10x_get_impulse_resp get_impulse_rsp; +union as10x_fw_context context; +union as10x_set_register set_register; +union as10x_get_register get_register; +union as10x_cfg_change_mode cfg_change_mode; +union as10x_dump_memory dump_memory; +union as10x_dumplog_memory dumplog_memory; +union as10x_raw_data raw_data; + } body; };struct as10x_token_cmd_t {
Signature · 1 line
1.7.5.4
PATCH 3/13 staging: as102: Remove leftovers of the SPI bus driver
In reply to Sylwester NawrockiSPI bus driver support is not included in this module, the SPI driver files are missing. But some bits are still present so clean up the unused code.
The SPI driver support can be properly added later if needed.
Then CONFIG_AS102_SPI and CONFIG_AS102_USB is now not needed and the pre-processor statements using these config options can now be removed from *.c files.
--- drivers/staging/media/as102/Makefile | 2 +- drivers/staging/media/as102/as102_drv.c | 33 ++-------------------- drivers/staging/media/as102/as102_drv.h | 46 ++++--------------------------- drivers/staging/media/as102/as102_fw.c | 7 +---- 4 files changed, 11 insertions(+), 77 deletions(-)
drivers/staging/media/as102/Makefile +1 -1
@@ -3,4 +3,4 @@ dvb-as102-objs := as102_drv.o as102_fw.o as10x_cmd.o as10x_cmd_stream.o \ obj-$(CONFIG_DVB_AS102) += dvb-as102.o -EXTRA_CFLAGS += -DCONFIG_AS102_USB -Idrivers/media/dvb/dvb-core +EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
drivers/staging/media/as102/as102_drv.c +3 -30
@@ -56,9 +56,7 @@ int elna_enable = 1;module_param_named (elna_enable, elna_enable, int,0644 );MODULE_PARM_DESC (elna_enable,"Activate eLNA (default: on)" ); -#ifdef DVB_DEFINE_MOD_OPT_ADAPTER_NR DVB_DEFINE_MOD_OPT_ADAPTER_NR (adapter_nr); -#endif static void as102_stop_stream (struct as102_dev_t *dev) {
@@ -203,16 +201,8 @@ int as102_dvb_register(struct as102_dev_t *as102_dev) ret =dvb_register_adapter (&as102_dev->dvb_adap, as102_dev->name,THIS_MODULE , -#if defined(CONFIG_AS102_USB) - &as102_dev->bus_adap.usb_dev->dev -#elif defined(CONFIG_AS102_SPI) - &as102_dev->bus_adap.spi_dev->dev -#else -#error >>> dvb_register_adapter <<< -#endif -#ifdef DVB_DEFINE_MOD_OPT_ADAPTER_NR - , adapter_nr -#endif + &as102_dev->bus_adap.usb_dev->dev, + adapter_nr );if (ret <0 ) { err("%s: dvb_register_adapter() failed (errno = %d)",
@@ -294,23 +284,13 @@ void as102_dvb_unregister(struct as102_dev_t *as102_dev)static int __init as102_driver_init (void ) { -int ret =0 ; - -ENTER (); +int ret;/* register this driver with the low level subsystem */ -#if defined(CONFIG_AS102_USB ) ret =usb_register (&as102_usb_driver);if (ret)err ("usb_register failed (ret = %d)" , ret); -#endif -#if defined(CONFIG_AS102_SPI ) - ret =spi_register_driver (&as102_spi_driver); -if (ret) -printk (KERN_ERR "spi_register failed (ret = %d)" , ret); -#endif -LEAVE ();return ret; }
@@ -327,15 +307,8 @@ module_init(as102_driver_init);*/ static void __exit as102_driver_exit(void) { -ENTER ();/* deregister this driver with the low level bus subsystem */ -#if defined(CONFIG_AS102_USB )usb_deregister (&as102_usb_driver); -#endif -#if defined(CONFIG_AS102_SPI ) -spi_unregister_driver (&as102_spi_driver); -#endif -LEAVE (); }/*
drivers/staging/media/as102/as102_drv.h +6 -40
72 lines not on this page · raw message
drivers/staging/media/as102/as102_fw.c +1 -6
@@ -169,13 +169,8 @@ int as102_fw_upload(struct as102_bus_adapter_t *bus_adap)const struct firmware *firmware;unsigned char *cmd_buf =NULL ;char *fw1, *fw2; - -#if defined(CONFIG_AS102_USB )struct usb_device *dev = bus_adap->usb_dev; -#endif -#if defined(CONFIG_AS102_SPI ) -struct spi_device *dev = bus_adap->spi_dev; -#endif +ENTER ();/* select fw file to upload */
Signature · 1 line
1.7.5.4
PATCH 4/13 staging: as102: Make the driver select CONFIG_FW_LOADER
In reply to Sylwester NawrockiIt doesn't seem to be of much advantage to compile in FW_LOADER support conditionally, then make the driver always select FW_LOADER and remove #idefs from the code.
--- drivers/staging/media/as102/Kconfig | 1 + drivers/staging/media/as102/as102_drv.c | 3 --- drivers/staging/media/as102/as102_fw.c | 5 +---- 3 files changed, 2 insertions(+), 7 deletions(-)
drivers/staging/media/as102/Kconfig +1 -0
@@ -1,6 +1,7 @@ config DVB_AS102 tristate "Abilis AS102 DVB receiver" depends on DVB_CORE && USB && I2C && INPUT + select FW_LOADER help Choose Y or M here if you have a device containing an AS102
drivers/staging/media/as102/as102_drv.c +0 -3
@@ -249,7 +249,6 @@ int as102_dvb_register(struct as102_dev_t *as102_dev)/* init start / stop stream mutex */ mutex_init (&as102_dev->sem); -#if defined(CONFIG_FW_LOADER ) || defined(CONFIG_FW_LOADER_MODULE )/* * try to load as102 firmware. If firmware upload failed, we'll be * able to upload it later.
@@ -257,8 +256,6 @@ int as102_dvb_register(struct as102_dev_t *as102_dev)if (fw_upload)try_then_request_module (as102_fw_upload (&as102_dev->bus_adap),"firmware_class" ); -#endif - failed:LEAVE ();/* FIXME: free dvb_XXX */
drivers/staging/media/as102/as102_fw.c +1 -4
@@ -26,7 +26,6 @@#include "as102_drv.h" #include "as102_fw.h" -#if defined(CONFIG_FW_LOADER ) || defined(CONFIG_FW_LOADER_MODULE )char as102_st_fw1[] ="as102_data1_st.hex" ;char as102_st_fw2[] ="as102_data2_st.hex" ;char as102_dt_fw1[] ="as102_data1_dt.hex" ;
@@ -182,7 +181,6 @@ int as102_fw_upload(struct as102_bus_adapter_t *bus_adap) fw2 = as102_st_fw2; } -#if defined(CONFIG_FW_LOADER ) || defined(CONFIG_FW_LOADER_MODULE )/* allocate buffer to store firmware upload command and data */ cmd_buf =kzalloc (MAX_FW_PKT_SIZE ,GFP_KERNEL );if (cmd_buf ==NULL ) {
@@ -237,8 +235,7 @@ error:/* release firmware if needed */ if (firmware !=NULL )release_firmware (firmware); -#endif +LEAVE ();return errno; } -#endif
Signature · 1 line
1.7.5.4
PATCH 5/13 staging: as102: Replace pragma(pack) with attribute __packed
In reply to Sylwester Nawrocki--- drivers/staging/media/as102/as102_fw.h | 6 +-- drivers/staging/media/as102/as10x_cmd.h | 47 +++++++++++++--------------- drivers/staging/media/as102/as10x_types.h | 15 ++++----- 3 files changed, 30 insertions(+), 38 deletions(-)
drivers/staging/media/as102/as102_fw.h +2 -4
@@ -20,11 +20,10 @@extern int dual_tuner; -#pragma pack(1)struct as10x_raw_fw_pkt {unsigned char address[4 ];unsigned char data[MAX_FW_PKT_SIZE -6 ]; -}; +} __packed; struct as10x_fw_pkt_t { union {
@@ -32,8 +31,7 @@ struct as10x_fw_pkt_t {unsigned char length[2 ]; } u;struct as10x_raw_fw_pkt raw; -}; -#pragma pack() +} __packed;#ifdef __KERNEL__int as102_fw_upload (struct as102_bus_adapter_t *bus_adap);
drivers/staging/media/as102/as10x_cmd.h +22 -25
185 lines not on this page · raw message
drivers/staging/media/as102/as10x_types.h +6 -9
@@ -111,7 +111,6 @@#define CFG_MODE_OFF 1#define CFG_MODE_AUTO 2 -#pragma pack(1)struct as10x_tps {uint8_t constellation;uint8_t hierarchy;
@@ -123,7 +122,7 @@ struct as10x_tps {uint8_t DVBH_mask_HP;uint8_t DVBH_mask_LP;uint16_t cell_ID; -}; +} __packed;struct as10x_tune_args {/* frequency */
@@ -144,7 +143,7 @@ struct as10x_tune_args {uint8_t guard_interval;/* transmission mode */ uint8_t transmission_mode; -}; +} __packed;struct as10x_tune_status {/* tune status */
@@ -155,7 +154,7 @@ struct as10x_tune_status {uint16_t PER ;/* bit error rate 10^-4 */ uint16_t BER ; -}; +} __packed;struct as10x_demod_stats {/* frame counter */
@@ -168,13 +167,13 @@ struct as10x_demod_stats {uint16_t mer;/* statistics calculation state indicator (started or not) */ uint8_t has_started; -}; +} __packed;struct as10x_ts_filter {uint16_t pid;/** valid PID value 0x00 : 0x2000 */ uint8_t type;/** Red TS_PID_TYPE_<N> values */ uint8_t idx;/** index in filtering table */ -}; +} __packed;struct as10x_register_value {uint8_t mode;
@@ -183,9 +182,7 @@ struct as10x_register_value {uint16_t value16;/* 16 bit value */ uint32_t value32;/* 32 bit value */ }u; -}; - -#pragma pack() +} __packed;struct as10x_register_addr {/* register addr */
Signature · 1 line
1.7.5.4
PATCH 6/13 staging: as102: Fix the dvb device registration error path
In reply to Sylwester NawrockiRelease already acquired resources when error happens during devices registration steps.
Use dev_err() where struct device is available, instead of driver specific err().
--- drivers/staging/media/as102/as102_drv.c | 48 ++++++++++++++++--------------- 1 files changed, 25 insertions(+), 23 deletions(-)
drivers/staging/media/as102/as102_drv.c +25 -23
@@ -195,19 +195,16 @@ static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed)int as102_dvb_register (struct as102_dev_t *as102_dev) { -int ret =0 ; -ENTER (); +struct device *dev = &as102_dev->bus_adap.usb_dev->dev; +int ret; ret =dvb_register_adapter (&as102_dev->dvb_adap, - as102_dev->name, -THIS_MODULE , - &as102_dev->bus_adap.usb_dev->dev, - adapter_nr - ); + as102_dev->name,THIS_MODULE , + dev, adapter_nr);if (ret <0 ) { -err ("%s: dvb_register_adapter() failed (errno = %d)" , - __func__, ret); - goto failed; +dev_err (dev,"%s: dvb_register_adapter() failed: %d\n" , + __func__, ret); +return ret; } as102_dev->dvb_dmx.priv = as102_dev;
@@ -225,22 +222,22 @@ int as102_dvb_register(struct as102_dev_t *as102_dev) ret =dvb_dmx_init (&as102_dev->dvb_dmx);if (ret <0 ) { -err ("%s: dvb_dmx_init() failed (errno = %d)" , __func__, ret); - goto failed; +dev_err ("%s: dvb_dmx_init() failed: %d\n" , __func__, ret); + goto edmxinit; } ret =dvb_dmxdev_init (&as102_dev->dvb_dmxdev, &as102_dev->dvb_adap);if (ret <0 ) { -err ("%s: dvb_dmxdev_init() failed (errno = %d)" , __func__, - ret); - goto failed; +dev_err (dev,"%s: dvb_dmxdev_init() failed: %d\n" , + __func__, ret); + goto edmxdinit; } ret =as102_dvb_register_fe (as102_dev, &as102_dev->dvb_fe);if (ret <0 ) { -err ("%s: as102_dvb_register_frontend() failed (errno = %d)" , +dev_err (dev,"%s: as102_dvb_register_frontend() failed: %d" , __func__, ret); - goto failed; + goto efereg; }/* init bus mutex for token locking */
@@ -256,16 +253,21 @@ int as102_dvb_register(struct as102_dev_t *as102_dev)if (fw_upload)try_then_request_module (as102_fw_upload (&as102_dev->bus_adap),"firmware_class" ); -failed: -LEAVE (); -/* FIXME: free dvb_XXX */ + +pr_info ("Registered device %s" , as102_dev->name); +return 0 ; + +efereg: +dvb_dmxdev_release (&as102_dev->dvb_dmxdev); +edmxdinit: +dvb_dmx_release (&as102_dev->dvb_dmx); +edmxinit: +dvb_unregister_adapter (&as102_dev->dvb_adap);return ret; }void as102_dvb_unregister (struct as102_dev_t *as102_dev) { -ENTER (); -/* unregister as102 frontend */ as102_dvb_unregister_fe (&as102_dev->dvb_fe);
@@ -276,7 +278,7 @@ void as102_dvb_unregister(struct as102_dev_t *as102_dev)/* unregister dvb adapter */ dvb_unregister_adapter (&as102_dev->dvb_adap); -LEAVE (); +pr_info ("Unregistered device %s" , as102_dev->name); }static int __init as102_driver_init (void )
Signature · 1 line
1.7.5.4
PATCH 7/13 staging: as102: Whitespace and indentation cleanup
In reply to Sylwester NawrockiRemove some unnecessary braces. Replace spaces with tabs where expected. Replace gcc specific __FUNCTION__ with C99 __func__. No functional changes.
--- drivers/staging/media/as102/as102_drv.c | 38 +- drivers/staging/media/as102/as102_drv.h | 6 +- drivers/staging/media/as102/as102_usb_drv.c | 14 +- drivers/staging/media/as102/as10x_cmd.c | 2 +- drivers/staging/media/as102/as10x_cmd.h | 687 ++++++++++++++------------- drivers/staging/media/as102/as10x_handle.h | 6 +- drivers/staging/media/as102/as10x_types.h | 235 +++++----- 7 files changed, 493 insertions(+), 495 deletions(-)
drivers/staging/media/as102/as102_drv.c +18 -20
@@ -121,22 +121,22 @@ static int as10x_pid_filter(struct as102_dev_t *dev,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 ; + 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; +struct as10x_ts_filter filter; - filter.type =TS_PID_TYPE_TS ; - filter.idx =0xFF ; - filter.pid = pid; + 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 ; + 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 ; } }
@@ -157,10 +157,9 @@ static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed)if (mutex_lock_interruptible (&as102_dev->sem))return -ERESTARTSYS ; -if (pid_filtering) { -as10x_pid_filter (as102_dev, - dvbdmxfeed->index, dvbdmxfeed->pid,1 ); - } +if (pid_filtering) +as10x_pid_filter (as102_dev, dvbdmxfeed->index, + dvbdmxfeed->pid,1 );if (as102_dev->streaming++ ==0 ) ret =as102_start_stream (as102_dev);
@@ -183,10 +182,9 @@ static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed)if (--as102_dev->streaming ==0 )as102_stop_stream (as102_dev); -if (pid_filtering) { -as10x_pid_filter (as102_dev, - dvbdmxfeed->index, dvbdmxfeed->pid,0 ); - } +if (pid_filtering) +as10x_pid_filter (as102_dev, dvbdmxfeed->index, + dvbdmxfeed->pid,0 );mutex_unlock (&as102_dev->sem);LEAVE ();
drivers/staging/media/as102/as102_drv.h +3 -3
@@ -32,13 +32,13 @@ extern struct usb_driver as102_usb_driver; #define dprintk(debug, args...) \ do { if (debug) { \ - printk(KERN_DEBUG "%s: ",__FUNCTION__); \ + pr_debug("%s: ", __func__); \ printk(args); \ } } while (0)#ifdef TRACE -#define ENTER () printk(">> enter %s\n", __FUNCTION__) -#define LEAVE () printk("<< leave %s\n", __FUNCTION__) +#define ENTER () pr_debug(">> enter %s\n", __func__) +#define LEAVE () pr_debug("<< leave %s\n", __func__)#else #define ENTER ()#define LEAVE ()
drivers/staging/media/as102/as102_usb_drv.c +7 -7
@@ -56,16 +56,16 @@ static const char *as102_device_names[] = { };struct usb_driver as102_usb_driver = { - .name =DRIVER_FULL_NAME , - .probe = as102_usb_probe, - .disconnect = as102_usb_disconnect, - .id_table = as102_usb_id_table + .name =DRIVER_FULL_NAME , + .probe = as102_usb_probe, + .disconnect = as102_usb_disconnect, + .id_table = as102_usb_id_table };static const struct file_operations as102_dev_fops = { - .owner =THIS_MODULE , - .open = as102_open, - .release = as102_release, + .owner =THIS_MODULE , + .open = as102_open, + .release = as102_release, };static struct usb_class_driver as102_usb_class_driver = {
drivers/staging/media/as102/as10x_cmd.c +1 -1
@@ -232,7 +232,7 @@ out: }/** -* send get TPS command to AS10x +* as10x_cmd_get_tps - send get TPS command to AS10x * @phandle: pointer to AS10x handle * @ptps: pointer to TPS parameters structure *
drivers/staging/media/as102/as10x_cmd.h +344 -343
776 lines not on this page · raw message
drivers/staging/media/as102/as10x_handle.h +3 -3
@@ -24,9 +24,9 @@ struct as102_dev_t;#include "as10x_cmd.h" /* values for "mode" field */ -#define REGMODE8 8 -#define REGMODE16 16 -#define REGMODE32 32 +#define REGMODE8 8 +#define REGMODE16 16 +#define REGMODE32 32struct as102_priv_ops_t { int (*upload_fw_pkt) (struct as102_bus_adapter_t *bus_adap,
drivers/staging/media/as102/as10x_types.h +117 -118
287 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 8/13 staging: as102: Replace printk(KERN_<LEVEL> witk pr_<level>
In reply to Sylwester NawrockiWhile at it also correct some spelling errors.
--- drivers/staging/media/as102/as102_fw.c | 26 +++++++++++++------------- drivers/staging/media/as102/as102_usb_drv.c | 10 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/staging/media/as102/as102_fw.c +13 -13
@@ -58,7 +58,7 @@ static int parse_hex_line(unsigned char *fw_data, unsigned char *addr,unsigned char *src, dst;if (*fw_data++ !=':' ) { -printk (KERN_ERR "invalid firmware file\n" ); +pr_err ("invalid firmware file\n" );return -EFAULT ; }
@@ -191,21 +191,21 @@ int as102_fw_upload(struct as102_bus_adapter_t *bus_adap)/* request kernel to locate firmware file: part1 */ errno =request_firmware (&firmware, fw1, &dev->dev);if (errno <0 ) { -printk (KERN_ERR "%s: unable to locate firmware file: %s\n" , -DRIVER_NAME , fw1); +pr_err ("%s: unable to locate firmware file: %s\n" , +DRIVER_NAME , fw1); goto error; }/* initiate firmware upload */ errno =as102_firmware_upload (bus_adap, cmd_buf, firmware);if (errno <0 ) { -printk (KERN_ERR "%s: error during firmware upload part1\n" , -DRIVER_NAME ); +pr_err ("%s: error during firmware upload part1\n" , +DRIVER_NAME ); goto error; } -printk (KERN_INFO "%s: fimrware: %s loaded with success\n" , -DRIVER_NAME , fw1); +pr_info ("%s: firmware: %s loaded with success\n" , +DRIVER_NAME , fw1);release_firmware (firmware);/* wait for boot to complete */
@@ -214,21 +214,21 @@ int as102_fw_upload(struct as102_bus_adapter_t *bus_adap)/* request kernel to locate firmware file: part2 */ errno =request_firmware (&firmware, fw2, &dev->dev);if (errno <0 ) { -printk (KERN_ERR "%s: unable to locate firmware file: %s\n" , -DRIVER_NAME , fw2); +pr_err ("%s: unable to locate firmware file: %s\n" , +DRIVER_NAME , fw2); goto error; }/* initiate firmware upload */ errno =as102_firmware_upload (bus_adap, cmd_buf, firmware);if (errno <0 ) { -printk (KERN_ERR "%s: error during firmware upload part2\n" , -DRIVER_NAME ); +pr_err ("%s: error during firmware upload part2\n" , +DRIVER_NAME ); goto error; } -printk (KERN_INFO "%s: fimrware: %s loaded with success\n" , -DRIVER_NAME , fw2); +pr_info ("%s: firmware: %s loaded with success\n" , +DRIVER_NAME , fw2); error:/* free data buffer */ kfree (cmd_buf);
drivers/staging/media/as102/as102_usb_drv.c +5 -5
@@ -337,7 +337,7 @@ static void as102_usb_disconnect(struct usb_interface *intf)/* decrement usage counter */ kref_put (&as102_dev->kref, as102_usb_release); -printk (KERN_INFO "%s: device has been disconnected\n" ,DRIVER_NAME ); +pr_info ("%s: device has been disconnected\n" ,DRIVER_NAME );LEAVE (); }
@@ -360,7 +360,7 @@ static int as102_usb_probe(struct usb_interface *intf,/* 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" ); +pr_err ("Device names table invalid size" );return -EINVAL ; }
@@ -399,7 +399,7 @@ static int as102_usb_probe(struct usb_interface *intf, goto failed; } -printk (KERN_INFO "%s: device has been detected\n" ,DRIVER_NAME ); +pr_info ("%s: device has been detected\n" ,DRIVER_NAME );/* request buffer allocation for streaming */ ret =as102_alloc_usb_stream_buffer (as102_dev);
@@ -432,8 +432,8 @@ static int as102_open(struct inode *inode, struct file *file)/* fetch device from usb interface */ intf =usb_find_interface (&as102_usb_driver, minor);if (intf ==NULL ) { -printk (KERN_ERR "%s: can't find device for minor %d\n" , - __func__, minor); +pr_err ("%s: can't find device for minor %d\n" , + __func__, minor); ret = -ENODEV ; goto exit; }
Signature · 1 line
1.7.5.4
PATCH 9/13 staging: as102: Remove linkage specifiers for C++
In reply to Sylwester NawrockiThe as10x_cmd.h header is not public so there should be no need for an "extern "C"" in it.
--- drivers/staging/media/as102/as10x_cmd.h | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
drivers/staging/media/as102/as10x_cmd.h +0 -7
@@ -488,10 +488,6 @@ void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id, uint16_t cmd_len);int as10x_rsp_parse (struct as10x_cmd_t *r,uint16_t proc_id); -#ifdef __cplusplus -extern "C" { -#endif -/* as10x cmd */ int as10x_cmd_turn_on (as10x_handle_t *phandle);int as10x_cmd_turn_off (as10x_handle_t *phandle);
@@ -530,7 +526,4 @@ int as10x_cmd_get_context(as10x_handle_t *phandle,int as10x_cmd_eLNA_change_mode (as10x_handle_t *phandle,uint8_t mode);int as10x_context_rsp_parse (struct as10x_cmd_t *prsp,uint16_t proc_id); -#ifdef __cplusplus -} -#endif #endif
Signature · 1 line
1.7.5.4
PATCH 10/13 staging: as102: Use linux/uaccess.h instead of asm/uaccess.h
In reply to Sylwester Nawrocki--- drivers/staging/media/as102/as102_drv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/media/as102/as102_drv.c +1 -1
@@ -24,7 +24,7 @@#include <linux/module.h> #include <linux/mm.h> #include <linux/kref.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/usb.h> /* header file for Usb device driver*/
Signature · 1 line
1.7.5.4
PATCH 11/13 staging: as102: Move variable declarations to the header
In reply to Sylwester NawrockiFixes following checkpatch.pl warning:
WARNING: externs should be avoided in .c files
--- drivers/staging/media/as102/as102_drv.h | 1 + drivers/staging/media/as102/as102_fe.c | 2 -- 2 files changed, 1 insertions(+), 2 deletions(-)
drivers/staging/media/as102/as102_drv.h +1 -0
@@ -29,6 +29,7 @@extern int debug;extern struct usb_driver as102_usb_driver; +extern int elna_enable; #define dprintk(debug, args...) \ do { if (debug) { \
drivers/staging/media/as102/as102_fe.c +0 -2
@@ -23,8 +23,6 @@#include "as10x_types.h" #include "as10x_cmd.h" -extern int elna_enable; -static void as10x_fe_copy_tps_parameters (struct dvb_frontend_parameters *dst,struct as10x_tps *src);
Signature · 1 line
1.7.5.4
PATCH 12/13 staging: as102: Define device name string pointers constant
In reply to Sylwester NawrockiSupresses following checkpatch warning:
WARNING: static const char * array should probably be static const char * const
--- drivers/staging/media/as102/as102_usb_drv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/media/as102/as102_usb_drv.c +1 -1
@@ -47,7 +47,7 @@ static struct usb_device_id as102_usb_id_table[] = {/* 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[] = { +static const char *const as102_device_names[] = {AS102_REFERENCE_DESIGN ,AS102_PCTV_74E ,AS102_ELGATO_EYETV_DTT_NAME ,
Signature · 1 line
1.7.5.4
PATCH 13/13 staging: as102: Eliminate as10x_handle_t alias
In reply to Sylwester NawrockiRemove pre-processor defined as10x_handle_t data type by directly replacing it with struct as102_bus_adapter_t. phandle is renamed to adap inside function bodies.
---
I'm not sure about this one, maybe something less invasive is needed.
--- drivers/staging/media/as102/as102_drv.c | 6 +- drivers/staging/media/as102/as102_drv.h | 4 +- drivers/staging/media/as102/as102_fw.c | 4 +- drivers/staging/media/as102/as102_fw.h | 2 +- drivers/staging/media/as102/as102_usb_drv.c | 6 +- drivers/staging/media/as102/as10x_cmd.c | 137 ++++++++++++------------ drivers/staging/media/as102/as10x_cmd.h | 28 +++--- drivers/staging/media/as102/as10x_cmd_cfg.c | 66 ++++++------ drivers/staging/media/as102/as10x_cmd_stream.c | 56 +++++----- drivers/staging/media/as102/as10x_handle.h | 20 ++-- 10 files changed, 163 insertions(+), 166 deletions(-)
drivers/staging/media/as102/as102_drv.c +3 -3
@@ -60,7 +60,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);static void as102_stop_stream (struct as102_dev_t *dev) { -struct as102_bus_adapter_t *bus_adap; +struct as10x_bus_adapter_t *bus_adap;if (dev !=NULL ) bus_adap = &dev->bus_adap;
@@ -83,7 +83,7 @@ static void as102_stop_stream(struct as102_dev_t *dev)static int as102_start_stream (struct as102_dev_t *dev) { -struct as102_bus_adapter_t *bus_adap; +struct as10x_bus_adapter_t *bus_adap;int ret = -EFAULT ;if (dev !=NULL )
@@ -109,7 +109,7 @@ static int as102_start_stream(struct as102_dev_t *dev)static int as10x_pid_filter (struct as102_dev_t *dev,int index,u16 pid,int onoff) { -struct as102_bus_adapter_t *bus_adap = &dev->bus_adap; +struct as10x_bus_adapter_t *bus_adap = &dev->bus_adap;int ret = -EFAULT ;ENTER ();
drivers/staging/media/as102/as102_drv.h +2 -2
@@ -50,7 +50,7 @@ extern int elna_enable;#define AS102_USB_BUF_SIZE 512#define MAX_STREAM_URB 32 -struct as102_bus_adapter_t { +struct as10x_bus_adapter_t {struct usb_device *usb_dev;/* bus token lock */ struct mutex lock;
@@ -72,7 +72,7 @@ struct as102_bus_adapter_t {struct as102_dev_t {const char *name; -struct as102_bus_adapter_t bus_adap; +struct as10x_bus_adapter_t bus_adap;struct list_head device_entry;struct kref kref;unsigned long minor;
drivers/staging/media/as102/as102_fw.c +2 -2
@@ -101,7 +101,7 @@ static int parse_hex_line(unsigned char *fw_data, unsigned char *addr,return (count *2 ) +2 ; } -static int as102_firmware_upload (struct as102_bus_adapter_t *bus_adap, +static int as102_firmware_upload (struct as10x_bus_adapter_t *bus_adap,unsigned char *cmd,const struct firmware *firmware) {
@@ -162,7 +162,7 @@ error:return (errno ==0 ) ? total_read_bytes : errno; } -int as102_fw_upload (struct as102_bus_adapter_t *bus_adap) +int as102_fw_upload (struct as10x_bus_adapter_t *bus_adap) {int errno = -EFAULT ;const struct firmware *firmware;
drivers/staging/media/as102/as102_fw.h +1 -1
@@ -34,5 +34,5 @@ struct as10x_fw_pkt_t { } __packed;#ifdef __KERNEL__ -int as102_fw_upload (struct as102_bus_adapter_t *bus_adap); +int as102_fw_upload (struct as10x_bus_adapter_t *bus_adap);#endif
drivers/staging/media/as102/as102_usb_drv.c +3 -3
@@ -74,7 +74,7 @@ static struct usb_class_driver as102_usb_class_driver = { .minor_base = AS102_DEVICE_MAJOR, }; -static int as102_usb_xfer_cmd (struct as102_bus_adapter_t *bus_adap, +static int as102_usb_xfer_cmd (struct as10x_bus_adapter_t *bus_adap,unsigned char *send_buf,int send_buf_len,unsigned char *recv_buf,int recv_buf_len) {
@@ -131,7 +131,7 @@ static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap,return ret; } -static int as102_send_ep1 (struct as102_bus_adapter_t *bus_adap, +static int as102_send_ep1 (struct as10x_bus_adapter_t *bus_adap,unsigned char *send_buf,int send_buf_len,int swap32)
@@ -154,7 +154,7 @@ static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap,return ret ? ret : actual_len; } -static int as102_read_ep2 (struct as102_bus_adapter_t *bus_adap, +static int as102_read_ep2 (struct as10x_bus_adapter_t *bus_adap,unsigned char *recv_buf,int recv_buf_len) {int ret =0 , actual_len;
drivers/staging/media/as102/as10x_cmd.c +69 -68
304 lines not on this page · raw message
drivers/staging/media/as102/as10x_cmd.h +14 -14
@@ -489,41 +489,41 @@ void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id,int as10x_rsp_parse (struct as10x_cmd_t *r,uint16_t proc_id);/* as10x cmd */ -int as10x_cmd_turn_on (as10x_handle_t *phandle); -int as10x_cmd_turn_off (as10x_handle_t *phandle); +int as10x_cmd_turn_on (struct as10x_bus_adapter_t *adap); +int as10x_cmd_turn_off (struct as10x_bus_adapter_t *adap); -int as10x_cmd_set_tune (as10x_handle_t *phandle, +int as10x_cmd_set_tune (struct as10x_bus_adapter_t *adap,struct as10x_tune_args *ptune); -int as10x_cmd_get_tune_status (as10x_handle_t *phandle, +int as10x_cmd_get_tune_status (struct as10x_bus_adapter_t *adap,struct as10x_tune_status *pstatus); -int as10x_cmd_get_tps (as10x_handle_t *phandle, +int as10x_cmd_get_tps (struct as10x_bus_adapter_t *adap,struct as10x_tps *ptps); -int as10x_cmd_get_demod_stats (as10x_handle_t *phandle, +int as10x_cmd_get_demod_stats (struct as10x_bus_adapter_t *adap,struct as10x_demod_stats *pdemod_stats); -int as10x_cmd_get_impulse_resp (as10x_handle_t *phandle, +int as10x_cmd_get_impulse_resp (struct as10x_bus_adapter_t *adap,uint8_t *is_ready);/* as10x cmd stream */ -int as10x_cmd_add_PID_filter (as10x_handle_t *phandle, +int as10x_cmd_add_PID_filter (struct as10x_bus_adapter_t *adap,struct as10x_ts_filter *filter); -int as10x_cmd_del_PID_filter (as10x_handle_t *phandle, +int as10x_cmd_del_PID_filter (struct as10x_bus_adapter_t *adap,uint16_t pid_value); -int as10x_cmd_start_streaming (as10x_handle_t *phandle); -int as10x_cmd_stop_streaming (as10x_handle_t *phandle); +int as10x_cmd_start_streaming (struct as10x_bus_adapter_t *adap); +int as10x_cmd_stop_streaming (struct as10x_bus_adapter_t *adap);/* as10x cmd cfg */ -int as10x_cmd_set_context (as10x_handle_t *phandle, +int as10x_cmd_set_context (struct as10x_bus_adapter_t *adap,uint16_t tag,uint32_t value); -int as10x_cmd_get_context (as10x_handle_t *phandle, +int as10x_cmd_get_context (struct as10x_bus_adapter_t *adap,uint16_t tag,uint32_t *pvalue); -int as10x_cmd_eLNA_change_mode (as10x_handle_t *phandle,uint8_t mode); +int as10x_cmd_eLNA_change_mode (struct as10x_bus_adapter_t *adap,uint8_t mode);int as10x_context_rsp_parse (struct as10x_cmd_t *prsp,uint16_t proc_id);#endif
drivers/staging/media/as102/as10x_cmd_cfg.c +33 -33
142 lines not on this page · raw message
drivers/staging/media/as102/as10x_cmd_stream.c +28 -28
150 lines not on this page · raw message
drivers/staging/media/as102/as10x_handle.h +8 -12
@@ -17,10 +17,9 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef __KERNEL__ -struct as102_bus_adapter_t ; +struct as10x_bus_adapter_t ;struct as102_dev_t ; -#define as10x_handle_t struct as102_bus_adapter_t#include "as10x_cmd.h" /* values for "mode" field */
@@ -29,29 +28,26 @@ struct as102_dev_t;#define REGMODE32 32struct as102_priv_ops_t { -int (*upload_fw_pkt) (struct as102_bus_adapter_t *bus_adap, +int (*upload_fw_pkt) (struct as10x_bus_adapter_t *bus_adap,unsigned char *buf,int buflen,int swap32); -int (*send_cmd) (struct as102_bus_adapter_t *bus_adap, +int (*send_cmd) (struct as10x_bus_adapter_t *bus_adap,unsigned char *buf,int buflen); -int (*xfer_cmd) (struct as102_bus_adapter_t *bus_adap, +int (*xfer_cmd) (struct as10x_bus_adapter_t *bus_adap,unsigned char *send_buf,int send_buf_len,unsigned char *recv_buf,int recv_buf_len); -/* -int (*pid_filter) (struct as102_bus_adapter_t *bus_adap, -int index, u16 pid, int onoff); -*/ +int (*start_stream) (struct as102_dev_t *dev);void (*stop_stream) (struct as102_dev_t *dev); -int (*reset_target) (struct as102_bus_adapter_t *bus_adap); +int (*reset_target) (struct as10x_bus_adapter_t *bus_adap); -int (*read_write)(struct as102_bus_adapter_t *bus_adap,uint8_t mode, +int (*read_write)(struct as10x_bus_adapter_t *bus_adap,uint8_t mode,uint32_t rd_addr,uint16_t rd_len,uint32_t wr_addr,uint16_t wr_len); -int (*as102_read_ep2) (struct as102_bus_adapter_t *bus_adap, +int (*as102_read_ep2) (struct as10x_bus_adapter_t *bus_adap,unsigned char *recv_buf,int recv_buf_len); };
Signature · 1 line
1.7.5.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Gianluca,
Quoted 4 lines · Gianluca Gennari
Hi Sylwester,
I spotted a minor error in fileas102_drv.cline 233:
in a call to function "dev_err", the first "dev" parameter is missing. This produces a compilation warning.
Thanks for pointing that out, not sure how I have managed to overlook this.. I'll wait for some time and I'll probably resend the whole series, including correction of the above, at the end of this week.
Signature · 2 lines
Regards, Sylwester
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Gianluca,
Quoted 11 lines · Gianluca Gennari
Hi Sylwestwer,
I was about to test the new driver when I discovered that my as102 device is not included in the list of supported devices:/* Super Digi KEY */
#defineAS102_SUPER_DIGI_NAME"Super Digi KEY"
#defineSUPER_DIGI_USB_VID0x2137
#defineSUPER_DIGI_USB_PID0x0001It's a "Digital key" offered by Sky Italia to its customers to watch terrestrial programs with the Sky satellite decoders.
I'm not sure if your device needs some special handling, but it might work if you repeat steps as in this patch:
http://git.linuxtv.org/media_tree.git/commitdiff/5f9745b2c942b2ab220831b2c51a18c3f1374249
Have you tried it already ?
Possibly something like this is enough (only compile tested):
drivers/staging/media/as102/as102_usb_drv.c +2 -0
@@ -42,6 +42,7 @@ static struct usb_device_id as102_usb_id_table[] = { { 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) }, + { USB_DEVICE(SUPER_DIGI_USB_VID, SUPER_DIGI_USB_PID) }, { } /* Terminating entry */ };
@@ -52,6 +53,7 @@ static const char * const as102_device_names[] = {AS102_PCTV_74E ,AS102_ELGATO_EYETV_DTT_NAME ,AS102_NBOX_DVBT_DONGLE_NAME , +AS102_SUPER_DIGI_NAME , NULL /* Terminating entry */ };
drivers/staging/media/as102/as102_usb_drv.h +5 -0
@@ -47,6 +47,11 @@#define NBOX_DVBT_DONGLE_USB_VID 0x0b89#define NBOX_DVBT_DONGLE_USB_PID 0x0007 +/* Super Digi KEY */ +#define AS102_SUPER_DIGI_NAME "Super Digi KEY" +#define SUPER_DIGI_USB_VID 0x2137 +#define SUPER_DIGI_USB_PID 0x0001 +
My knowledge about this driver is rather limited, in case of any issues I guess it's best to ask Devin directly.
Signature · 2 lines
Regards, Sylwester
Quoted 2 lines · Sylwester Nawrocki
My knowledge about this driver is rather limited, in case of any issues I guess it's best to ask Devin directly.
Part of the problem here is that the as102 chip is a fully programmable part, and as a result the firmware may differ on a product-by-product basis. In fact, the engineer at Abilis told me outright that the firmware provided for the PCTV device isn't appropriate for the Elgato board, but it worked "good enough" for the user.
In other words, users are free to try the firmware prepared for PCTV against other devices, but be prepared for it to not be optimized properly for that hardware design (meaning tuning quality issues or perhaps not working at all), and if it destroys your board then don't come crying to me.
The only way to know if the same firmware is being used would be to do a USB capture, write a decoder which allows you to extract the firmware being uploaded, and compare it against the PCTV blob. And if it doesn't match, there's no real way of knowing whether the delta is significant.
Also worth noting that the only firmware we have the legal right to freely redistribute is the one needed by the PCTV device. Even if somebody extracts another firmware blob from a USB trace, there are no legal rights to redistribute it (meaning a firmware extract script written to work against the Windows driver binary would be required).
Devin
Signature · 2 lines
Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com
Em 06-11-2011 18:31, Sylwester Nawrocki escreveu:
Quoted 68 lines
Hello,
the following patch set is a further cleanup of the AS102 DVB-T receiver driver. I'm not sure if there are more issues to address before moving the driver to
drivers/media/dvb/, but checkpatch.pl seems now to be fairly happy about the driver's state:8<------
$ scripts/checkpatch.pl -f drivers/staging/media/as102/*.[ch] WARNING: line over 80 characters #137: FILE: staging/media/as102/as102_drv.c:137:(quoted diff) +1
-0+ dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n",total: 0 errors, 1 warnings, 319 lines checked
drivers/staging/media/as102/as102_drv.chas style problems, please review.If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in
MAINTAINERS.
total: 0 errors, 0 warnings, 106 lines checked
drivers/staging/media/as102/as102_drv.hhas no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 599 lines checked
drivers/staging/media/as102/as102_fe.chas no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 241 lines checked
drivers/staging/media/as102/as102_fw.chas no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 38 lines checked
drivers/staging/media/as102/as102_fw.hhas no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 476 lines checked
drivers/staging/media/as102/as102_usb_drv.chas no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 58 lines checked
drivers/staging/media/as102/as102_usb_drv.hhas no obvious style problems and is ready for submission.
WARNING: line over 80 characters
#349: FILE:staging/media/as102/as10x_cmd.c:349:(quoted diff) +1
-0+ le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count);WARNING: line over 80 characters
#351: FILE:staging/media/as102/as10x_cmd.c:351:(quoted diff) +1
-0+ le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs);total: 0 errors, 2 warnings, 453 lines checked
drivers/staging/media/as102/as10x_cmd.chas style problems, please review.If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in
MAINTAINERS.
total: 0 errors, 0 warnings, 215 lines checked
drivers/staging/media/as102/as10x_cmd_cfg.chas no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 529 lines checked
drivers/staging/media/as102/as10x_cmd.hhas no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 223 lines checked
drivers/staging/media/as102/as10x_cmd_stream.chas no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 54 lines checked
drivers/staging/media/as102/as10x_handle.hhas no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 194 lines checked
drivers/staging/media/as102/as10x_types.hhas no obvious style problems and is ready for submission. ---->8
Quoted 6 lines
Thanks to Piotr Chmura for initially reviewing the series.
The patches can be pulled from:
git://gitorious.org/linux-media/media_tree.gitstaging_media_as102_cleanupThe driver has been tested with PCTV picoStick (74e) DVB-T tuner.
I got a few warnings here, after applying the patch series:
drivers/staging/media/as102/as102_drv.c: In function ‘as102_dvb_register’:drivers/staging/media/as102/as102_drv.c:223:3: warning: passing argument 1 of ‘dev_err’ from incompatible pointer type [enabled by default] include/linux/device.h:812:12: note: expected ‘const struct device *’ but argument is of type ‘char *’ drivers/staging/media/as102/as102_drv.c:223:3: warning: too many arguments for format [-Wformat-extra-args]
please check.
Quoted 46 lines
The only issue I observed is at first run MeTV displays "Failed to lock channel" error instead of playing the last selected channel immediately.
I'm rather not planning to be doing much more work on this driver.
--
Thanks,
SylwesterPiotr Chmura (1):
staging: as102: Remove comment tags for editors configurationSylwester Nawrocki (12):
staging: as102: Remove unnecessary typedefs
staging: as102: Remove leftovers of the SPI bus driver
staging: as102: Make the driver selectCONFIG_FW_LOADER
staging: as102: Replace pragma(pack) with attribute__packed
staging: as102: Fix the dvb device registration error path
staging: as102: Whitespace and indentation cleanup
staging: as102: Replace printk(KERN_<LEVEL> witk pr_<level>
staging: as102: Remove linkage specifiers for C++
staging: as102: Uselinux/uaccess.hinstead ofasm/uaccess.h
staging: as102: Move variable declarations to the header
staging: as102: Define device name string pointers constant
staging: as102: Eliminateas10x_handle_taliasdrivers/staging/media/as102/Kconfig | 1 + drivers/staging/media/as102/Makefile | 2 +- drivers/staging/media/as102/as102_drv.c | 126 ++--- drivers/staging/media/as102/as102_drv.h | 59 +-- drivers/staging/media/as102/as102_fe.c | 4 - drivers/staging/media/as102/as102_fw.c | 44 +- drivers/staging/media/as102/as102_fw.h | 10 +- drivers/staging/media/as102/as102_usb_drv.c | 34 +- drivers/staging/media/as102/as102_usb_drv.h | 1 - drivers/staging/media/as102/as10x_cmd.c | 139 ++-- drivers/staging/media/as102/as10x_cmd.h | 895 ++++++++++++------------ drivers/staging/media/as102/as10x_cmd_cfg.c | 66 +- drivers/staging/media/as102/as10x_cmd_stream.c | 56 +- drivers/staging/media/as102/as10x_handle.h | 26 +- drivers/staging/media/as102/as10x_types.h | 250 ++++---- 15 files changed, 804 insertions(+), 909 deletions(-)
Quoted 8 lines · Mauro Carvalho Chehab
I got a few warnings here, after applying the patch series:
drivers/staging/media/as102/as102_drv.c: In function ‘as102_dvb_register’:drivers/staging/media/as102/as102_drv.c:223:3: warning: passing argument 1 of ‘dev_err’ from incompatible pointer type [enabled by default]include/linux/device.h:812:12: note: expected ‘const struct device *’ but argument is of type ‘char *’drivers/staging/media/as102/as102_drv.c:223:3: warning: too many arguments for format [-Wformat-extra-args]please check.
Yes, there was an error in patch 06/13, this has been pointed out yesterday. I intended to resend the patch, but since you have already pulled the whole series.. :), I'll post an additional patch to fix the problem.
Signature · 2 lines
Cheers, Sylwester
PATCH 1/1 staging: as102: Add missing function argument
In reply to Mauro Carvalho ChehabAdd missing dev argument in dev_err() call to correct an error introduced in commit 880102898f19cf9f9ba36dc9d838b5476645ce00 "...as102: Fix the dvb device registration error path".
--- drivers/staging/media/as102/as102_drv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/media/as102/as102_drv.c +1 -1
@@ -220,7 +220,7 @@ int as102_dvb_register(struct as102_dev_t *as102_dev) ret =dvb_dmx_init (&as102_dev->dvb_dmx);if (ret <0 ) { -dev_err ("%s: dvb_dmx_init() failed: %d\n" , __func__, ret); +dev_err (dev,"%s: dvb_dmx_init() failed: %d\n" , __func__, ret); goto edmxinit; }
Signature · 1 line
1.7.5.4
PATCH 1/1 staging: as102: Add support for Sky Italia Digital Key based on the same chip.
Add support for the Sky Italia Digital Key, an USB dongle offered by Sky Italia to its customers for use with their satellite set-top-boxes. This is the "green led" model based on the Abilis as102 chip, while the so called "blue led" model is based on the Avermedia A867 design.
--- 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(-)
(quoted diff) +0 -0
b/drivers/staging/media/as102/as102_usb_drv.c
index 9faab5b..7bcb28c 100644
drivers/staging/media/as102/as102_usb_drv.c +2 -0
@@ -42,6 +42,7 @@ static struct usb_device_id as102_usb_id_table[] = { { 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) }, + { USB_DEVICE(SKY_IT_DIGITAL_KEY_USB_VID, SKY_IT_DIGITAL_KEY_USB_PID) }, { } /* Terminating entry */ };
@@ -52,6 +53,7 @@ static const char * const as102_device_names[] = {AS102_PCTV_74E ,AS102_ELGATO_EYETV_DTT_NAME ,AS102_NBOX_DVBT_DONGLE_NAME , +AS102_SKY_IT_DIGITAL_KEY_NAME , NULL /* Terminating entry */ };
(quoted diff) +0 -0
b/drivers/staging/media/as102/as102_usb_drv.h
index 35925b7..fc2884a 100644
drivers/staging/media/as102/as102_usb_drv.h +5 -0
@@ -47,6 +47,11 @@#define NBOX_DVBT_DONGLE_USB_VID 0x0b89#define NBOX_DVBT_DONGLE_USB_PID 0x0007 +/* Sky Italia: Digital Key (green led) */ +#define AS102_SKY_IT_DIGITAL_KEY_NAME "Sky IT Digital Key (green led)" +#define SKY_IT_DIGITAL_KEY_USB_VID 0x2137 +#define SKY_IT_DIGITAL_KEY_USB_PID 0x0001 +void as102_urb_stream_irq (struct urb *urb);struct as10x_usb_token_cmd_t {
Signature · 1 line
1.7.0.4