diff --git a/[refs] b/[refs] index 6a15099042fc..32babaad6678 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 31b3c31bca3b4df975631323d6ee6f49f43f4956 +refs/heads/master: d9e2d185bf01e20339158f77c3fca00b02014912 diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 1fc80ec4999b..a74a0c726134 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -536,7 +536,6 @@ P: Mauro Carvalho Chehab M: mchehab@brturbo.com.br L: video4linux-list@redhat.com W: http://linuxtv.org -T: quilt http://www.linuxtv.org/download/quilt/ S: Maintained BUSLOGIC SCSI DRIVER @@ -834,7 +833,6 @@ P: LinuxTV.org Project M: linux-dvb-maintainer@linuxtv.org L: linux-dvb@linuxtv.org (subscription required) W: http://linuxtv.org/ -T: quilt http://www.linuxtv.org/download/quilt/ S: Supported EATA-DMA SCSI DRIVER @@ -2887,7 +2885,6 @@ P: Mauro Carvalho Chehab M: mchehab@brturbo.com.br L: video4linux-list@redhat.com W: http://linuxtv.org -T: quilt http://www.linuxtv.org/download/quilt/ S: Maintained W1 DALLAS'S 1-WIRE BUS diff --git a/trunk/Makefile b/trunk/Makefile index 4643d579fc87..5187fee78080 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 15 -EXTRAVERSION =-rc4 +EXTRAVERSION =-rc3 NAME=Affluent Albatross # *DOCUMENTATION* diff --git a/trunk/arch/i386/kernel/acpi/boot.c b/trunk/arch/i386/kernel/acpi/boot.c index 447fa9e33ffb..76b1135d401a 100644 --- a/trunk/arch/i386/kernel/acpi/boot.c +++ b/trunk/arch/i386/kernel/acpi/boot.c @@ -638,13 +638,6 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) return 0; pmtmr_ioport = fadt->xpm_tmr_blk.address; - /* - * "X" fields are optional extensions to the original V1.0 - * fields, so we must selectively expand V1.0 fields if the - * corresponding X field is zero. - */ - if (!pmtmr_ioport) - pmtmr_ioport = fadt->V1_pm_tmr_blk; } else { /* FADT rev. 1 */ pmtmr_ioport = fadt->V1_pm_tmr_blk; diff --git a/trunk/arch/ppc/boot/simple/Makefile b/trunk/arch/ppc/boot/simple/Makefile index f3e9c534aa82..82df88b01bbe 100644 --- a/trunk/arch/ppc/boot/simple/Makefile +++ b/trunk/arch/ppc/boot/simple/Makefile @@ -262,11 +262,11 @@ $(images)/zImage.initrd-STRIPELF: $(obj)/zvmlinux.initrd skip=64 bs=1k $(images)/zImage-TREE: $(obj)/zvmlinux $(MKTREE) - $(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(end-y) $(entrypoint-y) + $(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(end-y) $(ENTRYPOINT) $(images)/zImage.initrd-TREE: $(obj)/zvmlinux.initrd $(MKTREE) $(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(end-y) \ - $(entrypoint-y) + $(ENTRYPOINT) $(images)/zImage-PPLUS: $(obj)/zvmlinux $(MKPREP) $(MKBUGBOOT) $(MKPREP) -pbp $(obj)/zvmlinux $(images)/zImage.$(end-y) diff --git a/trunk/arch/ppc/syslib/m82xx_pci.c b/trunk/arch/ppc/syslib/m82xx_pci.c index 1941a8c7ca9a..1d1c3956c1ae 100644 --- a/trunk/arch/ppc/syslib/m82xx_pci.c +++ b/trunk/arch/ppc/syslib/m82xx_pci.c @@ -248,8 +248,7 @@ pq2ads_setup_pci(struct pci_controller *hose) pci_div = ( (sccr & SCCR_PCI_MODCK) ? 2 : 1) * ( ( (sccr & SCCR_PCIDF_MSK) >> SCCR_PCIDF_SHIFT) + 1); freq = (uint)((2*binfo->bi_cpmfreq)/(pci_div)); - time = (int)66666666/freq; - + time = (int)666666/freq; /* due to PCI Local Bus spec, some devices needs to wait such a long time after RST deassertion. More specifically, 0.508s for 66MHz & twice more for 33 */ printk("%s: The PCI bus is %d Mhz.\nWaiting %s after deasserting RST...\n",__FILE__,freq, diff --git a/trunk/drivers/acpi/Kconfig b/trunk/drivers/acpi/Kconfig index fce21c257523..fe1e8126fbae 100644 --- a/trunk/drivers/acpi/Kconfig +++ b/trunk/drivers/acpi/Kconfig @@ -197,6 +197,7 @@ config ACPI_ASUS config ACPI_IBM tristate "IBM ThinkPad Laptop Extras" depends on X86 + default y ---help--- This is a Linux ACPI driver for the IBM ThinkPad laptops. It adds support for Fn-Fx key combinations, Bluetooth control, video diff --git a/trunk/drivers/acpi/Makefile b/trunk/drivers/acpi/Makefile index 5984b4f6715a..a18243488c66 100644 --- a/trunk/drivers/acpi/Makefile +++ b/trunk/drivers/acpi/Makefile @@ -16,7 +16,7 @@ EXTRA_CFLAGS += $(ACPI_CFLAGS) # ACPI Boot-Time Table Parsing # obj-y += tables.o -obj-$(CONFIG_X86) += blacklist.o +obj-y += blacklist.o # # ACPI Core Subsystem (Interpreter) diff --git a/trunk/drivers/acpi/processor_core.c b/trunk/drivers/acpi/processor_core.c index 0c561c571f29..421792562642 100644 --- a/trunk/drivers/acpi/processor_core.c +++ b/trunk/drivers/acpi/processor_core.c @@ -543,8 +543,6 @@ static int acpi_processor_get_info(struct acpi_processor *pr) return_VALUE(0); } -static void *processor_device_array[NR_CPUS]; - static int acpi_processor_start(struct acpi_device *device) { int result = 0; @@ -563,19 +561,6 @@ static int acpi_processor_start(struct acpi_device *device) BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); - /* - * Buggy BIOS check - * ACPI id of processors can be reported wrongly by the BIOS. - * Don't trust it blindly - */ - if (processor_device_array[pr->id] != NULL && - processor_device_array[pr->id] != (void *)device) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "BIOS reporting wrong ACPI id" - "for the processor\n")); - return_VALUE(-ENODEV); - } - processor_device_array[pr->id] = (void *)device; - processors[pr->id] = pr; result = acpi_processor_add_fs(device); diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index 83fd1b6c10c4..70d8a6ec0920 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -280,16 +280,6 @@ static void acpi_processor_idle(void) cx->usage++; -#ifdef CONFIG_HOTPLUG_CPU - /* - * Check for P_LVL2_UP flag before entering C2 and above on - * an SMP system. We do it here instead of doing it at _CST/P_LVL - * detection phase, to work cleanly with logical CPU hotplug. - */ - if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && - !pr->flags.has_cst && acpi_fadt.plvl2_up) - cx->type = ACPI_STATE_C1; -#endif /* * Sleep: * ------ @@ -544,15 +534,6 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) pr->power.states[ACPI_STATE_C0].valid = 1; pr->power.states[ACPI_STATE_C1].valid = 1; -#ifndef CONFIG_HOTPLUG_CPU - /* - * Check for P_LVL2_UP flag before entering C2 and above on - * an SMP system. - */ - if ((num_online_cpus() > 1) && acpi_fadt.plvl2_up) - return_VALUE(-ENODEV); -#endif - /* determine C2 and C3 address from pblk */ pr->power.states[ACPI_STATE_C2].address = pr->pblk + 4; pr->power.states[ACPI_STATE_C3].address = pr->pblk + 5; @@ -709,7 +690,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) /* Validate number of power states discovered */ if (pr->power.count < 2) - status = -EFAULT; + status = -ENODEV; end: acpi_os_free(buffer.pointer); @@ -860,11 +841,11 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) * this function */ result = acpi_processor_get_power_info_cst(pr); - if (result == -ENODEV) + if ((result) || (acpi_processor_power_verify(pr) < 2)) { result = acpi_processor_get_power_info_fadt(pr); - - if ((result) || (acpi_processor_power_verify(pr) < 2)) - result = acpi_processor_get_power_info_default_c1(pr); + if ((result) || (acpi_processor_power_verify(pr) < 2)) + result = acpi_processor_get_power_info_default_c1(pr); + } /* * Set Default Policy diff --git a/trunk/drivers/acpi/processor_thermal.c b/trunk/drivers/acpi/processor_thermal.c index f37584015324..37528c3b64b0 100644 --- a/trunk/drivers/acpi/processor_thermal.c +++ b/trunk/drivers/acpi/processor_thermal.c @@ -101,7 +101,9 @@ static unsigned int acpi_thermal_cpufreq_is_init = 0; static int cpu_has_cpufreq(unsigned int cpu) { struct cpufreq_policy policy; - if (!acpi_thermal_cpufreq_is_init || cpufreq_get_policy(&policy, cpu)) + if (!acpi_thermal_cpufreq_is_init) + return -ENODEV; + if (!cpufreq_get_policy(&policy, cpu)) return -ENODEV; return 0; } @@ -125,13 +127,13 @@ static int acpi_thermal_cpufreq_decrease(unsigned int cpu) if (!cpu_has_cpufreq(cpu)) return -ENODEV; - if (cpufreq_thermal_reduction_pctg[cpu] > 20) + if (cpufreq_thermal_reduction_pctg[cpu] >= 20) { cpufreq_thermal_reduction_pctg[cpu] -= 20; - else - cpufreq_thermal_reduction_pctg[cpu] = 0; - cpufreq_update_policy(cpu); - /* We reached max freq again and can leave passive mode */ - return !cpufreq_thermal_reduction_pctg[cpu]; + cpufreq_update_policy(cpu); + return 0; + } + + return -ERANGE; } static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb, @@ -198,7 +200,7 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) int result = 0; struct acpi_processor *pr = NULL; struct acpi_device *device = NULL; - int tx = 0, max_tx_px = 0; + int tx = 0; ACPI_FUNCTION_TRACE("acpi_processor_set_thermal_limit"); @@ -257,27 +259,19 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) /* if going down: T-states first, P-states later */ if (pr->flags.throttling) { - if (tx == 0) { - max_tx_px = 1; + if (tx == 0) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "At minimum throttling state\n")); - } else { + else { tx--; goto end; } } result = acpi_thermal_cpufreq_decrease(pr->id); - if (result) { - /* - * We only could get -ERANGE, 1 or 0. - * In the first two cases we reached max freq again. - */ + if (result == -ERANGE) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "At minimum performance state\n")); - max_tx_px = 1; - } else - max_tx_px = 0; break; } @@ -296,10 +290,8 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) pr->limit.thermal.px, pr->limit.thermal.tx)); } else result = 0; - if (max_tx_px) - return_VALUE(1); - else - return_VALUE(result); + + return_VALUE(result); } int acpi_processor_get_limit_info(struct acpi_processor *pr) diff --git a/trunk/drivers/acpi/scan.c b/trunk/drivers/acpi/scan.c index 31218e1d2a18..23e2c6968a11 100644 --- a/trunk/drivers/acpi/scan.c +++ b/trunk/drivers/acpi/scan.c @@ -1110,7 +1110,7 @@ acpi_add_single_object(struct acpi_device **child, * * TBD: Assumes LDM provides driver hot-plug capability. */ - acpi_bus_find_driver(device); + result = acpi_bus_find_driver(device); end: if (!result) diff --git a/trunk/drivers/acpi/thermal.c b/trunk/drivers/acpi/thermal.c index 19f3ea48475e..a24847c08f7f 100644 --- a/trunk/drivers/acpi/thermal.c +++ b/trunk/drivers/acpi/thermal.c @@ -72,7 +72,7 @@ #define _COMPONENT ACPI_THERMAL_COMPONENT ACPI_MODULE_NAME("acpi_thermal") -MODULE_AUTHOR("Paul Diefenbaugh"); + MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION(ACPI_THERMAL_DRIVER_NAME); MODULE_LICENSE("GPL"); @@ -517,9 +517,9 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) return_VALUE(0); } -static void acpi_thermal_passive(struct acpi_thermal *tz) +static int acpi_thermal_passive(struct acpi_thermal *tz) { - int result = 1; + int result = 0; struct acpi_thermal_passive *passive = NULL; int trend = 0; int i = 0; @@ -527,7 +527,7 @@ static void acpi_thermal_passive(struct acpi_thermal *tz) ACPI_FUNCTION_TRACE("acpi_thermal_passive"); if (!tz || !tz->trips.passive.flags.valid) - return; + return_VALUE(-EINVAL); passive = &(tz->trips.passive); @@ -547,7 +547,7 @@ static void acpi_thermal_passive(struct acpi_thermal *tz) trend, passive->tc1, tz->temperature, tz->last_temperature, passive->tc2, tz->temperature, passive->temperature)); - passive->flags.enabled = 1; + tz->trips.passive.flags.enabled = 1; /* Heating up? */ if (trend > 0) for (i = 0; i < passive->devices.count; i++) @@ -556,32 +556,12 @@ static void acpi_thermal_passive(struct acpi_thermal *tz) handles[i], ACPI_PROCESSOR_LIMIT_INCREMENT); /* Cooling off? */ - else if (trend < 0) { + else if (trend < 0) for (i = 0; i < passive->devices.count; i++) - /* - * assume that we are on highest - * freq/lowest thrott and can leave - * passive mode, even in error case - */ - if (!acpi_processor_set_thermal_limit - (passive->devices.handles[i], - ACPI_PROCESSOR_LIMIT_DECREMENT)) - result = 0; - /* - * Leave cooling mode, even if the temp might - * higher than trip point This is because some - * machines might have long thermal polling - * frequencies (tsp) defined. We will fall back - * into passive mode in next cycle (probably quicker) - */ - if (result) { - passive->flags.enabled = 0; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Disabling passive cooling, still above threshold," - " but we are cooling down\n")); - } - } - return; + acpi_processor_set_thermal_limit(passive-> + devices. + handles[i], + ACPI_PROCESSOR_LIMIT_DECREMENT); } /* @@ -591,21 +571,23 @@ static void acpi_thermal_passive(struct acpi_thermal *tz) * and avoid thrashing around the passive trip point. Note that we * assume symmetry. */ - if (!passive->flags.enabled) - return; - for (i = 0; i < passive->devices.count; i++) - if (!acpi_processor_set_thermal_limit - (passive->devices.handles[i], - ACPI_PROCESSOR_LIMIT_DECREMENT)) - result = 0; - if (result) { - passive->flags.enabled = 0; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Disabling passive cooling (zone is cool)\n")); + else if (tz->trips.passive.flags.enabled) { + for (i = 0; i < passive->devices.count; i++) + result = + acpi_processor_set_thermal_limit(passive->devices. + handles[i], + ACPI_PROCESSOR_LIMIT_DECREMENT); + if (result == 1) { + tz->trips.passive.flags.enabled = 0; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Disabling passive cooling (zone is cool)\n")); + } } + + return_VALUE(0); } -static void acpi_thermal_active(struct acpi_thermal *tz) +static int acpi_thermal_active(struct acpi_thermal *tz) { int result = 0; struct acpi_thermal_active *active = NULL; @@ -616,66 +598,74 @@ static void acpi_thermal_active(struct acpi_thermal *tz) ACPI_FUNCTION_TRACE("acpi_thermal_active"); if (!tz) - return; + return_VALUE(-EINVAL); for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { + active = &(tz->trips.active[i]); if (!active || !active->flags.valid) break; + + /* + * Above Threshold? + * ---------------- + * If not already enabled, turn ON all cooling devices + * associated with this active threshold. + */ if (tz->temperature >= active->temperature) { - /* - * Above Threshold? - * ---------------- - * If not already enabled, turn ON all cooling devices - * associated with this active threshold. - */ if (active->temperature > maxtemp) - tz->state.active_index = i; - maxtemp = active->temperature; - if (active->flags.enabled) - continue; - for (j = 0; j < active->devices.count; j++) { - result = - acpi_bus_set_power(active->devices. - handles[j], - ACPI_STATE_D0); - if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to turn cooling device [%p] 'on'\n", + tz->state.active_index = i, maxtemp = + active->temperature; + if (!active->flags.enabled) { + for (j = 0; j < active->devices.count; j++) { + result = + acpi_bus_set_power(active->devices. + handles[j], + ACPI_STATE_D0); + if (result) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Unable to turn cooling device [%p] 'on'\n", + active-> + devices. + handles[j])); + continue; + } + active->flags.enabled = 1; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Cooling device [%p] now 'on'\n", active->devices. handles[j])); - continue; } - active->flags.enabled = 1; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Cooling device [%p] now 'on'\n", - active->devices.handles[j])); } - continue; } - if (!active->flags.enabled) - continue; /* * Below Threshold? * ---------------- * Turn OFF all cooling devices associated with this * threshold. */ - for (j = 0; j < active->devices.count; j++) { - result = acpi_bus_set_power(active->devices.handles[j], - ACPI_STATE_D3); - if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to turn cooling device [%p] 'off'\n", + else if (active->flags.enabled) { + for (j = 0; j < active->devices.count; j++) { + result = + acpi_bus_set_power(active->devices. + handles[j], + ACPI_STATE_D3); + if (result) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Unable to turn cooling device [%p] 'off'\n", + active->devices. + handles[j])); + continue; + } + active->flags.enabled = 0; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Cooling device [%p] now 'off'\n", active->devices.handles[j])); - continue; } - active->flags.enabled = 0; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Cooling device [%p] now 'off'\n", - active->devices.handles[j])); } } + + return_VALUE(0); } static void acpi_thermal_check(void *context); @@ -754,12 +744,15 @@ static void acpi_thermal_check(void *data) * Again, separated from the above two to allow independent policy * decisions. */ - tz->state.critical = tz->trips.critical.flags.enabled; - tz->state.hot = tz->trips.hot.flags.enabled; - tz->state.passive = tz->trips.passive.flags.enabled; - tz->state.active = 0; + if (tz->trips.critical.flags.enabled) + tz->state.critical = 1; + if (tz->trips.hot.flags.enabled) + tz->state.hot = 1; + if (tz->trips.passive.flags.enabled) + tz->state.passive = 1; for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) - tz->state.active |= tz->trips.active[i].flags.enabled; + if (tz->trips.active[i].flags.enabled) + tz->state.active = 1; /* * Calculate Sleep Time diff --git a/trunk/drivers/acpi/video.c b/trunk/drivers/acpi/video.c index d10668f14699..f051b151580d 100644 --- a/trunk/drivers/acpi/video.c +++ b/trunk/drivers/acpi/video.c @@ -812,7 +812,7 @@ acpi_video_device_write_brightness(struct file *file, ACPI_FUNCTION_TRACE("acpi_video_device_write_brightness"); - if (!dev || !dev->brightness || count + 1 > sizeof str) + if (!dev || count + 1 > sizeof str) return_VALUE(-EINVAL); if (copy_from_user(str, buffer, count)) diff --git a/trunk/drivers/media/dvb/b2c2/flexcop-hw-filter.c b/trunk/drivers/media/dvb/b2c2/flexcop-hw-filter.c index b386cc66c6b3..75cf237196eb 100644 --- a/trunk/drivers/media/dvb/b2c2/flexcop-hw-filter.c +++ b/trunk/drivers/media/dvb/b2c2/flexcop-hw-filter.c @@ -19,7 +19,7 @@ void flexcop_smc_ctrl(struct flexcop_device *fc, int onoff) flexcop_set_ibi_value(ctrl_208,SMC_Enable_sig,onoff); } -static void flexcop_null_filter_ctrl(struct flexcop_device *fc, int onoff) +void flexcop_null_filter_ctrl(struct flexcop_device *fc, int onoff) { flexcop_set_ibi_value(ctrl_208,Null_filter_sig,onoff); } diff --git a/trunk/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/trunk/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index cb2e7d6ba283..2aa767f9bd7d 100644 --- a/trunk/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/trunk/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include "dvb_ca_en50221.h" @@ -111,6 +111,9 @@ struct dvb_ca_slot { /* size of the buffer to use when talking to the CAM */ int link_buf_size; + /* semaphore for syncing access to slot structure */ + struct rw_semaphore sem; + /* buffer for incoming packets */ struct dvb_ringbuffer rx_buffer; @@ -599,11 +602,14 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private *ca, int slot, u8 * eb if (ebuf == NULL) { int buf_free; + down_read(&ca->slot_info[slot].sem); if (ca->slot_info[slot].rx_buffer.data == NULL) { + up_read(&ca->slot_info[slot].sem); status = -EIO; goto exit; } buf_free = dvb_ringbuffer_free(&ca->slot_info[slot].rx_buffer); + up_read(&ca->slot_info[slot].sem); if (buf_free < (ca->slot_info[slot].link_buf_size + DVB_RINGBUFFER_PKTHDRSIZE)) { status = -EAGAIN; @@ -674,11 +680,14 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private *ca, int slot, u8 * eb /* OK, add it to the receive buffer, or copy into external buffer if supplied */ if (ebuf == NULL) { + down_read(&ca->slot_info[slot].sem); if (ca->slot_info[slot].rx_buffer.data == NULL) { + up_read(&ca->slot_info[slot].sem); status = -EIO; goto exit; } dvb_ringbuffer_pkt_write(&ca->slot_info[slot].rx_buffer, buf, bytes_read); + up_read(&ca->slot_info[slot].sem); } else { memcpy(ebuf, buf, bytes_read); } @@ -793,8 +802,12 @@ static int dvb_ca_en50221_slot_shutdown(struct dvb_ca_private *ca, int slot) { dprintk("%s\n", __FUNCTION__); + down_write(&ca->slot_info[slot].sem); ca->pub->slot_shutdown(ca->pub, slot); ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE; + vfree(ca->slot_info[slot].rx_buffer.data); + ca->slot_info[slot].rx_buffer.data = NULL; + up_write(&ca->slot_info[slot].sem); /* need to wake up all processes to check if they're now trying to write to a defunct CAM */ @@ -880,7 +893,7 @@ void dvb_ca_en50221_frda_irq(struct dvb_ca_en50221 *pubca, int slot) case DVB_CA_SLOTSTATE_RUNNING: if (ca->open) - dvb_ca_en50221_thread_wakeup(ca); + dvb_ca_en50221_read_data(ca, slot, NULL, 0); break; } } @@ -1114,16 +1127,16 @@ static int dvb_ca_en50221_thread(void *data) break; } - if (ca->slot_info[slot].rx_buffer.data == NULL) { - rxbuf = vmalloc(RX_BUFFER_SIZE); - if (rxbuf == NULL) { - printk("dvb_ca adapter %d: Unable to allocate CAM rx buffer :(\n", ca->dvbdev->adapter->num); - ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID; - dvb_ca_en50221_thread_update_delay(ca); - break; - } - dvb_ringbuffer_init(&ca->slot_info[slot].rx_buffer, rxbuf, RX_BUFFER_SIZE); + rxbuf = vmalloc(RX_BUFFER_SIZE); + if (rxbuf == NULL) { + printk("dvb_ca adapter %d: Unable to allocate CAM rx buffer :(\n", ca->dvbdev->adapter->num); + ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID; + dvb_ca_en50221_thread_update_delay(ca); + break; } + down_write(&ca->slot_info[slot].sem); + dvb_ringbuffer_init(&ca->slot_info[slot].rx_buffer, rxbuf, RX_BUFFER_SIZE); + up_write(&ca->slot_info[slot].sem); ca->pub->slot_ts_enable(ca->pub, slot); ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_RUNNING; @@ -1135,7 +1148,11 @@ static int dvb_ca_en50221_thread(void *data) if (!ca->open) continue; - // poll slots for data + // no need to poll if the CAM supports IRQs + if (ca->slot_info[slot].da_irq_supported) + break; + + // poll mode pktcount = 0; while ((status = dvb_ca_en50221_read_data(ca, slot, NULL, 0)) > 0) { if (!ca->open) @@ -1350,13 +1367,12 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file, /** * Condition for waking up in dvb_ca_en50221_io_read_condition */ -static int dvb_ca_en50221_io_read_condition(struct dvb_ca_private *ca, - int *result, int *_slot) +static int dvb_ca_en50221_io_read_condition(struct dvb_ca_private *ca, int *result, int *_slot) { int slot; int slot_count = 0; int idx; - size_t fraglen; + int fraglen; int connection_id = -1; int found = 0; u8 hdr[2]; @@ -1366,7 +1382,10 @@ static int dvb_ca_en50221_io_read_condition(struct dvb_ca_private *ca, if (ca->slot_info[slot].slot_state != DVB_CA_SLOTSTATE_RUNNING) goto nextslot; + down_read(&ca->slot_info[slot].sem); + if (ca->slot_info[slot].rx_buffer.data == NULL) { + up_read(&ca->slot_info[slot].sem); return 0; } @@ -1384,7 +1403,10 @@ static int dvb_ca_en50221_io_read_condition(struct dvb_ca_private *ca, idx = dvb_ringbuffer_pkt_next(&ca->slot_info[slot].rx_buffer, idx, &fraglen); } -nextslot: + if (!found) + up_read(&ca->slot_info[slot].sem); + + nextslot: slot = (slot + 1) % ca->slot_count; slot_count++; } @@ -1489,7 +1511,8 @@ static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf, goto exit; status = pktlen; -exit: + exit: + up_read(&ca->slot_info[slot].sem); return status; } @@ -1521,11 +1544,11 @@ static int dvb_ca_en50221_io_open(struct inode *inode, struct file *file) for (i = 0; i < ca->slot_count; i++) { if (ca->slot_info[i].slot_state == DVB_CA_SLOTSTATE_RUNNING) { + down_write(&ca->slot_info[i].sem); if (ca->slot_info[i].rx_buffer.data != NULL) { - /* it is safe to call this here without locks because - * ca->open == 0. Data is not read in this case */ dvb_ringbuffer_flush(&ca->slot_info[i].rx_buffer); } + up_write(&ca->slot_info[i].sem); } } @@ -1584,6 +1607,7 @@ static unsigned int dvb_ca_en50221_io_poll(struct file *file, poll_table * wait) dprintk("%s\n", __FUNCTION__); if (dvb_ca_en50221_io_read_condition(ca, &result, &slot) == 1) { + up_read(&ca->slot_info[slot].sem); mask |= POLLIN; } @@ -1595,6 +1619,7 @@ static unsigned int dvb_ca_en50221_io_poll(struct file *file, poll_table * wait) poll_wait(file, &ca->wait_queue, wait); if (dvb_ca_en50221_io_read_condition(ca, &result, &slot) == 1) { + up_read(&ca->slot_info[slot].sem); mask |= POLLIN; } @@ -1684,6 +1709,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, ca->slot_info[i].slot_state = DVB_CA_SLOTSTATE_NONE; atomic_set(&ca->slot_info[i].camchange_count, 0); ca->slot_info[i].camchange_type = DVB_CA_EN50221_CAMCHANGE_REMOVED; + init_rwsem(&ca->slot_info[i].sem); } if (signal_pending(current)) { @@ -1703,7 +1729,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, ca->thread_pid = ret; return 0; -error: + error: if (ca != NULL) { if (ca->dvbdev != NULL) dvb_unregister_device(ca->dvbdev); @@ -1745,9 +1771,6 @@ void dvb_ca_en50221_release(struct dvb_ca_en50221 *pubca) for (i = 0; i < ca->slot_count; i++) { dvb_ca_en50221_slot_shutdown(ca, i); - if (ca->slot_info[i].rx_buffer.data != NULL) { - vfree(ca->slot_info[i].rx_buffer.data); - } } kfree(ca->slot_info); dvb_unregister_device(ca->dvbdev); diff --git a/trunk/drivers/media/dvb/dvb-core/dvb_net.c b/trunk/drivers/media/dvb/dvb-core/dvb_net.c index df536bd2e103..87935490bfb2 100644 --- a/trunk/drivers/media/dvb/dvb-core/dvb_net.c +++ b/trunk/drivers/media/dvb/dvb-core/dvb_net.c @@ -151,8 +151,6 @@ struct dvb_net_priv { unsigned char ule_bridged; /* Whether the ULE_BRIDGED extension header was found. */ int ule_sndu_remain; /* Nr. of bytes still required for current ULE SNDU. */ unsigned long ts_count; /* Current ts cell counter. */ - - struct semaphore mutex; }; @@ -883,13 +881,12 @@ static int dvb_net_filter_sec_set(struct net_device *dev, static int dvb_net_feed_start(struct net_device *dev) { - int ret = 0, i; + int ret, i; struct dvb_net_priv *priv = dev->priv; struct dmx_demux *demux = priv->demux; unsigned char *mac = (unsigned char *) dev->dev_addr; dprintk("%s: rx_mode %i\n", __FUNCTION__, priv->rx_mode); - down(&priv->mutex); if (priv->tsfeed || priv->secfeed || priv->secfilter || priv->multi_secfilter[0]) printk("%s: BUG %d\n", __FUNCTION__, __LINE__); @@ -903,7 +900,7 @@ static int dvb_net_feed_start(struct net_device *dev) dvb_net_sec_callback); if (ret<0) { printk("%s: could not allocate section feed\n", dev->name); - goto error; + return ret; } ret = priv->secfeed->set(priv->secfeed, priv->pid, 32768, 1); @@ -912,7 +909,7 @@ static int dvb_net_feed_start(struct net_device *dev) printk("%s: could not set section feed\n", dev->name); priv->demux->release_section_feed(priv->demux, priv->secfeed); priv->secfeed=NULL; - goto error; + return ret; } if (priv->rx_mode != RX_MODE_PROMISC) { @@ -951,7 +948,7 @@ static int dvb_net_feed_start(struct net_device *dev) ret = demux->allocate_ts_feed(demux, &priv->tsfeed, dvb_net_ts_callback); if (ret < 0) { printk("%s: could not allocate ts feed\n", dev->name); - goto error; + return ret; } /* Set netdevice pointer for ts decaps callback. */ @@ -965,26 +962,23 @@ static int dvb_net_feed_start(struct net_device *dev) printk("%s: could not set ts feed\n", dev->name); priv->demux->release_ts_feed(priv->demux, priv->tsfeed); priv->tsfeed = NULL; - goto error; + return ret; } dprintk("%s: start filtering\n", __FUNCTION__); priv->tsfeed->start_filtering(priv->tsfeed); } else - ret = -EINVAL; + return -EINVAL; -error: - up(&priv->mutex); - return ret; + return 0; } static int dvb_net_feed_stop(struct net_device *dev) { struct dvb_net_priv *priv = dev->priv; - int i, ret = 0; + int i; dprintk("%s\n", __FUNCTION__); - down(&priv->mutex); if (priv->feedtype == DVB_NET_FEEDTYPE_MPE) { if (priv->secfeed) { if (priv->secfeed->is_filtering) { @@ -1025,9 +1019,8 @@ static int dvb_net_feed_stop(struct net_device *dev) else printk("%s: no ts feed to stop\n", dev->name); } else - ret = -EINVAL; - up(&priv->mutex); - return ret; + return -EINVAL; + return 0; } @@ -1051,8 +1044,8 @@ static void wq_set_multicast_list (void *data) struct dvb_net_priv *priv = dev->priv; dvb_net_feed_stop(dev); + priv->rx_mode = RX_MODE_UNI; - spin_lock_bh(&dev->xmit_lock); if (dev->flags & IFF_PROMISC) { dprintk("%s: promiscuous mode\n", dev->name); @@ -1077,7 +1070,6 @@ static void wq_set_multicast_list (void *data) } } - spin_unlock_bh(&dev->xmit_lock); dvb_net_feed_start(dev); } @@ -1208,7 +1200,6 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype) INIT_WORK(&priv->set_multicast_list_wq, wq_set_multicast_list, net); INIT_WORK(&priv->restart_net_feed_wq, wq_restart_net_feed, net); - init_MUTEX(&priv->mutex); net->base_addr = pid; diff --git a/trunk/drivers/media/dvb/dvb-usb/a800.c b/trunk/drivers/media/dvb/dvb-usb/a800.c index 8c7beffb045f..49f541d9a042 100644 --- a/trunk/drivers/media/dvb/dvb-usb/a800.c +++ b/trunk/drivers/media/dvb/dvb-usb/a800.c @@ -65,7 +65,7 @@ static struct dvb_usb_rc_key a800_rc_keys[] = { }; -static int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state) +int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { u8 key[5]; if (usb_control_msg(d->udev,usb_rcvctrlpipe(d->udev,0), diff --git a/trunk/drivers/media/dvb/dvb-usb/dibusb-common.c b/trunk/drivers/media/dvb/dvb-usb/dibusb-common.c index 269d899da488..00b946419b40 100644 --- a/trunk/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/trunk/drivers/media/dvb/dvb-usb/dibusb-common.c @@ -21,9 +21,9 @@ MODULE_LICENSE("GPL"); int dibusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) { if (d->priv != NULL) { - struct dibusb_state *st = d->priv; - if (st->ops.fifo_ctrl != NULL) - if (st->ops.fifo_ctrl(d->fe,onoff)) { + struct dib_fe_xfer_ops *ops = d->priv; + if (ops->fifo_ctrl != NULL) + if (ops->fifo_ctrl(d->fe,onoff)) { err("error while controlling the fifo of the demod."); return -ENODEV; } @@ -35,9 +35,9 @@ EXPORT_SYMBOL(dibusb_streaming_ctrl); int dibusb_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int onoff) { if (d->priv != NULL) { - struct dibusb_state *st = d->priv; - if (st->ops.pid_ctrl != NULL) - st->ops.pid_ctrl(d->fe,index,pid,onoff); + struct dib_fe_xfer_ops *ops = d->priv; + if (d->pid_filtering && ops->pid_ctrl != NULL) + ops->pid_ctrl(d->fe,index,pid,onoff); } return 0; } @@ -46,9 +46,9 @@ EXPORT_SYMBOL(dibusb_pid_filter); int dibusb_pid_filter_ctrl(struct dvb_usb_device *d, int onoff) { if (d->priv != NULL) { - struct dibusb_state *st = d->priv; - if (st->ops.pid_parse != NULL) - if (st->ops.pid_parse(d->fe,onoff) < 0) + struct dib_fe_xfer_ops *ops = d->priv; + if (ops->pid_parse != NULL) + if (ops->pid_parse(d->fe,onoff) < 0) err("could not handle pid_parser"); } return 0; diff --git a/trunk/drivers/media/dvb/dvb-usb/digitv.c b/trunk/drivers/media/dvb/dvb-usb/digitv.c index f98e306a5759..74545f82eff1 100644 --- a/trunk/drivers/media/dvb/dvb-usb/digitv.c +++ b/trunk/drivers/media/dvb/dvb-usb/digitv.c @@ -148,7 +148,7 @@ static struct dvb_usb_rc_key digitv_rc_keys[] = { }; /* TODO is it really the NEC protocol ? */ -static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) +int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { u8 key[5]; diff --git a/trunk/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/trunk/drivers/media/dvb/dvb-usb/dvb-usb-init.c index dd8e0b94edba..a902059812a2 100644 --- a/trunk/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/trunk/drivers/media/dvb/dvb-usb/dvb-usb-init.c @@ -23,7 +23,7 @@ module_param_named(disable_rc_polling, dvb_usb_disable_rc_polling, int, 0644); MODULE_PARM_DESC(disable_rc_polling, "disable remote control polling (default: 0)."); /* general initialization functions */ -static int dvb_usb_exit(struct dvb_usb_device *d) +int dvb_usb_exit(struct dvb_usb_device *d) { deb_info("state before exiting everything: %x\n",d->state); dvb_usb_remote_exit(d); diff --git a/trunk/drivers/media/dvb/frontends/cx22702.c b/trunk/drivers/media/dvb/frontends/cx22702.c index d9a8ede14b45..9f639297a9f2 100644 --- a/trunk/drivers/media/dvb/frontends/cx22702.c +++ b/trunk/drivers/media/dvb/frontends/cx22702.c @@ -7,7 +7,7 @@ Copyright (C) 2001-2002 Convergence Integrated Media GmbH Holger Waechtler - Copyright (C) 2004 Steven Toth + Copyright (C) 2004 Steven Toth 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 diff --git a/trunk/drivers/media/dvb/frontends/cx22702.h b/trunk/drivers/media/dvb/frontends/cx22702.h index 1f250885d2ce..11f86806756e 100644 --- a/trunk/drivers/media/dvb/frontends/cx22702.h +++ b/trunk/drivers/media/dvb/frontends/cx22702.h @@ -7,7 +7,7 @@ Copyright (C) 2001-2002 Convergence Integrated Media GmbH Holger Waechtler - Copyright (C) 2004 Steven Toth + Copyright (C) 2004 Steven Toth 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 diff --git a/trunk/drivers/media/dvb/frontends/nxt200x.c b/trunk/drivers/media/dvb/frontends/nxt200x.c index 84b62881cea7..bad0933eb714 100644 --- a/trunk/drivers/media/dvb/frontends/nxt200x.c +++ b/trunk/drivers/media/dvb/frontends/nxt200x.c @@ -44,8 +44,6 @@ #include #include #include -#include -#include #include "dvb_frontend.h" #include "dvb-pll.h" diff --git a/trunk/drivers/media/dvb/frontends/ves1820.c b/trunk/drivers/media/dvb/frontends/ves1820.c index ad8647a3c85e..c6d276618e86 100644 --- a/trunk/drivers/media/dvb/frontends/ves1820.c +++ b/trunk/drivers/media/dvb/frontends/ves1820.c @@ -140,25 +140,25 @@ static int ves1820_set_symbolrate(struct ves1820_state *state, u32 symbolrate) /* yeuch! */ fpxin = state->config->xin * 10; fptmp = fpxin; do_div(fptmp, 123); - if (symbolrate < fptmp) + if (symbolrate < fptmp); SFIL = 1; fptmp = fpxin; do_div(fptmp, 160); - if (symbolrate < fptmp) + if (symbolrate < fptmp); SFIL = 0; fptmp = fpxin; do_div(fptmp, 246); - if (symbolrate < fptmp) + if (symbolrate < fptmp); SFIL = 1; fptmp = fpxin; do_div(fptmp, 320); - if (symbolrate < fptmp) + if (symbolrate < fptmp); SFIL = 0; fptmp = fpxin; do_div(fptmp, 492); - if (symbolrate < fptmp) + if (symbolrate < fptmp); SFIL = 1; fptmp = fpxin; do_div(fptmp, 640); - if (symbolrate < fptmp) + if (symbolrate < fptmp); SFIL = 0; fptmp = fpxin; do_div(fptmp, 984); - if (symbolrate < fptmp) + if (symbolrate < fptmp); SFIL = 1; fin = state->config->xin >> 4; diff --git a/trunk/drivers/media/dvb/ttpci/Kconfig b/trunk/drivers/media/dvb/ttpci/Kconfig index fa5034a9ecf5..d8bf65877897 100644 --- a/trunk/drivers/media/dvb/ttpci/Kconfig +++ b/trunk/drivers/media/dvb/ttpci/Kconfig @@ -81,7 +81,6 @@ config DVB_BUDGET_CI tristate "Budget cards with onboard CI connector" depends on DVB_CORE && PCI select VIDEO_SAA7146 - select DVB_STV0297 select DVB_STV0299 select DVB_TDA1004X help diff --git a/trunk/drivers/media/dvb/ttpci/av7110_ca.c b/trunk/drivers/media/dvb/ttpci/av7110_ca.c index 6079e8865d5b..c3801e328fe9 100644 --- a/trunk/drivers/media/dvb/ttpci/av7110_ca.c +++ b/trunk/drivers/media/dvb/ttpci/av7110_ca.c @@ -40,7 +40,6 @@ #include "av7110.h" #include "av7110_hw.h" -#include "av7110_ca.h" void CI_handle(struct av7110 *av7110, u8 *data, u16 len) diff --git a/trunk/drivers/media/dvb/ttpci/budget-av.c b/trunk/drivers/media/dvb/ttpci/budget-av.c index 9f51bae7194c..aa75dc03a0b3 100644 --- a/trunk/drivers/media/dvb/ttpci/budget-av.c +++ b/trunk/drivers/media/dvb/ttpci/budget-av.c @@ -1020,8 +1020,6 @@ MODULE_DEVICE_TABLE(pci, pci_tbl); static struct saa7146_extension budget_extension = { .name = "budget_av", - .flags = SAA7146_I2C_SHORT_DELAY, - .pci_tbl = pci_tbl, .module = THIS_MODULE, diff --git a/trunk/drivers/media/dvb/ttpci/budget-ci.c b/trunk/drivers/media/dvb/ttpci/budget-ci.c index b9b3cd9c0369..75fb92d60998 100644 --- a/trunk/drivers/media/dvb/ttpci/budget-ci.c +++ b/trunk/drivers/media/dvb/ttpci/budget-ci.c @@ -1166,7 +1166,7 @@ MODULE_DEVICE_TABLE(pci, pci_tbl); static struct saa7146_extension budget_extension = { .name = "budget_ci dvb\0", - .flags = SAA7146_I2C_SHORT_DELAY, + .flags = 0, .module = THIS_MODULE, .pci_tbl = &pci_tbl[0], diff --git a/trunk/drivers/media/dvb/ttpci/budget.c b/trunk/drivers/media/dvb/ttpci/budget.c index bc4ce7559cbe..4fd8bbc47037 100644 --- a/trunk/drivers/media/dvb/ttpci/budget.c +++ b/trunk/drivers/media/dvb/ttpci/budget.c @@ -738,7 +738,7 @@ MODULE_DEVICE_TABLE(pci, pci_tbl); static struct saa7146_extension budget_extension = { .name = "budget dvb\0", - .flags = SAA7146_I2C_SHORT_DELAY, + .flags = 0, .module = THIS_MODULE, .pci_tbl = pci_tbl, diff --git a/trunk/drivers/media/dvb/ttpci/ttpci-eeprom.c b/trunk/drivers/media/dvb/ttpci/ttpci-eeprom.c index ac79ef178c05..e9a8457b0727 100644 --- a/trunk/drivers/media/dvb/ttpci/ttpci-eeprom.c +++ b/trunk/drivers/media/dvb/ttpci/ttpci-eeprom.c @@ -37,7 +37,6 @@ #include #include -#include "ttpci-eeprom.h" #if 1 #define dprintk(x...) do { printk(x); } while (0) diff --git a/trunk/drivers/media/video/Kconfig b/trunk/drivers/media/video/Kconfig index cc4a723e24db..ecb9a31dd003 100644 --- a/trunk/drivers/media/video/Kconfig +++ b/trunk/drivers/media/video/Kconfig @@ -32,6 +32,9 @@ config VIDEO_BT848_DVB ---help--- This adds support for DVB/ATSC cards based on the BT878 chip. + To compile this driver as a module, choose M here: the + module will be called dvb-bt8xx. + config VIDEO_SAA6588 tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards" depends on VIDEO_DEV && I2C && VIDEO_BT848 diff --git a/trunk/drivers/media/video/bttv-cards.c b/trunk/drivers/media/video/bttv-cards.c index 012be639aa18..e31ebb11c468 100644 --- a/trunk/drivers/media/video/bttv-cards.c +++ b/trunk/drivers/media/video/bttv-cards.c @@ -2904,7 +2904,7 @@ void __devinit bttv_idcard(struct bttv *btv) */ /* Some Modular Technology cards have an eeprom, but no subsystem ID */ -static void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256]) +void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256]) { int type = -1; @@ -3879,7 +3879,7 @@ static void __devinit init_PXC200(struct bttv *btv) * error. ERROR_CPLD_Check_Failed. */ /* ----------------------------------------------------------------------- */ -static void +void init_RTV24 (struct bttv *btv) { uint32_t dataRead = 0; @@ -4103,7 +4103,7 @@ void tea5757_set_freq(struct bttv *btv, unsigned short freq) /* ----------------------------------------------------------------------- */ /* winview */ -static void winview_audio(struct bttv *btv, struct video_audio *v, int set) +void winview_audio(struct bttv *btv, struct video_audio *v, int set) { /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */ int bits_out, loops, vol, data; diff --git a/trunk/drivers/media/video/bttv-driver.c b/trunk/drivers/media/video/bttv-driver.c index 3c58a2a68906..709099f03bd2 100644 --- a/trunk/drivers/media/video/bttv-driver.c +++ b/trunk/drivers/media/video/bttv-driver.c @@ -1720,7 +1720,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) memset(i,0,sizeof(*i)); i->index = n; i->type = V4L2_INPUT_TYPE_CAMERA; - i->audioset = 0; + i->audioset = 1; if (i->index == bttv_tvcards[btv->c.type].tuner) { sprintf(i->name, "Television"); i->type = V4L2_INPUT_TYPE_TUNER; @@ -1771,19 +1771,11 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) memset(t,0,sizeof(*t)); strcpy(t->name, "Television"); t->type = V4L2_TUNER_ANALOG_TV; + t->rangehigh = 0xffffffffUL; t->capability = V4L2_TUNER_CAP_NORM; t->rxsubchans = V4L2_TUNER_SUB_MONO; if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC) t->signal = 0xffff; - { - struct video_tuner tuner; - - memset(&tuner, 0, sizeof (tuner)); - tuner.rangehigh = 0xffffffffUL; - bttv_call_i2c_clients(btv, VIDIOCGTUNER, &tuner); - t->rangelow = tuner.rangelow; - t->rangehigh = tuner.rangehigh; - } { /* Hmmm ... */ struct video_audio va; @@ -1861,7 +1853,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) } case VIDIOC_LOG_STATUS: { - bttv_call_i2c_clients(btv, VIDIOC_LOG_STATUS, NULL); + bttv_call_i2c_clients(btv, VIDIOC_LOG_STATUS, 0); return 0; } @@ -2037,33 +2029,19 @@ static int bttv_switch_type(struct bttv_fh *fh, enum v4l2_buf_type type) return 0; } -static void -pix_format_set_size (struct v4l2_pix_format * f, - const struct bttv_format * fmt, - unsigned int width, - unsigned int height) -{ - f->width = width; - f->height = height; - - if (fmt->flags & FORMAT_FLAGS_PLANAR) { - f->bytesperline = width; /* Y plane */ - f->sizeimage = (width * height * fmt->depth) >> 3; - } else { - f->bytesperline = (width * fmt->depth) >> 3; - f->sizeimage = height * f->bytesperline; - } -} - static int bttv_g_fmt(struct bttv_fh *fh, struct v4l2_format *f) { switch (f->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: memset(&f->fmt.pix,0,sizeof(struct v4l2_pix_format)); - pix_format_set_size (&f->fmt.pix, fh->fmt, - fh->width, fh->height); + f->fmt.pix.width = fh->width; + f->fmt.pix.height = fh->height; f->fmt.pix.field = fh->cap.field; f->fmt.pix.pixelformat = fh->fmt->fourcc; + f->fmt.pix.bytesperline = + (f->fmt.pix.width * fh->fmt->depth) >> 3; + f->fmt.pix.sizeimage = + f->fmt.pix.height * f->fmt.pix.bytesperline; return 0; case V4L2_BUF_TYPE_VIDEO_OVERLAY: memset(&f->fmt.win,0,sizeof(struct v4l2_window)); @@ -2128,9 +2106,11 @@ static int bttv_try_fmt(struct bttv_fh *fh, struct bttv *btv, f->fmt.pix.width = maxw; if (f->fmt.pix.height > maxh) f->fmt.pix.height = maxh; - pix_format_set_size (&f->fmt.pix, fmt, - f->fmt.pix.width & ~3, - f->fmt.pix.height); + f->fmt.pix.width &= ~0x03; + f->fmt.pix.bytesperline = + (f->fmt.pix.width * fmt->depth) >> 3; + f->fmt.pix.sizeimage = + f->fmt.pix.height * f->fmt.pix.bytesperline; return 0; } @@ -2298,15 +2278,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, retval = -EINVAL; goto fh_unlock_and_return; } - if (fmt->flags & FORMAT_FLAGS_RAW) { - /* VIDIOCMCAPTURE uses gbufsize, not RAW_BPL * - RAW_LINES * 2. F1 is stored at offset 0, F2 - at buffer size / 2. */ - fh->width = RAW_BPL; - fh->height = gbufsize / RAW_BPL; - btv->init.width = RAW_BPL; - btv->init.height = gbufsize / RAW_BPL; - } fh->ovfmt = fmt; fh->fmt = fmt; btv->init.ovfmt = fmt; @@ -2618,11 +2589,9 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, if (0 == v4l2) return -EINVAL; - memset(cap, 0, sizeof (*cap)); - strlcpy(cap->driver, "bttv", sizeof (cap->driver)); - strlcpy(cap->card, btv->video_dev->name, sizeof (cap->card)); - snprintf(cap->bus_info, sizeof (cap->bus_info), - "PCI:%s", pci_name(btv->c.pci)); + strcpy(cap->driver,"bttv"); + strlcpy(cap->card,btv->video_dev->name,sizeof(cap->card)); + sprintf(cap->bus_info,"PCI:%s",pci_name(btv->c.pci)); cap->version = BTTV_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | @@ -2983,8 +2952,6 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; field = videobuf_next_field(&fh->cap); if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) { - kfree (fh->cap.read_buf); - fh->cap.read_buf = NULL; up(&fh->cap.lock); return POLLERR; } diff --git a/trunk/drivers/media/video/cx25840/cx25840-core.c b/trunk/drivers/media/video/cx25840/cx25840-core.c index aea3f038cff6..f6afeec499c5 100644 --- a/trunk/drivers/media/video/cx25840/cx25840-core.c +++ b/trunk/drivers/media/video/cx25840/cx25840-core.c @@ -208,11 +208,8 @@ static void cx25840_initialize(struct i2c_client *client, int loadfw) static void input_change(struct i2c_client *client) { - struct cx25840_state *state = i2c_get_clientdata(client); v4l2_std_id std = cx25840_get_v4lstd(client); - /* Note: perhaps V4L2_STD_PAL_M should be handled as V4L2_STD_NTSC - instead of V4L2_STD_PAL. Someone needs to test this. */ if (std & V4L2_STD_PAL) { /* Follow tuner change procedure for PAL */ cx25840_write(client, 0x808, 0xff); @@ -223,32 +220,7 @@ static void input_change(struct i2c_client *client) cx25840_write(client, 0x80b, 0x10); } else if (std & V4L2_STD_NTSC) { /* NTSC */ - if (state->cardtype == CARDTYPE_PVR150_WORKAROUND) { - /* Certain Hauppauge PVR150 models have a hardware bug - that causes audio to drop out. For these models the - audio standard must be set explicitly. - To be precise: it affects cards with tuner models - 85, 99 and 112 (model numbers from tveeprom). */ - if (std == V4L2_STD_NTSC_M_JP) { - /* Japan uses EIAJ audio standard */ - cx25840_write(client, 0x808, 0x2f); - } else { - /* Others use the BTSC audio standard */ - cx25840_write(client, 0x808, 0x1f); - } - /* South Korea uses the A2-M (aka Zweiton M) audio - standard, and should set 0x808 to 0x3f, but I don't - know how to detect this. */ - } else if (std == V4L2_STD_NTSC_M_JP) { - /* Japan uses EIAJ audio standard */ - cx25840_write(client, 0x808, 0xf7); - } else { - /* Others use the BTSC audio standard */ - cx25840_write(client, 0x808, 0xf6); - } - /* South Korea uses the A2-M (aka Zweiton M) audio standard, - and should set 0x808 to 0xf8, but I don't know how to - detect this. */ + cx25840_write(client, 0x808, 0xf6); cx25840_write(client, 0x80b, 0x00); } @@ -269,8 +241,7 @@ static int set_input(struct i2c_client *client, enum cx25840_input input) case CX25840_TUNER: cx25840_dbg("now setting Tuner input\n"); - if (state->cardtype == CARDTYPE_PVR150 || - state->cardtype == CARDTYPE_PVR150_WORKAROUND) { + if (state->cardtype == CARDTYPE_PVR150) { /* CH_SEL_ADC2=1 */ cx25840_and_or(client, 0x102, ~0x2, 0x02); } @@ -392,7 +363,6 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) case CX25840_CID_CARDTYPE: switch (ctrl->value) { case CARDTYPE_PVR150: - case CARDTYPE_PVR150_WORKAROUND: case CARDTYPE_PG600: state->cardtype = ctrl->value; break; @@ -744,7 +714,7 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, /* ----------------------------------------------------------------------- */ -static struct i2c_driver i2c_driver_cx25840; +struct i2c_driver i2c_driver_cx25840; static int cx25840_detect_client(struct i2c_adapter *adapter, int address, int kind) @@ -837,7 +807,7 @@ static int cx25840_detach_client(struct i2c_client *client) /* ----------------------------------------------------------------------- */ -static struct i2c_driver i2c_driver_cx25840 = { +struct i2c_driver i2c_driver_cx25840 = { .name = "cx25840", .id = I2C_DRIVERID_CX25840, diff --git a/trunk/drivers/media/video/cx25840/cx25840.h b/trunk/drivers/media/video/cx25840/cx25840.h index 4932ed1c9b19..5c3f0639fb77 100644 --- a/trunk/drivers/media/video/cx25840/cx25840.h +++ b/trunk/drivers/media/video/cx25840/cx25840.h @@ -40,16 +40,9 @@ extern int cx25840_debug; #define CX25840_CID_CARDTYPE (V4L2_CID_PRIVATE_BASE+0) -/* The CARDTYPE_PVR150_WORKAROUND cardtype activates a workaround for a - hardware bug that is present in PVR150 (and possible PVR500) cards that - have certain NTSC tuners (tveeprom model numbers 85, 99 and 112). The - audio autodetect fails on some channels for these models and the workaround - is to select the audio standard explicitly. Many thanks to Hauppauge for - providing this information. */ enum cx25840_cardtype { CARDTYPE_PVR150, - CARDTYPE_PG600, - CARDTYPE_PVR150_WORKAROUND, + CARDTYPE_PG600 }; enum cx25840_input { diff --git a/trunk/drivers/media/video/cx88/cx88-cards.c b/trunk/drivers/media/video/cx88/cx88-cards.c index 24651661630a..f2268631b7c0 100644 --- a/trunk/drivers/media/video/cx88/cx88-cards.c +++ b/trunk/drivers/media/video/cx88/cx88-cards.c @@ -1083,28 +1083,41 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data) tveeprom_hauppauge_analog(&core->i2c_client, &tv, eeprom_data); core->tuner_type = tv.tuner_type; core->has_radio = tv.has_radio; +} - /* Make sure we support the board model */ - switch (tv.model) - { - case 90002: /* Nova-T-PCI (9002) */ - case 92001: /* Nova-S-Plus (Video and IR) */ - case 92002: /* Nova-S-Plus (Video and IR) */ - case 90003: /* Nova-T-PCI (9002 No RF out) */ - case 90500: /* Nova-T-PCI (oem) */ - case 90501: /* Nova-T-PCI (oem/IR) */ - case 92000: /* Nova-SE2 (OEM, No Video or IR) */ +static int hauppauge_eeprom_dvb(struct cx88_core *core, u8 *ee) +{ + int model; + int tuner; + /* Make sure we support the board model */ + model = ee[0x1f] << 24 | ee[0x1e] << 16 | ee[0x1d] << 8 | ee[0x1c]; + switch(model) { + case 90002: + case 90500: + case 90501: /* known */ break; default: printk("%s: warning: unknown hauppauge model #%d\n", - core->name, tv.model); + core->name, model); break; } - printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n", - core->name, tv.model); + /* Make sure we support the tuner */ + tuner = ee[0x2d]; + switch(tuner) { + case 0x4B: /* dtt 7595 */ + case 0x4C: /* dtt 7592 */ + break; + default: + printk("%s: error: unknown hauppauge tuner 0x%02x\n", + core->name, tuner); + return -ENODEV; + } + printk(KERN_INFO "%s: hauppauge eeprom: model=%d, tuner=%d\n", + core->name, model, tuner); + return 0; } /* ----------------------------------------------------------------------- */ @@ -1188,7 +1201,7 @@ void cx88_card_list(struct cx88_core *core, struct pci_dev *pci) void cx88_card_setup(struct cx88_core *core) { - static u8 eeprom[256]; + static u8 eeprom[128]; if (0 == core->i2c_rc) { core->i2c_client.addr = 0xa0 >> 1; @@ -1211,7 +1224,7 @@ void cx88_card_setup(struct cx88_core *core) break; case CX88_BOARD_HAUPPAUGE_DVB_T1: if (0 == core->i2c_rc) - hauppauge_eeprom(core,eeprom); + hauppauge_eeprom_dvb(core,eeprom); break; case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: diff --git a/trunk/drivers/media/video/cx88/cx88-core.c b/trunk/drivers/media/video/cx88/cx88-core.c index bb6eb54e19ce..eb806af17182 100644 --- a/trunk/drivers/media/video/cx88/cx88-core.c +++ b/trunk/drivers/media/video/cx88/cx88-core.c @@ -837,29 +837,6 @@ static int set_pll(struct cx88_core *core, int prescale, u32 ofreq) return -1; } -int cx88_start_audio_dma(struct cx88_core *core) -{ - /* setup fifo + format */ - cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], 128, 0); - cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH26], 128, 0); - - cx_write(MO_AUDD_LNGTH, 128); /* fifo bpl size */ - cx_write(MO_AUDR_LNGTH, 128); /* fifo bpl size */ - - /* start dma */ - cx_write(MO_AUD_DMACNTRL, 0x0003); /* Up and Down fifo enable */ - - return 0; -} - -int cx88_stop_audio_dma(struct cx88_core *core) -{ - /* stop dma */ - cx_write(MO_AUD_DMACNTRL, 0x0000); - - return 0; -} - static int set_tvaudio(struct cx88_core *core) { struct cx88_tvnorm *norm = core->tvnorm; @@ -900,16 +877,12 @@ static int set_tvaudio(struct cx88_core *core) cx88_set_tvaudio(core); /* cx88_set_stereo(dev,V4L2_TUNER_MODE_STEREO); */ -/* - This should be needed only on cx88-alsa. It seems that some cx88 chips have - bugs and does require DMA enabled for it to work. - */ - cx88_start_audio_dma(core); + cx_write(MO_AUDD_LNGTH, 128); /* fifo size */ + cx_write(MO_AUDR_LNGTH, 128); /* fifo size */ + cx_write(MO_AUD_DMACNTRL, 0x03); /* need audio fifo */ return 0; } - - int cx88_set_tvnorm(struct cx88_core *core, struct cx88_tvnorm *norm) { u32 fsc8; @@ -1231,8 +1204,6 @@ EXPORT_SYMBOL(cx88_set_scale); EXPORT_SYMBOL(cx88_vdev_init); EXPORT_SYMBOL(cx88_core_get); EXPORT_SYMBOL(cx88_core_put); -EXPORT_SYMBOL(cx88_start_audio_dma); -EXPORT_SYMBOL(cx88_stop_audio_dma); /* * Local variables: diff --git a/trunk/drivers/media/video/cx88/cx88-tvaudio.c b/trunk/drivers/media/video/cx88/cx88-tvaudio.c index a1b120c8a9b5..6d9bec1c583b 100644 --- a/trunk/drivers/media/video/cx88/cx88-tvaudio.c +++ b/trunk/drivers/media/video/cx88/cx88-tvaudio.c @@ -119,10 +119,13 @@ static void set_audio_registers(struct cx88_core *core, const struct rlist *l) static void set_audio_start(struct cx88_core *core, u32 mode) { - /* mute */ + // mute cx_write(AUD_VOL_CTL, (1 << 6)); - /* start programming */ + // start programming + cx_write(MO_AUD_DMACNTRL, 0x0000); + msleep(100); + //cx_write(AUD_CTL, 0x0000); cx_write(AUD_INIT, mode); cx_write(AUD_INIT_LD, 0x0001); cx_write(AUD_SOFT_RESET, 0x0001); @@ -132,21 +135,17 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl) { u32 volume; - /* restart dma; This avoids buzz in NICAM and is good in others */ - cx88_stop_audio_dma(core); - cx_write(AUD_RATE_THRES_DMD, 0x000000C0); - cx88_start_audio_dma(core); - if (cx88_boards[core->board].blackbird) { - /* sets sound input from external adc */ + // sets sound input from external adc cx_set(AUD_CTL, EN_I2SIN_ENABLE); + //cx_write(AUD_I2SINPUTCNTL, 0); cx_write(AUD_I2SINPUTCNTL, 4); cx_write(AUD_BAUDRATE, 1); - /* 'pass-thru mode': this enables the i2s output to the mpeg encoder */ + // 'pass-thru mode': this enables the i2s output to the mpeg encoder cx_set(AUD_CTL, EN_I2SOUT_ENABLE); cx_write(AUD_I2SOUTPUTCNTL, 1); cx_write(AUD_I2SCNTL, 0); - /* cx_write(AUD_APB_IN_RATE_ADJ, 0); */ + //cx_write(AUD_APB_IN_RATE_ADJ, 0); } else { ctl |= EN_DAC_ENABLE; cx_write(AUD_CTL, ctl); @@ -154,6 +153,7 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl) /* finish programming */ cx_write(AUD_SOFT_RESET, 0x0000); + cx_write(MO_AUD_DMACNTRL, 0x0003); /* unmute */ volume = cx_sread(SHADOW_AUD_VOL_CTL); @@ -313,6 +313,7 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode) {AUD_RATE_ADJ3, 0x00000100}, {AUD_RATE_ADJ4, 0x00000400}, {AUD_RATE_ADJ5, 0x00001000}, + //{ AUD_DMD_RA_DDS, 0x00c0d5ce }, {AUD_ERRLOGPERIOD_R, 0x00000fff}, {AUD_ERRINTRPTTHSHLD1_R, 0x000003ff}, {AUD_ERRINTRPTTHSHLD2_R, 0x000000ff}, @@ -350,12 +351,12 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode) set_audio_registers(core, nicam_l); break; case WW_I: - dprintk("%s PAL-I NICAM (status: known-good)\n", __FUNCTION__); + dprintk("%s PAL-I NICAM (status: devel)\n", __FUNCTION__); set_audio_registers(core, nicam_bgdki_common); set_audio_registers(core, nicam_i); break; default: - dprintk("%s PAL-BGDK NICAM (status: known-good)\n", __FUNCTION__); + dprintk("%s PAL-BGDK NICAM (status: unknown)\n", __FUNCTION__); set_audio_registers(core, nicam_bgdki_common); set_audio_registers(core, nicam_default); break; @@ -714,7 +715,8 @@ int cx88_detect_nicam(struct cx88_core *core) /* if bit1=1 then nicam is detected */ j += ((cx_read(AUD_NICAM_STATUS2) & 0x02) >> 1); - if (j == 1) { + /* 3x detected: absolutly sure now */ + if (j == 3) { dprintk("nicam is detected.\n"); return 1; } diff --git a/trunk/drivers/media/video/cx88/cx88.h b/trunk/drivers/media/video/cx88/cx88.h index 27fb080fd7aa..b19d3a9e2298 100644 --- a/trunk/drivers/media/video/cx88/cx88.h +++ b/trunk/drivers/media/video/cx88/cx88.h @@ -491,10 +491,6 @@ extern struct cx88_core* cx88_core_get(struct pci_dev *pci); extern void cx88_core_put(struct cx88_core *core, struct pci_dev *pci); -extern int cx88_start_audio_dma(struct cx88_core *core); -extern int cx88_stop_audio_dma(struct cx88_core *core); - - /* ----------------------------------------------------------- */ /* cx88-vbi.c */ diff --git a/trunk/drivers/media/video/em28xx/em28xx-core.c b/trunk/drivers/media/video/em28xx/em28xx-core.c index 9f6e5e5355a1..d54bc0127484 100644 --- a/trunk/drivers/media/video/em28xx/em28xx-core.c +++ b/trunk/drivers/media/video/em28xx/em28xx-core.c @@ -32,7 +32,7 @@ /* #define ENABLE_DEBUG_ISOC_FRAMES */ -static unsigned int core_debug; +unsigned int core_debug; module_param(core_debug,int,0644); MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); @@ -41,7 +41,7 @@ MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); printk(KERN_INFO "%s %s :"fmt, \ dev->name, __FUNCTION__ , ##arg); } while (0) -static unsigned int reg_debug; +unsigned int reg_debug; module_param(reg_debug,int,0644); MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); @@ -50,7 +50,7 @@ MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); printk(KERN_INFO "%s %s :"fmt, \ dev->name, __FUNCTION__ , ##arg); } while (0) -static unsigned int isoc_debug; +unsigned int isoc_debug; module_param(isoc_debug,int,0644); MODULE_PARM_DESC(isoc_debug,"enable debug messages [isoc transfers]"); diff --git a/trunk/drivers/media/video/em28xx/em28xx-video.c b/trunk/drivers/media/video/em28xx/em28xx-video.c index abec32c175aa..57c1826b928e 100644 --- a/trunk/drivers/media/video/em28xx/em28xx-video.c +++ b/trunk/drivers/media/video/em28xx/em28xx-video.c @@ -226,7 +226,7 @@ static int em28xx_config(struct em28xx *dev) * em28xx_config_i2c() * configure i2c attached devices */ -static void em28xx_config_i2c(struct em28xx *dev) +void em28xx_config_i2c(struct em28xx *dev) { struct v4l2_frequency f; struct video_decoder_init em28xx_vdi = {.data = NULL }; diff --git a/trunk/drivers/media/video/ir-kbd-i2c.c b/trunk/drivers/media/video/ir-kbd-i2c.c index 124c502ea1f3..801c736e9328 100644 --- a/trunk/drivers/media/video/ir-kbd-i2c.c +++ b/trunk/drivers/media/video/ir-kbd-i2c.c @@ -278,7 +278,7 @@ static int ir_probe(struct i2c_adapter *adap); static struct i2c_driver driver = { .name = "ir remote kbd driver", - .id = I2C_DRIVERID_I2C_IR, + .id = I2C_DRIVERID_EXP3, /* FIXME */ .flags = I2C_DF_NOTIFY, .attach_adapter = ir_probe, .detach_client = ir_detach, diff --git a/trunk/drivers/media/video/saa7115.c b/trunk/drivers/media/video/saa7115.c index e717e30d8187..0235cef07b31 100644 --- a/trunk/drivers/media/video/saa7115.c +++ b/trunk/drivers/media/video/saa7115.c @@ -771,19 +771,17 @@ static v4l2_std_id saa7115_get_v4lstd(struct i2c_client *client) static void saa7115_log_status(struct i2c_client *client) { + static const char * const audclk_freq_strs[] = { + "44.1 kHz", + "48 kHz", + "32 kHz" + }; struct saa7115_state *state = i2c_get_clientdata(client); - char *audfreq = "undefined"; int reg1e, reg1f; int signalOk; int vcr; - switch (state->audclk_freq) { - case V4L2_AUDCLK_32_KHZ: audfreq = "32 kHz"; break; - case V4L2_AUDCLK_441_KHZ: audfreq = "44.1 kHz"; break; - case V4L2_AUDCLK_48_KHZ: audfreq = "48 kHz"; break; - } - - saa7115_info("Audio frequency: %s\n", audfreq); + saa7115_info("Audio frequency: %s\n", audclk_freq_strs[state->audclk_freq]); if (client->name[6] == '4') { /* status for the saa7114 */ reg1f = saa7115_read(client, 0x1f); diff --git a/trunk/drivers/media/video/saa711x.c b/trunk/drivers/media/video/saa711x.c index 59e13fdea780..25b30f352d84 100644 --- a/trunk/drivers/media/video/saa711x.c +++ b/trunk/drivers/media/video/saa711x.c @@ -323,7 +323,7 @@ saa711x_command (struct i2c_client *client, case VIDEO_MODE_SECAM: saa711x_write(client, 0x08, - (decoder->reg[0x08] & 0x3f) | 0x00); + (decoder->reg[0x0e] & 0x3f) | 0x00); saa711x_write(client, 0x0e, (decoder->reg[0x0e] & 0x8f) | 0x50); break; diff --git a/trunk/drivers/media/video/saa7127.c b/trunk/drivers/media/video/saa7127.c index 3428e1ed0032..843431f10e3b 100644 --- a/trunk/drivers/media/video/saa7127.c +++ b/trunk/drivers/media/video/saa7127.c @@ -223,7 +223,7 @@ static const struct i2c_reg_value saa7127_init_config_60hz[] = { }; #define SAA7127_50HZ_DAC_CONTROL 0x02 -static struct i2c_reg_value saa7127_init_config_50hz[] = { +struct i2c_reg_value saa7127_init_config_50hz[] = { { SAA7127_REG_BURST_START, 0x21 }, /* BURST_END is also used as a chip ID in saa7127_detect_client */ { SAA7127_REG_BURST_END, 0x1d }, @@ -696,7 +696,7 @@ static int saa7127_command(struct i2c_client *client, /* ----------------------------------------------------------------------- */ -static struct i2c_driver i2c_driver_saa7127; +struct i2c_driver i2c_driver_saa7127; /* ----------------------------------------------------------------------- */ @@ -818,7 +818,7 @@ static int saa7127_detach(struct i2c_client *client) /* ----------------------------------------------------------------------- */ -static struct i2c_driver i2c_driver_saa7127 = { +struct i2c_driver i2c_driver_saa7127 = { .name = "saa7127", .id = I2C_DRIVERID_SAA7127, .flags = I2C_DF_NOTIFY, diff --git a/trunk/drivers/media/video/saa7134/saa7134-alsa.c b/trunk/drivers/media/video/saa7134/saa7134-alsa.c index 263c6e2e3e8e..5707c666660b 100644 --- a/trunk/drivers/media/video/saa7134/saa7134-alsa.c +++ b/trunk/drivers/media/video/saa7134/saa7134-alsa.c @@ -58,6 +58,8 @@ static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s)."); +int position; + #define dprintk(fmt, arg...) if (debug) \ printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg) @@ -138,8 +140,7 @@ static void saa7134_dma_start(struct saa7134_dev *dev) * */ -static void saa7134_irq_alsa_done(struct saa7134_dev *dev, - unsigned long status) +void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status) { int next_blk, reg = 0; @@ -880,7 +881,7 @@ static void snd_saa7134_free(snd_card_t * card) * */ -static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) +int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) { snd_card_t *card; @@ -944,8 +945,6 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) sprintf(card->longname, "%s at 0x%lx irq %d", chip->dev->name, chip->iobase, chip->irq); - printk(KERN_INFO "%s/alsa: %s registered as card %d\n",dev->name,card->longname,index[devnum]); - if ((err = snd_card_register(card)) == 0) { snd_saa7134_cards[devnum] = card; return 0; @@ -956,22 +955,6 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) return err; } - -static int alsa_device_init(struct saa7134_dev *dev) -{ - dev->dmasound.priv_data = dev; - alsa_card_saa7134_create(dev,dev->nr); - return 1; -} - -static int alsa_device_exit(struct saa7134_dev *dev) -{ - - snd_card_free(snd_saa7134_cards[dev->nr]); - snd_saa7134_cards[dev->nr] = NULL; - return 1; -} - /* * Module initializer * @@ -985,21 +968,22 @@ static int saa7134_alsa_init(void) struct saa7134_dev *dev = NULL; struct list_head *list; + position = 0; + printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); list_for_each(list,&saa7134_devlist) { dev = list_entry(list, struct saa7134_dev, devlist); if (dev->dmasound.priv_data == NULL) { - alsa_device_init(dev); + dev->dmasound.priv_data = dev; + alsa_card_saa7134_create(dev,position); + position++; } else { printk(KERN_ERR "saa7134 ALSA: DMA sound is being handled by OSS. ignoring %s\n",dev->name); return -EBUSY; } } - dmasound_init = alsa_device_init; - dmasound_exit = alsa_device_exit; - if (dev == NULL) printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n"); @@ -1010,7 +994,7 @@ static int saa7134_alsa_init(void) * Module destructor */ -static void saa7134_alsa_exit(void) +void saa7134_alsa_exit(void) { int idx; diff --git a/trunk/drivers/media/video/saa7134/saa7134-core.c b/trunk/drivers/media/video/saa7134/saa7134-core.c index 1a093bf176f3..4275d2ddb864 100644 --- a/trunk/drivers/media/video/saa7134/saa7134-core.c +++ b/trunk/drivers/media/video/saa7134/saa7134-core.c @@ -88,9 +88,6 @@ LIST_HEAD(saa7134_devlist); static LIST_HEAD(mops_list); static unsigned int saa7134_devcount; -int (*dmasound_init)(struct saa7134_dev *dev); -int (*dmasound_exit)(struct saa7134_dev *dev); - #define dprintk(fmt, arg...) if (core_debug) \ printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg) @@ -187,7 +184,8 @@ void saa7134_track_gpio(struct saa7134_dev *dev, char *msg) /* ----------------------------------------------------------- */ /* delayed request_module */ -#if defined(CONFIG_MODULES) && defined(MODULE) +#ifdef CONFIG_MODULES + static int need_empress; static int need_dvb; static int need_alsa; @@ -236,7 +234,9 @@ static void request_module_depend(char *name, int *flag) } #else + #define request_module_depend(name,flag) + #endif /* CONFIG_MODULES */ /* ------------------------------------------------------------------ */ @@ -1017,10 +1017,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, /* check for signal */ saa7134_irq_video_intl(dev); - if (dmasound_init && !dev->dmasound.priv_data) { - dmasound_init(dev); - } - return 0; fail4: @@ -1044,11 +1040,6 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) struct list_head *item; struct saa7134_mpeg_ops *mops; - /* Release DMA sound modules if present */ - if (dmasound_exit && dev->dmasound.priv_data) { - dmasound_exit(dev); - } - /* debugging ... */ if (irq_debug) { u32 report = saa_readl(SAA7134_IRQ_REPORT); @@ -1080,7 +1071,6 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) saa7134_i2c_unregister(dev); saa7134_unregister_video(dev); - /* the DMA sound modules should be unloaded before reaching this, but just in case they are still present... */ if (dev->dmasound.priv_data != NULL) { @@ -1088,7 +1078,6 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) dev->dmasound.priv_data = NULL; } - /* release resources */ free_irq(pci_dev->irq, dev); iounmap(dev->lmmio); @@ -1160,10 +1149,10 @@ static int saa7134_init(void) static void saa7134_fini(void) { -#if defined(CONFIG_MODULES) && defined(MODULE) +#ifdef CONFIG_MODULES if (pending_registered) unregister_module_notifier(&pending_notifier); -#endif /* CONFIG_MODULES */ +#endif pci_unregister_driver(&saa7134_pci_driver); } @@ -1179,8 +1168,6 @@ EXPORT_SYMBOL(saa7134_boards); /* ----------------- for the DMA sound modules --------------- */ -EXPORT_SYMBOL(dmasound_init); -EXPORT_SYMBOL(dmasound_exit); EXPORT_SYMBOL(saa7134_pgtable_free); EXPORT_SYMBOL(saa7134_pgtable_build); EXPORT_SYMBOL(saa7134_pgtable_alloc); diff --git a/trunk/drivers/media/video/saa7134/saa7134-oss.c b/trunk/drivers/media/video/saa7134/saa7134-oss.c index 5a579194e455..fd9ed11ab1e2 100644 --- a/trunk/drivers/media/video/saa7134/saa7134-oss.c +++ b/trunk/drivers/media/video/saa7134/saa7134-oss.c @@ -899,26 +899,26 @@ void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status) spin_unlock(&dev->slock); } -static int saa7134_dsp_create(struct saa7134_dev *dev) +int saa7134_dsp_create(struct saa7134_dev *dev) { int err; - err = dev->dmasound.minor_dsp = - register_sound_dsp(&saa7134_dsp_fops, - dsp_nr[dev->nr]); - if (err < 0) { - goto fail; - } - printk(KERN_INFO "%s: registered device dsp%d\n", - dev->name,dev->dmasound.minor_dsp >> 4); - - err = dev->dmasound.minor_mixer = - register_sound_mixer(&saa7134_mixer_fops, - mixer_nr[dev->nr]); - if (err < 0) - goto fail; - printk(KERN_INFO "%s: registered device mixer%d\n", - dev->name,dev->dmasound.minor_mixer >> 4); + err = dev->dmasound.minor_dsp = + register_sound_dsp(&saa7134_dsp_fops, + dsp_nr[dev->nr]); + if (err < 0) { + goto fail; + } + printk(KERN_INFO "%s: registered device dsp%d\n", + dev->name,dev->dmasound.minor_dsp >> 4); + + err = dev->dmasound.minor_mixer = + register_sound_mixer(&saa7134_mixer_fops, + mixer_nr[dev->nr]); + if (err < 0) + goto fail; + printk(KERN_INFO "%s: registered device mixer%d\n", + dev->name,dev->dmasound.minor_mixer >> 4); return 0; @@ -929,31 +929,6 @@ static int saa7134_dsp_create(struct saa7134_dev *dev) } -static int oss_device_init(struct saa7134_dev *dev) -{ - dev->dmasound.priv_data = dev; - saa7134_oss_init1(dev); - saa7134_dsp_create(dev); - return 1; -} - -static int oss_device_exit(struct saa7134_dev *dev) -{ - - unregister_sound_mixer(dev->dmasound.minor_mixer); - unregister_sound_dsp(dev->dmasound.minor_dsp); - - saa7134_oss_fini(dev); - - if (dev->pci->irq > 0) { - synchronize_irq(dev->pci->irq); - free_irq(dev->pci->irq,&dev->dmasound); - } - - dev->dmasound.priv_data = NULL; - return 1; -} - static int saa7134_oss_init(void) { struct saa7134_dev *dev = NULL; @@ -964,7 +939,9 @@ static int saa7134_oss_init(void) list_for_each(list,&saa7134_devlist) { dev = list_entry(list, struct saa7134_dev, devlist); if (dev->dmasound.priv_data == NULL) { - oss_device_init(dev); + dev->dmasound.priv_data = dev; + saa7134_oss_init1(dev); + saa7134_dsp_create(dev); } else { printk(KERN_ERR "saa7134 OSS: DMA sound is being handled by ALSA, ignoring %s\n",dev->name); return -EBUSY; @@ -974,14 +951,11 @@ static int saa7134_oss_init(void) if (dev == NULL) printk(KERN_INFO "saa7134 OSS: no saa7134 cards found\n"); - dmasound_init = oss_device_init; - dmasound_exit = oss_device_exit; - return 0; } -static void saa7134_oss_exit(void) +void saa7134_oss_exit(void) { struct saa7134_dev *dev = NULL; struct list_head *list; @@ -993,7 +967,18 @@ static void saa7134_oss_exit(void) if (!dev->dmasound.minor_dsp) continue; - oss_device_exit(dev); + unregister_sound_mixer(dev->dmasound.minor_mixer); + unregister_sound_dsp(dev->dmasound.minor_dsp); + + saa7134_oss_fini(dev); + + if (dev->pci->irq > 0) { + synchronize_irq(dev->pci->irq); + free_irq(dev->pci->irq,&dev->dmasound); + } + + dev->dmasound.priv_data = NULL; + } printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n"); diff --git a/trunk/drivers/media/video/saa7134/saa7134.h b/trunk/drivers/media/video/saa7134/saa7134.h index add49db1ad41..244e1973081c 100644 --- a/trunk/drivers/media/video/saa7134/saa7134.h +++ b/trunk/drivers/media/video/saa7134/saa7134.h @@ -571,10 +571,6 @@ void saa7134_dma_free(struct saa7134_dev *dev,struct saa7134_buf *buf); int saa7134_set_dmabits(struct saa7134_dev *dev); -extern int (*dmasound_init)(struct saa7134_dev *dev); -extern int (*dmasound_exit)(struct saa7134_dev *dev); - - /* ----------------------------------------------------------- */ /* saa7134-cards.c */ diff --git a/trunk/drivers/media/video/tveeprom.c b/trunk/drivers/media/video/tveeprom.c index d95aecebbda3..72e8741e8b59 100644 --- a/trunk/drivers/media/video/tveeprom.c +++ b/trunk/drivers/media/video/tveeprom.c @@ -81,7 +81,7 @@ hauppauge_tuner_fmt[] = { 0x00000010, " PAL(I)" }, { 0x00400000, " SECAM(L/L')" }, { 0x00000e00, " PAL(D/K)" }, - { 0x03000000, " ATSC/DVB Digital" }, + { 0x03000000, " ATSC Digital" }, }; /* This is the full list of possible tuners. Many thanks to Hauppauge for @@ -209,27 +209,13 @@ hauppauge_tuner[] = { TUNER_ABSENT, "Philips FMD1216ME"}, { TUNER_TEA5767, "Philips TEA5768HL FM Radio"}, { TUNER_ABSENT, "Panasonic ENV57H12D5"}, - { TUNER_PHILIPS_FM1236_MK3, "TCL MFNM05-4"}, + { TUNER_ABSENT, "TCL MFNM05-4"}, { TUNER_ABSENT, "TCL MNM05-4"}, { TUNER_PHILIPS_FM1216ME_MK3, "TCL MPE05-2"}, { TUNER_ABSENT, "TCL MQNM05-4"}, { TUNER_ABSENT, "LG TAPC-W701D"}, { TUNER_ABSENT, "TCL 9886P-WM"}, { TUNER_ABSENT, "TCL 1676NM-WM"}, - /* 110-119 */ - { TUNER_ABSENT, "Thompson DTT75105"}, - { TUNER_ABSENT, "Conexant_CX24109"}, - { TUNER_ABSENT, "TCL M2523_5N_E"}, - { TUNER_ABSENT, "TCL M2523_3DB_E"}, - { TUNER_ABSENT, "Philips 8275A"}, - { TUNER_ABSENT, "Microtune MT2060"}, - { TUNER_ABSENT, "Philips FM1236 MK5"}, - { TUNER_ABSENT, "Philips FM1216ME MK5"}, - { TUNER_ABSENT, "TCL M2523_3DI_E"}, - { TUNER_ABSENT, "Samsung THPD5222FG30A"}, - /* 120-129 */ - { TUNER_ABSENT, "Xceive XC3028"}, - { TUNER_ABSENT, "Philips FQ1216LME MK5"}, }; static struct HAUPPAUGE_AUDIOIC @@ -339,7 +325,6 @@ static int hasRadioTuner(int tunerType) case 78: //PNPEnv_TUNER_TDA8275C1_8290_FM: case 89: //PNPEnv_TUNER_TCL_MFPE05_2: case 92: //PNPEnv_TUNER_PHILIPS_FQ1236A_MK4: - case 105: return 1; } return 0; @@ -383,15 +368,10 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, memset(tvee, 0, sizeof(*tvee)); done = len = beenhere = 0; - /* Hack for processing eeprom for em28xx and cx 2388x*/ - if ((eeprom_data[0] == 0x1a) && (eeprom_data[1] == 0xeb) && - (eeprom_data[2] == 0x67) && (eeprom_data[3] == 0x95)) - start=0xa0; /* Generic em28xx offset */ - else if (((eeprom_data[0] & 0xf0) == 0x10) && - (eeprom_data[1] == 0x00) && - (eeprom_data[2] == 0x00) && - (eeprom_data[8] == 0x84)) - start=8; /* Generic cx2388x offset */ + /* Hack for processing eeprom for em28xx */ + if ((eeprom_data[0]==0x1a)&&(eeprom_data[1]==0xeb)&& + (eeprom_data[2]==0x67)&&(eeprom_data[3]==0x95)) + start=0xa0; else start=0; @@ -468,17 +448,6 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, eeprom_data[i+5] + (eeprom_data[i+6] << 8) + (eeprom_data[i+7] << 16); - - if ( (eeprom_data[i + 8] && 0xf0) && - (tvee->serial_number < 0xffffff) ) { - tvee->MAC_address[0] = 0x00; - tvee->MAC_address[1] = 0x0D; - tvee->MAC_address[2] = 0xFE; - tvee->MAC_address[3] = eeprom_data[i + 7]; - tvee->MAC_address[4] = eeprom_data[i + 6]; - tvee->MAC_address[5] = eeprom_data[i + 5]; - tvee->has_MAC_address = 1; - } break; case 0x05: @@ -497,14 +466,11 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, case 0x06: /* tag 'ModelRev' */ tvee->model = - eeprom_data[i + 1] + - (eeprom_data[i + 2] << 8) + - (eeprom_data[i + 3] << 16) + - (eeprom_data[i + 4] << 24); - tvee->revision = - eeprom_data[i +5 ] + - (eeprom_data[i + 6] << 8) + - (eeprom_data[i + 7] << 16); + eeprom_data[i+1] + + (eeprom_data[i+2] << 8); + tvee->revision = eeprom_data[i+5] + + (eeprom_data[i+6] << 8) + + (eeprom_data[i+7] << 16); break; case 0x07: @@ -597,8 +563,6 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, t_name2 = "unknown"; } - tvee->tuner_hauppauge_model = tuner1; - tvee->tuner2_hauppauge_model = tuner2; tvee->tuner_formats = 0; tvee->tuner2_formats = 0; for (i = j = 0; i < 8; i++) { @@ -614,12 +578,6 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, tveeprom_info("Hauppauge model %d, rev %s, serial# %d\n", tvee->model, tvee->rev_str, tvee->serial_number); - if (tvee->has_MAC_address == 1) { - tveeprom_info("MAC address is %02X-%02X-%02X-%02X-%02X-%02X\n", - tvee->MAC_address[0], tvee->MAC_address[1], - tvee->MAC_address[2], tvee->MAC_address[3], - tvee->MAC_address[4], tvee->MAC_address[5]); - } tveeprom_info("tuner model is %s (idx %d, type %d)\n", t_name1, tuner1, tvee->tuner_type); tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", diff --git a/trunk/drivers/media/video/video-buf.c b/trunk/drivers/media/video/video-buf.c index 9a6bf287e26a..acfd3a103f35 100644 --- a/trunk/drivers/media/video/video-buf.c +++ b/trunk/drivers/media/video/video-buf.c @@ -753,9 +753,10 @@ videobuf_read_zerocopy(struct videobuf_queue *q, char __user *data, int retval; /* setup stuff */ + retval = -ENOMEM; q->read_buf = videobuf_alloc(q->msize); if (NULL == q->read_buf) - return -ENOMEM; + goto done; q->read_buf->memory = V4L2_MEMORY_USERPTR; q->read_buf->baddr = (unsigned long)data; @@ -816,14 +817,10 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, if (NULL == q->read_buf) goto done; q->read_buf->memory = V4L2_MEMORY_USERPTR; - q->read_buf->bsize = count; /* preferred size */ field = videobuf_next_field(q); retval = q->ops->buf_prepare(q,q->read_buf,field); - if (0 != retval) { - kfree (q->read_buf); - q->read_buf = NULL; + if (0 != retval) goto done; - } spin_lock_irqsave(q->irqlock,flags); q->ops->buf_queue(q,q->read_buf); spin_unlock_irqrestore(q->irqlock,flags); diff --git a/trunk/drivers/media/video/videodev.c b/trunk/drivers/media/video/videodev.c index 6de5b0094b82..83c49f9610d0 100644 --- a/trunk/drivers/media/video/videodev.c +++ b/trunk/drivers/media/video/videodev.c @@ -76,14 +76,14 @@ static void video_release(struct class_device *cd) } static struct class video_class = { - .name = VIDEO_NAME, + .name = VIDEO_NAME, .release = video_release, }; /* - * Active devices + * Active devices */ - + static struct video_device *video_device[VIDEO_NUM_DEVICES]; static DECLARE_MUTEX(videodev_lock); @@ -101,7 +101,7 @@ static int video_open(struct inode *inode, struct file *file) int err = 0; struct video_device *vfl; struct file_operations *old_fops; - + if(minor>=VIDEO_NUM_DEVICES) return -ENODEV; down(&videodev_lock); @@ -189,7 +189,7 @@ video_usercopy(struct inode *inode, struct file *file, return -ENOMEM; parg = mbuf; } - + err = -EFAULT; if (_IOC_DIR(cmd) & _IOC_WRITE) if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd))) @@ -240,7 +240,7 @@ int video_exclusive_open(struct inode *inode, struct file *file) int video_exclusive_release(struct inode *inode, struct file *file) { struct video_device *vfl = video_devdata(file); - + vfl->users--; return 0; } @@ -253,7 +253,7 @@ static struct file_operations video_fops; * @type: type of device to register * @nr: which device number (0 == /dev/video0, 1 == /dev/video1, ... * -1 == first free) - * + * * The registration code assigns minor numbers based on the type * requested. -ENFILE is returned in all the device slots for this * category are full. If not then the minor field is set and the @@ -269,7 +269,7 @@ static struct file_operations video_fops; * * %VFL_TYPE_VBI - Vertical blank data (undecoded) * - * %VFL_TYPE_RADIO - A radio card + * %VFL_TYPE_RADIO - A radio card */ int video_register_device(struct video_device *vfd, int type, int nr) @@ -278,7 +278,7 @@ int video_register_device(struct video_device *vfd, int type, int nr) int base; int end; char *name_base; - + switch(type) { case VFL_TYPE_GRABBER: @@ -293,7 +293,7 @@ int video_register_device(struct video_device *vfd, int type, int nr) break; case VFL_TYPE_VBI: base=224; - end=256; + end=240; name_base = "vbi"; break; case VFL_TYPE_RADIO: @@ -334,7 +334,7 @@ int video_register_device(struct video_device *vfd, int type, int nr) init_MUTEX(&vfd->lock); /* sysfs class */ - memset(&vfd->class_dev, 0x00, sizeof(vfd->class_dev)); + memset(&vfd->class_dev, 0x00, sizeof(vfd->class_dev)); if (vfd->dev) vfd->class_dev.dev = vfd->dev; vfd->class_dev.class = &video_class; @@ -360,7 +360,7 @@ int video_register_device(struct video_device *vfd, int type, int nr) * This unregisters the passed device and deassigns the minor * number. Future open calls will be met with errors. */ - + void video_unregister_device(struct video_device *vfd) { down(&videodev_lock); @@ -384,7 +384,7 @@ static struct file_operations video_fops= /* * Initialise video for linux */ - + static int __init videodev_init(void) { int ret; diff --git a/trunk/drivers/net/b44.c b/trunk/drivers/net/b44.c index c53848f787eb..c8d9b4d66704 100644 --- a/trunk/drivers/net/b44.c +++ b/trunk/drivers/net/b44.c @@ -1417,6 +1417,7 @@ static int b44_open(struct net_device *dev) add_timer(&bp->timer); b44_enable_ints(bp); + netif_start_queue(dev); out: return err; } @@ -2113,6 +2114,7 @@ static int b44_resume(struct pci_dev *pdev) add_timer(&bp->timer); b44_enable_ints(bp); + netif_wake_queue(dev); return 0; } diff --git a/trunk/fs/cifs/CHANGES b/trunk/fs/cifs/CHANGES index 943ef9b82244..6bded10c0d50 100644 --- a/trunk/fs/cifs/CHANGES +++ b/trunk/fs/cifs/CHANGES @@ -1,12 +1,10 @@ Version 1.39 ------------ -Defer close of a file handle slightly if pending writes depend on that handle +Defer close of a file handle slightly if pending writes depend on that file handle (this reduces the EBADF bad file handle errors that can be logged under heavy stress on writes). Modify cifs Kconfig options to expose CONFIG_CIFS_STATS2 -Fix SFU style symlinks and mknod needed for servers which do not support the -CIFS Unix Extensions. Fix setfacl/getfacl on bigendian. Timeout negative -dentries so files that the client sees as deleted but that later get created -on the server will be recognized. Add client side permission check on setattr. +Fix SFU style symlinks and mknod needed for servers which do not support the CIFS +Unix Extensions. Fix setfacl/getfacl on bigendian. Version 1.38 ------------ diff --git a/trunk/fs/cifs/README b/trunk/fs/cifs/README index e5d09a2fc7a5..bb90941826ad 100644 --- a/trunk/fs/cifs/README +++ b/trunk/fs/cifs/README @@ -278,9 +278,7 @@ A partial list of the supported mount options follows: (such as Windows), permissions can also be checked at the client, and a crude form of client side permission checking can be enabled by specifying file_mode and dir_mode on - the client. Note that the mount.cifs helper must be - at version 1.10 or higher to support specifying the uid - (or gid) in non-numberic form. + the client gid If CIFS Unix extensions are not supported by the server this overrides the default gid for inodes. file_mode If CIFS Unix extensions are not supported by the server @@ -347,10 +345,7 @@ A partial list of the supported mount options follows: client system. It is typically only needed when the server supports the CIFS Unix Extensions but the UIDs/GIDs on the client and server system do not match closely enough to allow - access by the user doing the mount, but it may be useful with - non CIFS Unix Extension mounts for cases in which the default - mode is specified on the mount but is not to be enforced on the - client (e.g. perhaps when MultiUserMount is enabled) + access by the user doing the mount. Note that this does not affect the normal ACL check on the target machine done by the server software (of the server ACL against the user name provided at mount time). @@ -373,21 +368,15 @@ A partial list of the supported mount options follows: setuids If the CIFS Unix extensions are negotiated with the server the client will attempt to set the effective uid and gid of the local process on newly created files, directories, and - devices (create, mkdir, mknod). If the CIFS Unix Extensions - are not negotiated, for newly created files and directories - instead of using the default uid and gid specified on the - the mount, cache the new file's uid and gid locally which means - that the uid for the file can change when the inode is - reloaded (or the user remounts the share). + devices (create, mkdir, mknod). nosetuids The client will not attempt to set the uid and gid on on newly created files, directories, and devices (create, mkdir, mknod) which will result in the server setting the uid and gid to the default (usually the server uid of the user who mounted the share). Letting the server (rather than - the client) set the uid and gid is the default. If the CIFS - Unix Extensions are not negotiated then the uid and gid for - new files will appear to be the uid (gid) of the mounter or the - uid (gid) parameter specified on the mount. + the client) set the uid and gid is the default. This + parameter has no effect if the CIFS Unix Extensions are not + negotiated. netbiosname When mounting to servers via port 139, specifies the RFC1001 source name to use to represent the client netbios machine name when doing the RFC1001 netbios session initialize. @@ -429,13 +418,6 @@ A partial list of the supported mount options follows: byte range locks). remount remount the share (often used to change from ro to rw mounts or vice versa) - sfu When the CIFS Unix Extensions are not negotiated, attempt to - create device files and fifos in a format compatible with - Services for Unix (SFU). In addition retrieve bits 10-12 - of the mode via the SETFILEBITS extended attribute (as - SFU does). In the future the bottom 9 bits of the mode - mode also will be emulated using queries of the security - descriptor (ACL). The mount.cifs mount helper also accepts a few mount options before -o including: diff --git a/trunk/fs/cifs/TODO b/trunk/fs/cifs/TODO index fc34c74ec4be..c909298d11ed 100644 --- a/trunk/fs/cifs/TODO +++ b/trunk/fs/cifs/TODO @@ -1,4 +1,4 @@ -Version 1.39 November 30, 2005 +version 1.37 October 9, 2005 A Partial List of Missing Features ================================== @@ -58,7 +58,7 @@ o) Improve performance of readpages by sending more than one read at a time when 8 pages or more are requested. In conjuntion add support for async_cifs_readpages. -p) Add support for storing symlink info to Windows servers +p) Add support for storing symlink and fifo info to Windows servers in the Extended Attribute format their SFU clients would recognize. q) Finish fcntl D_NOTIFY support so kde and gnome file list windows diff --git a/trunk/fs/cifs/cifsfs.c b/trunk/fs/cifs/cifsfs.c index 2a13a2bac8f1..51548ed2e9cc 100644 --- a/trunk/fs/cifs/cifsfs.c +++ b/trunk/fs/cifs/cifsfs.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "cifsfs.h" #include "cifspdu.h" #define DECLARE_GLOBALS_HERE @@ -430,11 +429,6 @@ static void cifs_umount_begin(struct super_block * sblock) { cFYI(1,("wake up tasks now - umount begin not complete")); wake_up_all(&tcon->ses->server->request_q); - wake_up_all(&tcon->ses->server->response_q); - msleep(1); /* yield */ - /* we have to kick the requests once more */ - wake_up_all(&tcon->ses->server->response_q); - msleep(1); } /* BB FIXME - finish add checks for tidStatus BB */ @@ -901,9 +895,6 @@ static int cifs_oplock_thread(void * dummyarg) static int cifs_dnotify_thread(void * dummyarg) { - struct list_head *tmp; - struct cifsSesInfo *ses; - daemonize("cifsdnotifyd"); allow_signal(SIGTERM); @@ -912,19 +903,7 @@ static int cifs_dnotify_thread(void * dummyarg) if(try_to_freeze()) continue; set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(15*HZ); - read_lock(&GlobalSMBSeslock); - /* check if any stuck requests that need - to be woken up and wakeq so the - thread can wake up and error out */ - list_for_each(tmp, &GlobalSMBSessionList) { - ses = list_entry(tmp, struct cifsSesInfo, - cifsSessionList); - if(ses && ses->server && - atomic_read(&ses->server->inFlight)) - wake_up_all(&ses->server->response_q); - } - read_unlock(&GlobalSMBSeslock); + schedule_timeout(39*HZ); } while(!signal_pending(current)); complete_and_exit (&cifs_dnotify_exited, 0); } diff --git a/trunk/fs/cifs/cifssmb.c b/trunk/fs/cifs/cifssmb.c index 6867e556d37e..d179b0c3eee4 100644 --- a/trunk/fs/cifs/cifssmb.c +++ b/trunk/fs/cifs/cifssmb.c @@ -90,18 +90,6 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, check for tcp and smb session status done differently for those three - in the calling routine */ if(tcon) { - if(tcon->tidStatus == CifsExiting) { - /* only tree disconnect, open, and write, - (and ulogoff which does not have tcon) - are allowed as we start force umount */ - if((smb_command != SMB_COM_WRITE_ANDX) && - (smb_command != SMB_COM_OPEN_ANDX) && - (smb_command != SMB_COM_TREE_DISCONNECT)) { - cFYI(1,("can not send cmd %d while umounting", - smb_command)); - return -ENODEV; - } - } if((tcon->ses) && (tcon->ses->status != CifsExiting) && (tcon->ses->server)){ struct nls_table *nls_codepage; @@ -199,19 +187,6 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, check for tcp and smb session status done differently for those three - in the calling routine */ if(tcon) { - if(tcon->tidStatus == CifsExiting) { - /* only tree disconnect, open, and write, - (and ulogoff which does not have tcon) - are allowed as we start force umount */ - if((smb_command != SMB_COM_WRITE_ANDX) && - (smb_command != SMB_COM_OPEN_ANDX) && - (smb_command != SMB_COM_TREE_DISCONNECT)) { - cFYI(1,("can not send cmd %d while umounting", - smb_command)); - return -ENODEV; - } - } - if((tcon->ses) && (tcon->ses->status != CifsExiting) && (tcon->ses->server)){ struct nls_table *nls_codepage; diff --git a/trunk/fs/cifs/dir.c b/trunk/fs/cifs/dir.c index 32cc96cafa3e..16b21522e8fe 100644 --- a/trunk/fs/cifs/dir.c +++ b/trunk/fs/cifs/dir.c @@ -228,15 +228,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, else { rc = cifs_get_inode_info(&newinode, full_path, buf, inode->i_sb,xid); - if(newinode) { + if(newinode) newinode->i_mode = mode; - if((oplock & CIFS_CREATE_ACTION) && - (cifs_sb->mnt_cifs_flags & - CIFS_MOUNT_SET_UID)) { - newinode->i_uid = current->fsuid; - newinode->i_gid = current->fsgid; - } - } } if (rc != 0) { @@ -472,20 +465,12 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name direntry->d_op = &cifs_dentry_ops; d_add(direntry, newInode); - /* since paths are not looked up by component - the parent - directories are presumed to be good here */ + /* since paths are not looked up by component - the parent directories are presumed to be good here */ renew_parental_timestamps(direntry); } else if (rc == -ENOENT) { rc = 0; - direntry->d_time = jiffies; - if (pTcon->nocase) - direntry->d_op = &cifs_ci_dentry_ops; - else - direntry->d_op = &cifs_dentry_ops; d_add(direntry, NULL); - /* if it was once a directory (but how can we tell?) we could do - shrink_dcache_parent(direntry); */ } else { cERROR(1,("Error 0x%x on cifs_get_inode_info in lookup of %s", rc,full_path)); @@ -504,20 +489,21 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) { int isValid = 1; +/* lock_kernel(); *//* surely we do not want to lock the kernel for a whole network round trip which could take seconds */ + if (direntry->d_inode) { if (cifs_revalidate(direntry)) { + /* unlock_kernel(); */ return 0; } } else { - cFYI(1, ("neg dentry 0x%p name = %s", - direntry, direntry->d_name.name)); - if(time_after(jiffies, direntry->d_time + HZ) || - !lookupCacheEnabled) { - d_drop(direntry); - isValid = 0; - } + cFYI(1, + ("In cifs_d_revalidate with no inode but name = %s and dentry 0x%p", + direntry->d_name.name, direntry)); } +/* unlock_kernel(); */ + return isValid; } diff --git a/trunk/fs/cifs/inode.c b/trunk/fs/cifs/inode.c index 411c1f7f84da..05b525812adb 100644 --- a/trunk/fs/cifs/inode.c +++ b/trunk/fs/cifs/inode.c @@ -710,7 +710,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) char *full_path = NULL; struct inode *newinode = NULL; - cFYI(1, ("In cifs_mkdir, mode = 0x%x inode = 0x%p", mode, inode)); + cFYI(1, ("In cifs_mkdir, mode = 0x%x inode = 0x%p ", mode, inode)); xid = GetXid(); @@ -768,17 +768,6 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) /* BB to be implemented via Windows secrty descriptors eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, -1, -1, local_nls); */ - if(direntry->d_inode) { - direntry->d_inode->i_mode = mode; - direntry->d_inode->i_mode |= S_IFDIR; - if(cifs_sb->mnt_cifs_flags & - CIFS_MOUNT_SET_UID) { - direntry->d_inode->i_uid = - current->fsuid; - direntry->d_inode->i_gid = - current->fsgid; - } - } } } kfree(full_path); @@ -1050,20 +1039,14 @@ int cifs_revalidate(struct dentry *direntry) filemap_fdatawrite(direntry->d_inode->i_mapping); } if (invalidate_inode) { - /* shrink_dcache not necessary now that cifs dentry ops - are exported for negative dentries */ -/* if(S_ISDIR(direntry->d_inode->i_mode)) - shrink_dcache_parent(direntry); */ - if (S_ISREG(direntry->d_inode->i_mode)) { - if (direntry->d_inode->i_mapping) - filemap_fdatawait(direntry->d_inode->i_mapping); - /* may eventually have to do this for open files too */ - if (list_empty(&(cifsInode->openFileList))) { - /* changed on server - flush read ahead pages */ - cFYI(1, ("Invalidating read ahead data on " - "closed file")); - invalidate_remote_inode(direntry->d_inode); - } + if (direntry->d_inode->i_mapping) + filemap_fdatawait(direntry->d_inode->i_mapping); + /* may eventually have to do this for open files too */ + if (list_empty(&(cifsInode->openFileList))) { + /* Has changed on server - flush read ahead pages */ + cFYI(1, ("Invalidating read ahead data on " + "closed file")); + invalidate_remote_inode(direntry->d_inode); } } /* up(&direntry->d_inode->i_sem); */ @@ -1122,20 +1105,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) cFYI(1, ("In cifs_setattr, name = %s attrs->iavalid 0x%x ", direntry->d_name.name, attrs->ia_valid)); - cifs_sb = CIFS_SB(direntry->d_inode->i_sb); pTcon = cifs_sb->tcon; - if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) { - /* check if we have permission to change attrs */ - rc = inode_change_ok(direntry->d_inode, attrs); - if(rc < 0) { - FreeXid(xid); - return rc; - } else - rc = 0; - } - down(&direntry->d_sb->s_vfs_rename_sem); full_path = build_path_from_dentry(direntry); up(&direntry->d_sb->s_vfs_rename_sem); @@ -1175,9 +1147,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) 1 /* 45 seconds */); cFYI(1,("Wrt seteof rc %d", rc)); } - } else - rc = -EINVAL; - + } if (rc != 0) { /* Set file size by pathname rather than by handle either because no valid, writeable file handle for diff --git a/trunk/fs/cifs/misc.c b/trunk/fs/cifs/misc.c index 94baf6c8ecbd..ca27a82c54cd 100644 --- a/trunk/fs/cifs/misc.c +++ b/trunk/fs/cifs/misc.c @@ -397,12 +397,12 @@ checkSMBhdr(struct smb_hdr *smb, __u16 mid) if(smb->Command == SMB_COM_LOCKING_ANDX) return 0; else - cERROR(1, ("Rcvd Request not response")); + cERROR(1, ("Rcvd Request not response ")); } } else { /* bad signature or mid */ if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) cERROR(1, - ("Bad protocol string signature header %x", + ("Bad protocol string signature header %x ", *(unsigned int *) smb->Protocol)); if (mid != smb->Mid) cERROR(1, ("Mids do not match")); @@ -417,7 +417,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length) __u32 len = smb->smb_buf_length; __u32 clc_len; /* calculated length */ cFYI(0, - ("Entering checkSMB with Length: %x, smb_buf_length: %x", + ("Entering checkSMB with Length: %x, smb_buf_length: %x ", length, len)); if (((unsigned int)length < 2 + sizeof (struct smb_hdr)) || (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4)) { @@ -451,16 +451,9 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length) cERROR(1, ("bad smb size detected for Mid=%d", smb->Mid)); /* Windows XP can return a few bytes too much, presumably an illegal pad, at the end of byte range lock responses - so we allow for that three byte pad, as long as actual + so we allow for up to eight byte pad, as long as actual received length is as long or longer than calculated length */ - /* We have now had to extend this more, since there is a - case in which it needs to be bigger still to handle a - malformed response to transact2 findfirst from WinXP when - access denied is returned and thus bcc and wct are zero - but server says length is 0x21 bytes too long as if the server - forget to reset the smb rfc1001 length when it reset the - wct and bcc to minimum size and drop the t2 parms and data */ - if((4+len > clc_len) && (len <= clc_len + 512)) + if((4+len > clc_len) && (len <= clc_len + 3)) return 0; else return 1; diff --git a/trunk/fs/cifs/netmisc.c b/trunk/fs/cifs/netmisc.c index 5de74d216fdd..f7814689844b 100644 --- a/trunk/fs/cifs/netmisc.c +++ b/trunk/fs/cifs/netmisc.c @@ -330,7 +330,7 @@ static const struct { ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, { ERRSRV, 2241, NT_STATUS_INVALID_LOGON_HOURS}, { ERRSRV, 2240, NT_STATUS_INVALID_WORKSTATION}, { - ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_EXPIRED}, { + ERRSRV, 2242, NT_STATUS_PASSWORD_EXPIRED}, { ERRSRV, 2239, NT_STATUS_ACCOUNT_DISABLED}, { ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, { ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, { @@ -676,7 +676,7 @@ static const struct { ERRDOS, 193, NT_STATUS_IMAGE_CHECKSUM_MISMATCH}, { ERRHRD, ERRgeneral, NT_STATUS_LOST_WRITEBEHIND_DATA}, { ERRHRD, ERRgeneral, NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID}, { - ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_MUST_CHANGE}, { + ERRSRV, 2242, NT_STATUS_PASSWORD_MUST_CHANGE}, { ERRHRD, ERRgeneral, NT_STATUS_NOT_FOUND}, { ERRHRD, ERRgeneral, NT_STATUS_NOT_TINY_STREAM}, { ERRHRD, ERRgeneral, NT_STATUS_RECOVERY_FAILURE}, { diff --git a/trunk/fs/cifs/transport.c b/trunk/fs/cifs/transport.c index f8871196098c..41a9659c16bc 100644 --- a/trunk/fs/cifs/transport.c +++ b/trunk/fs/cifs/transport.c @@ -515,7 +515,6 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, *pbytes_returned = in_buf->smb_buf_length; /* BB special case reconnect tid and uid here? */ - /* BB special case Errbadpassword and pwdexpired here */ rc = map_smb_to_linux_error(in_buf); /* convert ByteCount if necessary */ diff --git a/trunk/include/linux/i2c-id.h b/trunk/include/linux/i2c-id.h index ef3b5632e63a..1543daaa9c5e 100644 --- a/trunk/include/linux/i2c-id.h +++ b/trunk/include/linux/i2c-id.h @@ -108,7 +108,6 @@ #define I2C_DRIVERID_SAA7127 72 /* saa7124 video encoder */ #define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ #define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ -#define I2C_DRIVERID_I2C_IR 75 /* I2C InfraRed on Video boards */ #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ #define I2C_DRIVERID_EXP1 0xF1 diff --git a/trunk/include/media/tveeprom.h b/trunk/include/media/tveeprom.h index e9fc1a785497..e2035c7da094 100644 --- a/trunk/include/media/tveeprom.h +++ b/trunk/include/media/tveeprom.h @@ -4,15 +4,12 @@ struct tveeprom { u32 has_radio; u32 has_ir; /* 0: no IR, 1: IR present, 2: unknown */ - u32 has_MAC_address; /* 0: no MAC, 1: MAC present, 2: unknown */ u32 tuner_type; u32 tuner_formats; - u32 tuner_hauppauge_model; u32 tuner2_type; u32 tuner2_formats; - u32 tuner2_hauppauge_model; u32 digitizer; u32 digitizer_formats; @@ -24,7 +21,6 @@ struct tveeprom { u32 revision; u32 serial_number; char rev_str[5]; - u8 MAC_address[6]; }; void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, diff --git a/trunk/security/keys/keyring.c b/trunk/security/keys/keyring.c index 4e9fa8be44b8..c7a0ab1cfda3 100644 --- a/trunk/security/keys/keyring.c +++ b/trunk/security/keys/keyring.c @@ -526,7 +526,7 @@ key_ref_t __keyring_search_one(key_ref_t keyring_ref, (!key->type->match || key->type->match(key, description)) && key_permission(make_key_ref(key, possessed), - perm) == 0 && + perm) < 0 && !test_bit(KEY_FLAG_REVOKED, &key->flags) ) goto found;