Commit e91cb3ff authored by Johannes Stezenbach's avatar Johannes Stezenbach Committed by Linus Torvalds

[PATCH] DVB linkage fix

We have two global variables called "debug".

The attached patch cleans up various aspects of dibusb module argument
handling, so it's a bit larger than just renaming "debug".
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9cd1850f
...@@ -27,17 +27,22 @@ ...@@ -27,17 +27,22 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
/* debug */ /* debug */
int dvb_dibusb_debug;
module_param_named(debug, dvb_dibusb_debug, int, 0644);
#ifdef CONFIG_DVB_DIBCOM_DEBUG #ifdef CONFIG_DVB_DIBCOM_DEBUG
int debug; #define DBSTATUS ""
module_param(debug, int, 0644); #else
MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=alotmore,8=ts,16=err,32=rc (|-able))."); #define DBSTATUS " (debugging is not enabled)"
#endif #endif
MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=alotmore,8=ts,16=err,32=rc (|-able))." DBSTATUS);
#undef DBSTATUS
int pid_parse; static int pid_parse;
module_param(pid_parse, int, 0644); module_param(pid_parse, int, 0644);
MODULE_PARM_DESC(pid_parse, "enable pid parsing (filtering) when running at USB2.0"); MODULE_PARM_DESC(pid_parse, "enable pid parsing (filtering) when running at USB2.0");
int rc_query_interval; static int rc_query_interval;
module_param(rc_query_interval, int, 0644); module_param(rc_query_interval, int, 0644);
MODULE_PARM_DESC(rc_query_interval, "interval in msecs for remote control query (default: 100; min: 40)"); MODULE_PARM_DESC(rc_query_interval, "interval in msecs for remote control query (default: 100; min: 40)");
...@@ -410,6 +415,10 @@ static int dibusb_probe(struct usb_interface *intf, ...@@ -410,6 +415,10 @@ static int dibusb_probe(struct usb_interface *intf,
dib->udev = udev; dib->udev = udev;
dib->dibdev = dibdev; dib->dibdev = dibdev;
/* store parameters to structures */
dib->rc_query_interval = rc_query_interval;
dib->pid_parse = pid_parse;
usb_set_intfdata(intf, dib); usb_set_intfdata(intf, dib);
ret = dibusb_init(dib); ret = dibusb_init(dib);
......
...@@ -143,7 +143,7 @@ static void dibusb_remote_query(void *data) ...@@ -143,7 +143,7 @@ static void dibusb_remote_query(void *data)
if we're busy. */ if we're busy. */
dibusb_read_remote_control(dib); dibusb_read_remote_control(dib);
schedule_delayed_work(&dib->rc_query_work, schedule_delayed_work(&dib->rc_query_work,
msecs_to_jiffies(rc_query_interval)); msecs_to_jiffies(dib->rc_query_interval));
} }
int dibusb_remote_init(struct usb_dibusb *dib) int dibusb_remote_init(struct usb_dibusb *dib)
...@@ -171,11 +171,11 @@ int dibusb_remote_init(struct usb_dibusb *dib) ...@@ -171,11 +171,11 @@ int dibusb_remote_init(struct usb_dibusb *dib)
INIT_WORK(&dib->rc_query_work, dibusb_remote_query, dib); INIT_WORK(&dib->rc_query_work, dibusb_remote_query, dib);
/* Start the remote-control polling. */ /* Start the remote-control polling. */
if (rc_query_interval < 40) if (dib->rc_query_interval < 40)
rc_query_interval = 100; /* default */ dib->rc_query_interval = 100; /* default */
info("schedule remote query interval to %d msecs.",rc_query_interval); info("schedule remote query interval to %d msecs.",dib->rc_query_interval);
schedule_delayed_work(&dib->rc_query_work,msecs_to_jiffies(rc_query_interval)); schedule_delayed_work(&dib->rc_query_work,msecs_to_jiffies(dib->rc_query_interval));
dib->init_state |= DIBUSB_STATE_REMOTE; dib->init_state |= DIBUSB_STATE_REMOTE;
......
...@@ -158,7 +158,7 @@ int dibusb_streaming(struct usb_dibusb *dib,int onoff) ...@@ -158,7 +158,7 @@ int dibusb_streaming(struct usb_dibusb *dib,int onoff)
int dibusb_urb_init(struct usb_dibusb *dib) int dibusb_urb_init(struct usb_dibusb *dib)
{ {
int ret,i,bufsize; int ret,i,bufsize,def_pid_parse = 1;
/* /*
* when reloading the driver w/o replugging the device * when reloading the driver w/o replugging the device
...@@ -210,12 +210,14 @@ int dibusb_urb_init(struct usb_dibusb *dib) ...@@ -210,12 +210,14 @@ int dibusb_urb_init(struct usb_dibusb *dib)
dib->init_state |= DIBUSB_STATE_URB_SUBMIT; dib->init_state |= DIBUSB_STATE_URB_SUBMIT;
} }
/* dib->pid_parse here contains the value of the module parameter */
dib->pid_parse = 1; /* decide if pid parsing can be deactivated:
* is possible (by speed) and wanted (by user)
*/
switch (dib->dibdev->dev_cl->id) { switch (dib->dibdev->dev_cl->id) {
case DIBUSB2_0: case DIBUSB2_0:
if (dib->udev->speed == USB_SPEED_HIGH && !pid_parse) { if (dib->udev->speed == USB_SPEED_HIGH && !dib->pid_parse) {
dib->pid_parse = 0; def_pid_parse = 0;
info("running at HIGH speed, will deliver the complete TS."); info("running at HIGH speed, will deliver the complete TS.");
} else } else
info("will use pid_parsing."); info("will use pid_parsing.");
...@@ -223,6 +225,8 @@ int dibusb_urb_init(struct usb_dibusb *dib) ...@@ -223,6 +225,8 @@ int dibusb_urb_init(struct usb_dibusb *dib)
default: default:
break; break;
} }
/* from here on it contains the device and user decision */
dib->pid_parse = def_pid_parse;
return 0; return 0;
} }
......
...@@ -27,31 +27,26 @@ ...@@ -27,31 +27,26 @@
/* debug */ /* debug */
#ifdef CONFIG_DVB_DIBCOM_DEBUG #ifdef CONFIG_DVB_DIBCOM_DEBUG
#define dprintk(level,args...) \ #define dprintk(level,args...) \
do { if ((debug & level)) { printk(args); } } while (0) do { if ((dvb_dibusb_debug & level)) { printk(args); } } while (0)
#define debug_dump(b,l) if (debug) {\ #define debug_dump(b,l) {\
int i; deb_xfer("%s: %d > ",__FUNCTION__,l); \ int i; \
for (i = 0; i < l; i++) deb_xfer("%02x ", b[i]); \ for (i = 0; i < l; i++) deb_xfer("%02x ", b[i]); \
deb_xfer("\n");\ deb_xfer("\n");\
} }
/* module parameters - declared in -core.c */
extern int debug;
#else #else
#define dprintk(args...) #define dprintk(args...)
#define debug_dump(b,l) #define debug_dump(b,l)
#endif #endif
extern int dvb_dibusb_debug;
/* Version information */ /* Version information */
#define DRIVER_VERSION "0.3" #define DRIVER_VERSION "0.3"
#define DRIVER_DESC "Driver for DiBcom based USB Budget DVB-T device" #define DRIVER_DESC "Driver for DiBcom based USB Budget DVB-T device"
#define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de" #define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de"
/* module parameters - declared in -core.c */
extern int pid_parse;
extern int rc_query_interval;
#define deb_info(args...) dprintk(0x01,args) #define deb_info(args...) dprintk(0x01,args)
#define deb_xfer(args...) dprintk(0x02,args) #define deb_xfer(args...) dprintk(0x02,args)
#define deb_alot(args...) dprintk(0x04,args) #define deb_alot(args...) dprintk(0x04,args)
...@@ -162,7 +157,6 @@ struct usb_dibusb { ...@@ -162,7 +157,6 @@ struct usb_dibusb {
int init_state; int init_state;
int feedcount; int feedcount;
int pid_parse;
struct dib_fe_xfer_ops xfer_ops; struct dib_fe_xfer_ops xfer_ops;
struct dibusb_tuner *tuner; struct dibusb_tuner *tuner;
...@@ -196,6 +190,10 @@ struct usb_dibusb { ...@@ -196,6 +190,10 @@ struct usb_dibusb {
struct input_dev rc_input_dev; struct input_dev rc_input_dev;
struct work_struct rc_query_work; struct work_struct rc_query_work;
int rc_input_event; int rc_input_event;
/* module parameters */
int pid_parse;
int rc_query_interval;
}; };
/* commonly used functions in the separated files */ /* commonly used functions in the separated files */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment