if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->oss.pt, dev->oss.dma.sglist, dev->oss.dma.sglen, 
if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->dmasound.pt, dev->dmasound.dma.sglist, dev->dmasound.dma.sglen, 
static int dsp_rec_start(struct saa7134_dev *dev){	int err, bswap, sign;	u32 fmt, control;	unsigned long flags;	/* prepare buffer */	if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->oss.dma)))		return err;	if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->oss.pt)))		goto fail1;	if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->oss.pt,					      dev->oss.dma.sglist,					      dev->oss.dma.sglen,					      0)))		goto fail2;	/* sample format */	switch (dev->oss.afmt) {	case AFMT_U8:	case AFMT_S8:     fmt = 0x00;  break;	case AFMT_U16_LE:	case AFMT_U16_BE:	case AFMT_S16_LE:	case AFMT_S16_BE: fmt = 0x01;  break;	default:		err = -EINVAL;		goto fail2;	}	switch (dev->oss.afmt) {	case AFMT_S8:	case AFMT_S16_LE:	case AFMT_S16_BE: sign = 1; break;	default:          sign = 0; break;	}	switch (dev->oss.afmt) {	case AFMT_U16_BE:	case AFMT_S16_BE: bswap = 1; break;	default:          bswap = 0; break;	}	switch (dev->pci->device) {	case PCI_DEVICE_ID_PHILIPS_SAA7134:		if (1 == dev->oss.channels)			fmt |= (1 << 3);		if (2 == dev->oss.channels)			fmt |= (3 << 3);		if (sign)			fmt |= 0x04;		fmt |= (TV == dev->oss.input) ? 0xc0 : 0x80;		saa_writeb(SAA7134_NUM_SAMPLES0, ((dev->oss.blksize - 1) & 0x0000ff));		saa_writeb(SAA7134_NUM_SAMPLES1, ((dev->oss.blksize - 1) & 0x00ff00) >>  8);		saa_writeb(SAA7134_NUM_SAMPLES2, ((dev->oss.blksize - 1) & 0xff0000) >> 16);		saa_writeb(SAA7134_AUDIO_FORMAT_CTRL, fmt);		break;	case PCI_DEVICE_ID_PHILIPS_SAA7133:	case PCI_DEVICE_ID_PHILIPS_SAA7135:		if (1 == dev->oss.channels)			fmt |= (1 << 4);		if (2 == dev->oss.channels)			fmt |= (2 << 4);		if (!sign)			fmt |= 0x04;		saa_writel(SAA7133_NUM_SAMPLES, dev->oss.blksize -4);		saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210 | (fmt << 24));		break;	}	dprintk("rec_start: afmt=%d ch=%d  =>  fmt=0x%x swap=%c\n",		dev->oss.afmt, dev->oss.channels, fmt,		bswap ? 'b' : '-');	/* dma: setup channel 6 (= AUDIO) */	control = SAA7134_RS_CONTROL_BURST_16 |		SAA7134_RS_CONTROL_ME |		(dev->oss.pt.dma >> 12);	if (bswap)		control |= SAA7134_RS_CONTROL_BSWAP;	saa_writel(SAA7134_RS_BA1(6),0);	saa_writel(SAA7134_RS_BA2(6),dev->oss.blksize);	saa_writel(SAA7134_RS_PITCH(6),0);	saa_writel(SAA7134_RS_CONTROL(6),control);	/* start dma */	dev->oss.recording_on = 1;	spin_lock_irqsave(&dev->slock,flags);	dsp_dma_start(dev);	spin_unlock_irqrestore(&dev->slock,flags);	return 0; fail2:	saa7134_pgtable_free(dev->pci,&dev->oss.pt); fail1:	videobuf_dma_pci_unmap(dev->pci,&dev->oss.dma);	return err;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/b54134be53be720da423692665ec215eb14a678b/saa7134-oss.c/buggy/drivers/media/video/saa7134/saa7134-oss.c