2.6.11-rc2-bk2 DVB fixes
PATCH 2/4 fix access to freed memory
In reply to Johannes Stezenbach- [DVB] core: fix access to freed memory when unloading frontend drivers (fix by Gerd Knorr)
drivers/media/dvb/dvb-core/dvb_frontend.c +3 -2
@@ -912,8 +912,9 @@ int dvb_unregister_frontend(struct dvb_f fe->ops->release (fe); else printk("dvb_frontend: Demodulator (%s) does not have a release callback!\n", fe->ops->info.name); -if (fe->frontend_priv) -kfree (fe->frontend_priv); +/* fe is invalid now */ +if (fepriv) +kfree (fepriv);up (&frontend_mutex);return 0 ; }
cover 2.6.11-rc2-bk2 DVB fixes
Hi Linus,
the following patches correct a few bugs which were found shortly after submission of the previous patchset :-( (except 03-core-more-cards which I just submit while I'm at it)
01-dibusb-le16 follow USB __le16 changes
02-core-fe-release fix access to freed memory on module unload
03-core-more-cards support up to six DVB cards (instead of just four)
04-frontends cleanup some confusing firmware loading printks
I also saw that there is a large amount of whitespace/indentation corruption throughout the DVB subsystem (some of it shows through in the 04-frontends patch), which was not introduced
by the latest patchset but already exists in linux-2.6.10-rc2 at least. I will try to sort this out over the next few days.
Johannes
PATCH 1/4 follow USB __le16 changes
- [DVB] dibusb: follow USB changes (idVendor, idProduct, bcdDevice and bcdUSB fields are now __le16)
drivers/media/dvb/dibusb/dvb-dibusb-core.c +5 -5
@@ -358,8 +360,8 @@ static struct dibusb_usb_device * dibusbfor (i =0 ; i <sizeof (dibusb_devices)/sizeof (struct dibusb_usb_device ); i++) {for (j =0 ; j <DIBUSB_ID_MAX_NUM && dibusb_devices[i].cold_ids[j] !=NULL ; j++) {deb_info ("check for cold %x %x\n" ,dibusb_devices[i].cold_ids[j]->idVendor, dibusb_devices[i].cold_ids[j]->idProduct); -if (dibusb_devices[i].cold_ids[j]->idVendor == udev->descriptor.idVendor && - dibusb_devices[i].cold_ids[j]->idProduct == udev->descriptor.idProduct) { +if (dibusb_devices[i].cold_ids[j]->idVendor ==le16_to_cpu (udev->descriptor.idVendor) && + dibusb_devices[i].cold_ids[j]->idProduct ==le16_to_cpu (udev->descriptor.idProduct)) { *cold =1 ;return &dibusb_devices[i]; }
@@ -367,8 +369,8 @@ static struct dibusb_usb_device * dibusbfor (j =0 ; j <DIBUSB_ID_MAX_NUM && dibusb_devices[i].warm_ids[j] !=NULL ; j++) {deb_info ("check for warm %x %x\n" ,dibusb_devices[i].warm_ids[j]->idVendor, dibusb_devices[i].warm_ids[j]->idProduct); -if (dibusb_devices[i].warm_ids[j]->idVendor == udev->descriptor.idVendor && - dibusb_devices[i].warm_ids[j]->idProduct == udev->descriptor.idProduct) { +if (dibusb_devices[i].warm_ids[j]->idVendor ==le16_to_cpu (udev->descriptor.idVendor) && + dibusb_devices[i].warm_ids[j]->idProduct ==le16_to_cpu (udev->descriptor.idProduct)) { *cold =0 ;return &dibusb_devices[i]; }
@@ -391,7 +393,7 @@ static int dibusb_probe(struct usb_interif ((dibdev =dibusb_find_device (udev,&cold)) ==NULL ) {err ("something went very wrong, " -"unknown product ID: %.4x" ,udev->descriptor.idProduct); +"unknown product ID: %.4x" ,le16_to_cpu (udev->descriptor.idProduct));return -ENODEV ; }
PATCH 3/4 support up to six DVB cards
In reply to Johannes Stezenbach- [DVB] core: add support for up to six DVB cards by using 32bit dev_t capabilities
drivers/media/dvb/dvb-core/dvbdev.c +29 -5
@@ -31,6 +31,8 @@#include <linux/init.h> #include <linux/slab.h> #include <linux/device.h> +#include <linux/fs.h> +#include <linux/cdev.h> #include "dvbdev.h"
@@ -50,8 +52,9 @@ static const char * const dnames[] = { }; -#define DVB_MAX_IDS 4 +#define DVB_MAX_IDS 6#define nums2minor (num,type,id) ((num << 6) | (id << 4) | type) +#define MAX_DVB_MINORS (DVB_MAX_IDS*64)struct class_simple *dvb_class;EXPORT_SYMBOL (dvb_class);
@@ -109,6 +112,11 @@ static struct file_operations dvb_device }; +static struct cdev dvb_device_cdev = { + .kobj = {.name ="dvb" , }, + .owner =THIS_MODULE , +}; +int dvb_generic_open (struct inode *inode,struct file *file) {struct dvb_device *dvbdev = file->private_data;
@@ -400,25 +408,41 @@ out:static int __init init_dvbdev (void ) {int retval; +dev_t dev =MKDEV (DVB_MAJOR ,0 ); + +if ((retval =register_chrdev_region (dev,MAX_DVB_MINORS ,"DVB" )) !=0 ) { +printk ("dvb-core: unable to get major %d\n" ,DVB_MAJOR ); +return retval; + } -if ((retval =register_chrdev (DVB_MAJOR ,"DVB" , &dvb_device_fops))) +cdev_init (&dvb_device_cdev, &dvb_device_fops); +if ((retval =cdev_add (&dvb_device_cdev, dev,MAX_DVB_MINORS )) !=0 ) {printk ("dvb-core: unable to get major %d\n" ,DVB_MAJOR ); + goto error; + }devfs_mk_dir ("dvb" ); dvb_class =class_simple_create (THIS_MODULE ,"dvb" ); -if (IS_ERR (dvb_class)) -return PTR_ERR (dvb_class); +if (IS_ERR (dvb_class)) { + retval =PTR_ERR (dvb_class); + goto error; + } +return 0 ; +error: +cdev_del (&dvb_device_cdev); +unregister_chrdev_region (dev,MAX_DVB_MINORS );return retval; } static void __exit exit_dvbdev(void) { -unregister_chrdev (DVB_MAJOR ,"DVB" );devfs_remove ("dvb" );class_simple_destroy (dvb_class); +cdev_del (&dvb_device_cdev); +unregister_chrdev_region (MKDEV (DVB_MAJOR ,0 ),MAX_DVB_MINORS ); }module_init (init_dvbdev);
PATCH 4/4 cleanup firmware loading printks
In reply to Johannes Stezenbach- [DVB] frontends: sp887x: improve confusing firmware loading messages
drivers/media/dvb/frontends/sp8870.c +2 -1
@@ -313,7 +313,7 @@ static int sp8870_init (struct dvb_front/* request the firmware, this will block until someone uploads it */ -printk ("sp8870: waiting for firmware upload...\n" ); +printk ("sp8870: waiting for firmware upload (%s)...\n" ,SP8870_DEFAULT_FIRMWARE );if (state->config->request_firmware (fe, &fw,SP8870_DEFAULT_FIRMWARE )) {printk ("sp8870: no firmware upload (timeout or file not found?)\n" );release_firmware (fw);
@@ -325,6 +325,7 @@ static int sp8870_init (struct dvb_frontrelease_firmware (fw);return -EIO ; } +printk ("sp8870: firmware upload complete\n" );/* enable TS output and interface pins */ sp8870_writereg (state,0xc18 ,0x00d );
drivers/media/dvb/frontends/sp887x.c +2 -1
@@ -518,7 +518,7 @@ static int sp887x_init(struct dvb_fronteif (!state->initialised) {/* request the firmware, this will block until someone uploads it */ -printk ("sp887x: waiting for firmware upload...\n" ); +printk ("sp887x: waiting for firmware upload (%s)...\n" ,SP887X_DEFAULT_FIRMWARE ); ret = state->config->request_firmware (fe, &fw,SP887X_DEFAULT_FIRMWARE );if (ret) {printk ("sp887x: no firmware upload (timeout or file not found?)\n" );
@@ -531,6 +531,7 @@ static int sp887x_init(struct dvb_fronterelease_firmware (fw);return ret; } +printk ("sp887x: firmware upload complete\n" ); state->initialised =1 ; }