From 5855d2f9567a582b0ae0033976a1704ac8410fe3 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 5 Nov 2004 23:00:43 +0100 Subject: [ide] shrink hw_regs_t sata_[misc,scr] and priv are write-only Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include/linux') diff --git a/include/linux/ide.h b/include/linux/ide.h index 3d9bc0542b7d..d7a3ad9381f5 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -256,10 +256,7 @@ typedef struct hw_regs_s { int irq; /* our irq number */ int dma; /* our dma entry */ ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ - void *priv; /* interface specific data */ hwif_chipset_t chipset; - unsigned long sata_scr[SATA_NR_PORTS]; - unsigned long sata_misc[SATA_NR_PORTS]; } hw_regs_t; /* -- cgit v1.2.3 From b0a0e63d484b301fc1124e2d28eb36560d124e95 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 6 Nov 2004 00:07:36 +0100 Subject: [ide] remove some cruft from ide.h From: Chris Wedgwood (minor changes by me - bart) Remove some accumulated (unused) cruft from ide.h Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'include/linux') diff --git a/include/linux/ide.h b/include/linux/ide.h index d7a3ad9381f5..e619f8247483 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -39,7 +39,6 @@ * * REALLY_SLOW_IO can be defined in ide.c and ide-cd.c, if necessary */ -#define REALLY_FAST_IO /* define if ide ports are perfect */ #define INITIAL_MULT_COUNT 0 /* off=0; on=2,4,8,16,32, etc.. */ #ifndef SUPPORT_SLOW_DATA_PORTS /* 1 to support slow data ports */ @@ -63,18 +62,6 @@ #define IDE_NO_IRQ (-1) -/* - * IDE_DRIVE_CMD is used to implement many features of the hdparm utility - */ -#define IDE_DRIVE_CMD 99 /* (magic) undef to reduce kernel size*/ - -#define IDE_DRIVE_TASK 98 - -/* - * IDE_DRIVE_TASKFILE is used to implement many features needed for raw tasks - */ -#define IDE_DRIVE_TASKFILE 97 - /* * "No user-serviceable parts" beyond this point :) *****************************************************************************/ @@ -101,13 +88,6 @@ typedef unsigned char byte; /* used everywhere */ #define DMA_PIO_RETRY 1 /* retrying in PIO */ -/* - * Ensure that various configuration flags have compatible settings - */ -#ifdef REALLY_SLOW_IO -#undef REALLY_FAST_IO -#endif - #define HWIF(drive) ((ide_hwif_t *)((drive)->hwif)) #define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup)) @@ -197,10 +177,7 @@ typedef unsigned char byte; /* used everywhere */ /* * Some more useful definitions */ -#define IDE_MAJOR_NAME "hd" /* the same for all i/f; see also genhd.c */ -#define MAJOR_NAME IDE_MAJOR_NAME #define PARTN_BITS 6 /* number of minor dev bits for partitions */ -#define PARTN_MASK ((1< Date: Sat, 6 Nov 2004 00:14:55 +0100 Subject: [ide] (partially) unify hdreg.h & ata.h Signed-off-by: Chris Wedgwood Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ata.h | 8 ++++++-- include/linux/hdreg.h | 23 ++--------------------- 2 files changed, 8 insertions(+), 23 deletions(-) (limited to 'include/linux') diff --git a/include/linux/ata.h b/include/linux/ata.h index 52c5fc6bb4ac..a4ac28db33cf 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -33,8 +33,6 @@ enum { ATA_MAX_DEVICES = 2, /* per bus/port */ ATA_MAX_PRD = 256, /* we could make these 256/256 */ ATA_SECT_SIZE = 512, - ATA_SECT_SIZE_MASK = (ATA_SECT_SIZE - 1), - ATA_SECT_DWORDS = ATA_SECT_SIZE / sizeof(u32), ATA_ID_WORDS = 256, ATA_ID_PROD_OFS = 27, @@ -143,6 +141,12 @@ enum { XFER_PIO_1 = 0x09, XFER_PIO_0 = 0x08, + /* legacy IDE 'stuff' */ + XFER_SW_DMA_2 = 0x12, + XFER_SW_DMA_1 = 0x11, + XFER_SW_DMA_0 = 0x10, + XFER_PIO_SLOW = 0x00, + /* ATAPI stuff */ ATAPI_PKT_DMA = (1 << 0), ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h index 54ad63b1d02c..c94de12a5ee1 100644 --- a/include/linux/hdreg.h +++ b/include/linux/hdreg.h @@ -1,6 +1,8 @@ #ifndef _LINUX_HDREG_H #define _LINUX_HDREG_H +#include + /* * This file contains some defines for the AT-hd-controller. * Various sources. @@ -328,27 +330,6 @@ typedef struct hd_drive_hob_hdr { /* WIN_SETFEATURES sub-commands */ #define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */ #define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */ -#define SETFEATURES_XFER 0x03 /* Set transfer mode */ -# define XFER_UDMA_7 0x47 /* 0100|0111 */ -# define XFER_UDMA_6 0x46 /* 0100|0110 */ -# define XFER_UDMA_5 0x45 /* 0100|0101 */ -# define XFER_UDMA_4 0x44 /* 0100|0100 */ -# define XFER_UDMA_3 0x43 /* 0100|0011 */ -# define XFER_UDMA_2 0x42 /* 0100|0010 */ -# define XFER_UDMA_1 0x41 /* 0100|0001 */ -# define XFER_UDMA_0 0x40 /* 0100|0000 */ -# define XFER_MW_DMA_2 0x22 /* 0010|0010 */ -# define XFER_MW_DMA_1 0x21 /* 0010|0001 */ -# define XFER_MW_DMA_0 0x20 /* 0010|0000 */ -# define XFER_SW_DMA_2 0x12 /* 0001|0010 */ -# define XFER_SW_DMA_1 0x11 /* 0001|0001 */ -# define XFER_SW_DMA_0 0x10 /* 0001|0000 */ -# define XFER_PIO_4 0x0C /* 0000|1100 */ -# define XFER_PIO_3 0x0B /* 0000|1011 */ -# define XFER_PIO_2 0x0A /* 0000|1010 */ -# define XFER_PIO_1 0x09 /* 0000|1001 */ -# define XFER_PIO_0 0x08 /* 0000|1000 */ -# define XFER_PIO_SLOW 0x00 /* 0000|0000 */ #define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */ #define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */ #define SETFEATURES_EN_SAME_R 0x22 /* for a region ATA-1 */ -- cgit v1.2.3 From dc3f1bf75e1d7c37b1e7ed49294fc6753f81e2ab Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 6 Nov 2004 02:31:02 +0100 Subject: [ide] apply undecoded slave fixup only for ide-cs From: Alan Cox (some changes by me - bart) We add probe_hwif_init_with_fixup (seperate naming as requested by Bartlomiej). This runs a fixup on present interfaces before attaching the drives. In order to be useful we need also an _with_fixup version of ide_register_hw function. The sometimes troublesome undecoded slave detector is moved to its own function and exported so that ide-cs and the upcoming delkin_cb can both use it (along with any arch specific cf/pcmcia drivers I don't know about). The non-relevant checks for this scenario are removed. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-probe.c | 63 ++++++++++++++++++++++++++++++++++----------- drivers/ide/ide.c | 14 +++++++--- drivers/ide/legacy/ide-cs.c | 2 +- include/linux/ide.h | 4 +++ 4 files changed, 64 insertions(+), 19 deletions(-) (limited to 'include/linux') diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index ca53e05a88ed..7b6d9c991ca2 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -652,6 +652,43 @@ static int wait_hwif_ready(ide_hwif_t *hwif) return rc; } +/** + * ide_undecoded_slave - look for bad CF adapters + * @hwif: interface + * + * Analyse the drives on the interface and attempt to decide if we + * have the same drive viewed twice. This occurs with crap CF adapters + * and PCMCIA sometimes. + */ + +void ide_undecoded_slave(ide_hwif_t *hwif) +{ + ide_drive_t *drive0 = &hwif->drives[0]; + ide_drive_t *drive1 = &hwif->drives[1]; + + if (drive0->present == 0 || drive1->present == 0) + return; + + /* If the models don't match they are not the same product */ + if (strcmp(drive0->id->model, drive1->id->model)) + return; + + /* Serial numbers do not match */ + if (strncmp(drive0->id->serial_no, drive1->id->serial_no, 20)) + return; + + /* No serial number, thankfully very rare for CF */ + if (drive0->id->serial_no[0] == 0) + return; + + /* Appears to be an IDE flash adapter with decode bugs */ + printk(KERN_WARNING "ide-probe: ignoring undecoded slave\n"); + + drive1->present = 0; +} + +EXPORT_SYMBOL_GPL(ide_undecoded_slave); + /* * This routine only knows how to look for drive units 0 and 1 * on an interface, so any setting of MAX_DRIVES > 2 won't work here. @@ -723,20 +760,6 @@ static void probe_hwif(ide_hwif_t *hwif) ide_drive_t *drive = &hwif->drives[unit]; drive->dn = (hwif->channel ? 2 : 0) + unit; (void) probe_for_drive(drive); - if (drive->present && hwif->present && unit == 1) { - if (strcmp(hwif->drives[0].id->model, drive->id->model) == 0 && - /* Don't do this for noprobe or non ATA */ - strcmp(drive->id->model, "UNKNOWN") && - /* And beware of confused Maxtor drives that go "M0000000000" - "The SN# is garbage in the ID block..." [Eric] */ - strncmp(drive->id->serial_no, "M0000000000000000000", 20) && - /* Same goes for another set of Maxtor drives that say "D3000000" */ - strncmp(drive->id->serial_no, "D3000000", 8) && - strncmp(hwif->drives[0].id->serial_no, drive->id->serial_no, 20) == 0) { - printk(KERN_WARNING "ide-probe: ignoring undecoded slave\n"); - drive->present = 0; - } - } if (drive->present && !hwif->present) { hwif->present = 1; if (hwif->chipset != ide_4drives || @@ -810,9 +833,14 @@ static void probe_hwif(ide_hwif_t *hwif) } static int hwif_init(ide_hwif_t *hwif); -int probe_hwif_init (ide_hwif_t *hwif) + +int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) { probe_hwif(hwif); + + if (fixup) + fixup(hwif); + hwif_init(hwif); if (hwif->present) { @@ -830,6 +858,11 @@ int probe_hwif_init (ide_hwif_t *hwif) return 0; } +int probe_hwif_init(ide_hwif_t *hwif) +{ + return probe_hwif_init_with_fixup(hwif, NULL); +} + EXPORT_SYMBOL(probe_hwif_init); #if MAX_HWIFS > 1 diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 427f633dc441..1dd413ae439b 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -985,9 +985,10 @@ void ide_setup_ports ( hw_regs_t *hw, } /** - * ide_register_hw - register IDE interface + * ide_register_hw_with_fixup - register IDE interface * @hw: hardware registers * @hwifp: pointer to returned hwif + * @fixup: fixup function * * Register an IDE interface, specifying exactly the registers etc. * Set init=1 iff calling before probes have taken place. @@ -995,7 +996,7 @@ void ide_setup_ports ( hw_regs_t *hw, * Returns -1 on error. */ -int ide_register_hw (hw_regs_t *hw, ide_hwif_t **hwifp) +int ide_register_hw_with_fixup(hw_regs_t *hw, ide_hwif_t **hwifp, void(*fixup)(ide_hwif_t *hwif)) { int index, retry = 1; ide_hwif_t *hwif; @@ -1034,7 +1035,7 @@ found: hwif->chipset = hw->chipset; if (!initializing) { - probe_hwif_init(hwif); + probe_hwif_init_with_fixup(hwif, fixup); create_proc_ide_interfaces(); } @@ -1044,6 +1045,13 @@ found: return (initializing || hwif->present) ? index : -1; } +EXPORT_SYMBOL(ide_register_hw_with_fixup); + +int ide_register_hw(hw_regs_t *hw, ide_hwif_t **hwifp) +{ + return ide_register_hw_with_fixup(hw, hwifp, NULL); +} + EXPORT_SYMBOL(ide_register_hw); /* diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index dda2a17e0c6e..36426f72cb3f 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c @@ -206,7 +206,7 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq ide_init_hwif_ports(&hw, io, ctl, NULL); hw.irq = irq; hw.chipset = ide_pci; - return ide_register_hw(&hw, NULL); + return ide_register_hw_with_fixup(&hw, NULL, ide_undecoded_slave); } /*====================================================================== diff --git a/include/linux/ide.h b/include/linux/ide.h index e619f8247483..b7bfa3f233ea 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -240,6 +240,7 @@ typedef struct hw_regs_s { * Register new hardware with ide */ int ide_register_hw(hw_regs_t *hw, struct hwif_s **hwifp); +int ide_register_hw_with_fixup(hw_regs_t *, struct hwif_s **, void (*)(struct hwif_s *)); /* * Set up hw_regs_t structure before calling ide_register_hw (optional) @@ -1487,6 +1488,9 @@ extern int ide_hwif_request_regions(ide_hwif_t *hwif); extern void ide_hwif_release_regions(ide_hwif_t* hwif); extern void ide_unregister (unsigned int index); +void ide_undecoded_slave(ide_hwif_t *); + +int probe_hwif_init_with_fixup(ide_hwif_t *, void (*)(ide_hwif_t *)); extern int probe_hwif_init(ide_hwif_t *); static inline void *ide_get_hwifdata (ide_hwif_t * hwif) -- cgit v1.2.3 From db01db102a3f12c83dc79bc378d4f81e425c4716 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 6 Nov 2004 02:32:42 +0100 Subject: [ide] siimage: fix the various SI3112 hangs From: Alan Cox (some changes by me - bart) The current driver looks at fields before it is safe to, we move the mod15rm bug handler to be a fixup and this ensures the probe has been completed before we use the ident data. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/siimage.c | 22 +++++++++++++++++++--- drivers/ide/setup-pci.c | 4 ++-- include/linux/ide.h | 1 + 3 files changed, 22 insertions(+), 5 deletions(-) (limited to 'include/linux') diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index ab303f422f0a..17089f3eb350 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -954,6 +954,22 @@ static int is_dev_seagate_sata(ide_drive_t *drive) return 0; } +/** + * siimage_fixup - post probe fixups + * @hwif: interface to fix up + * + * Called after drive probe we use this to decide whether the + * Seagate fixup must be applied. This used to be in init_iops but + * that can occur before we know what drives are present. + */ + +static void __devinit siimage_fixup(ide_hwif_t *hwif) +{ + /* Try and raise the rqsize */ + if (!is_sata(hwif) || !is_dev_seagate_sata(&hwif->drives[0])) + hwif->rqsize = 128; +} + /** * init_iops_siimage - set up iops * @hwif: interface to set up @@ -974,9 +990,8 @@ static void __devinit init_iops_siimage(ide_hwif_t *hwif) hwif->hwif_data = NULL; - hwif->rqsize = 128; - if (is_sata(hwif) && is_dev_seagate_sata(&hwif->drives[0])) - hwif->rqsize = 15; + /* Pessimal until we finish probing */ + hwif->rqsize = 15; if (pci_get_drvdata(dev) == NULL) return; @@ -1064,6 +1079,7 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) .init_chipset = init_chipset_siimage, \ .init_iops = init_iops_siimage, \ .init_hwif = init_hwif_siimage, \ + .fixup = siimage_fixup, \ .channels = 2, \ .autodma = AUTODMA, \ .bootable = ON_BOARD, \ diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 126c51dc2925..5ccb60e40839 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -707,9 +707,9 @@ void ide_setup_pci_device (struct pci_dev *dev, ide_pci_device_t *d) ata_index_t index_list = do_ide_setup_pci_device(dev, d, 1); if ((index_list.b.low & 0xf0) != 0xf0) - probe_hwif_init(&ide_hwifs[index_list.b.low]); + probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.low], d->fixup); if ((index_list.b.high & 0xf0) != 0xf0) - probe_hwif_init(&ide_hwifs[index_list.b.high]); + probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.high], d->fixup); create_proc_ide_interfaces(); } diff --git a/include/linux/ide.h b/include/linux/ide.h index b7bfa3f233ea..ec81a19ec550 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1428,6 +1428,7 @@ typedef struct ide_pci_device_s { void (*init_iops)(ide_hwif_t *); void (*init_hwif)(ide_hwif_t *); void (*init_dma)(ide_hwif_t *, unsigned long); + void (*fixup)(ide_hwif_t *); u8 channels; u8 autodma; ide_pci_enablebit_t enablebits[2]; -- cgit v1.2.3 From 0401471a53e67a4d350038940171174c304daae8 Mon Sep 17 00:00:00 2001 From: Meelis Roos Date: Sat, 6 Nov 2004 03:39:18 -0500 Subject: [PATCH] ata.h undefined types in USB This is todays BK on a x86: CC [M] drivers/usb/storage/freecom.o In file included from include/linux/hdreg.h:4, from drivers/usb/storage/freecom.c:32: include/linux/ata.h:197: error: parse error before "u32" ... and so on for tens of lines. Signed-off-by: Jeff Garzik --- include/linux/ata.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/linux') diff --git a/include/linux/ata.h b/include/linux/ata.h index a4ac28db33cf..2fc05d1d2344 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -24,6 +24,8 @@ #ifndef __LINUX_ATA_H__ #define __LINUX_ATA_H__ +#include + /* defines only for the constants which don't work well as enums */ #define ATA_DMA_BOUNDARY 0xffffUL #define ATA_DMA_MASK 0xffffffffULL -- cgit v1.2.3 From fac172c34a6780b93d0376ffda2086a6eeb541ea Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 6 Nov 2004 03:44:22 -0500 Subject: Remove silly comment from linux/ata.h. XFER_xxx is not necessarily "legacy IDE 'stuff'" --- include/linux/ata.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/ata.h b/include/linux/ata.h index 2fc05d1d2344..b6d8e8681603 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -142,8 +142,6 @@ enum { XFER_PIO_2 = 0x0A, XFER_PIO_1 = 0x09, XFER_PIO_0 = 0x08, - - /* legacy IDE 'stuff' */ XFER_SW_DMA_2 = 0x12, XFER_SW_DMA_1 = 0x11, XFER_SW_DMA_0 = 0x10, -- cgit v1.2.3 From 80f1f4d9c298de88621a6dcb9c87e79198fddf5c Mon Sep 17 00:00:00 2001 From: Wen Xiong Date: Sun, 7 Nov 2004 03:38:05 -0800 Subject: [PATCH] "PORT_ICOM" defination for icom adapter "PORT_ICOM" is not defined. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/serial_core.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/linux') diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index a01972bb5c52..bba805dd7a39 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -91,6 +91,9 @@ /* MPC52xx type numbers */ #define PORT_MPC52xx 59 +/*IBM icom*/ +#define PORT_ICOM 60 + #ifdef __KERNEL__ #include -- cgit v1.2.3 From 2252004fae9b12f1e326a1bb932ed9babb4ba5c7 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 7 Nov 2004 03:39:48 -0800 Subject: [PATCH] more hardirq.h consolidation PREEMPT_BITS, SOFTIRQ_BITS, PREEMPT_SHIFT, SOFTIRQ_SHIFT and HARDIRQ_SHIFT are the same for all architectures (and chaning them in future ports doesn't make a lot of sense), so move them to . Make the HARDIRQ_BITS definition guarded by #ifndef HARDIRQ_BITS instead of CONFIG_GENERIC_HARDIRQS so we have a saner way to override it once ports with lots of irq sources are changed to use the generic hardirq framework. Ingo, maybe we should change the default for it back to 8 as that's what most ports use? Signed-off-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-alpha/hardirq.h | 21 --------------------- include/asm-arm/hardirq.h | 19 ------------------- include/asm-arm26/hardirq.h | 15 --------------- include/asm-cris/hardirq.h | 21 --------------------- include/asm-h8300/hardirq.h | 21 --------------------- include/asm-ia64/hardirq.h | 21 --------------------- include/asm-m32r/hardirq.h | 22 ---------------------- include/asm-m68k/hardirq.h | 21 --------------------- include/asm-m68knommu/hardirq.h | 21 --------------------- include/asm-mips/hardirq.h | 21 --------------------- include/asm-parisc/hardirq.h | 21 --------------------- include/asm-s390/hardirq.h | 21 --------------------- include/asm-sh/hardirq.h | 21 --------------------- include/asm-sparc/hardirq.h | 21 --------------------- include/asm-sparc64/hardirq.h | 21 --------------------- include/asm-v850/hardirq.h | 21 --------------------- include/linux/hardirq.h | 24 ++++++++++++------------ 17 files changed, 12 insertions(+), 341 deletions(-) (limited to 'include/linux') diff --git a/include/asm-alpha/hardirq.h b/include/asm-alpha/hardirq.h index 10be402fcb26..de7e476ff7a9 100644 --- a/include/asm-alpha/hardirq.h +++ b/include/asm-alpha/hardirq.h @@ -16,29 +16,8 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-27 are the hardirq count (max # of hardirqs: 4096) - * - * - ( bit 30 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * SOFTIRQ_MASK: 0x0000ff00 - * HARDIRQ_MASK: 0x0fff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 12 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have * space for potentially nestable IRQ sources in the system diff --git a/include/asm-arm/hardirq.h b/include/asm-arm/hardirq.h index 8cf189b44f33..a808f3c4f283 100644 --- a/include/asm-arm/hardirq.h +++ b/include/asm-arm/hardirq.h @@ -12,31 +12,12 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-24 are the hardirq count (max # of hardirqs: 512) - * - bit 26 is the PREEMPT_ACTIVE flag - * - * We optimize HARDIRQ_BITS for immediate constant, and only - * increase it if really needed. - */ -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 - #if NR_IRQS > 256 #define HARDIRQ_BITS 9 #else #define HARDIRQ_BITS 8 #endif -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have space * for potentially all IRQ sources in the system nesting diff --git a/include/asm-arm26/hardirq.h b/include/asm-arm26/hardirq.h index 52feb957f3e7..bb5a5faba266 100644 --- a/include/asm-arm26/hardirq.h +++ b/include/asm-arm26/hardirq.h @@ -15,23 +15,8 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - bit 26 is the PREEMPT_ACTIVE flag - */ -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 8 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have space * for potentially all IRQ sources in the system nesting diff --git a/include/asm-cris/hardirq.h b/include/asm-cris/hardirq.h index 4e28c83324ad..502aed5ec1af 100644 --- a/include/asm-cris/hardirq.h +++ b/include/asm-cris/hardirq.h @@ -17,29 +17,8 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - * - ( bit 26 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * SOFTIRQ_MASK: 0x0000ff00 - * HARDIRQ_MASK: 0x00ff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 8 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have * space for potentially all IRQ sources in the system diff --git a/include/asm-h8300/hardirq.h b/include/asm-h8300/hardirq.h index c878cc44b6cb..5b16e797b497 100644 --- a/include/asm-h8300/hardirq.h +++ b/include/asm-h8300/hardirq.h @@ -15,29 +15,8 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - * - ( bit 26 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * HARDIRQ_MASK: 0x0000ff00 - * SOFTIRQ_MASK: 0x00ff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 8 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have * space for potentially all IRQ sources in the system diff --git a/include/asm-ia64/hardirq.h b/include/asm-ia64/hardirq.h index 491996a79251..602471e51aab 100644 --- a/include/asm-ia64/hardirq.h +++ b/include/asm-ia64/hardirq.h @@ -29,29 +29,8 @@ #define local_ksoftirqd_task() (local_cpu_data->ksoftirqd) #define local_nmi_count() 0 -/* - * We put the hardirq and softirq counter into the preemption counter. The bitmask has the - * following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-29 are the hardirq count (max # of hardirqs: 16384) - * - * - (bit 63 is the PREEMPT_ACTIVE flag---not currently implemented.) - * - * PREEMPT_MASK: 0x000000ff - * SOFTIRQ_MASK: 0x0000ff00 - * HARDIRQ_MASK: 0x3fff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 14 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have space for potentially all IRQ sources * in the system nesting on a single CPU: diff --git a/include/asm-m32r/hardirq.h b/include/asm-m32r/hardirq.h index b46a265d683a..78cb4c96d1e3 100644 --- a/include/asm-m32r/hardirq.h +++ b/include/asm-m32r/hardirq.h @@ -13,34 +13,12 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - * - ( bit 26 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * SOFTIRQ_MASK: 0x0000ff00 - * HARDIRQ_MASK: 0x00ff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 - #if NR_IRQS > 256 #define HARDIRQ_BITS 9 #else #define HARDIRQ_BITS 8 #endif -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have * space for potentially all IRQ sources in the system diff --git a/include/asm-m68k/hardirq.h b/include/asm-m68k/hardirq.h index c74ad7709210..5bc0577931f5 100644 --- a/include/asm-m68k/hardirq.h +++ b/include/asm-m68k/hardirq.h @@ -12,29 +12,8 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - * - ( bit 26 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * HARDIRQ_MASK: 0x0000ff00 - * SOFTIRQ_MASK: 0x00ff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 8 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have * space for potentially all IRQ sources in the system diff --git a/include/asm-m68knommu/hardirq.h b/include/asm-m68knommu/hardirq.h index 840eac2812ae..79327f540b09 100644 --- a/include/asm-m68knommu/hardirq.h +++ b/include/asm-m68knommu/hardirq.h @@ -13,29 +13,8 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - * - ( bit 26 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * HARDIRQ_MASK: 0x0000ff00 - * SOFTIRQ_MASK: 0x00ff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 8 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have * space for potentially all IRQ sources in the system diff --git a/include/asm-mips/hardirq.h b/include/asm-mips/hardirq.h index 7562703b44e2..47a0237ac136 100644 --- a/include/asm-mips/hardirq.h +++ b/include/asm-mips/hardirq.h @@ -20,29 +20,8 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - * - ( bit 26 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * SOFTIRQ_MASK: 0x0000ff00 - * HARDIRQ_MASK: 0x00ff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 8 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have * space for potentially all IRQ sources in the system diff --git a/include/asm-parisc/hardirq.h b/include/asm-parisc/hardirq.h index 7ebdebbe539e..39f4698d6ecc 100644 --- a/include/asm-parisc/hardirq.h +++ b/include/asm-parisc/hardirq.h @@ -28,29 +28,8 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption counter. The bitmask has the - * following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-31 are the hardirq count (max # of hardirqs: 65536) - * - * - (bit 63 is the PREEMPT_ACTIVE flag---not currently implemented.) - * - * PREEMPT_MASK: 0x000000ff - * SOFTIRQ_MASK: 0x0000ff00 - * HARDIRQ_MASK: 0xffff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 16 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have space for potentially all IRQ sources * in the system nesting on a single CPU: diff --git a/include/asm-s390/hardirq.h b/include/asm-s390/hardirq.h index 363b0a89711a..05670c2149de 100644 --- a/include/asm-s390/hardirq.h +++ b/include/asm-s390/hardirq.h @@ -38,29 +38,8 @@ softirq_pending(unsigned int cpu) #define __ARCH_IRQ_STAT -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - * - ( bit 26 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * SOFTIRQ_MASK: 0x0000ff00 - * HARDIRQ_MASK: 0x00ff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 8 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - extern void account_ticks(struct pt_regs *); #define __ARCH_HAS_DO_SOFTIRQ diff --git a/include/asm-sh/hardirq.h b/include/asm-sh/hardirq.h index 1d7135a7dcde..f63336a9b292 100644 --- a/include/asm-sh/hardirq.h +++ b/include/asm-sh/hardirq.h @@ -12,29 +12,8 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - * - ( bit 26 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * SOFTIRQ_MASK: 0x0000ff00 - * HARDIRQ_MASK: 0x00ff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 8 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have * space for potentially all IRQ sources in the system diff --git a/include/asm-sparc/hardirq.h b/include/asm-sparc/hardirq.h index 548b44167a9d..a741114a7efb 100644 --- a/include/asm-sparc/hardirq.h +++ b/include/asm-sparc/hardirq.h @@ -19,29 +19,8 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - * - ( bit 26 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * SOFTIRQ_MASK: 0x0000ff00 - * HARDIRQ_MASK: 0x00ff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 8 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - #define irq_enter() (preempt_count() += HARDIRQ_OFFSET) #define irq_exit() \ do { \ diff --git a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h index ac63de550508..260db1e3d5dc 100644 --- a/include/asm-sparc64/hardirq.h +++ b/include/asm-sparc64/hardirq.h @@ -18,29 +18,8 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - * - ( bit 26 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * SOFTIRQ_MASK: 0x0000ff00 - * HARDIRQ_MASK: 0x00ff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 8 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - #define irq_enter() (preempt_count() += HARDIRQ_OFFSET) #define irq_exit() \ do { \ diff --git a/include/asm-v850/hardirq.h b/include/asm-v850/hardirq.h index 7493d6d48682..974fc08818c2 100644 --- a/include/asm-v850/hardirq.h +++ b/include/asm-v850/hardirq.h @@ -13,29 +13,8 @@ typedef struct { #include /* Standard mappings for irq_cpustat_t above */ -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - * - ( bit 26 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * HARDIRQ_MASK: 0x0000ff00 - * SOFTIRQ_MASK: 0x00ff0000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 8 -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - /* * The hardirq mask has to be large enough to have * space for potentially all IRQ sources in the system diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 7969257bc87a..eae45cc3ea7a 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h @@ -5,39 +5,39 @@ #include #include -#ifdef CONFIG_GENERIC_HARDIRQS /* * We put the hardirq and softirq counter into the preemption * counter. The bitmask has the following meaning: * * - bits 0-7 are the preemption count (max preemption depth: 256) * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-27 are the hardirq count (max # of hardirqs: 4096) * + * The hardirq count can be overridden per architecture, the default is: + * + * - bits 16-27 are the hardirq count (max # of hardirqs: 4096) * - ( bit 28 is the PREEMPT_ACTIVE flag. ) * * PREEMPT_MASK: 0x000000ff * SOFTIRQ_MASK: 0x0000ff00 * HARDIRQ_MASK: 0x0fff0000 */ - #define PREEMPT_BITS 8 #define SOFTIRQ_BITS 8 -#define HARDIRQ_BITS 12 - -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) +#ifndef HARDIRQ_BITS +#define HARDIRQ_BITS 12 /* - * The hardirq mask has to be large enough to have - * space for potentially all IRQ sources in the system - * nesting on a single CPU: + * The hardirq mask has to be large enough to have space for potentially + * all IRQ sources in the system nesting on a single CPU. */ #if (1 << HARDIRQ_BITS) < NR_IRQS # error HARDIRQ_BITS is too low! #endif -#endif /* CONFIG_GENERIC_HARDIRQS */ +#endif + +#define PREEMPT_SHIFT 0 +#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) +#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) #define __IRQ_MASK(x) ((1UL << (x))-1) -- cgit v1.2.3 From 773f7f2fa37aeb880efc24299f0b8efb2259bda0 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Sun, 7 Nov 2004 04:01:28 -0800 Subject: [PATCH] meye: add v4l2 support Signed-off-by: Stelian Pop Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/meye.txt | 19 +- drivers/media/video/meye.c | 562 ++++++++++++++++++++++++++++++++++++- drivers/media/video/meye.h | 3 + include/linux/meye.h | 7 + 4 files changed, 575 insertions(+), 16 deletions(-) (limited to 'include/linux') diff --git a/Documentation/video4linux/meye.txt b/Documentation/video4linux/meye.txt index 418b48599caa..05e18fa49766 100644 --- a/Documentation/video4linux/meye.txt +++ b/Documentation/video4linux/meye.txt @@ -46,6 +46,8 @@ module argument syntax (= when passing the option to the module or meye.= on the kernel boot line when meye is statically linked into the kernel). Those options are: + forcev4l1: force use of V4L1 API instead of V4L2 + gbuffers: number of capture buffers, default is 2 (32 max) gbufsize: size of each capture buffer, default is 614400 @@ -78,8 +80,9 @@ Usage: Private API: ------------ - The driver supports frame grabbing with the video4linux API, so - all video4linux tools (like xawtv) should work with this driver. + The driver supports frame grabbing with the video4linux API + (either v4l1 or v4l2), so all video4linux tools (like xawtv) + should work with this driver. Besides the video4linux interface, the driver has a private interface for accessing the Motion Eye extended parameters (camera sharpness, @@ -121,13 +124,7 @@ Private API: Bugs / Todo: ------------ - - overlay output is not supported (although the camera is capable of). - (it should not be too hard to to it, provided we found how...) - - - mjpeg hardware playback doesn't work (depends on overlay...) + - the driver could be much cleaned up by removing the v4l1 support. + However, this means all v4l1-only applications will stop working. - - rewrite the driver to use some common video4linux API for snapshot - and mjpeg capture. Unfortunately, video4linux1 does not permit it, - the BUZ API seems to be targeted to TV cards only. The video4linux 2 - API may be an option, if it goes into the kernel (maybe 2.5 - material ?). + - 'motioneye' still uses the meye private v4l1 API extensions. diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index 04f4bb2c55fa..4732b3a4af34 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c @@ -46,6 +46,11 @@ MODULE_DESCRIPTION("v4l/v4l2 driver for the MotionEye camera"); MODULE_LICENSE("GPL"); MODULE_VERSION(MEYE_DRIVER_VERSION); +/* force usage of V4L1 API */ +static int forcev4l1; /* = 0 */ +module_param(forcev4l1, int, 0644); +MODULE_PARM_DESC(forcev4l1, "force use of V4L1 instead of V4L2"); + /* number of grab buffers */ static unsigned int gbuffers = 2; module_param(gbuffers, int, 0444); @@ -781,6 +786,8 @@ static irqreturn_t meye_irq(int irq, void *dev_id, struct pt_regs *regs) { u32 v; int reqnr; + static int sequence = 0; + v = mchip_read(MCHIP_MM_INTA); if (meye.mchip_mode != MCHIP_HIC_MODE_CONT_OUT && @@ -802,6 +809,8 @@ again: mchip_hsize() * mchip_vsize() * 2); meye.grab_buffer[reqnr].size = mchip_hsize() * mchip_vsize() * 2; meye.grab_buffer[reqnr].state = MEYE_BUF_DONE; + do_gettimeofday(&meye.grab_buffer[reqnr].timestamp); + meye.grab_buffer[reqnr].sequence = sequence++; kfifo_put(meye.doneq, (unsigned char *)&reqnr, sizeof(int)); wake_up_interruptible(&meye.proc_list); } else { @@ -820,6 +829,8 @@ again: size); meye.grab_buffer[reqnr].size = size; meye.grab_buffer[reqnr].state = MEYE_BUF_DONE; + do_gettimeofday(&meye.grab_buffer[reqnr].timestamp); + meye.grab_buffer[reqnr].sequence = sequence++; kfifo_put(meye.doneq, (unsigned char *)&reqnr, sizeof(int)); wake_up_interruptible(&meye.proc_list); } @@ -1132,10 +1143,519 @@ static int meye_do_ioctl(struct inode *inode, struct file *file, break; } + case VIDIOC_QUERYCAP: { + struct v4l2_capability *cap = arg; + + if (forcev4l1) + return -EINVAL; + + memset(cap, 0, sizeof(*cap)); + strcpy(cap->driver, "meye"); + strcpy(cap->card, "meye"); + sprintf(cap->bus_info, "PCI:%s", meye.mchip_dev->slot_name); + cap->version = (MEYE_DRIVER_MAJORVERSION << 8) + + MEYE_DRIVER_MINORVERSION; + cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | + V4L2_CAP_STREAMING; + break; + } + + case VIDIOC_ENUMINPUT: { + struct v4l2_input *i = arg; + + if (i->index != 0) + return -EINVAL; + memset(i, 0, sizeof(*i)); + i->index = 0; + strcpy(i->name, "Camera"); + i->type = V4L2_INPUT_TYPE_CAMERA; + break; + } + + case VIDIOC_G_INPUT: { + int *i = arg; + + *i = 0; + break; + } + + case VIDIOC_S_INPUT: { + int *i = arg; + + if (*i != 0) + return -EINVAL; + break; + } + + case VIDIOC_QUERYCTRL: { + struct v4l2_queryctrl *c = arg; + + switch (c->id) { + + case V4L2_CID_BRIGHTNESS: + c->type = V4L2_CTRL_TYPE_INTEGER; + strcpy(c->name, "Brightness"); + c->minimum = 0; + c->maximum = 63; + c->step = 1; + c->default_value = 32; + c->flags = 0; + break; + case V4L2_CID_HUE: + c->type = V4L2_CTRL_TYPE_INTEGER; + strcpy(c->name, "Hue"); + c->minimum = 0; + c->maximum = 63; + c->step = 1; + c->default_value = 32; + c->flags = 0; + break; + case V4L2_CID_CONTRAST: + c->type = V4L2_CTRL_TYPE_INTEGER; + strcpy(c->name, "Contrast"); + c->minimum = 0; + c->maximum = 63; + c->step = 1; + c->default_value = 32; + c->flags = 0; + break; + case V4L2_CID_SATURATION: + c->type = V4L2_CTRL_TYPE_INTEGER; + strcpy(c->name, "Saturation"); + c->minimum = 0; + c->maximum = 63; + c->step = 1; + c->default_value = 32; + c->flags = 0; + break; + case V4L2_CID_AGC: + c->type = V4L2_CTRL_TYPE_INTEGER; + strcpy(c->name, "Agc"); + c->minimum = 0; + c->maximum = 63; + c->step = 1; + c->default_value = 48; + c->flags = 0; + break; + case V4L2_CID_SHARPNESS: + c->type = V4L2_CTRL_TYPE_INTEGER; + strcpy(c->name, "Sharpness"); + c->minimum = 0; + c->maximum = 63; + c->step = 1; + c->default_value = 32; + c->flags = 0; + break; + case V4L2_CID_PICTURE: + c->type = V4L2_CTRL_TYPE_INTEGER; + strcpy(c->name, "Picture"); + c->minimum = 0; + c->maximum = 63; + c->step = 1; + c->default_value = 0; + c->flags = 0; + break; + case V4L2_CID_JPEGQUAL: + c->type = V4L2_CTRL_TYPE_INTEGER; + strcpy(c->name, "JPEG quality"); + c->minimum = 0; + c->maximum = 10; + c->step = 1; + c->default_value = 8; + c->flags = 0; + break; + case V4L2_CID_FRAMERATE: + c->type = V4L2_CTRL_TYPE_INTEGER; + strcpy(c->name, "Framerate"); + c->minimum = 0; + c->maximum = 31; + c->step = 1; + c->default_value = 0; + c->flags = 0; + break; + default: + return -EINVAL; + } + break; + } + + case VIDIOC_S_CTRL: { + struct v4l2_control *c = arg; + + down(&meye.lock); + switch (c->id) { + + case V4L2_CID_BRIGHTNESS: + sonypi_camera_command( + SONYPI_COMMAND_SETCAMERABRIGHTNESS, c->value); + break; + case V4L2_CID_HUE: + sonypi_camera_command( + SONYPI_COMMAND_SETCAMERAHUE, c->value); + break; + case V4L2_CID_CONTRAST: + sonypi_camera_command( + SONYPI_COMMAND_SETCAMERACOLOR, c->value); + break; + case V4L2_CID_SATURATION: + sonypi_camera_command( + SONYPI_COMMAND_SETCAMERACOLOR, c->value); + break; + case V4L2_CID_AGC: + sonypi_camera_command( + SONYPI_COMMAND_SETCAMERAAGC, c->value); + break; + case V4L2_CID_SHARPNESS: + sonypi_camera_command( + SONYPI_COMMAND_SETCAMERASHARPNESS, c->value); + break; + case V4L2_CID_PICTURE: + sonypi_camera_command( + SONYPI_COMMAND_SETCAMERAPICTURE, c->value); + break; + case V4L2_CID_JPEGQUAL: + meye.params.quality = c->value; + break; + case V4L2_CID_FRAMERATE: + meye.params.framerate = c->value; + break; + default: + up(&meye.lock); + return -EINVAL; + } + up(&meye.lock); + break; + } + + case VIDIOC_G_CTRL: { + struct v4l2_control *c = arg; + + down(&meye.lock); + switch (c->id) { + case V4L2_CID_BRIGHTNESS: + c->value = sonypi_camera_command( + SONYPI_COMMAND_GETCAMERABRIGHTNESS, 0); + break; + case V4L2_CID_HUE: + c->value = sonypi_camera_command( + SONYPI_COMMAND_GETCAMERAHUE, 0); + break; + case V4L2_CID_CONTRAST: + c->value = sonypi_camera_command( + SONYPI_COMMAND_GETCAMERACOLOR, 0); + break; + case V4L2_CID_SATURATION: + c->value = sonypi_camera_command( + SONYPI_COMMAND_GETCAMERACOLOR, 0); + break; + case V4L2_CID_AGC: + c->value = sonypi_camera_command( + SONYPI_COMMAND_GETCAMERAAGC, 0); + break; + case V4L2_CID_SHARPNESS: + c->value = sonypi_camera_command( + SONYPI_COMMAND_GETCAMERASHARPNESS, 0); + break; + case V4L2_CID_PICTURE: + c->value = sonypi_camera_command( + SONYPI_COMMAND_GETCAMERAPICTURE, 0); + break; + case V4L2_CID_JPEGQUAL: + c->value = meye.params.quality; + break; + case V4L2_CID_FRAMERATE: + c->value = meye.params.framerate; + break; + default: + up(&meye.lock); + return -EINVAL; + } + up(&meye.lock); + break; + } + + case VIDIOC_ENUM_FMT: { + struct v4l2_fmtdesc *f = arg; + + if (f->index > 1) + return -EINVAL; + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + if (f->index == 0) { + /* standard YUV 422 capture */ + memset(f, 0, sizeof(*f)); + f->index = 0; + f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + f->flags = 0; + strcpy(f->description, "YUV422"); + f->pixelformat = V4L2_PIX_FMT_YUYV; + } else { + /* compressed MJPEG capture */ + memset(f, 0, sizeof(*f)); + f->index = 1; + f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + f->flags = V4L2_FMT_FLAG_COMPRESSED; + strcpy(f->description, "MJPEG"); + f->pixelformat = V4L2_PIX_FMT_MJPEG; + } + break; + } + + case VIDIOC_TRY_FMT: { + struct v4l2_format *f = arg; + + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + if (f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV && + f->fmt.pix.pixelformat != V4L2_PIX_FMT_MJPEG) + return -EINVAL; + if (f->fmt.pix.field != V4L2_FIELD_ANY && + f->fmt.pix.field != V4L2_FIELD_NONE) + return -EINVAL; + f->fmt.pix.field = V4L2_FIELD_NONE; + if (f->fmt.pix.width <= 320) { + f->fmt.pix.width = 320; + f->fmt.pix.height = 240; + } else { + f->fmt.pix.width = 640; + f->fmt.pix.height = 480; + } + f->fmt.pix.bytesperline = f->fmt.pix.width * 2; + f->fmt.pix.sizeimage = f->fmt.pix.height * + f->fmt.pix.bytesperline; + f->fmt.pix.colorspace = 0; + f->fmt.pix.priv = 0; + break; + } + + case VIDIOC_G_FMT: { + struct v4l2_format *f = arg; + + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + memset(&f->fmt.pix, 0, sizeof(struct v4l2_pix_format)); + f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + switch (meye.mchip_mode) { + case MCHIP_HIC_MODE_CONT_OUT: + default: + f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; + break; + case MCHIP_HIC_MODE_CONT_COMP: + f->fmt.pix.pixelformat = V4L2_PIX_FMT_MJPEG; + break; + } + f->fmt.pix.field = V4L2_FIELD_NONE; + f->fmt.pix.width = mchip_hsize(); + f->fmt.pix.height = mchip_vsize(); + f->fmt.pix.bytesperline = f->fmt.pix.width * 2; + f->fmt.pix.sizeimage = f->fmt.pix.height * + f->fmt.pix.bytesperline; + f->fmt.pix.colorspace = 0; + f->fmt.pix.priv = 0; + break; + } + + case VIDIOC_S_FMT: { + struct v4l2_format *f = arg; + + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + if (f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV && + f->fmt.pix.pixelformat != V4L2_PIX_FMT_MJPEG) + return -EINVAL; + if (f->fmt.pix.field != V4L2_FIELD_ANY && + f->fmt.pix.field != V4L2_FIELD_NONE) + return -EINVAL; + f->fmt.pix.field = V4L2_FIELD_NONE; + down(&meye.lock); + if (f->fmt.pix.width <= 320) { + f->fmt.pix.width = 320; + f->fmt.pix.height = 240; + meye.params.subsample = 1; + } else { + f->fmt.pix.width = 640; + f->fmt.pix.height = 480; + meye.params.subsample = 0; + } + switch (f->fmt.pix.pixelformat) { + case V4L2_PIX_FMT_YUYV: + meye.mchip_mode = MCHIP_HIC_MODE_CONT_OUT; + break; + case V4L2_PIX_FMT_MJPEG: + meye.mchip_mode = MCHIP_HIC_MODE_CONT_COMP; + break; + } + up(&meye.lock); + f->fmt.pix.bytesperline = f->fmt.pix.width * 2; + f->fmt.pix.sizeimage = f->fmt.pix.height * + f->fmt.pix.bytesperline; + f->fmt.pix.colorspace = 0; + f->fmt.pix.priv = 0; + + break; + } + + case VIDIOC_REQBUFS: { + struct v4l2_requestbuffers *req = arg; + int i; + + if (req->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + if (req->memory != V4L2_MEMORY_MMAP) + return -EINVAL; + if (meye.grab_fbuffer && req->count == gbuffers) { + /* already allocated, no modifications */ + break; + } + down(&meye.lock); + if (meye.grab_fbuffer) { + for (i = 0; i < gbuffers; i++) + if (meye.vma_use_count[i]) { + up(&meye.lock); + return -EINVAL; + } + rvfree(meye.grab_fbuffer, gbuffers * gbufsize); + meye.grab_fbuffer = NULL; + } + gbuffers = max(2, min((int)req->count, MEYE_MAX_BUFNBRS)); + req->count = gbuffers; + meye.grab_fbuffer = rvmalloc(gbuffers * gbufsize); + if (!meye.grab_fbuffer) { + printk(KERN_ERR "meye: v4l framebuffer allocation" + " failed\n"); + up(&meye.lock); + return -ENOMEM; + } + for (i = 0; i < gbuffers; i++) + meye.vma_use_count[i] = 0; + up(&meye.lock); + break; + } + + case VIDIOC_QUERYBUF: { + struct v4l2_buffer *buf = arg; + int index = buf->index; + + if (index < 0 || index >= gbuffers) + return -EINVAL; + memset(buf, 0, sizeof(*buf)); + buf->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf->index = index; + buf->bytesused = meye.grab_buffer[index].size; + buf->flags = V4L2_BUF_FLAG_MAPPED; + if (meye.grab_buffer[index].state == MEYE_BUF_USING) + buf->flags |= V4L2_BUF_FLAG_QUEUED; + if (meye.grab_buffer[index].state == MEYE_BUF_DONE) + buf->flags |= V4L2_BUF_FLAG_DONE; + buf->field = V4L2_FIELD_NONE; + buf->timestamp = meye.grab_buffer[index].timestamp; + buf->sequence = meye.grab_buffer[index].sequence; + buf->memory = V4L2_MEMORY_MMAP; + buf->m.offset = index * gbufsize; + buf->length = gbufsize; + break; + } + + case VIDIOC_QBUF: { + struct v4l2_buffer *buf = arg; + + if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + if (buf->memory != V4L2_MEMORY_MMAP) + return -EINVAL; + if (buf->index < 0 || buf->index >= gbuffers) + return -EINVAL; + if (meye.grab_buffer[buf->index].state != MEYE_BUF_UNUSED) + return -EINVAL; + down(&meye.lock); + buf->flags |= V4L2_BUF_FLAG_QUEUED; + buf->flags &= ~V4L2_BUF_FLAG_DONE; + meye.grab_buffer[buf->index].state = MEYE_BUF_USING; + kfifo_put(meye.grabq, (unsigned char *)&buf->index, sizeof(int)); + up(&meye.lock); + break; + } + + case VIDIOC_DQBUF: { + struct v4l2_buffer *buf = arg; + int reqnr; + + if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + if (buf->memory != V4L2_MEMORY_MMAP) + return -EINVAL; + + down(&meye.lock); + if (kfifo_len(meye.doneq) == 0 && file->f_flags & O_NONBLOCK) { + up(&meye.lock); + return -EAGAIN; + } + if (wait_event_interruptible(meye.proc_list, + kfifo_len(meye.doneq) != 0) < 0) { + up(&meye.lock); + return -EINTR; + } + if (!kfifo_get(meye.doneq, (unsigned char *)&reqnr, + sizeof(int))) { + up(&meye.lock); + return -EBUSY; + } + if (meye.grab_buffer[reqnr].state != MEYE_BUF_DONE) { + up(&meye.lock); + return -EINVAL; + } + buf->index = reqnr; + buf->bytesused = meye.grab_buffer[reqnr].size; + buf->flags = V4L2_BUF_FLAG_MAPPED; + buf->field = V4L2_FIELD_NONE; + buf->timestamp = meye.grab_buffer[reqnr].timestamp; + buf->sequence = meye.grab_buffer[reqnr].sequence; + buf->memory = V4L2_MEMORY_MMAP; + buf->m.offset = reqnr * gbufsize; + buf->length = gbufsize; + meye.grab_buffer[reqnr].state = MEYE_BUF_UNUSED; + up(&meye.lock); + break; + } + + case VIDIOC_STREAMON: { + down(&meye.lock); + switch (meye.mchip_mode) { + case MCHIP_HIC_MODE_CONT_OUT: + mchip_continuous_start(); + break; + case MCHIP_HIC_MODE_CONT_COMP: + mchip_cont_compression_start(); + break; + default: + up(&meye.lock); + return -EINVAL; + } + up(&meye.lock); + break; + } + + case VIDIOC_STREAMOFF: { + int i; + + down(&meye.lock); + mchip_hic_stop(); + kfifo_reset(meye.grabq); + kfifo_reset(meye.doneq); + for (i = 0; i < MEYE_MAX_BUFNBRS; i++) + meye.grab_buffer[i].state = MEYE_BUF_UNUSED; + up(&meye.lock); + break; + } + + /* + * XXX what about private snapshot ioctls ? + * Do they need to be converted to V4L2 ? + */ + default: return -ENOIOCTLCMD; - - } /* switch */ + } return 0; } @@ -1158,9 +1678,27 @@ static unsigned int meye_poll(struct file *file, poll_table *wait) return res; } +static void meye_vm_open(struct vm_area_struct *vma) +{ + int idx = (int)vma->vm_private_data; + meye.vma_use_count[idx]++; +} + +static void meye_vm_close(struct vm_area_struct *vma) +{ + int idx = (int)vma->vm_private_data; + meye.vma_use_count[idx]--; +} + +static struct vm_operations_struct meye_vm_ops = { + .open = meye_vm_open, + .close = meye_vm_close, +}; + static int meye_mmap(struct file *file, struct vm_area_struct *vma) { unsigned long start = vma->vm_start; - unsigned long size = vma->vm_end - vma->vm_start; + unsigned long size = vma->vm_end - vma->vm_start; + unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; unsigned long page, pos; down(&meye.lock); @@ -1169,6 +1707,8 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma) { return -EINVAL; } if (!meye.grab_fbuffer) { + int i; + /* lazy allocation */ meye.grab_fbuffer = rvmalloc(gbuffers*gbufsize); if (!meye.grab_fbuffer) { @@ -1176,8 +1716,10 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma) { up(&meye.lock); return -ENOMEM; } + for (i = 0; i < gbuffers; i++) + meye.vma_use_count[i] = 0; } - pos = (unsigned long)meye.grab_fbuffer; + pos = (unsigned long)meye.grab_fbuffer + offset; while (size > 0) { page = vmalloc_to_pfn((void *)pos); @@ -1187,8 +1729,18 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma) { } start += PAGE_SIZE; pos += PAGE_SIZE; - size -= PAGE_SIZE; + if (size > PAGE_SIZE) + size -= PAGE_SIZE; + else + size = 0; } + + vma->vm_ops = &meye_vm_ops; + vma->vm_flags &= ~VM_IO; /* not I/O memory */ + vma->vm_flags |= VM_RESERVED; /* avoid to swap out this VMA */ + vma->vm_private_data = (void *) (offset / gbufsize); + meye_vm_open(vma); + up(&meye.lock); return 0; } diff --git a/drivers/media/video/meye.h b/drivers/media/video/meye.h index 508c95ede45c..db02302f7ee3 100644 --- a/drivers/media/video/meye.h +++ b/drivers/media/video/meye.h @@ -279,6 +279,8 @@ struct meye_grab_buffer { int state; /* state of buffer */ unsigned long size; /* size of jpg frame */ + struct timeval timestamp; /* timestamp */ + unsigned long sequence; /* sequence number */ }; /* size of kfifos containings buffer indices */ @@ -302,6 +304,7 @@ struct meye { unsigned char *grab_temp; /* temporary buffer */ /* list of buffers */ struct meye_grab_buffer grab_buffer[MEYE_MAX_BUFNBRS]; + int vma_use_count[MEYE_MAX_BUFNBRS]; /* mmap count */ /* other */ struct semaphore lock; /* semaphore for open/mmap... */ diff --git a/include/linux/meye.h b/include/linux/meye.h index dc2c12d64f7f..69783a65f52c 100644 --- a/include/linux/meye.h +++ b/include/linux/meye.h @@ -56,4 +56,11 @@ struct meye_params { /* get a jpeg compressed snapshot */ #define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOCPRIVATE+5, int) +/* V4L2 private controls */ +#define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE +#define V4L2_CID_SHARPNESS (V4L2_CID_PRIVATE_BASE + 1) +#define V4L2_CID_PICTURE (V4L2_CID_PRIVATE_BASE + 2) +#define V4L2_CID_JPEGQUAL (V4L2_CID_PRIVATE_BASE + 3) +#define V4L2_CID_FRAMERATE (V4L2_CID_PRIVATE_BASE + 4) + #endif -- cgit v1.2.3 From 2d39d7cf6ebd0cefba14ff203b61480329b8bc67 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Sun, 7 Nov 2004 04:01:40 -0800 Subject: [PATCH] meye: whitespace and coding style cleanups Signed-off-by: Stelian Pop Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/meye.txt | 10 +- drivers/media/video/meye.c | 624 +++++++++++++++++++------------------ drivers/media/video/meye.h | 26 +- include/linux/meye.h | 10 +- 4 files changed, 332 insertions(+), 338 deletions(-) (limited to 'include/linux') diff --git a/Documentation/video4linux/meye.txt b/Documentation/video4linux/meye.txt index 05e18fa49766..2137da97552f 100644 --- a/Documentation/video4linux/meye.txt +++ b/Documentation/video4linux/meye.txt @@ -1,12 +1,12 @@ Vaio Picturebook Motion Eye Camera Driver Readme ------------------------------------------------ - Copyright (C) 2001-2003 Stelian Pop + Copyright (C) 2001-2004 Stelian Pop Copyright (C) 2001-2002 Alcôve Copyright (C) 2000 Andrew Tridgell This driver enable the use of video4linux compatible applications with the -Motion Eye camera. This driver requires the "Sony Vaio Programmable I/O -Control Device" driver (which can be found in the "Character drivers" +Motion Eye camera. This driver requires the "Sony Vaio Programmable I/O +Control Device" driver (which can be found in the "Character drivers" section of the kernel configuration utility) to be compiled and installed (using its "camera=1" parameter). @@ -24,7 +24,7 @@ This driver supports the 'second' version of the MotionEye camera :) The first version was connected directly on the video bus of the Neomagic video card and is unsupported. -The second one, made by Kawasaki Steel is fully supported by this +The second one, made by Kawasaki Steel is fully supported by this driver (PCI vendor/device is 0x136b/0xff01) The third one, present in recent (more or less last year) Picturebooks @@ -116,7 +116,7 @@ Private API: MEYEIOC_STILLJCAPT Takes a snapshot in an uncompressed or compressed jpeg format. This ioctl blocks until the snapshot is done and returns (for - jpeg snapshot) the size of the image. The image data is + jpeg snapshot) the size of the image. The image data is available from the first mmap'ed buffer. Look at the 'motioneye' application code for an actual example. diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index 4732b3a4af34..797f58666e23 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c @@ -1,7 +1,7 @@ -/* +/* * Motion Eye video4linux driver for Sony Vaio PictureBook * - * Copyright (C) 2001-2003 Stelian Pop + * Copyright (C) 2001-2004 Stelian Pop * * Copyright (C) 2001-2002 Alcôve * @@ -11,17 +11,17 @@ * * Some parts borrowed from various video4linux drivers, especially * bttv-driver.c and zoran.c, see original files for credits. - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -73,15 +73,16 @@ static struct meye meye; /****************************************************************************/ /* Memory allocation routines (stolen from bttv-driver.c) */ /****************************************************************************/ -static void *rvmalloc(unsigned long size) { +static void *rvmalloc(unsigned long size) +{ void *mem; unsigned long adr; size = PAGE_ALIGN(size); mem = vmalloc_32(size); if (mem) { - memset(mem, 0, size); /* Clear the ram out, no junk to the user */ - adr = (unsigned long)mem; + memset(mem, 0, size); + adr = (unsigned long) mem; while (size > 0) { SetPageReserved(vmalloc_to_page((void *)adr)); adr += PAGE_SIZE; @@ -91,11 +92,12 @@ static void *rvmalloc(unsigned long size) { return mem; } -static void rvfree(void * mem, unsigned long size) { - unsigned long adr; +static void rvfree(void * mem, unsigned long size) +{ + unsigned long adr; if (mem) { - adr = (unsigned long) mem; + adr = (unsigned long) mem; while ((long) size > 0) { ClearPageReserved(vmalloc_to_page((void *)adr)); adr += PAGE_SIZE; @@ -114,7 +116,8 @@ static void rvfree(void * mem, unsigned long size) { * dma_addr_t for correctness but the compilation of this driver is * disabled for HIGHMEM64G=y, where sizeof(dma_addr_t) != 4 */ -static int ptable_alloc(void) { +static int ptable_alloc(void) +{ dma_addr_t *pt; int i; @@ -131,7 +134,7 @@ static int ptable_alloc(void) { pt = meye.mchip_ptable_toc; for (i = 0; i < MCHIP_NB_PAGES; i++) { - meye.mchip_ptable[i] = dma_alloc_coherent(&meye.mchip_dev->dev, + meye.mchip_ptable[i] = dma_alloc_coherent(&meye.mchip_dev->dev, PAGE_SIZE, pt, GFP_KERNEL); @@ -157,22 +160,23 @@ static int ptable_alloc(void) { return 0; } -static void ptable_free(void) { +static void ptable_free(void) +{ dma_addr_t *pt; int i; pt = meye.mchip_ptable_toc; for (i = 0; i < MCHIP_NB_PAGES; i++) { if (meye.mchip_ptable[i]) - dma_free_coherent(&meye.mchip_dev->dev, - PAGE_SIZE, + dma_free_coherent(&meye.mchip_dev->dev, + PAGE_SIZE, meye.mchip_ptable[i], *pt); pt++; } if (meye.mchip_ptable_toc) - dma_free_coherent(&meye.mchip_dev->dev, - PAGE_SIZE, + dma_free_coherent(&meye.mchip_dev->dev, + PAGE_SIZE, meye.mchip_ptable_toc, meye.mchip_dmahandle); @@ -182,9 +186,10 @@ static void ptable_free(void) { } /* copy data from ptable into buf */ -static void ptable_copy(u8 *buf, int start, int size, int pt_pages) { +static void ptable_copy(u8 *buf, int start, int size, int pt_pages) +{ int i; - + for (i = 0; i < (size / PAGE_SIZE) * PAGE_SIZE; i += PAGE_SIZE) { memcpy(buf + i, meye.mchip_ptable[start++], PAGE_SIZE); if (start >= pt_pages) @@ -193,224 +198,193 @@ static void ptable_copy(u8 *buf, int start, int size, int pt_pages) { memcpy(buf + i, meye.mchip_ptable[start], size % PAGE_SIZE); } - /****************************************************************************/ /* JPEG tables at different qualities to load into the VRJ chip */ /****************************************************************************/ /* return a set of quantisation tables based on a quality from 1 to 10 */ -static u16 *jpeg_quantisation_tables(int *size, int quality) { - static u16 tables0[] = { - 0xdbff, 0x4300, 0xff00, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, - 0xdbff, 0x4300, 0xff01, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, - }; - static u16 tables1[] = { - 0xdbff, 0x4300, 0x5000, 0x3c37, 0x3c46, 0x5032, 0x4146, 0x5a46, - 0x5055, 0x785f, 0x82c8, 0x6e78, 0x786e, 0xaff5, 0x91b9, 0xffc8, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, - 0xdbff, 0x4300, 0x5501, 0x5a5a, 0x6978, 0xeb78, 0x8282, 0xffeb, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, - }; - static u16 tables2[] = { - 0xdbff, 0x4300, 0x2800, 0x1e1c, 0x1e23, 0x2819, 0x2123, 0x2d23, - 0x282b, 0x3c30, 0x4164, 0x373c, 0x3c37, 0x587b, 0x495d, 0x9164, - 0x9980, 0x8f96, 0x8c80, 0xa08a, 0xe6b4, 0xa0c3, 0xdaaa, 0x8aad, - 0xc88c, 0xcbff, 0xeeda, 0xfff5, 0xffff, 0xc19b, 0xffff, 0xfaff, - 0xe6ff, 0xfffd, 0xfff8, - 0xdbff, 0x4300, 0x2b01, 0x2d2d, 0x353c, 0x763c, 0x4141, 0xf876, - 0x8ca5, 0xf8a5, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, - 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, - 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, - 0xf8f8, 0xf8f8, 0xfff8, - }; - static u16 tables3[] = { - 0xdbff, 0x4300, 0x1b00, 0x1412, 0x1417, 0x1b11, 0x1617, 0x1e17, - 0x1b1c, 0x2820, 0x2b42, 0x2528, 0x2825, 0x3a51, 0x303d, 0x6042, - 0x6555, 0x5f64, 0x5d55, 0x6a5b, 0x9978, 0x6a81, 0x9071, 0x5b73, - 0x855d, 0x86b5, 0x9e90, 0xaba3, 0xabad, 0x8067, 0xc9bc, 0xa6ba, - 0x99c7, 0xaba8, 0xffa4, - 0xdbff, 0x4300, 0x1c01, 0x1e1e, 0x2328, 0x4e28, 0x2b2b, 0xa44e, - 0x5d6e, 0xa46e, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, - 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, - 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, - 0xa4a4, 0xa4a4, 0xffa4, - }; - static u16 tables4[] = { - 0xdbff, 0x4300, 0x1400, 0x0f0e, 0x0f12, 0x140d, 0x1012, 0x1712, - 0x1415, 0x1e18, 0x2132, 0x1c1e, 0x1e1c, 0x2c3d, 0x242e, 0x4932, - 0x4c40, 0x474b, 0x4640, 0x5045, 0x735a, 0x5062, 0x6d55, 0x4556, - 0x6446, 0x6588, 0x776d, 0x817b, 0x8182, 0x604e, 0x978d, 0x7d8c, - 0x7396, 0x817e, 0xff7c, - 0xdbff, 0x4300, 0x1501, 0x1717, 0x1a1e, 0x3b1e, 0x2121, 0x7c3b, - 0x4653, 0x7c53, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, - 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, - 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, - 0x7c7c, 0x7c7c, 0xff7c, - }; - static u16 tables5[] = { - 0xdbff, 0x4300, 0x1000, 0x0c0b, 0x0c0e, 0x100a, 0x0d0e, 0x120e, - 0x1011, 0x1813, 0x1a28, 0x1618, 0x1816, 0x2331, 0x1d25, 0x3a28, - 0x3d33, 0x393c, 0x3833, 0x4037, 0x5c48, 0x404e, 0x5744, 0x3745, - 0x5038, 0x516d, 0x5f57, 0x6762, 0x6768, 0x4d3e, 0x7971, 0x6470, - 0x5c78, 0x6765, 0xff63, - 0xdbff, 0x4300, 0x1101, 0x1212, 0x1518, 0x2f18, 0x1a1a, 0x632f, - 0x3842, 0x6342, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, - 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, - 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, - 0x6363, 0x6363, 0xff63, - }; - static u16 tables6[] = { - 0xdbff, 0x4300, 0x0d00, 0x0a09, 0x0a0b, 0x0d08, 0x0a0b, 0x0e0b, - 0x0d0e, 0x130f, 0x1520, 0x1213, 0x1312, 0x1c27, 0x171e, 0x2e20, - 0x3129, 0x2e30, 0x2d29, 0x332c, 0x4a3a, 0x333e, 0x4636, 0x2c37, - 0x402d, 0x4157, 0x4c46, 0x524e, 0x5253, 0x3e32, 0x615a, 0x505a, - 0x4a60, 0x5251, 0xff4f, - 0xdbff, 0x4300, 0x0e01, 0x0e0e, 0x1113, 0x2613, 0x1515, 0x4f26, - 0x2d35, 0x4f35, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, - 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, - 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, - 0x4f4f, 0x4f4f, 0xff4f, - }; - static u16 tables7[] = { - 0xdbff, 0x4300, 0x0a00, 0x0707, 0x0708, 0x0a06, 0x0808, 0x0b08, - 0x0a0a, 0x0e0b, 0x1018, 0x0d0e, 0x0e0d, 0x151d, 0x1116, 0x2318, - 0x251f, 0x2224, 0x221f, 0x2621, 0x372b, 0x262f, 0x3429, 0x2129, - 0x3022, 0x3141, 0x3934, 0x3e3b, 0x3e3e, 0x2e25, 0x4944, 0x3c43, - 0x3748, 0x3e3d, 0xff3b, - 0xdbff, 0x4300, 0x0a01, 0x0b0b, 0x0d0e, 0x1c0e, 0x1010, 0x3b1c, - 0x2228, 0x3b28, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, - 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, - 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, - 0x3b3b, 0x3b3b, 0xff3b, - }; - static u16 tables8[] = { - 0xdbff, 0x4300, 0x0600, 0x0504, 0x0506, 0x0604, 0x0506, 0x0706, - 0x0607, 0x0a08, 0x0a10, 0x090a, 0x0a09, 0x0e14, 0x0c0f, 0x1710, - 0x1814, 0x1718, 0x1614, 0x1a16, 0x251d, 0x1a1f, 0x231b, 0x161c, - 0x2016, 0x202c, 0x2623, 0x2927, 0x292a, 0x1f19, 0x302d, 0x282d, - 0x2530, 0x2928, 0xff28, - 0xdbff, 0x4300, 0x0701, 0x0707, 0x080a, 0x130a, 0x0a0a, 0x2813, - 0x161a, 0x281a, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, - 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, - 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, - 0x2828, 0x2828, 0xff28, - }; - static u16 tables9[] = { - 0xdbff, 0x4300, 0x0300, 0x0202, 0x0203, 0x0302, 0x0303, 0x0403, - 0x0303, 0x0504, 0x0508, 0x0405, 0x0504, 0x070a, 0x0607, 0x0c08, - 0x0c0a, 0x0b0c, 0x0b0a, 0x0d0b, 0x120e, 0x0d10, 0x110e, 0x0b0e, - 0x100b, 0x1016, 0x1311, 0x1514, 0x1515, 0x0f0c, 0x1817, 0x1416, - 0x1218, 0x1514, 0xff14, - 0xdbff, 0x4300, 0x0301, 0x0404, 0x0405, 0x0905, 0x0505, 0x1409, - 0x0b0d, 0x140d, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, - 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, - 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, - 0x1414, 0x1414, 0xff14, - }; - static u16 tables10[] = { - 0xdbff, 0x4300, 0x0100, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, - 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, - 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, - 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, - 0x0101, 0x0101, 0xff01, - 0xdbff, 0x4300, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, - 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, - 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, - 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, - 0x0101, 0x0101, 0xff01, - }; - - switch (quality) { - case 0: - *size = sizeof(tables0); - return tables0; - case 1: - *size = sizeof(tables1); - return tables1; - case 2: - *size = sizeof(tables2); - return tables2; - case 3: - *size = sizeof(tables3); - return tables3; - case 4: - *size = sizeof(tables4); - return tables4; - case 5: - *size = sizeof(tables5); - return tables5; - case 6: - *size = sizeof(tables6); - return tables6; - case 7: - *size = sizeof(tables7); - return tables7; - case 8: - *size = sizeof(tables8); - return tables8; - case 9: - *size = sizeof(tables9); - return tables9; - case 10: - *size = sizeof(tables10); - return tables10; - default: - printk(KERN_WARNING "meye: invalid quality level %d - using 8\n", quality); - *size = sizeof(tables8); - return tables8; - } - return NULL; +static u16 *jpeg_quantisation_tables(int *length, int quality) +{ + static u16 jpeg_tables[][70] = { { + 0xdbff, 0x4300, 0xff00, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, + 0xdbff, 0x4300, 0xff01, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, + }, + { + 0xdbff, 0x4300, 0x5000, 0x3c37, 0x3c46, 0x5032, 0x4146, 0x5a46, + 0x5055, 0x785f, 0x82c8, 0x6e78, 0x786e, 0xaff5, 0x91b9, 0xffc8, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, + 0xdbff, 0x4300, 0x5501, 0x5a5a, 0x6978, 0xeb78, 0x8282, 0xffeb, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, + }, + { + 0xdbff, 0x4300, 0x2800, 0x1e1c, 0x1e23, 0x2819, 0x2123, 0x2d23, + 0x282b, 0x3c30, 0x4164, 0x373c, 0x3c37, 0x587b, 0x495d, 0x9164, + 0x9980, 0x8f96, 0x8c80, 0xa08a, 0xe6b4, 0xa0c3, 0xdaaa, 0x8aad, + 0xc88c, 0xcbff, 0xeeda, 0xfff5, 0xffff, 0xc19b, 0xffff, 0xfaff, + 0xe6ff, 0xfffd, 0xfff8, + 0xdbff, 0x4300, 0x2b01, 0x2d2d, 0x353c, 0x763c, 0x4141, 0xf876, + 0x8ca5, 0xf8a5, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, + 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, + 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, 0xf8f8, + 0xf8f8, 0xf8f8, 0xfff8, + }, + { + 0xdbff, 0x4300, 0x1b00, 0x1412, 0x1417, 0x1b11, 0x1617, 0x1e17, + 0x1b1c, 0x2820, 0x2b42, 0x2528, 0x2825, 0x3a51, 0x303d, 0x6042, + 0x6555, 0x5f64, 0x5d55, 0x6a5b, 0x9978, 0x6a81, 0x9071, 0x5b73, + 0x855d, 0x86b5, 0x9e90, 0xaba3, 0xabad, 0x8067, 0xc9bc, 0xa6ba, + 0x99c7, 0xaba8, 0xffa4, + 0xdbff, 0x4300, 0x1c01, 0x1e1e, 0x2328, 0x4e28, 0x2b2b, 0xa44e, + 0x5d6e, 0xa46e, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, + 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, + 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, + 0xa4a4, 0xa4a4, 0xffa4, + }, + { + 0xdbff, 0x4300, 0x1400, 0x0f0e, 0x0f12, 0x140d, 0x1012, 0x1712, + 0x1415, 0x1e18, 0x2132, 0x1c1e, 0x1e1c, 0x2c3d, 0x242e, 0x4932, + 0x4c40, 0x474b, 0x4640, 0x5045, 0x735a, 0x5062, 0x6d55, 0x4556, + 0x6446, 0x6588, 0x776d, 0x817b, 0x8182, 0x604e, 0x978d, 0x7d8c, + 0x7396, 0x817e, 0xff7c, + 0xdbff, 0x4300, 0x1501, 0x1717, 0x1a1e, 0x3b1e, 0x2121, 0x7c3b, + 0x4653, 0x7c53, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, + 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, + 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, 0x7c7c, + 0x7c7c, 0x7c7c, 0xff7c, + }, + { + 0xdbff, 0x4300, 0x1000, 0x0c0b, 0x0c0e, 0x100a, 0x0d0e, 0x120e, + 0x1011, 0x1813, 0x1a28, 0x1618, 0x1816, 0x2331, 0x1d25, 0x3a28, + 0x3d33, 0x393c, 0x3833, 0x4037, 0x5c48, 0x404e, 0x5744, 0x3745, + 0x5038, 0x516d, 0x5f57, 0x6762, 0x6768, 0x4d3e, 0x7971, 0x6470, + 0x5c78, 0x6765, 0xff63, + 0xdbff, 0x4300, 0x1101, 0x1212, 0x1518, 0x2f18, 0x1a1a, 0x632f, + 0x3842, 0x6342, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, + 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, + 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, 0x6363, + 0x6363, 0x6363, 0xff63, + }, + { + 0xdbff, 0x4300, 0x0d00, 0x0a09, 0x0a0b, 0x0d08, 0x0a0b, 0x0e0b, + 0x0d0e, 0x130f, 0x1520, 0x1213, 0x1312, 0x1c27, 0x171e, 0x2e20, + 0x3129, 0x2e30, 0x2d29, 0x332c, 0x4a3a, 0x333e, 0x4636, 0x2c37, + 0x402d, 0x4157, 0x4c46, 0x524e, 0x5253, 0x3e32, 0x615a, 0x505a, + 0x4a60, 0x5251, 0xff4f, + 0xdbff, 0x4300, 0x0e01, 0x0e0e, 0x1113, 0x2613, 0x1515, 0x4f26, + 0x2d35, 0x4f35, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, + 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, + 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, 0x4f4f, + 0x4f4f, 0x4f4f, 0xff4f, + }, + { + 0xdbff, 0x4300, 0x0a00, 0x0707, 0x0708, 0x0a06, 0x0808, 0x0b08, + 0x0a0a, 0x0e0b, 0x1018, 0x0d0e, 0x0e0d, 0x151d, 0x1116, 0x2318, + 0x251f, 0x2224, 0x221f, 0x2621, 0x372b, 0x262f, 0x3429, 0x2129, + 0x3022, 0x3141, 0x3934, 0x3e3b, 0x3e3e, 0x2e25, 0x4944, 0x3c43, + 0x3748, 0x3e3d, 0xff3b, + 0xdbff, 0x4300, 0x0a01, 0x0b0b, 0x0d0e, 0x1c0e, 0x1010, 0x3b1c, + 0x2228, 0x3b28, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, + 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, + 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, 0x3b3b, + 0x3b3b, 0x3b3b, 0xff3b, + }, + { + 0xdbff, 0x4300, 0x0600, 0x0504, 0x0506, 0x0604, 0x0506, 0x0706, + 0x0607, 0x0a08, 0x0a10, 0x090a, 0x0a09, 0x0e14, 0x0c0f, 0x1710, + 0x1814, 0x1718, 0x1614, 0x1a16, 0x251d, 0x1a1f, 0x231b, 0x161c, + 0x2016, 0x202c, 0x2623, 0x2927, 0x292a, 0x1f19, 0x302d, 0x282d, + 0x2530, 0x2928, 0xff28, + 0xdbff, 0x4300, 0x0701, 0x0707, 0x080a, 0x130a, 0x0a0a, 0x2813, + 0x161a, 0x281a, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, + 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, + 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, + 0x2828, 0x2828, 0xff28, + }, + { + 0xdbff, 0x4300, 0x0300, 0x0202, 0x0203, 0x0302, 0x0303, 0x0403, + 0x0303, 0x0504, 0x0508, 0x0405, 0x0504, 0x070a, 0x0607, 0x0c08, + 0x0c0a, 0x0b0c, 0x0b0a, 0x0d0b, 0x120e, 0x0d10, 0x110e, 0x0b0e, + 0x100b, 0x1016, 0x1311, 0x1514, 0x1515, 0x0f0c, 0x1817, 0x1416, + 0x1218, 0x1514, 0xff14, + 0xdbff, 0x4300, 0x0301, 0x0404, 0x0405, 0x0905, 0x0505, 0x1409, + 0x0b0d, 0x140d, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, + 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, + 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, 0x1414, + 0x1414, 0x1414, 0xff14, + }, + { + 0xdbff, 0x4300, 0x0100, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, + 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, + 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, + 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, + 0x0101, 0x0101, 0xff01, + 0xdbff, 0x4300, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, + 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, + 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, + 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, + 0x0101, 0x0101, 0xff01, + } }; + + if (quality < 0 || quality > 10) { + printk(KERN_WARNING + "meye: invalid quality level %d - using 8\n", quality); + quality = 8; + } + + *length = ARRAY_SIZE(jpeg_tables[quality]); + return jpeg_tables[quality]; } /* return a generic set of huffman tables */ -static u16 *jpeg_huffman_tables(int *size) { +static u16 *jpeg_huffman_tables(int *length) +{ static u16 tables[] = { - 0xC4FF, 0xB500, 0x0010, 0x0102, 0x0303, 0x0402, 0x0503, 0x0405, - 0x0004, 0x0100, 0x017D, 0x0302, 0x0400, 0x0511, 0x2112, 0x4131, - 0x1306, 0x6151, 0x2207, 0x1471, 0x8132, 0xA191, 0x2308, 0xB142, - 0x15C1, 0xD152, 0x24F0, 0x6233, 0x8272, 0x0A09, 0x1716, 0x1918, - 0x251A, 0x2726, 0x2928, 0x342A, 0x3635, 0x3837, 0x3A39, 0x4443, - 0x4645, 0x4847, 0x4A49, 0x5453, 0x5655, 0x5857, 0x5A59, 0x6463, - 0x6665, 0x6867, 0x6A69, 0x7473, 0x7675, 0x7877, 0x7A79, 0x8483, - 0x8685, 0x8887, 0x8A89, 0x9392, 0x9594, 0x9796, 0x9998, 0xA29A, - 0xA4A3, 0xA6A5, 0xA8A7, 0xAAA9, 0xB3B2, 0xB5B4, 0xB7B6, 0xB9B8, - 0xC2BA, 0xC4C3, 0xC6C5, 0xC8C7, 0xCAC9, 0xD3D2, 0xD5D4, 0xD7D6, - 0xD9D8, 0xE1DA, 0xE3E2, 0xE5E4, 0xE7E6, 0xE9E8, 0xF1EA, 0xF3F2, - 0xF5F4, 0xF7F6, 0xF9F8, 0xFFFA, - 0xC4FF, 0xB500, 0x0011, 0x0102, 0x0402, 0x0304, 0x0704, 0x0405, - 0x0004, 0x0201, 0x0077, 0x0201, 0x1103, 0x0504, 0x3121, 0x1206, - 0x5141, 0x6107, 0x1371, 0x3222, 0x0881, 0x4214, 0xA191, 0xC1B1, - 0x2309, 0x5233, 0x15F0, 0x7262, 0x0AD1, 0x2416, 0xE134, 0xF125, - 0x1817, 0x1A19, 0x2726, 0x2928, 0x352A, 0x3736, 0x3938, 0x433A, - 0x4544, 0x4746, 0x4948, 0x534A, 0x5554, 0x5756, 0x5958, 0x635A, - 0x6564, 0x6766, 0x6968, 0x736A, 0x7574, 0x7776, 0x7978, 0x827A, - 0x8483, 0x8685, 0x8887, 0x8A89, 0x9392, 0x9594, 0x9796, 0x9998, - 0xA29A, 0xA4A3, 0xA6A5, 0xA8A7, 0xAAA9, 0xB3B2, 0xB5B4, 0xB7B6, - 0xB9B8, 0xC2BA, 0xC4C3, 0xC6C5, 0xC8C7, 0xCAC9, 0xD3D2, 0xD5D4, - 0xD7D6, 0xD9D8, 0xE2DA, 0xE4E3, 0xE6E5, 0xE8E7, 0xEAE9, 0xF3F2, - 0xF5F4, 0xF7F6, 0xF9F8, 0xFFFA, - 0xC4FF, 0x1F00, 0x0000, 0x0501, 0x0101, 0x0101, 0x0101, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0201, 0x0403, 0x0605, 0x0807, 0x0A09, - 0xFF0B, - 0xC4FF, 0x1F00, 0x0001, 0x0103, 0x0101, 0x0101, 0x0101, 0x0101, - 0x0000, 0x0000, 0x0000, 0x0201, 0x0403, 0x0605, 0x0807, 0x0A09, + 0xC4FF, 0xB500, 0x0010, 0x0102, 0x0303, 0x0402, 0x0503, 0x0405, + 0x0004, 0x0100, 0x017D, 0x0302, 0x0400, 0x0511, 0x2112, 0x4131, + 0x1306, 0x6151, 0x2207, 0x1471, 0x8132, 0xA191, 0x2308, 0xB142, + 0x15C1, 0xD152, 0x24F0, 0x6233, 0x8272, 0x0A09, 0x1716, 0x1918, + 0x251A, 0x2726, 0x2928, 0x342A, 0x3635, 0x3837, 0x3A39, 0x4443, + 0x4645, 0x4847, 0x4A49, 0x5453, 0x5655, 0x5857, 0x5A59, 0x6463, + 0x6665, 0x6867, 0x6A69, 0x7473, 0x7675, 0x7877, 0x7A79, 0x8483, + 0x8685, 0x8887, 0x8A89, 0x9392, 0x9594, 0x9796, 0x9998, 0xA29A, + 0xA4A3, 0xA6A5, 0xA8A7, 0xAAA9, 0xB3B2, 0xB5B4, 0xB7B6, 0xB9B8, + 0xC2BA, 0xC4C3, 0xC6C5, 0xC8C7, 0xCAC9, 0xD3D2, 0xD5D4, 0xD7D6, + 0xD9D8, 0xE1DA, 0xE3E2, 0xE5E4, 0xE7E6, 0xE9E8, 0xF1EA, 0xF3F2, + 0xF5F4, 0xF7F6, 0xF9F8, 0xFFFA, + 0xC4FF, 0xB500, 0x0011, 0x0102, 0x0402, 0x0304, 0x0704, 0x0405, + 0x0004, 0x0201, 0x0077, 0x0201, 0x1103, 0x0504, 0x3121, 0x1206, + 0x5141, 0x6107, 0x1371, 0x3222, 0x0881, 0x4214, 0xA191, 0xC1B1, + 0x2309, 0x5233, 0x15F0, 0x7262, 0x0AD1, 0x2416, 0xE134, 0xF125, + 0x1817, 0x1A19, 0x2726, 0x2928, 0x352A, 0x3736, 0x3938, 0x433A, + 0x4544, 0x4746, 0x4948, 0x534A, 0x5554, 0x5756, 0x5958, 0x635A, + 0x6564, 0x6766, 0x6968, 0x736A, 0x7574, 0x7776, 0x7978, 0x827A, + 0x8483, 0x8685, 0x8887, 0x8A89, 0x9392, 0x9594, 0x9796, 0x9998, + 0xA29A, 0xA4A3, 0xA6A5, 0xA8A7, 0xAAA9, 0xB3B2, 0xB5B4, 0xB7B6, + 0xB9B8, 0xC2BA, 0xC4C3, 0xC6C5, 0xC8C7, 0xCAC9, 0xD3D2, 0xD5D4, + 0xD7D6, 0xD9D8, 0xE2DA, 0xE4E3, 0xE6E5, 0xE8E7, 0xEAE9, 0xF3F2, + 0xF5F4, 0xF7F6, 0xF9F8, 0xFFFA, + 0xC4FF, 0x1F00, 0x0000, 0x0501, 0x0101, 0x0101, 0x0101, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0201, 0x0403, 0x0605, 0x0807, 0x0A09, + 0xFF0B, + 0xC4FF, 0x1F00, 0x0001, 0x0103, 0x0101, 0x0101, 0x0101, 0x0101, + 0x0000, 0x0000, 0x0000, 0x0201, 0x0403, 0x0605, 0x0807, 0x0A09, 0xFF0B }; - *size = sizeof(tables); + *length = ARRAY_SIZE(tables); return tables; } @@ -419,23 +393,27 @@ static u16 *jpeg_huffman_tables(int *size) { /****************************************************************************/ /* returns the horizontal capture size */ -static inline int mchip_hsize(void) { +static inline int mchip_hsize(void) +{ return meye.params.subsample ? 320 : 640; } /* returns the vertical capture size */ -static inline int mchip_vsize(void) { +static inline int mchip_vsize(void) +{ return meye.params.subsample ? 240 : 480; } /* waits for a register to be available */ -static void mchip_sync(int reg) { +static void mchip_sync(int reg) +{ u32 status; int i; if (reg == MCHIP_MM_FIFO_DATA) { for (i = 0; i < MCHIP_REG_TIMEOUT; i++) { - status = readl(meye.mchip_mmregs + MCHIP_MM_FIFO_STATUS); + status = readl(meye.mchip_mmregs + + MCHIP_MM_FIFO_STATUS); if (!(status & MCHIP_MM_FIFO_WAIT)) { printk(KERN_WARNING "meye: fifo not ready\n"); return; @@ -444,44 +422,48 @@ static void mchip_sync(int reg) { return; udelay(1); } - } - else if (reg > 0x80) { + } else if (reg > 0x80) { u32 mask = (reg < 0x100) ? MCHIP_HIC_STATUS_MCC_RDY - : MCHIP_HIC_STATUS_VRJ_RDY; + : MCHIP_HIC_STATUS_VRJ_RDY; for (i = 0; i < MCHIP_REG_TIMEOUT; i++) { status = readl(meye.mchip_mmregs + MCHIP_HIC_STATUS); if (status & mask) return; udelay(1); } - } - else + } else return; - printk(KERN_WARNING "meye: mchip_sync() timeout on reg 0x%x status=0x%x\n", reg, status); + printk(KERN_WARNING + "meye: mchip_sync() timeout on reg 0x%x status=0x%x\n", + reg, status); } /* sets a value into the register */ -static inline void mchip_set(int reg, u32 v) { +static inline void mchip_set(int reg, u32 v) +{ mchip_sync(reg); writel(v, meye.mchip_mmregs + reg); } /* get the register value */ -static inline u32 mchip_read(int reg) { +static inline u32 mchip_read(int reg) +{ mchip_sync(reg); return readl(meye.mchip_mmregs + reg); } /* wait for a register to become a particular value */ -static inline int mchip_delay(u32 reg, u32 v) { +static inline int mchip_delay(u32 reg, u32 v) +{ int n = 10; - while (--n && mchip_read(reg) != v) + while (--n && mchip_read(reg) != v) udelay(1); return n; } /* setup subsampling */ -static void mchip_subsample(void) { +static void mchip_subsample(void) +{ mchip_set(MCHIP_MCC_R_SAMPLING, meye.params.subsample); mchip_set(MCHIP_MCC_R_XRANGE, mchip_hsize()); mchip_set(MCHIP_MCC_R_YRANGE, mchip_vsize()); @@ -491,29 +473,31 @@ static void mchip_subsample(void) { } /* set the framerate into the mchip */ -static void mchip_set_framerate(void) { +static void mchip_set_framerate(void) +{ mchip_set(MCHIP_HIC_S_RATE, meye.params.framerate); } /* load some huffman and quantisation tables into the VRJ chip ready for JPEG compression */ -static void mchip_load_tables(void) { +static void mchip_load_tables(void) +{ int i; - int size; + int length; u16 *tables; - tables = jpeg_huffman_tables(&size); - for (i = 0; i < size / 2; i++) + tables = jpeg_huffman_tables(&length); + for (i = 0; i < length; i++) writel(tables[i], meye.mchip_mmregs + MCHIP_VRJ_TABLE_DATA); - tables = jpeg_quantisation_tables(&size, meye.params.quality); - for (i = 0; i < size / 2; i++) + tables = jpeg_quantisation_tables(&length, meye.params.quality); + for (i = 0; i < length; i++) writel(tables[i], meye.mchip_mmregs + MCHIP_VRJ_TABLE_DATA); } /* setup the VRJ parameters in the chip */ -static void mchip_vrj_setup(u8 mode) { - +static void mchip_vrj_setup(u8 mode) +{ mchip_set(MCHIP_VRJ_BUS_MODE, 5); mchip_set(MCHIP_VRJ_SIGNAL_ACTIVE_LEVEL, 0x1f); mchip_set(MCHIP_VRJ_PDAT_USE, 1); @@ -530,13 +514,14 @@ static void mchip_vrj_setup(u8 mode) { mchip_set(MCHIP_VRJ_SOF2, 0x1502); mchip_set(MCHIP_VRJ_SOF3, 0x1503); mchip_set(MCHIP_VRJ_SOF4, 0x1596); - mchip_set(MCHIP_VRJ_SOS, 0x0ed0); + mchip_set(MCHIP_VRJ_SOS, 0x0ed0); mchip_load_tables(); } /* sets the DMA parameters into the chip */ -static void mchip_dma_setup(u32 dma_addr) { +static void mchip_dma_setup(u32 dma_addr) +{ int i; mchip_set(MCHIP_MM_PT_ADDR, dma_addr); @@ -546,7 +531,8 @@ static void mchip_dma_setup(u32 dma_addr) { } /* setup for DMA transfers - also zeros the framebuffer */ -static int mchip_dma_alloc(void) { +static int mchip_dma_alloc(void) +{ if (!meye.mchip_dmahandle) if (ptable_alloc()) return -1; @@ -554,7 +540,8 @@ static int mchip_dma_alloc(void) { } /* frees the DMA buffer */ -static void mchip_dma_free(void) { +static void mchip_dma_free(void) +{ if (meye.mchip_dmahandle) { mchip_dma_setup(0); ptable_free(); @@ -563,7 +550,8 @@ static void mchip_dma_free(void) { /* stop any existing HIC action and wait for any dma to complete then reset the dma engine */ -static void mchip_hic_stop(void) { +static void mchip_hic_stop(void) +{ int i, j; meye.mchip_mode = MCHIP_HIC_MODE_NOOP; @@ -573,12 +561,13 @@ static void mchip_hic_stop(void) { mchip_set(MCHIP_HIC_CMD, MCHIP_HIC_CMD_STOP); mchip_delay(MCHIP_HIC_CMD, 0); for (j = 0; j < 100; ++j) { - if (mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE)) + if (mchip_delay(MCHIP_HIC_STATUS, + MCHIP_HIC_STATUS_IDLE)) return; msleep(1); } printk(KERN_ERR "meye: need to reset HIC!\n"); - + mchip_set(MCHIP_HIC_CTL, MCHIP_HIC_CTL_SOFT_RESET); msleep(250); } @@ -590,15 +579,17 @@ static void mchip_hic_stop(void) { /****************************************************************************/ /* get the next ready frame from the dma engine */ -static u32 mchip_get_frame(void) { +static u32 mchip_get_frame(void) +{ u32 v; - + v = mchip_read(MCHIP_MM_FIR(meye.mchip_fnum)); return v; } /* frees the current frame from the dma engine */ -static void mchip_free_frame(void) { +static void mchip_free_frame(void) +{ mchip_set(MCHIP_MM_FIR(meye.mchip_fnum), 0); meye.mchip_fnum++; meye.mchip_fnum %= 4; @@ -606,17 +597,18 @@ static void mchip_free_frame(void) { /* read one frame from the framebuffer assuming it was captured using a uncompressed transfer */ -static void mchip_cont_read_frame(u32 v, u8 *buf, int size) { +static void mchip_cont_read_frame(u32 v, u8 *buf, int size) +{ int pt_id; pt_id = (v >> 17) & 0x3FF; ptable_copy(buf, pt_id, size, MCHIP_NB_PAGES); - } /* read a compressed frame from the framebuffer */ -static int mchip_comp_read_frame(u32 v, u8 *buf, int size) { +static int mchip_comp_read_frame(u32 v, u8 *buf, int size) +{ int pt_start, pt_end, trailer; int fsize; int i; @@ -632,18 +624,17 @@ static int mchip_comp_read_frame(u32 v, u8 *buf, int size) { fsize = (pt_end - pt_start) * PAGE_SIZE + trailer * 4; if (fsize > size) { - printk(KERN_WARNING "meye: oversized compressed frame %d\n", + printk(KERN_WARNING "meye: oversized compressed frame %d\n", fsize); return -1; } ptable_copy(buf, pt_start, fsize, MCHIP_NB_PAGES_MJPEG); - #ifdef MEYE_JPEG_CORRECTION /* Some mchip generated jpeg frames are incorrect. In most - * (all ?) of those cases, the final EOI (0xff 0xd9) marker + * (all ?) of those cases, the final EOI (0xff 0xd9) marker * is not present at the end of the frame. * * Since adding the final marker is not enough to restore @@ -661,9 +652,10 @@ static int mchip_comp_read_frame(u32 v, u8 *buf, int size) { } /* take a picture into SDRAM */ -static void mchip_take_picture(void) { +static void mchip_take_picture(void) +{ int i; - + mchip_hic_stop(); mchip_subsample(); mchip_dma_setup(meye.mchip_dmahandle); @@ -681,7 +673,8 @@ static void mchip_take_picture(void) { } /* dma a previously taken picture into a buffer */ -static void mchip_get_picture(u8 *buf, int bufsize) { +static void mchip_get_picture(u8 *buf, int bufsize) +{ u32 v; int i; @@ -694,7 +687,7 @@ static void mchip_get_picture(u8 *buf, int bufsize) { break; msleep(1); } - for (i = 0; i < 4 ; ++i) { + for (i = 0; i < 4; ++i) { v = mchip_get_frame(); if (v & MCHIP_MM_FIR_RDY) { mchip_cont_read_frame(v, buf, bufsize); @@ -705,7 +698,8 @@ static void mchip_get_picture(u8 *buf, int bufsize) { } /* start continuous dma capture */ -static void mchip_continuous_start(void) { +static void mchip_continuous_start(void) +{ mchip_hic_stop(); mchip_subsample(); mchip_set_framerate(); @@ -720,7 +714,8 @@ static void mchip_continuous_start(void) { } /* compress one frame into a buffer */ -static int mchip_compress_frame(u8 *buf, int bufsize) { +static int mchip_compress_frame(u8 *buf, int bufsize) +{ u32 v; int len = -1, i; @@ -729,7 +724,7 @@ static int mchip_compress_frame(u8 *buf, int bufsize) { mchip_set(MCHIP_HIC_MODE, MCHIP_HIC_MODE_STILL_COMP); mchip_set(MCHIP_HIC_CMD, MCHIP_HIC_CMD_START); - + mchip_delay(MCHIP_HIC_CMD, 0); for (i = 0; i < 100; ++i) { if (mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE)) @@ -737,7 +732,7 @@ static int mchip_compress_frame(u8 *buf, int bufsize) { msleep(1); } - for (i = 0; i < 4 ; ++i) { + for (i = 0; i < 4; ++i) { v = mchip_get_frame(); if (v & MCHIP_MM_FIR_RDY) { len = mchip_comp_read_frame(v, buf, bufsize); @@ -750,13 +745,14 @@ static int mchip_compress_frame(u8 *buf, int bufsize) { #if 0 /* uncompress one image into a buffer */ -static int mchip_uncompress_frame(u8 *img, int imgsize, u8 *buf, int bufsize) { +static int mchip_uncompress_frame(u8 *img, int imgsize, u8 *buf, int bufsize) +{ mchip_vrj_setup(0x3f); udelay(50); mchip_set(MCHIP_HIC_MODE, MCHIP_HIC_MODE_STILL_DECOMP); mchip_set(MCHIP_HIC_CMD, MCHIP_HIC_CMD_START); - + mchip_delay(MCHIP_HIC_CMD, 0); return mchip_comp_read_frame(buf, bufsize); @@ -764,7 +760,8 @@ static int mchip_uncompress_frame(u8 *img, int imgsize, u8 *buf, int bufsize) { #endif /* start continuous compressed capture */ -static void mchip_cont_compression_start(void) { +static void mchip_cont_compression_start(void) +{ mchip_hic_stop(); mchip_vrj_setup(0x3f); mchip_subsample(); @@ -782,6 +779,7 @@ static void mchip_cont_compression_start(void) { /****************************************************************************/ /* Interrupt handling */ /****************************************************************************/ + static irqreturn_t meye_irq(int irq, void *dev_id, struct pt_regs *regs) { u32 v; @@ -842,10 +840,11 @@ again: /* video4linux integration */ /****************************************************************************/ -static int meye_open(struct inode *inode, struct file *file) { +static int meye_open(struct inode *inode, struct file *file) +{ int i, err; - err = video_exclusive_open(inode,file); + err = video_exclusive_open(inode, file); if (err < 0) return err; @@ -853,7 +852,7 @@ static int meye_open(struct inode *inode, struct file *file) { if (mchip_dma_alloc()) { printk(KERN_ERR "meye: mchip framebuffer allocation failed\n"); - video_exclusive_release(inode,file); + video_exclusive_release(inode, file); return -ENOBUFS; } @@ -861,20 +860,20 @@ static int meye_open(struct inode *inode, struct file *file) { meye.grab_buffer[i].state = MEYE_BUF_UNUSED; kfifo_reset(meye.grabq); kfifo_reset(meye.doneq); - return 0; } -static int meye_release(struct inode *inode, struct file *file) { +static int meye_release(struct inode *inode, struct file *file) +{ mchip_hic_stop(); mchip_dma_free(); - video_exclusive_release(inode,file); + video_exclusive_release(inode, file); return 0; } static int meye_do_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, void *arg) { - + unsigned int cmd, void *arg) +{ switch (cmd) { case VIDIOCGCAP: { @@ -921,13 +920,13 @@ static int meye_do_ioctl(struct inode *inode, struct file *file, if (p->palette != VIDEO_PALETTE_YUV422) return -EINVAL; down(&meye.lock); - sonypi_camera_command(SONYPI_COMMAND_SETCAMERABRIGHTNESS, + sonypi_camera_command(SONYPI_COMMAND_SETCAMERABRIGHTNESS, p->brightness >> 10); - sonypi_camera_command(SONYPI_COMMAND_SETCAMERAHUE, + sonypi_camera_command(SONYPI_COMMAND_SETCAMERAHUE, p->hue >> 10); - sonypi_camera_command(SONYPI_COMMAND_SETCAMERACOLOR, + sonypi_camera_command(SONYPI_COMMAND_SETCAMERACOLOR, p->colour >> 10); - sonypi_camera_command(SONYPI_COMMAND_SETCAMERACONTRAST, + sonypi_camera_command(SONYPI_COMMAND_SETCAMERACONTRAST, p->contrast >> 10); meye.picture = *p; up(&meye.lock); @@ -988,14 +987,12 @@ static int meye_do_ioctl(struct inode *inode, struct file *file, meye.params.subsample = 0; restart = 1; } - } - else if (vm->width == 320 && vm->height == 240) { + } else if (vm->width == 320 && vm->height == 240) { if (!meye.params.subsample) { meye.params.subsample = 1; restart = 1; } - } - else { + } else { up(&meye.lock); return -EINVAL; } @@ -1054,7 +1051,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file, case MEYEIOC_QBUF_CAPT: { int *nb = arg; - if (!meye.grab_fbuffer) + if (!meye.grab_fbuffer) return -EINVAL; if (*nb >= gbuffers) return -EINVAL; @@ -1109,7 +1106,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file, case MEYEIOC_STILLCAPT: { - if (!meye.grab_fbuffer) + if (!meye.grab_fbuffer) return -EINVAL; if (meye.grab_buffer[0].state != MEYE_BUF_UNUSED) return -EBUSY; @@ -1127,7 +1124,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file, case MEYEIOC_STILLJCAPT: { int *len = arg; - if (!meye.grab_fbuffer) + if (!meye.grab_fbuffer) return -EINVAL; if (meye.grab_buffer[0].state != MEYE_BUF_UNUSED) return -EBUSY; @@ -1695,7 +1692,8 @@ static struct vm_operations_struct meye_vm_ops = { .close = meye_vm_close, }; -static int meye_mmap(struct file *file, struct vm_area_struct *vma) { +static int meye_mmap(struct file *file, struct vm_area_struct *vma) +{ unsigned long start = vma->vm_start; unsigned long size = vma->vm_end - vma->vm_start; unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; @@ -1801,8 +1799,9 @@ static int meye_resume(struct pci_dev *pdev) } #endif -static int __devinit meye_probe(struct pci_dev *pcidev, - const struct pci_device_id *ent) { +static int __devinit meye_probe(struct pci_dev *pcidev, + const struct pci_device_id *ent) +{ int ret = -EBUSY; unsigned long mchip_adr; u8 revision; @@ -1897,12 +1896,12 @@ static int __devinit meye_probe(struct pci_dev *pcidev, msleep(1); mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK); - if (video_register_device(meye.video_dev, VFL_TYPE_GRABBER, video_nr) < 0) { - + if (video_register_device(meye.video_dev, VFL_TYPE_GRABBER, + video_nr) < 0) { printk(KERN_ERR "meye: video_register_device failed\n"); goto outvideoreg; } - + init_MUTEX(&meye.lock); init_waitqueue_head(&meye.proc_list); meye.picture.depth = 16; @@ -1956,8 +1955,8 @@ outnotdev: return ret; } -static void __devexit meye_remove(struct pci_dev *pcidev) { - +static void __devexit meye_remove(struct pci_dev *pcidev) +{ video_unregister_device(meye.video_dev); mchip_hic_stop(); @@ -1992,7 +1991,7 @@ static void __devexit meye_remove(struct pci_dev *pcidev) { } static struct pci_device_id meye_pci_tbl[] = { - { PCI_VENDOR_ID_KAWASAKI, PCI_DEVICE_ID_MCHIP_KL5A72002, + { PCI_VENDOR_ID_KAWASAKI, PCI_DEVICE_ID_MCHIP_KL5A72002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { } }; @@ -2010,20 +2009,23 @@ static struct pci_driver meye_driver = { #endif }; -static int __init meye_init(void) { +static int __init meye_init(void) +{ gbuffers = max(2, min((int)gbuffers, MEYE_MAX_BUFNBRS)); if (gbufsize < 0 || gbufsize > MEYE_MAX_BUFSIZE) gbufsize = MEYE_MAX_BUFSIZE; gbufsize = PAGE_ALIGN(gbufsize); - printk(KERN_INFO "meye: using %d buffers with %dk (%dk total) for capture\n", - gbuffers, gbufsize/1024, gbuffers*gbufsize/1024); - return pci_module_init(&meye_driver); + printk(KERN_INFO "meye: using %d buffers with %dk (%dk total)" + "for capture\n", + gbuffers, + gbufsize / 1024, gbuffers * gbufsize / 1024); + return pci_register_driver(&meye_driver); } -static void __exit meye_exit(void) { +static void __exit meye_exit(void) +{ pci_unregister_driver(&meye_driver); } -/* Module entry points */ module_init(meye_init); module_exit(meye_exit); diff --git a/drivers/media/video/meye.h b/drivers/media/video/meye.h index db02302f7ee3..68286c575a6b 100644 --- a/drivers/media/video/meye.h +++ b/drivers/media/video/meye.h @@ -1,27 +1,27 @@ -/* +/* * Motion Eye video4linux driver for Sony Vaio PictureBook * - * Copyright (C) 2001-2003 Stelian Pop + * Copyright (C) 2001-2004 Stelian Pop * * Copyright (C) 2001-2002 Alcôve * * Copyright (C) 2000 Andrew Tridgell * * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras. - * + * * Some parts borrowed from various video4linux drivers, especially * bttv-driver.c and zoran.c, see original files for credits. - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -30,7 +30,7 @@ #ifndef _MEYE_PRIV_H_ #define _MEYE_PRIV_H_ -#define MEYE_DRIVER_MAJORVERSION 1 +#define MEYE_DRIVER_MAJORVERSION 1 #define MEYE_DRIVER_MINORVERSION 10 #define MEYE_DRIVER_VERSION __stringify(MEYE_DRIVER_MAJORVERSION) "." \ @@ -47,7 +47,7 @@ /* Motion JPEG chip PCI configuration registers */ #define MCHIP_PCI_POWER_CSR 0x54 -#define MCHIP_PCI_MCORE_STATUS 0x60 /* see HIC_STATUS */ +#define MCHIP_PCI_MCORE_STATUS 0x60 /* see HIC_STATUS */ #define MCHIP_PCI_HOSTUSEREQ_SET 0x64 #define MCHIP_PCI_HOSTUSEREQ_CLR 0x68 #define MCHIP_PCI_LOWPOWER_SET 0x6c @@ -77,7 +77,7 @@ #define MCHIP_MM_INTA_PCI_ERR 0x00000040 /* PCI error */ #define MCHIP_MM_INTA_PCI_ERR_MASK 0x00004000 -#define MCHIP_MM_PT_ADDR 0x08 /* page table address */ +#define MCHIP_MM_PT_ADDR 0x08 /* page table address*/ /* n*4kB */ #define MCHIP_NB_PAGES 1024 /* pages for display */ #define MCHIP_NB_PAGES_MJPEG 256 /* pages for mjpeg */ @@ -288,33 +288,25 @@ struct meye_grab_buffer { /* Motion Eye device structure */ struct meye { - - /* mchip related */ struct pci_dev *mchip_dev; /* pci device */ u8 mchip_irq; /* irq */ u8 mchip_mode; /* actual mchip mode: HIC_MODE... */ u8 mchip_fnum; /* current mchip frame number */ - unsigned char *mchip_mmregs; /* mchip: memory mapped registers */ u8 *mchip_ptable[MCHIP_NB_PAGES];/* mchip: ptable */ dma_addr_t *mchip_ptable_toc; /* mchip: ptable toc */ dma_addr_t mchip_dmahandle; /* mchip: dma handle to ptable toc */ - unsigned char *grab_fbuffer; /* capture framebuffer */ unsigned char *grab_temp; /* temporary buffer */ /* list of buffers */ struct meye_grab_buffer grab_buffer[MEYE_MAX_BUFNBRS]; int vma_use_count[MEYE_MAX_BUFNBRS]; /* mmap count */ - - /* other */ struct semaphore lock; /* semaphore for open/mmap... */ - struct kfifo *grabq; /* queue for buffers to be grabbed */ spinlock_t grabq_lock; /* lock protecting the queue */ struct kfifo *doneq; /* queue for grabbed buffers */ spinlock_t doneq_lock; /* lock protecting the queue */ wait_queue_head_t proc_list; /* wait queue */ - struct video_device *video_dev; /* video device parameters */ struct video_picture picture; /* video picture parameters */ struct meye_params params; /* additional parameters */ diff --git a/include/linux/meye.h b/include/linux/meye.h index 69783a65f52c..11ec45e9a132 100644 --- a/include/linux/meye.h +++ b/include/linux/meye.h @@ -1,4 +1,4 @@ -/* +/* * Motion Eye video4linux driver for Sony Vaio PictureBook * * Copyright (C) 2001-2003 Stelian Pop @@ -8,20 +8,20 @@ * Copyright (C) 2000 Andrew Tridgell * * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras. - * + * * Some parts borrowed from various video4linux drivers, especially * bttv-driver.c and zoran.c, see original files for credits. - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- cgit v1.2.3 From 03d234808af3114835151019848b119b46d86bff Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Sun, 7 Nov 2004 04:02:32 -0800 Subject: [PATCH] videodev2.h patchlet The following patchlet to videodev2.h brings in the "__user" definition from linux/compiler.h, making it suitable for inclusion in both kernel or user code. Signed-off-by: Stelian Pop Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/videodev2.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index fda602c77144..819e211f60be 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -16,6 +16,7 @@ #ifdef __KERNEL__ #include /* need struct timeval */ #endif +#include /* need __user */ /* * M I S C E L L A N E O U S -- cgit v1.2.3 From 857c46acab86c3966bdcd007d2db2360f74dbc91 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Sun, 7 Nov 2004 04:02:44 -0800 Subject: [PATCH] remove journal callback code from jbd With the demise of intermezzo, the journal callback stuff in jbd is entirely unused (neither ext3 nor ocfs2 use it), and thus will only bitrot and bloat the kernel with code and datastructure growth. If intermezzo ever gets resurrected this will be the least of the problems they have to face (both with generic kernel as jbd). Signed-off-by: Arjan van de Ven Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/jbd/checkpoint.c | 1 - fs/jbd/commit.c | 24 ------------------------ fs/jbd/journal.c | 2 -- fs/jbd/transaction.c | 38 -------------------------------------- include/linux/jbd.h | 44 -------------------------------------------- 5 files changed, 109 deletions(-) (limited to 'include/linux') diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c index 2615ad1d86ed..85c874177f05 100644 --- a/fs/jbd/checkpoint.c +++ b/fs/jbd/checkpoint.c @@ -616,7 +616,6 @@ void __journal_drop_transaction(journal_t *journal, transaction_t *transaction) J_ASSERT(transaction->t_log_list == NULL); J_ASSERT(transaction->t_checkpoint_list == NULL); J_ASSERT(transaction->t_updates == 0); - J_ASSERT(list_empty(&transaction->t_jcb)); J_ASSERT(journal->j_committing_transaction != transaction); J_ASSERT(journal->j_running_transaction != transaction); diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index b4d6654ef7f2..875e06ba9aba 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c @@ -686,30 +686,6 @@ skip_commit: /* The journal should be unlocked by now. */ if (err) __journal_abort_hard(journal); - /* - * Call any callbacks that had been registered for handles in this - * transaction. It is up to the callback to free any allocated - * memory. - * - * The spinlocking (t_jcb_lock) here is surely unnecessary... - */ - spin_lock(&commit_transaction->t_jcb_lock); - if (!list_empty(&commit_transaction->t_jcb)) { - struct list_head *p, *n; - int error = is_journal_aborted(journal); - - list_for_each_safe(p, n, &commit_transaction->t_jcb) { - struct journal_callback *jcb; - - jcb = list_entry(p, struct journal_callback, jcb_list); - list_del(p); - spin_unlock(&commit_transaction->t_jcb_lock); - jcb->jcb_func(jcb, error); - spin_lock(&commit_transaction->t_jcb_lock); - } - } - spin_unlock(&commit_transaction->t_jcb_lock); - jbd_debug(3, "JBD: commit phase 7\n"); J_ASSERT(commit_transaction->t_sync_datalist == NULL); diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index cb9d794cc588..66ef3f81d7fc 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c @@ -55,7 +55,6 @@ EXPORT_SYMBOL(journal_sync_buffer); #endif EXPORT_SYMBOL(journal_flush); EXPORT_SYMBOL(journal_revoke); -EXPORT_SYMBOL(journal_callback_set); EXPORT_SYMBOL(journal_init_dev); EXPORT_SYMBOL(journal_init_inode); @@ -79,7 +78,6 @@ EXPORT_SYMBOL(journal_wipe); EXPORT_SYMBOL(journal_blocks_per_page); EXPORT_SYMBOL(journal_invalidatepage); EXPORT_SYMBOL(journal_try_to_free_buffers); -EXPORT_SYMBOL(journal_bmap); EXPORT_SYMBOL(journal_force_commit); static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *); diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index a168757d26af..eba3a475ee4b 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c @@ -50,9 +50,7 @@ get_transaction(journal_t *journal, transaction_t *transaction) transaction->t_state = T_RUNNING; transaction->t_tid = journal->j_transaction_sequence++; transaction->t_expires = jiffies + journal->j_commit_interval; - INIT_LIST_HEAD(&transaction->t_jcb); spin_lock_init(&transaction->t_handle_lock); - spin_lock_init(&transaction->t_jcb_lock); /* Set up the commit timer for the new transaction. */ journal->j_commit_timer->expires = transaction->t_expires; @@ -243,7 +241,6 @@ static handle_t *new_handle(int nblocks) memset(handle, 0, sizeof(*handle)); handle->h_buffer_credits = nblocks; handle->h_ref = 1; - INIT_LIST_HEAD(&handle->h_jcb); return handle; } @@ -1276,36 +1273,6 @@ not_jbd: return; } -/** - * void journal_callback_set() - Register a callback function for this handle. - * @handle: handle to attach the callback to. - * @func: function to callback. - * @jcb: structure with additional information required by func() , and - * some space for jbd internal information. - * - * The function will be - * called when the transaction that this handle is part of has been - * committed to disk with the original callback data struct and the - * error status of the journal as parameters. There is no guarantee of - * ordering between handles within a single transaction, nor between - * callbacks registered on the same handle. - * - * The caller is responsible for allocating the journal_callback struct. - * This is to allow the caller to add as much extra data to the callback - * as needed, but reduce the overhead of multiple allocations. The caller - * allocated struct must start with a struct journal_callback at offset 0, - * and has the caller-specific data afterwards. - */ -void journal_callback_set(handle_t *handle, - void (*func)(struct journal_callback *jcb, int error), - struct journal_callback *jcb) -{ - spin_lock(&handle->h_transaction->t_jcb_lock); - list_add_tail(&jcb->jcb_list, &handle->h_jcb); - spin_unlock(&handle->h_transaction->t_jcb_lock); - jcb->jcb_func = func; -} - /** * int journal_stop() - complete a transaction * @handle: tranaction to complete. @@ -1372,11 +1339,6 @@ int journal_stop(handle_t *handle) wake_up(&journal->j_wait_transaction_locked); } - /* Move callbacks from the handle to the transaction. */ - spin_lock(&transaction->t_jcb_lock); - list_splice(&handle->h_jcb, &transaction->t_jcb); - spin_unlock(&transaction->t_jcb_lock); - /* * If the handle is marked SYNC, we need to set another commit * going! We also want to force a commit if the current diff --git a/include/linux/jbd.h b/include/linux/jbd.h index dfdd307872bb..3d9451b62e5a 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h @@ -352,27 +352,6 @@ static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh) bit_spin_unlock(BH_JournalHead, &bh->b_state); } -#define HAVE_JOURNAL_CALLBACK_STATUS -/** - * struct journal_callback - Base structure for callback information. - * @jcb_list: list information for other callbacks attached to the same handle. - * @jcb_func: Function to call with this callback structure. - * - * This struct is a 'seed' structure for a using with your own callback - * structs. If you are using callbacks you must allocate one of these - * or another struct of your own definition which has this struct - * as it's first element and pass it to journal_callback_set(). - * - * This is used internally by jbd to maintain callback information. - * - * See journal_callback_set for more information. - **/ -struct journal_callback { - struct list_head jcb_list; /* t_jcb_lock */ - void (*jcb_func)(struct journal_callback *jcb, int error); - /* user data goes here */ -}; - struct jbd_revoke_table_s; /** @@ -381,7 +360,6 @@ struct jbd_revoke_table_s; * @h_transaction: Which compound transaction is this update a part of? * @h_buffer_credits: Number of remaining buffers we are allowed to dirty. * @h_ref: Reference count on this handle - * @h_jcb: List of application registered callbacks for this handle. * @h_err: Field for caller's use to track errors through large fs operations * @h_sync: flag for sync-on-close * @h_jdata: flag to force data journaling @@ -407,13 +385,6 @@ struct handle_s /* operations */ int h_err; - /* - * List of application registered callbacks for this handle. The - * function(s) will be called after the transaction that this handle is - * part of has been committed to disk. [t_jcb_lock] - */ - struct list_head h_jcb; - /* Flags [no locking] */ unsigned int h_sync: 1; /* sync-on-close */ unsigned int h_jdata: 1; /* force data journaling */ @@ -455,8 +426,6 @@ struct handle_s * j_state_lock * ->j_list_lock (journal_unmap_buffer) * - * t_handle_lock - * ->t_jcb_lock */ struct transaction_s @@ -580,15 +549,6 @@ struct transaction_s */ int t_handle_count; - /* - * Protects the callback list - */ - spinlock_t t_jcb_lock; - /* - * List of registered callback functions for this transaction. - * Called when the transaction is committed. [t_jcb_lock] - */ - struct list_head t_jcb; }; /** @@ -921,10 +881,6 @@ extern int journal_invalidatepage(journal_t *, extern int journal_try_to_free_buffers(journal_t *, struct page *, int); extern int journal_stop(handle_t *); extern int journal_flush (journal_t *); -extern void journal_callback_set(handle_t *handle, - void (*fn)(struct journal_callback *,int), - struct journal_callback *jcb); - extern void journal_lock_updates (journal_t *); extern void journal_unlock_updates (journal_t *); -- cgit v1.2.3 From 94c60aadc32e3ce33c9cebe507bfe674fcd0e8b9 Mon Sep 17 00:00:00 2001 From: Antonino Daplas Date: Sun, 7 Nov 2004 04:04:01 -0800 Subject: [PATCH] fbcon/fbdev: Remove fbcon-specific fields from struct fb_info The following fields in struct fb_info is specific only to fbcon: - struct timer_ cursor_timer - int currcon Remove them from struct fb_info and place them in fbcon_par so they become invisible from the drivers. Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/acornfb.c | 1 - drivers/video/aty/radeon_base.c | 1 - drivers/video/bw2.c | 1 - drivers/video/cg14.c | 1 - drivers/video/cg3.c | 1 - drivers/video/cg6.c | 1 - drivers/video/cirrusfb.c | 1 - drivers/video/console/fbcon.c | 82 ++++++++++++++++++++++------------- drivers/video/console/fbcon.h | 2 + drivers/video/ffb.c | 1 - drivers/video/gbefb.c | 1 - drivers/video/intelfb/intelfbdrv.c | 1 - drivers/video/leo.c | 1 - drivers/video/matrox/matroxfb_base.c | 26 ++++++----- drivers/video/matrox/matroxfb_crtc2.c | 5 +-- drivers/video/p9100.c | 1 - drivers/video/pxafb.c | 1 - drivers/video/radeonfb.c | 1 - drivers/video/sa1100fb.c | 1 - drivers/video/sis/sis_main.c | 5 ++- drivers/video/sstfb.c | 1 - drivers/video/stifb.c | 1 - drivers/video/tcx.c | 1 - drivers/video/tgafb.c | 1 - drivers/video/vga16fb.c | 1 - include/linux/fb.h | 2 - 26 files changed, 73 insertions(+), 69 deletions(-) (limited to 'include/linux') diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 3d7275c2ab6b..9e1a835f7e5c 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c @@ -1326,7 +1326,6 @@ static int __init acornfb_probe(struct device *dev) } } - fb_info.currcon = -1; fb_info.screen_base = (char *)SCREEN_BASE; fb_info.fix.smem_start = SCREEN_START; current_par.using_vram = 0; diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index b51f966c6851..639ca7223ee4 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c @@ -1749,7 +1749,6 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo) { struct fb_info *info = rinfo->info; - info->currcon = -1; info->par = rinfo; info->pseudo_palette = rinfo->pseudo_palette; info->flags = FBINFO_DEFAULT diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index 3b2c5a5e6c12..17c75483e179 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c @@ -361,7 +361,6 @@ static void bw2_init_one(struct sbus_dev *sdev) if (!all->info.screen_base) all->info.screen_base = (char *) sbus_ioremap(resp, 0, all->par.fbsize, "bw2 ram"); - all->info.currcon = -1; all->info.par = &all->par; bw2_blank(0, &all->info); diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index c43322b2d666..4ead66f95efe 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c @@ -552,7 +552,6 @@ static void cg14_init_one(struct sbus_dev *sdev, int node, int parent_node) all->info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; all->info.fbops = &cg14_ops; - all->info.currcon = -1; all->info.par = &all->par; __cg14_reset(&all->par); diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c index 078394109714..295624ded17f 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/cg3.c @@ -408,7 +408,6 @@ static void cg3_init_one(struct sbus_dev *sdev) all->info.screen_base = (char *) sbus_ioremap(&sdev->resource[0], CG3_RAM_OFFSET, all->par.fbsize, "cg3 ram"); - all->info.currcon = -1; all->info.par = &all->par; cg3_blank(0, &all->info); diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c index be87a66f1f06..9b8a465e588d 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/cg6.c @@ -723,7 +723,6 @@ static void cg6_init_one(struct sbus_dev *sdev) all->info.screen_base = (char *) sbus_ioremap(&sdev->resource[0], CG6_RAM_OFFSET, all->par.fbsize, "cgsix ram"); - all->info.currcon = -1; all->info.par = &all->par; all->info.var.accel_flags = FB_ACCELF_TEXT; diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index a8d97b857698..3bbee5a9c9bf 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c @@ -2246,7 +2246,6 @@ static int cirrusfb_set_fbinfo(struct cirrusfb_info *cinfo) struct fb_info *info = cinfo->info; struct fb_var_screeninfo *var = &info->var; - info->currcon = -1; info->par = cinfo; info->pseudo_palette = cinfo->pseudo_palette; info->flags = FBINFO_DEFAULT diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index c9dfbbe50d4f..f49794e1318f 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -249,8 +249,8 @@ static void fb_flashcursor(void *private) int c; int mode; - if (info->currcon != -1) - vc = vc_cons[info->currcon].d; + if (ops->currcon != -1) + vc = vc_cons[ops->currcon].d; if (info->state != FBINFO_STATE_RUNNING || !vc || !CON_IS_VISIBLE(vc) || @@ -284,9 +284,10 @@ static irqreturn_t fb_vbl_handler(int irq, void *dev_id, struct pt_regs *fp) static void cursor_timer_handler(unsigned long dev_addr) { struct fb_info *info = (struct fb_info *) dev_addr; - + struct fbcon_ops *ops = info->fbcon_par; + schedule_work(&info->queue); - mod_timer(&info->cursor_timer, jiffies + HZ/5); + mod_timer(&ops->cursor_timer, jiffies + HZ/5); } int __init fb_console_setup(char *this_opt) @@ -502,6 +503,7 @@ static int set_con2fb_map(int unit, int newidx, int user) int oldidx = con2fb_map[unit]; struct fb_info *info = registered_fb[newidx]; struct fb_info *oldinfo = NULL; + struct fbcon_ops *ops; int found; if (oldidx == newidx) @@ -524,8 +526,10 @@ static int set_con2fb_map(int unit, int newidx, int user) con2fb_map[unit] = newidx; if (!found) { - struct fbcon_ops *ops = NULL; int err = 0; + + ops = NULL; + if (!try_module_get(info->fbops->owner)) { err = -ENODEV; } @@ -560,7 +564,8 @@ static int set_con2fb_map(int unit, int newidx, int user) * fbcon should release it. */ if (oldinfo && !search_fb_in_map(oldidx)) { - struct fbcon_ops *ops = (struct fbcon_ops *) oldinfo->fbcon_par; + + ops = oldinfo->fbcon_par; if (oldinfo->fbops->fb_release && oldinfo->fbops->fb_release(oldinfo, 0)) { @@ -574,28 +579,33 @@ static int set_con2fb_map(int unit, int newidx, int user) } if (oldinfo->queue.func == fb_flashcursor) - del_timer_sync(&oldinfo->cursor_timer); + del_timer_sync(&ops->cursor_timer); kfree(ops->cursor_state.mask); kfree(ops->cursor_data); kfree(oldinfo->fbcon_par); + oldinfo->fbcon_par = NULL; module_put(oldinfo->fbops->owner); } if (!found) { if (!info->queue.func || info->queue.func == fb_flashcursor) { + + ops = info->fbcon_par; + if (!info->queue.func) INIT_WORK(&info->queue, fb_flashcursor, info); - init_timer(&info->cursor_timer); - info->cursor_timer.function = cursor_timer_handler; - info->cursor_timer.expires = jiffies + HZ / 5; - info->cursor_timer.data = (unsigned long ) info; - add_timer(&info->cursor_timer); + init_timer(&ops->cursor_timer); + ops->cursor_timer.function = cursor_timer_handler; + ops->cursor_timer.expires = jiffies + HZ / 5; + ops->cursor_timer.data = (unsigned long ) info; + add_timer(&ops->cursor_timer); } } - info->currcon = fg_console; + ops = info->fbcon_par; + ops->currcon = fg_console; con2fb_map_boot[unit] = newidx; if (info->fbops->fb_set_par) @@ -690,7 +700,6 @@ static const char *fbcon_startup(void) info = registered_fb[info_idx]; if (!info) return NULL; - info->currcon = -1; owner = info->fbops->owner; if (!try_module_get(owner)) @@ -707,6 +716,7 @@ static const char *fbcon_startup(void) } memset(ops, 0, sizeof(struct fbcon_ops)); + ops->currcon = -1; info->fbcon_par = ops; set_blitting_type(vc, info, NULL); @@ -821,11 +831,11 @@ static const char *fbcon_startup(void) if (!info->queue.func) { INIT_WORK(&info->queue, fb_flashcursor, info); - init_timer(&info->cursor_timer); - info->cursor_timer.function = cursor_timer_handler; - info->cursor_timer.expires = jiffies + HZ / 5; - info->cursor_timer.data = (unsigned long ) info; - add_timer(&info->cursor_timer); + init_timer(&ops->cursor_timer); + ops->cursor_timer.function = cursor_timer_handler; + ops->cursor_timer.expires = jiffies + HZ / 5; + ops->cursor_timer.data = (unsigned long ) info; + add_timer(&ops->cursor_timer); } return display_desc; } @@ -1074,7 +1084,7 @@ static int scrollback_current = 0; int update_var(int con, struct fb_info *info) { - if (con == info->currcon) + if (con == ((struct fbcon_ops *)info->fbcon_par)->currcon) return fb_pan_display(info, &info->var); return 0; } @@ -1877,7 +1887,7 @@ static int fbcon_switch(struct vc_data *vc) logo_shown = FBCON_LOGO_CANSHOW; } - prev_console = info->currcon; + prev_console = ((struct fbcon_ops *)info->fbcon_par)->currcon; /* * FIXME: If we have multiple fbdev's loaded, we need to @@ -1888,10 +1898,12 @@ static int fbcon_switch(struct vc_data *vc) * info->currcon = vc->vc_num; */ for (i = 0; i < FB_MAX; i++) { - if (registered_fb[i] != NULL) - registered_fb[i]->currcon = vc->vc_num; - } + if (registered_fb[i] != NULL && registered_fb[i]->fbcon_par) { + struct fbcon_ops *ops = registered_fb[i]->fbcon_par; + ops->currcon = vc->vc_num; + } + } memset(&var, 0, sizeof(struct fb_var_screeninfo)); display_to_var(&var, p); var.activate = FB_ACTIVATE_NOW; @@ -1960,7 +1972,7 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) { unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; - struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par; + struct fbcon_ops *ops = info->fbcon_par; struct display *p = &fb_display[vc->vc_num]; int retval = 0; @@ -2517,10 +2529,11 @@ static int fbcon_set_origin(struct vc_data *vc) static void fbcon_suspended(struct fb_info *info) { struct vc_data *vc = NULL; + struct fbcon_ops *ops = info->fbcon_par; - if (info->currcon < 0) + if (!ops || ops->currcon < 0) return; - vc = vc_cons[info->currcon].d; + vc = vc_cons[ops->currcon].d; /* Clear cursor, restore saved data */ fbcon_cursor(vc, CM_ERASE); @@ -2529,21 +2542,28 @@ static void fbcon_suspended(struct fb_info *info) static void fbcon_resumed(struct fb_info *info) { struct vc_data *vc; + struct fbcon_ops *ops = info->fbcon_par; - if (info->currcon < 0) + if (!ops || ops->currcon < 0) return; - vc = vc_cons[info->currcon].d; + vc = vc_cons[ops->currcon].d; update_screen(vc->vc_num); } static void fbcon_modechanged(struct fb_info *info) { - struct vc_data *vc = vc_cons[info->currcon].d; + struct fbcon_ops *ops = info->fbcon_par; + struct vc_data *vc; struct display *p; int rows, cols; - if (info->currcon < 0 || vt_cons[info->currcon]->vc_mode != + if (!ops) + return; + + vc = vc_cons[ops->currcon].d; + + if (ops->currcon < 0 || vt_cons[ops->currcon]->vc_mode != KD_TEXT) return; p = &fb_display[vc->vc_num]; diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h index 095378eb8e19..fabf64c8501f 100644 --- a/drivers/video/console/fbcon.h +++ b/drivers/video/console/fbcon.h @@ -61,7 +61,9 @@ struct fbcon_ops { void (*cursor)(struct vc_data *vc, struct fb_info *info, struct display *p, int mode, int fg, int bg); + struct timer_list cursor_timer; /* Cursor timer */ struct fb_cursor cursor_state; + int currcon; /* Current VC. */ int cursor_flash; char *cursor_data; }; diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index 349499ef4cc9..31e55def0732 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c @@ -969,7 +969,6 @@ static void ffb_init_one(int node, int parent) FBINFO_HWACCEL_IMAGEBLIT); all->info.fbops = &ffb_ops; all->info.screen_base = (char *) all->par.physbase + FFB_DFB24_POFF; - all->info.currcon = -1; all->info.par = &all->par; all->info.pseudo_palette = all->pseudo_palette; diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index 15d9e998f23f..6d7a635fb69e 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c @@ -1140,7 +1140,6 @@ int __init gbefb_init(void) for (i = 0; i < (gbe_mem_size >> TILE_SHIFT); i++) gbe_tiles.cpu[i] = (gbe_mem_phys >> TILE_SHIFT) + i; - fb_info.currcon = -1; fb_info.fbops = &gbefb_ops; fb_info.pseudo_palette = pseudo_palette; fb_info.flags = FBINFO_DEFAULT; diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index b5aadd7f1f12..c7f32cc56c9b 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c @@ -1108,7 +1108,6 @@ intelfb_set_fbinfo(struct intelfb_info *dinfo) DBG_MSG("intelfb_set_fbinfo\n"); - //info->currcon = -1; info->flags = FBINFO_FLAG_DEFAULT; info->fbops = &intel_fb_ops; info->pseudo_palette = dinfo->pseudo_palette; diff --git a/drivers/video/leo.c b/drivers/video/leo.c index 99fb72aa184d..35b03302ad10 100644 --- a/drivers/video/leo.c +++ b/drivers/video/leo.c @@ -590,7 +590,6 @@ static void leo_init_one(struct sbus_dev *sdev) all->info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; all->info.fbops = &leo_ops; - all->info.currcon = -1; all->info.par = &all->par; leo_init_wids(&all->info); diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index 47439c4d276a..3faae14a42f6 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c @@ -1712,7 +1712,6 @@ static int initMatrox2(WPMINFO struct board* b){ } ACCESS_FBINFO(devflags.ydstorg) = 0; - ACCESS_FBINFO(fbcon.currcon) = -1; ACCESS_FBINFO(video.base) = video_base_phys; ACCESS_FBINFO(video.len_usable) = ACCESS_FBINFO(video.len); if (ACCESS_FBINFO(video.len_usable) > b->base->maxdisplayable) @@ -1877,16 +1876,21 @@ static int initMatrox2(WPMINFO struct board* b){ } printk("fb%d: %s frame buffer device\n", ACCESS_FBINFO(fbcon.node), ACCESS_FBINFO(fbcon.fix.id)); - if (ACCESS_FBINFO(fbcon.currcon) < 0) { - /* there is no console on this fb... but we have to initialize hardware - * until someone tells me what is proper thing to do */ - printk(KERN_INFO "fb%d: initializing hardware\n", - ACCESS_FBINFO(fbcon.node)); - /* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var - * already before, so register_framebuffer works correctly. */ - vesafb_defined.activate |= FB_ACTIVATE_FORCE; - fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined); - } + /* + * Tony: If this driver is to be mapped to the console, then + * fbcon will automatically do a set_par for us. The code below + * may not be needed. + */ + + /* there is no console on this fb... but we have to initialize hardware + * until someone tells me what is proper thing to do */ + printk(KERN_INFO "fb%d: initializing hardware\n", + ACCESS_FBINFO(fbcon.node)); + /* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var + * already before, so register_framebuffer works correctly. */ + vesafb_defined.activate |= FB_ACTIVATE_FORCE; + fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined); + return 0; failVideoIO:; matroxfb_g450_shutdown(PMINFO2); diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c index c5230bbe1da4..b19d3d523e0b 100644 --- a/drivers/video/matrox/matroxfb_crtc2.c +++ b/drivers/video/matrox/matroxfb_crtc2.c @@ -605,7 +605,6 @@ static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) { m2info->fbcon.flags = FBINFO_FLAG_DEFAULT; m2info->fbcon.flags |= FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN; - m2info->fbcon.currcon = -1; m2info->fbcon.pseudo_palette = m2info->cmap; fb_alloc_cmap(&m2info->fbcon.cmap, 256, 1); @@ -634,9 +633,7 @@ static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) { if (register_framebuffer(&m2info->fbcon)) { return -ENXIO; } - if (m2info->fbcon.currcon < 0) { - fb_set_var(&m2info->fbcon, &matroxfb_dh_defined); - } + fb_set_var(&m2info->fbcon, &matroxfb_dh_defined); down_write(&ACCESS_FBINFO(crtc2.lock)); oldcrtc2 = ACCESS_FBINFO(crtc2.info); ACCESS_FBINFO(crtc2.info) = m2info; diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c index 7fbbef4619df..3048f02e6167 100644 --- a/drivers/video/p9100.c +++ b/drivers/video/p9100.c @@ -307,7 +307,6 @@ static void p9100_init_one(struct sbus_dev *sdev) all->info.screen_base = (char *) sbus_ioremap(&sdev->resource[2], 0, all->par.fbsize, "p9100 ram"); - all->info.currcon = -1; all->info.par = &all->par; p9100_blank(0, &all->info); diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 3e2bb2d887ac..8d0c933ce1d1 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -1043,7 +1043,6 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) fbi->fb.fbops = &pxafb_ops; fbi->fb.flags = FBINFO_DEFAULT; fbi->fb.node = -1; - fbi->fb.currcon = -1; addr = fbi; addr = addr + sizeof(struct pxafb_info); diff --git a/drivers/video/radeonfb.c b/drivers/video/radeonfb.c index 82f8e1529498..ca8d3c3b3efa 100644 --- a/drivers/video/radeonfb.c +++ b/drivers/video/radeonfb.c @@ -2247,7 +2247,6 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo) info = &rinfo->info; - info->currcon = -1; info->par = rinfo; info->pseudo_palette = rinfo->pseudo_palette; info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index b2c7aa10449a..7c4ae200e110 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c @@ -1673,7 +1673,6 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev) fbi->fb.fbops = &sa1100fb_ops; fbi->fb.flags = FBINFO_DEFAULT; fbi->fb.monspecs = monspecs; - fbi->fb.currcon = -1; fbi->fb.pseudo_palette = (fbi + 1); fbi->rgb[RGB_8] = &rgb_8; diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index 72afe0838937..1ece9b6b4b85 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c @@ -1813,8 +1813,11 @@ sisfb_set_par(struct fb_info *info) return err; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) sisfb_get_fix(&info->fix, info->currcon, info); - +#else + sisfb_get_fix(&info->fix, -1, info); +#endif return 0; } diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c index 0e915d7ea3f7..52686d849926 100644 --- a/drivers/video/sstfb.c +++ b/drivers/video/sstfb.c @@ -1471,7 +1471,6 @@ static int __devinit sstfb_probe(struct pci_dev *pdev, info->flags = FBINFO_DEFAULT; info->fbops = &sstfb_ops; - info->currcon = -1; info->pseudo_palette = &all->pseudo_palette; fix->type = FB_TYPE_PACKED_PIXELS; diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c index d64d6a6bf6ff..8b76a919297e 100644 --- a/drivers/video/stifb.c +++ b/drivers/video/stifb.c @@ -1335,7 +1335,6 @@ stifb_init_fb(struct sti_struct *sti, int force_bpp) info->fbops = &stifb_ops; info->screen_base = (void*) REGION_BASE(fb,1); info->flags = FBINFO_DEFAULT; - info->currcon = -1; info->pseudo_palette = &fb->pseudo_palette; /* This has to been done !!! */ diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c index e3e43ca2f6fe..de628c72e7d6 100644 --- a/drivers/video/tcx.c +++ b/drivers/video/tcx.c @@ -422,7 +422,6 @@ static void tcx_init_one(struct sbus_dev *sdev) all->info.screen_base = (char *) sbus_ioremap(&sdev->resource[0], 0, all->par.fbsize, "tcx ram"); - all->info.currcon = -1; all->info.par = &all->par; /* Initialize brooktree DAC. */ diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c index ffe811038a9a..b38c09c8b444 100644 --- a/drivers/video/tgafb.c +++ b/drivers/video/tgafb.c @@ -1430,7 +1430,6 @@ tgafb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) FBINFO_HWACCEL_IMAGEBLIT | FBINFO_HWACCEL_FILLRECT; all->info.fbops = &tgafb_ops; all->info.screen_base = (char *) all->par.tga_fb_base; - all->info.currcon = -1; all->info.par = &all->par; all->info.pseudo_palette = all->pseudo_palette; diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index f2b053c0f214..6c15be9ea39b 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c @@ -859,7 +859,6 @@ static int vga16fb_blank(int blank, struct fb_info *info) par->vesa_blanked = 0; } if (par->palette_blanked) { - //do_install_cmap(info->currcon, info); par->palette_blanked = 0; } break; diff --git a/include/linux/fb.h b/include/linux/fb.h index bd9e42e356d0..d8f4789dce45 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -685,7 +685,6 @@ struct fb_info { struct fb_fix_screeninfo fix; /* Current fix */ struct fb_monspecs monspecs; /* Current Monitor specs */ struct work_struct queue; /* Framebuffer event queue */ - struct timer_list cursor_timer; /* Cursor timer */ struct fb_pixmap pixmap; /* Image hardware mapper */ struct fb_pixmap sprite; /* Cursor hardware mapper */ struct fb_cmap cmap; /* Current cmap */ @@ -697,7 +696,6 @@ struct fb_info { #endif char __iomem *screen_base; /* Virtual address */ unsigned long screen_size; /* Amount of ioremapped VRAM or 0 */ - int currcon; /* Current VC. */ void *pseudo_palette; /* Fake palette of 16 colors */ #define FBINFO_STATE_RUNNING 0 #define FBINFO_STATE_SUSPENDED 1 -- cgit v1.2.3 From a010e3766ac052bc6036a91145651f1cb25285a5 Mon Sep 17 00:00:00 2001 From: Pawel Sikora Date: Sun, 7 Nov 2004 04:06:07 -0800 Subject: [PATCH] /proc/kcore - enable/disable. The presence of /proc/kcore is supposed to be configurable. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/Kconfig | 4 ++-- include/linux/proc_fs.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include/linux') diff --git a/fs/Kconfig b/fs/Kconfig index 1b2b74d45b17..88e92f15445c 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -819,8 +819,8 @@ config PROC_FS programs depend on this, so everyone should say Y here. config PROC_KCORE - bool - default y if !ARM + bool "/proc/kcore support" if !ARM + depends on PROC_FS config SYSFS bool "sysfs file system support" if EMBEDDED diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index ba4c3255ccf7..14b0b41e5ecc 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -227,7 +227,7 @@ extern struct proc_dir_entry proc_root; #endif /* CONFIG_PROC_FS */ -#if !defined(CONFIG_PROC_FS) +#if !defined(CONFIG_PROC_KCORE) static inline void kclist_add(struct kcore_list *new, void *addr, size_t size) { } -- cgit v1.2.3 From 1eccda347986a26bb4dd65c8dfee03da71de3fa8 Mon Sep 17 00:00:00 2001 From: Pavel Fedin Date: Sun, 7 Nov 2004 04:06:20 -0800 Subject: [PATCH] VIA8231 support for parallel port driver This patch allows the kernel to configure port's mode without help of BIOS. It is needed on my machine because its firmware simply ignores the parallel port leaving in unidirectional SPP mode. Notes on usage: To configure the port you need to: - if parport_pc driver is compiled as a module: specify parport_pc init_mode=[spp|ps2|epp|ecp|ecpepp] in /etc/modules file (for Debian Linux). - if the driver is linked statically with the kernel: specify parport_init_mode=[spp|ps2|epp|ecp|ecpepp] in kernel's arguments. This patch is intended for use primarily on Pegasos machines but it will work on any computer with VIA8231 south bridge. In this case it will override BIOS setting if you tell the driver to configure the port. BIOS setting will be honored if you omit init_mode parameter. Technical details: 1. On Pegasos standard port settings (set by OpenFirmware) are: IRQ=7, DMA=3, base address=0x3BC, mode is unidirectional SPP. 2. The patch changes only port mode, all other settings are preserved. So if you have a PC with VIA8231 and use driver to configure the port you'll still be able to change IRQ, DMA and base address in BIOS and these settings will be kept. 3. One exclusion: if you tell the driver to turn on EPP mode (specify epp or ecpepp value) and if default base address is 0x3BC (this is the case on Pegasos) the port will be moved to 0x378. EPP port can't have 0x3BC as the base. Known problems: 1. ECP+EPP mode is strange, it doesn't work even on several PC's i tested with Linux. ECP mode is detected and EPP is not. So if you get the same thing, it's not my fault. I just have no time to deal with it, current result is enough for me. 2. Not all devices work on Pegasos, i tried my Genuis-HR6 parallel port scanner and parallel ZIP drive and both of them don't work. ZIP drive is detected properly but then suddenly gets offline. Scanner does not answer any command at all. Without the patch the same thing happens. Obviously Pegasos has some more problems which are not discovered and not fixed yet. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/kernel-parameters.txt | 10 ++ drivers/parport/parport_pc.c | 246 ++++++++++++++++++++++++++---------- include/linux/parport_pc.h | 17 +++ include/linux/via.h | 22 ++++ 4 files changed, 229 insertions(+), 66 deletions(-) create mode 100644 include/linux/via.h (limited to 'include/linux') diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 9be21893dfb4..442bff3b2837 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -866,6 +866,16 @@ running once the system is up. order they are specified on the command line, starting with parport0. + parport_init_mode= + [HW,PPT] Configure VIA parallel port to + operate in specific mode. This is + necessary on Pegasos computer where + firmware has no options for setting up + parallel port mode and sets it to + spp. Currently this function knows + 686a and 8231 chips. + Format: [spp|ps2|epp|ecp|ecpepp] + pas2= [HW,OSS] Format: ,,,,,,, diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index b26723426dac..f136ff777d07 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -62,6 +62,7 @@ #include #include +#include #include #define PARPORT_PC_MAX_PORTS PARPORT_MAX @@ -2378,7 +2379,7 @@ EXPORT_SYMBOL (parport_pc_unregister_port); /* ITE support maintained by Rich Liu */ static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq, - int autodma) + int autodma, struct parport_pc_via_data *via) { short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 }; struct resource *base_res; @@ -2481,71 +2482,161 @@ static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq, return 0; } -/* Via support maintained by Jeff Garzik */ -static int __devinit sio_via_686a_probe (struct pci_dev *pdev, int autoirq, - int autodma) +/* VIA 8231 support by Pavel Fedin + based on VIA 686a support code by Jeff Garzik */ +static int __initdata parport_init_mode = 0; + +/* Data for two known VIA chips */ +static struct parport_pc_via_data via_686a_data __devinitdata = { + 0x51, + 0x50, + 0x85, + 0x02, + 0xE2, + 0xF0, + 0xE6 +}; +static struct parport_pc_via_data via_8231_data __devinitdata = { + 0x45, + 0x44, + 0x50, + 0x04, + 0xF2, + 0xFA, + 0xF6 +}; + +static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq, + int autodma, struct parport_pc_via_data *via) { - u8 tmp; + u8 tmp, tmp2, siofunc; + u8 ppcontrol = 0; int dma, irq; - unsigned port1, port2, have_eppecp; + unsigned port1, port2; + unsigned have_epp = 0; + printk(KERN_DEBUG "parport_pc: VIA 686A/8231 detected\n"); + + switch(parport_init_mode) + { + case 1: + printk(KERN_DEBUG "parport_pc: setting SPP mode\n"); + siofunc = VIA_FUNCTION_PARPORT_SPP; + break; + case 2: + printk(KERN_DEBUG "parport_pc: setting PS/2 mode\n"); + siofunc = VIA_FUNCTION_PARPORT_SPP; + ppcontrol = VIA_PARPORT_BIDIR; + break; + case 3: + printk(KERN_DEBUG "parport_pc: setting EPP mode\n"); + siofunc = VIA_FUNCTION_PARPORT_EPP; + ppcontrol = VIA_PARPORT_BIDIR; + have_epp = 1; + break; + case 4: + printk(KERN_DEBUG "parport_pc: setting ECP mode\n"); + siofunc = VIA_FUNCTION_PARPORT_ECP; + ppcontrol = VIA_PARPORT_BIDIR; + break; + case 5: + printk(KERN_DEBUG "parport_pc: setting EPP+ECP mode\n"); + siofunc = VIA_FUNCTION_PARPORT_ECP; + ppcontrol = VIA_PARPORT_BIDIR|VIA_PARPORT_ECPEPP; + have_epp = 1; + break; + default: + printk(KERN_DEBUG "parport_pc: probing current configuration\n"); + siofunc = VIA_FUNCTION_PROBE; + break; + } /* - * unlock super i/o configuration, set 0x85_1 - */ - pci_read_config_byte (pdev, 0x85, &tmp); - tmp |= (1 << 1); - pci_write_config_byte (pdev, 0x85, tmp); - - /* - * Super I/O configuration, index port == 3f0h, data port == 3f1h + * unlock super i/o configuration */ + pci_read_config_byte(pdev, via->via_pci_superio_config_reg, &tmp); + tmp |= via->via_pci_superio_config_data; + pci_write_config_byte(pdev, via->via_pci_superio_config_reg, tmp); + + /* Bits 1-0: Parallel Port Mode / Enable */ + outb(via->viacfg_function, VIA_CONFIG_INDEX); + tmp = inb (VIA_CONFIG_DATA); + /* Bit 5: EPP+ECP enable; bit 7: PS/2 bidirectional port enable */ + outb(via->viacfg_parport_control, VIA_CONFIG_INDEX); + tmp2 = inb (VIA_CONFIG_DATA); + if (siofunc == VIA_FUNCTION_PROBE) + { + siofunc = tmp & VIA_FUNCTION_PARPORT_DISABLE; + ppcontrol = tmp2; + } + else + { + tmp &= ~VIA_FUNCTION_PARPORT_DISABLE; + tmp |= siofunc; + outb(via->viacfg_function, VIA_CONFIG_INDEX); + outb(tmp, VIA_CONFIG_DATA); + tmp2 &= ~(VIA_PARPORT_BIDIR|VIA_PARPORT_ECPEPP); + tmp2 |= ppcontrol; + outb(via->viacfg_parport_control, VIA_CONFIG_INDEX); + outb(tmp2, VIA_CONFIG_DATA); + } - /* 0xE2_1-0: Parallel Port Mode / Enable */ - outb (0xE2, 0x3F0); - tmp = inb (0x3F1); + /* Parallel Port I/O Base Address, bits 9-2 */ + outb(via->viacfg_parport_base, VIA_CONFIG_INDEX); + port1 = inb(VIA_CONFIG_DATA) << 2; - if ((tmp & 0x03) == 0x03) { - printk (KERN_INFO "parport_pc: Via 686A parallel port disabled in BIOS\n"); + printk (KERN_DEBUG "parport_pc: Current parallel port base: 0x%X\n",port1); + if ((port1 == 0x3BC) && have_epp) + { + outb(via->viacfg_parport_base, VIA_CONFIG_INDEX); + outb((0x378 >> 2), VIA_CONFIG_DATA); + printk(KERN_DEBUG "parport_pc: Parallel port base changed to 0x378\n"); + port1 = 0x378; + } + + /* + * lock super i/o configuration + */ + pci_read_config_byte(pdev, via->via_pci_superio_config_reg, &tmp); + tmp &= ~via->via_pci_superio_config_data; + pci_write_config_byte(pdev, via->via_pci_superio_config_reg, tmp); + + if (siofunc == VIA_FUNCTION_PARPORT_DISABLE) { + printk(KERN_INFO "parport_pc: VIA parallel port disabled in BIOS\n"); return 0; } - /* 0xE6: Parallel Port I/O Base Address, bits 9-2 */ - outb (0xE6, 0x3F0); - port1 = inb (0x3F1) << 2; - + /* Bits 7-4: PnP Routing for Parallel Port IRQ */ + pci_read_config_byte(pdev, via->via_pci_parport_irq_reg, &tmp); + irq = ((tmp & VIA_IRQCONTROL_PARALLEL) >> 4); + + if (siofunc == VIA_FUNCTION_PARPORT_ECP) + { + /* Bits 3-2: PnP Routing for Parallel Port DMA */ + pci_read_config_byte(pdev, via->via_pci_parport_dma_reg, &tmp); + dma = ((tmp & VIA_DMACONTROL_PARALLEL) >> 2); + } + else + /* if ECP not enabled, DMA is not enabled, assumed bogus 'dma' value */ + dma = PARPORT_DMA_NONE; + + /* Let the user (or defaults) steer us away from interrupts and DMA */ + if (autoirq == PARPORT_IRQ_NONE) { + irq = PARPORT_IRQ_NONE; + dma = PARPORT_DMA_NONE; + } + if (autodma == PARPORT_DMA_NONE) + dma = PARPORT_DMA_NONE; + switch (port1) { case 0x3bc: port2 = 0x7bc; break; case 0x378: port2 = 0x778; break; case 0x278: port2 = 0x678; break; default: - printk (KERN_INFO "parport_pc: Weird Via 686A parport base 0x%X, ignoring\n", + printk(KERN_INFO "parport_pc: Weird VIA parport base 0x%X, ignoring\n", port1); return 0; } - /* 0xF0_5: EPP+ECP enable */ - outb (0xF0, 0x3F0); - have_eppecp = (inb (0x3F1) & (1 << 5)); - - /* - * lock super i/o configuration, clear 0x85_1 - */ - pci_read_config_byte (pdev, 0x85, &tmp); - tmp &= ~(1 << 1); - pci_write_config_byte (pdev, 0x85, tmp); - - /* - * Get DMA and IRQ from PCI->ISA bridge PCI config registers - */ - - /* 0x50_3-2: PnP Routing for Parallel Port DRQ */ - pci_read_config_byte (pdev, 0x50, &tmp); - dma = ((tmp >> 2) & 0x03); - - /* 0x51_7-4: PnP Routing for Parallel Port IRQ */ - pci_read_config_byte (pdev, 0x51, &tmp); - irq = ((tmp >> 4) & 0x0F); - /* filter bogus IRQs */ switch (irq) { case 0: @@ -2559,22 +2650,10 @@ static int __devinit sio_via_686a_probe (struct pci_dev *pdev, int autoirq, break; } - /* if ECP not enabled, DMA is not enabled, assumed bogus 'dma' value */ - if (!have_eppecp) - dma = PARPORT_DMA_NONE; - - /* Let the user (or defaults) steer us away from interrupts and DMA */ - if (autoirq != PARPORT_IRQ_AUTO) { - irq = PARPORT_IRQ_NONE; - dma = PARPORT_DMA_NONE; - } - if (autodma != PARPORT_DMA_AUTO) - dma = PARPORT_DMA_NONE; - /* finally, do the probe with values obtained */ if (parport_pc_probe_port (port1, port2, irq, dma, NULL)) { printk (KERN_INFO - "parport_pc: Via 686A parallel port: io=0x%X", port1); + "parport_pc: VIA parallel port: io=0x%X", port1); if (irq != PARPORT_IRQ_NONE) printk (", irq=%d", irq); if (dma != PARPORT_DMA_NONE) @@ -2583,7 +2662,7 @@ static int __devinit sio_via_686a_probe (struct pci_dev *pdev, int autoirq, return 1; } - printk (KERN_WARNING "parport_pc: Strange, can't probe Via 686A parallel port: io=0x%X, irq=%d, dma=%d\n", + printk(KERN_WARNING "parport_pc: Strange, can't probe VIA parallel port: io=0x%X, irq=%d, dma=%d\n", port1, irq, dma); return 0; } @@ -2591,19 +2670,21 @@ static int __devinit sio_via_686a_probe (struct pci_dev *pdev, int autoirq, enum parport_pc_sio_types { sio_via_686a = 0, /* Via VT82C686A motherboard Super I/O */ + sio_via_8231, /* Via VT8231 south bridge integrated Super IO */ sio_ite_8872, last_sio }; /* each element directly indexed from enum list, above */ static struct parport_pc_superio { - int (*probe) (struct pci_dev *pdev, int autoirq, int autodma); + int (*probe) (struct pci_dev *pdev, int autoirq, int autodma, struct parport_pc_via_data *via); + struct parport_pc_via_data *via; } parport_pc_superio_info[] __devinitdata = { - { sio_via_686a_probe, }, - { sio_ite_8872_probe, }, + { sio_via_probe, &via_686a_data, }, + { sio_via_probe, &via_8231_data, }, + { sio_ite_8872_probe, NULL, }, }; - enum parport_pc_pci_cards { siig_1p_10x = last_sio, siig_2p_10x, @@ -2737,6 +2818,7 @@ static struct parport_pc_pci { static struct pci_device_id parport_pc_pci_tbl[] = { /* Super-IO onboard chips */ { 0x1106, 0x0686, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sio_via_686a }, + { 0x1106, 0x8231, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sio_via_8231 }, { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8872, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sio_ite_8872 }, @@ -2886,7 +2968,7 @@ static int __init parport_pc_init_superio (int autoirq, int autodma) continue; if (parport_pc_superio_info[id->driver_data].probe - (pdev, autoirq, autodma)) { + (pdev, autoirq, autodma,parport_pc_superio_info[id->driver_data].via)) { ret++; } } @@ -3072,9 +3154,27 @@ static int __init parport_parse_dma(const char *dmastr, int *val) PARPORT_DMA_NONE, PARPORT_DMA_NOFIFO); } +static int __init parport_init_mode_setup(const char *str) { + + printk(KERN_DEBUG "parport_pc.c: Specified parameter parport_init_mode=%s\n", str); + + if (!strcmp (str, "spp")) + parport_init_mode=1; + if (!strcmp (str, "ps2")) + parport_init_mode=2; + if (!strcmp (str, "epp")) + parport_init_mode=3; + if (!strcmp (str, "ecp")) + parport_init_mode=4; + if (!strcmp (str, "ecpepp")) + parport_init_mode=5; + return 1; +} + #ifdef MODULE static const char *irq[PARPORT_PC_MAX_PORTS]; static const char *dma[PARPORT_PC_MAX_PORTS]; +static const char *init_mode; MODULE_PARM_DESC(io, "Base I/O address (SPP regs)"); MODULE_PARM(io, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "i"); @@ -3089,12 +3189,17 @@ MODULE_PARM(dma, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "s"); MODULE_PARM_DESC(verbose_probing, "Log chit-chat during initialisation"); MODULE_PARM(verbose_probing, "i"); #endif +MODULE_PARM_DESC(init_mode, "Initialise mode for VIA VT8231 port (spp, ps2, epp, ecp or ecpepp)"); +MODULE_PARM(init_mode, "s"); static int __init parse_parport_params(void) { unsigned int i; int val; + if (init_mode) + parport_init_mode_setup(init_mode); + for (i = 0; i < PARPORT_PC_MAX_PORTS && io[i]; i++) { if (parport_parse_irq(irq[i], &val)) return 1; @@ -3202,6 +3307,15 @@ static int __init parse_parport_params(void) } __setup ("parport=", parport_setup); + +/* + * Acceptable parameters: + * + * parport_init_mode=[spp|ps2|epp|ecp|ecpepp] + */ + +__setup("parport_init_mode=",parport_init_mode_setup); + #endif /* "Parser" ends here */ diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h index 2b5ad1bf19a2..0682cb927170 100644 --- a/include/linux/parport_pc.h +++ b/include/linux/parport_pc.h @@ -43,6 +43,23 @@ struct parport_pc_private { struct parport *port; }; +struct parport_pc_via_data +{ + /* ISA PnP IRQ routing register 1 */ + u8 via_pci_parport_irq_reg; + /* ISA PnP DMA request routing register */ + u8 via_pci_parport_dma_reg; + /* Register and value to enable SuperIO configuration access */ + u8 via_pci_superio_config_reg; + u8 via_pci_superio_config_data; + /* SuperIO function register number */ + u8 viacfg_function; + /* parallel port control register number */ + u8 viacfg_parport_control; + /* Parallel port base address register */ + u8 viacfg_parport_base; +}; + static __inline__ void parport_pc_write_data(struct parport *p, unsigned char d) { #ifdef DEBUG_PARPORT diff --git a/include/linux/via.h b/include/linux/via.h new file mode 100644 index 000000000000..86ae3bcdb2ba --- /dev/null +++ b/include/linux/via.h @@ -0,0 +1,22 @@ +/* Miscellaneous definitions for VIA chipsets + Currently used only by drivers/parport/parport_pc.c */ + +/* Values for SuperIO function select configuration register */ +#define VIA_FUNCTION_PARPORT_SPP 0x00 +#define VIA_FUNCTION_PARPORT_ECP 0x01 +#define VIA_FUNCTION_PARPORT_EPP 0x02 +#define VIA_FUNCTION_PARPORT_DISABLE 0x03 +#define VIA_FUNCTION_PROBE 0xFF /* Special magic value to be used in code, not to be written into chip */ + +/* Bits for parallel port mode configuration register */ +#define VIA_PARPORT_ECPEPP 0X20 +#define VIA_PARPORT_BIDIR 0x80 + +/* VIA configuration registers */ +#define VIA_CONFIG_INDEX 0x3F0 +#define VIA_CONFIG_DATA 0x3F1 + +/* Mask for parallel port IRQ bits (in ISA PnP IRQ routing register 1) */ +#define VIA_IRQCONTROL_PARALLEL 0xF0 +/* Mask for parallel port DMA bits (in ISA PnP DMA routing register) */ +#define VIA_DMACONTROL_PARALLEL 0x0C -- cgit v1.2.3 From 4b44897435a4e907b87cb14501c04d593f2323d8 Mon Sep 17 00:00:00 2001 From: Jason Baron Date: Sun, 7 Nov 2004 04:06:32 -0800 Subject: [PATCH] fix alt-sysrq deadlock The sysrq code is taking a spinlock from both interrupt and process context in an unsafe and deadlocky manner. Move all those inlined functions out of sysrq.h, into sysrq.c then withdraw all those exported-to-modules helper functions then remove __sysrq_trylock_table() altogether and then use spin_lock_irqsave() in the appropriate places. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/sysrq.c | 47 +++++++++++++++++++++++++++++++++-------------- include/linux/sysrq.h | 45 ++------------------------------------------- 2 files changed, 35 insertions(+), 57 deletions(-) (limited to 'include/linux') diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index da52bff37f97..170ce992e92c 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c @@ -283,14 +283,6 @@ static int sysrq_key_table_key2index(int key) { return retval; } -/* - * table lock and unlocking functions, exposed to modules - */ - -void __sysrq_lock_table (void) { spin_lock(&sysrq_key_table_lock); } - -void __sysrq_unlock_table (void) { spin_unlock(&sysrq_key_table_lock); } - /* * get and put functions for the table, exposed to modules. */ @@ -323,8 +315,9 @@ void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty) struct sysrq_key_op *op_p; int orig_log_level; int i, j; + unsigned long flags; - __sysrq_lock_table(); + spin_lock_irqsave(&sysrq_key_table_lock, flags); orig_log_level = console_loglevel; console_loglevel = 7; printk(KERN_INFO "SysRq : "); @@ -346,7 +339,7 @@ void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty) printk ("\n"); console_loglevel = orig_log_level; } - __sysrq_unlock_table(); + spin_unlock_irqrestore(&sysrq_key_table_lock, flags); } /* @@ -361,8 +354,34 @@ void handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty) __handle_sysrq(key, pt_regs, tty); } +int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, + struct sysrq_key_op *remove_op_p) { + + int retval; + unsigned long flags; + + spin_lock_irqsave(&sysrq_key_table_lock, flags); + if (__sysrq_get_key_op(key) == remove_op_p) { + __sysrq_put_key_op(key, insert_op_p); + retval = 0; + } else { + retval = -1; + } + spin_unlock_irqrestore(&sysrq_key_table_lock, flags); + + return retval; +} + +int register_sysrq_key(int key, struct sysrq_key_op *op_p) +{ + return __sysrq_swap_key_ops(key, op_p, NULL); +} + +int unregister_sysrq_key(int key, struct sysrq_key_op *op_p) +{ + return __sysrq_swap_key_ops(key, NULL, op_p); +} + EXPORT_SYMBOL(handle_sysrq); -EXPORT_SYMBOL(__sysrq_lock_table); -EXPORT_SYMBOL(__sysrq_unlock_table); -EXPORT_SYMBOL(__sysrq_get_key_op); -EXPORT_SYMBOL(__sysrq_put_key_op); +EXPORT_SYMBOL(register_sysrq_key); +EXPORT_SYMBOL(unregister_sysrq_key); diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h index 7fe8012f79f9..94cbe97bd8e6 100644 --- a/include/linux/sysrq.h +++ b/include/linux/sysrq.h @@ -31,49 +31,8 @@ struct sysrq_key_op { void handle_sysrq(int, struct pt_regs *, struct tty_struct *); void __handle_sysrq(int, struct pt_regs *, struct tty_struct *); - -/* - * Sysrq registration manipulation functions - */ - -void __sysrq_lock_table (void); -void __sysrq_unlock_table (void); -struct sysrq_key_op *__sysrq_get_key_op (int key); -void __sysrq_put_key_op (int key, struct sysrq_key_op *op_p); - -extern __inline__ int -__sysrq_swap_key_ops_nolock(int key, struct sysrq_key_op *insert_op_p, - struct sysrq_key_op *remove_op_p) -{ - int retval; - if (__sysrq_get_key_op(key) == remove_op_p) { - __sysrq_put_key_op(key, insert_op_p); - retval = 0; - } else { - retval = -1; - } - return retval; -} - -extern __inline__ int -__sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, - struct sysrq_key_op *remove_op_p) { - int retval; - __sysrq_lock_table(); - retval = __sysrq_swap_key_ops_nolock(key, insert_op_p, remove_op_p); - __sysrq_unlock_table(); - return retval; -} - -static inline int register_sysrq_key(int key, struct sysrq_key_op *op_p) -{ - return __sysrq_swap_key_ops(key, op_p, NULL); -} - -static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op_p) -{ - return __sysrq_swap_key_ops(key, NULL, op_p); -} +int register_sysrq_key(int, struct sysrq_key_op *); +int unregister_sysrq_key(int, struct sysrq_key_op *); #else -- cgit v1.2.3 From 107e7ba54f5dcd12b5ddbd6a41cf7a9f08b0ea4e Mon Sep 17 00:00:00 2001 From: MĂ„ns RullgĂ„rd Date: Sun, 7 Nov 2004 04:06:45 -0800 Subject: [PATCH] SysRq-n changes RT tasks to normal Teach sysrq-N to switch all rt-policy tasks to SCHED_OTHER. For recovering from (and diagnosing) userspace bugs. Acked-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/sysrq.c | 12 +++++++++++- include/linux/sched.h | 6 ++++++ kernel/sched.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) (limited to 'include/linux') diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 170ce992e92c..fb4c59faad07 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c @@ -216,6 +216,16 @@ static struct sysrq_key_op sysrq_kill_op = { /* END SIGNAL SYSRQ HANDLERS BLOCK */ +static void sysrq_handle_unrt(int key, struct pt_regs *pt_regs, + struct tty_struct *tty) +{ + normalize_rt_tasks(); +} +static struct sysrq_key_op sysrq_unrt_op = { + .handler = sysrq_handle_unrt, + .help_msg = "Nice", + .action_msg = "Nice All RT Tasks" +}; /* Key Operations table and lock */ static spinlock_t sysrq_key_table_lock = SPIN_LOCK_UNLOCKED; @@ -250,7 +260,7 @@ static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = { #endif /* l */ NULL, /* m */ &sysrq_showmem_op, -/* n */ NULL, +/* n */ &sysrq_unrt_op, /* o */ NULL, /* This will often be registered as 'Off' at init time */ /* p */ &sysrq_showregs_op, diff --git a/include/linux/sched.h b/include/linux/sched.h index 5d4ebb202ea6..0c8262c6d6b8 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1105,6 +1105,12 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); extern long sched_getaffinity(pid_t pid, cpumask_t *mask); +#ifdef CONFIG_MAGIC_SYSRQ + +extern void normalize_rt_tasks(void); + +#endif + #endif /* __KERNEL__ */ #endif diff --git a/kernel/sched.c b/kernel/sched.c index 76d8d418eae3..595348452a06 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -4607,3 +4607,35 @@ void __might_sleep(char *file, int line) } EXPORT_SYMBOL(__might_sleep); #endif + +#ifdef CONFIG_MAGIC_SYSRQ +void normalize_rt_tasks(void) +{ + struct task_struct *p; + prio_array_t *array; + unsigned long flags; + runqueue_t *rq; + + read_lock_irq(&tasklist_lock); + for_each_process (p) { + if (!rt_task(p)) + continue; + + rq = task_rq_lock(p, &flags); + + array = p->array; + if (array) + deactivate_task(p, task_rq(p)); + __setscheduler(p, SCHED_NORMAL, 0); + if (array) { + __activate_task(p, task_rq(p)); + resched_task(rq->curr); + } + + task_rq_unlock(rq, &flags); + } + read_unlock_irq(&tasklist_lock); +} + +EXPORT_SYMBOL(normalize_rt_tasks); +#endif /* CONFIG_MAGIC_SYSRQ */ -- cgit v1.2.3 From 3d6921be81ab76bb542b9a7f04e130009e1662b1 Mon Sep 17 00:00:00 2001 From: "Prasanna S. Panchamukhi" Date: Sun, 7 Nov 2004 04:07:23 -0800 Subject: [PATCH] kprobes: Minor i386 changes required for porting kprobes to x86_64 - Kprobes structure has been modified to support copying of original instruction as required by the architecture. On x86_64 normal pages we get from kmalloc or vmalloc are not executable. Single-stepping an instruction on such a page yields an oops. So instead of storing the instruction copies in their respective kprobe objects, we allocate a page, map it executable, and store all the instruction copies there and store the pointer of the copied instruction in the specific kprobes object. - jprobe_return_end is moved into inline assembly to avoid compiler optimization. - arch_prepare_kprobe() now returns an integer,since arch_prepare_kprobe() might fail on other architectures. - added arch_remove_kprobe() routine, since other architectures requires it. Signed-off-by: Prasanna S Panchamukhi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/i386/kernel/kprobes.c | 32 +++++++++++++++++++------------- include/asm-i386/kprobes.h | 7 +++++++ include/linux/kprobes.h | 5 +++-- kernel/kprobes.c | 6 +++++- 4 files changed, 34 insertions(+), 16 deletions(-) (limited to 'include/linux') diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index 4d066cc30ac1..f96a30d7caf7 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c @@ -42,6 +42,7 @@ static struct pt_regs jprobe_saved_regs; static long *jprobe_saved_esp; /* copy of the kernel stack at the probe fire time */ static kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; +void jprobe_return_end(void); /* * returns non-zero if opcode modifies the interrupt flag. @@ -58,9 +59,14 @@ static inline int is_IF_modifier(kprobe_opcode_t opcode) return 0; } -void arch_prepare_kprobe(struct kprobe *p) +int arch_prepare_kprobe(struct kprobe *p) +{ + memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); + return 0; +} + +void arch_remove_kprobe(struct kprobe *p) { - memcpy(p->insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); } static inline void disarm_kprobe(struct kprobe *p, struct pt_regs *regs) @@ -73,7 +79,7 @@ static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) { regs->eflags |= TF_MASK; regs->eflags &= ~IF_MASK; - regs->eip = (unsigned long)&p->insn; + regs->eip = (unsigned long)&p->ainsn.insn; } /* @@ -153,7 +159,7 @@ static inline int kprobe_handler(struct pt_regs *regs) * instruction. To avoid the SMP problems that can occur when we * temporarily put back the original opcode to single-step, we * single-stepped a copy of the instruction. The address of this - * copy is p->insn. + * copy is p->ainsn.insn. * * This function prepares to return from the post-single-step * interrupt. We have to fix up the stack as follows: @@ -173,10 +179,10 @@ static void resume_execution(struct kprobe *p, struct pt_regs *regs) { unsigned long *tos = (unsigned long *)®s->esp; unsigned long next_eip = 0; - unsigned long copy_eip = (unsigned long)&p->insn; + unsigned long copy_eip = (unsigned long)&p->ainsn.insn; unsigned long orig_eip = (unsigned long)p->addr; - switch (p->insn[0]) { + switch (p->ainsn.insn[0]) { case 0x9c: /* pushfl */ *tos &= ~(TF_MASK | IF_MASK); *tos |= kprobe_old_eflags; @@ -185,13 +191,13 @@ static void resume_execution(struct kprobe *p, struct pt_regs *regs) *tos = orig_eip + (*tos - copy_eip); break; case 0xff: - if ((p->insn[1] & 0x30) == 0x10) { + if ((p->ainsn.insn[1] & 0x30) == 0x10) { /* call absolute, indirect */ /* Fix return addr; eip is correct. */ next_eip = regs->eip; *tos = orig_eip + (*tos - copy_eip); - } else if (((p->insn[1] & 0x31) == 0x20) || /* jmp near, absolute indirect */ - ((p->insn[1] & 0x31) == 0x21)) { /* jmp far, absolute indirect */ + } else if (((p->ainsn.insn[1] & 0x31) == 0x20) || /* jmp near, absolute indirect */ + ((p->ainsn.insn[1] & 0x31) == 0x21)) { /* jmp far, absolute indirect */ /* eip is correct. */ next_eip = regs->eip; } @@ -315,12 +321,12 @@ void jprobe_return(void) { preempt_enable_no_resched(); asm volatile (" xchgl %%ebx,%%esp \n" - " int3 \n"::"b" + " int3 \n" + " .globl jprobe_return_end \n" + " jprobe_return_end: \n" + " nop \n"::"b" (jprobe_saved_esp):"memory"); } -void jprobe_return_end(void) -{ -}; int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) { diff --git a/include/asm-i386/kprobes.h b/include/asm-i386/kprobes.h index 566e34a19996..c0e8ad379ee6 100644 --- a/include/asm-i386/kprobes.h +++ b/include/asm-i386/kprobes.h @@ -38,6 +38,13 @@ typedef u8 kprobe_opcode_t; ? (MAX_STACK_SIZE) \ : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) +/* Architecture specific copy of original instruction*/ +struct arch_specific_insn { + /* copy of the original instruction */ + kprobe_opcode_t insn[MAX_INSN_SIZE]; +}; + + /* trap3/1 are intr gates for kprobes. So, restore the status of IF, * if necessary, before executing the original int3/1 (trap) handler. */ diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 172b7f421f72..3177a7ffe573 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h @@ -64,7 +64,7 @@ struct kprobe { kprobe_opcode_t opcode; /* copy of the original instruction */ - kprobe_opcode_t insn[MAX_INSN_SIZE]; + struct arch_specific_insn ainsn; }; /* @@ -94,7 +94,8 @@ static inline int kprobe_running(void) return kprobe_cpu == smp_processor_id(); } -extern void arch_prepare_kprobe(struct kprobe *p); +extern int arch_prepare_kprobe(struct kprobe *p); +extern void arch_remove_kprobe(struct kprobe *p); extern void show_registers(struct pt_regs *regs); /* Get the kprobe at this addr (if any). Must have called lock_kprobes */ diff --git a/kernel/kprobes.c b/kernel/kprobes.c index ca4e28b4c6a7..d3d1321b0e5c 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -84,10 +84,13 @@ int register_kprobe(struct kprobe *p) ret = -EEXIST; goto out; } + + if ((ret = arch_prepare_kprobe(p)) != 0) { + goto out; + } hlist_add_head(&p->hlist, &kprobe_table[hash_ptr(p->addr, KPROBE_HASH_BITS)]); - arch_prepare_kprobe(p); p->opcode = *p->addr; *p->addr = BREAKPOINT_INSTRUCTION; flush_icache_range((unsigned long) p->addr, @@ -101,6 +104,7 @@ void unregister_kprobe(struct kprobe *p) { unsigned long flags; spin_lock_irqsave(&kprobe_lock, flags); + arch_remove_kprobe(p); *p->addr = p->opcode; hlist_del(&p->hlist); flush_icache_range((unsigned long) p->addr, -- cgit v1.2.3 From 85a139b8af1760a0de44dab6895db13abbee5438 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 7 Nov 2004 04:08:26 -0800 Subject: [PATCH] remove dead exports from random.c Signed-off-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/random.c | 8 +------- include/linux/random.h | 2 -- 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'include/linux') diff --git a/drivers/char/random.c b/drivers/char/random.c index cde68a2d4f10..f867eee30bd4 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -698,7 +698,7 @@ static int __init batch_entropy_init(int size, struct entropy_store *r) * hashing calculations during an interrupt in add_timer_randomness(). * Instead, the entropy is only added to the pool by keventd. */ -void batch_entropy_store(u32 a, u32 b, int num) +static void batch_entropy_store(u32 a, u32 b, int num) { int new; unsigned long flags; @@ -729,8 +729,6 @@ void batch_entropy_store(u32 a, u32 b, int num) spin_unlock_irqrestore(&batch_lock, flags); } -EXPORT_SYMBOL(batch_entropy_store); - /* * Flush out the accumulated entropy operations, adding entropy to the passed * store (normally random_state). If that store has enough entropy, alternate @@ -874,8 +872,6 @@ void add_keyboard_randomness(unsigned char scancode) } } -EXPORT_SYMBOL(add_keyboard_randomness); - void add_mouse_randomness(__u32 mouse_data) { add_timer_randomness(&mouse_timer_state, mouse_data); @@ -891,8 +887,6 @@ void add_interrupt_randomness(int irq) add_timer_randomness(irq_timer_state[irq], 0x100+irq); } -EXPORT_SYMBOL(add_interrupt_randomness); - void add_disk_randomness(struct gendisk *disk) { if (!disk || !disk->random) diff --git a/include/linux/random.h b/include/linux/random.h index 068875bf9601..4aaffb57349d 100644 --- a/include/linux/random.h +++ b/include/linux/random.h @@ -44,8 +44,6 @@ struct rand_pool_info { extern void rand_initialize_irq(int irq); -extern void batch_entropy_store(u32 a, u32 b, int num); - extern void add_keyboard_randomness(unsigned char scancode); extern void add_mouse_randomness(__u32 mouse_data); extern void add_interrupt_randomness(int irq); -- cgit v1.2.3 From 5b62f4042372118f6fd1b501daccbded4d19a20b Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Sun, 7 Nov 2004 04:10:19 -0800 Subject: [PATCH] Fix building of samba userland After 2.6.8.1, samba userland would no longer build with current kernel headers, as it needs some of the samba kernel headers to work, yet they included outside of __KERNEL__. Signed-off-by: Tom Rini Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/smb_fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h index c776bcd95b7a..c4153120ade6 100644 --- a/include/linux/smb_fs.h +++ b/include/linux/smb_fs.h @@ -12,7 +12,6 @@ #include #include #include -#include /* * ioctl commands @@ -26,6 +25,7 @@ #ifdef __KERNEL__ +#include #include #include #include -- cgit v1.2.3 From 5eab006d95919a025911d9c53a654fcc1e109ac6 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Sun, 7 Nov 2004 04:10:44 -0800 Subject: [PATCH] Add __KERNEL__ to The following adds a __KERNEL__ check to . The problem is that the ppp package includes via , which in turn gets . Signed-off-by: Tom Rini Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/crc-ccitt.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/linux') diff --git a/include/linux/crc-ccitt.h b/include/linux/crc-ccitt.h index f52696a1ff0d..90037617da8f 100644 --- a/include/linux/crc-ccitt.h +++ b/include/linux/crc-ccitt.h @@ -1,5 +1,6 @@ #ifndef _LINUX_CRC_CCITT_H #define _LINUX_CRC_CCITT_H +#ifdef __KERNEL__ #include @@ -12,4 +13,5 @@ static inline u16 crc_ccitt_byte(u16 crc, const u8 c) return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff]; } +#endif /* __KERNEL__ */ #endif /* _LINUX_CRC_CCITT_H */ -- cgit v1.2.3 From 7602d24973c896f3d5070d96e8c19377d6e25c36 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Sun, 7 Nov 2004 04:11:09 -0800 Subject: [PATCH] fix initcall_debug on ppc64/ia64 ia64 and ppc64 have function descriptors. Booting with initcall_debug will print the descriptor address, not the address and name of the actual function. Another indirection is required. Tested on ppc, ppc64 and ia64. Signed-off-by: Olaf Hering Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/kallsyms.h | 10 ++++++++++ init/main.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 1a5dce8f9346..9bbd04092365 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -47,6 +47,16 @@ __attribute__((format(printf,1,2))); static inline void __check_printsym_format(const char *fmt, ...) { } +/* ia64 and ppc64 use function descriptors, which contain the real address */ +#if defined(CONFIG_IA64) || defined(CONFIG_PPC64) +#define print_fn_descriptor_symbol(fmt, addr) \ +do { \ + unsigned long *__faddr = (unsigned long*) addr; \ + print_symbol(fmt, __faddr[0]); \ +} while (0) +#else +#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr) +#endif #define print_symbol(fmt, addr) \ do { \ diff --git a/init/main.c b/init/main.c index 4b20c9303bd4..ecc39fafe51c 100644 --- a/init/main.c +++ b/init/main.c @@ -604,7 +604,7 @@ static void __init do_initcalls(void) if (initcall_debug) { printk(KERN_DEBUG "Calling initcall 0x%p", *call); - print_symbol(": %s()", (unsigned long) *call); + print_fn_descriptor_symbol(": %s()", (unsigned long) *call); printk("\n"); } -- cgit v1.2.3 From 8ce8001a10c9494c4a7c8662daf7d0118133b4b2 Mon Sep 17 00:00:00 2001 From: Petr Vandrovec Date: Sun, 7 Nov 2004 04:11:34 -0800 Subject: [PATCH] Add argument-less ppdev ioctls to compat_ioctl.h ppdev's ioctls are not available for 32bit apps on 64bit systems. There are four ioctls which take no argument at all (so they are compatible between 32bit and 64bit), these numbers do not clash with any other ioctl code, and so I see no reason why not applying patch below. It solves problem VMware users are faced on 64bit systems if they want to use direct access to the parallel port. Signed-off-by: Petr Vandrovec Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/compat_ioctl.c | 1 + include/linux/compat_ioctl.h | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'include/linux') diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index d5d03d0407d0..cf8c035180e1 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -96,6 +96,7 @@ #include #include #include +#include #include #include diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h index a9d099134bf2..c8c2cea10623 100644 --- a/include/linux/compat_ioctl.h +++ b/include/linux/compat_ioctl.h @@ -340,6 +340,11 @@ COMPATIBLE_IOCTL(PPPOEIOCSFWD) COMPATIBLE_IOCTL(PPPOEIOCDFWD) /* LP */ COMPATIBLE_IOCTL(LPGETSTATUS) +/* ppdev */ +COMPATIBLE_IOCTL(PPCLAIM) +COMPATIBLE_IOCTL(PPRELEASE) +COMPATIBLE_IOCTL(PPEXCL) +COMPATIBLE_IOCTL(PPYIELD) /* CDROM stuff */ COMPATIBLE_IOCTL(CDROMPAUSE) COMPATIBLE_IOCTL(CDROMRESUME) -- cgit v1.2.3