111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz#include <linux/kernel.h>
35a0e3ad6af8660be21ca98a971cd00f331318c05Tejun Heo#include <linux/gfp.h>
411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz#include <linux/ide.h>
511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej ZolnierkiewiczDEFINE_MUTEX(ide_setting_mtx);
711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczide_devset_get(io_32bit, io_32bit);
911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
1011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczstatic int set_io_32bit(ide_drive_t *drive, int arg)
1111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz{
1211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (drive->dev_flags & IDE_DFLAG_NO_IO_32BIT)
1311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return -EPERM;
1411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
1511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (arg < 0 || arg > 1 + (SUPPORT_VLB_SYNC << 1))
1611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return -EINVAL;
1711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
1811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	drive->io_32bit = arg;
1911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
2011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	return 0;
2111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz}
2211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
2311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczide_devset_get_flag(ksettings, IDE_DFLAG_KEEP_SETTINGS);
2411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
2511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczstatic int set_ksettings(ide_drive_t *drive, int arg)
2611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz{
2711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (arg < 0 || arg > 1)
2811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return -EINVAL;
2911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
3011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (arg)
3111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		drive->dev_flags |= IDE_DFLAG_KEEP_SETTINGS;
3211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	else
3311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		drive->dev_flags &= ~IDE_DFLAG_KEEP_SETTINGS;
3411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
3511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	return 0;
3611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz}
3711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
3811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczide_devset_get_flag(using_dma, IDE_DFLAG_USING_DMA);
3911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
4011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczstatic int set_using_dma(ide_drive_t *drive, int arg)
4111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz{
4211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz#ifdef CONFIG_BLK_DEV_IDEDMA
4311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	int err = -EPERM;
4411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
4511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (arg < 0 || arg > 1)
4611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return -EINVAL;
4711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
4811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (ata_id_has_dma(drive->id) == 0)
4911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		goto out;
5011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
5111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (drive->hwif->dma_ops == NULL)
5211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		goto out;
5311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
5411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	err = 0;
5511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
5611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (arg) {
5711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		if (ide_set_dma(drive))
5811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz			err = -EIO;
5911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	} else
6011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		ide_dma_off(drive);
6111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
6211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczout:
6311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	return err;
6411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz#else
6511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (arg < 0 || arg > 1)
6611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return -EINVAL;
6711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
6811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	return -EPERM;
6911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz#endif
7011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz}
7111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
7211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz/*
7311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz * handle HDIO_SET_PIO_MODE ioctl abusers here, eventually it will go away
7411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz */
7511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczstatic int set_pio_mode_abuse(ide_hwif_t *hwif, u8 req_pio)
7611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz{
7711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	switch (req_pio) {
7811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	case 202:
7911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	case 201:
8011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	case 200:
8111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	case 102:
8211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	case 101:
8311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	case 100:
8411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return (hwif->host_flags & IDE_HFLAG_ABUSE_DMA_MODES) ? 1 : 0;
8511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	case 9:
8611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	case 8:
8711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return (hwif->host_flags & IDE_HFLAG_ABUSE_PREFETCH) ? 1 : 0;
8811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	case 7:
8911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	case 6:
9011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return (hwif->host_flags & IDE_HFLAG_ABUSE_FAST_DEVSEL) ? 1 : 0;
9111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	default:
9211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return 0;
9311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	}
9411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz}
9511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
9611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczstatic int set_pio_mode(ide_drive_t *drive, int arg)
9711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz{
9811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	ide_hwif_t *hwif = drive->hwif;
9911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	const struct ide_port_ops *port_ops = hwif->port_ops;
10011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
10111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (arg < 0 || arg > 255)
10211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return -EINVAL;
10311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
10411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (port_ops == NULL || port_ops->set_pio_mode == NULL ||
10511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	    (hwif->host_flags & IDE_HFLAG_NO_SET_MODE))
10611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return -ENOSYS;
10711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
10811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (set_pio_mode_abuse(drive->hwif, arg)) {
109d2d4e780aff2fab46a792ebc89f80d1a6872b325Bartlomiej Zolnierkiewicz		drive->pio_mode = arg + XFER_PIO_0;
110d2d4e780aff2fab46a792ebc89f80d1a6872b325Bartlomiej Zolnierkiewicz
11111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		if (arg == 8 || arg == 9) {
11211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz			unsigned long flags;
11311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
11411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz			/* take lock for IDE_DFLAG_[NO_]UNMASK/[NO_]IO_32BIT */
11511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz			spin_lock_irqsave(&hwif->lock, flags);
116e085b3cae85af47eb0a3eda3186bd898310fb322Bartlomiej Zolnierkiewicz			port_ops->set_pio_mode(hwif, drive);
11711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz			spin_unlock_irqrestore(&hwif->lock, flags);
11811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		} else
119e085b3cae85af47eb0a3eda3186bd898310fb322Bartlomiej Zolnierkiewicz			port_ops->set_pio_mode(hwif, drive);
12011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	} else {
12111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		int keep_dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
12211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
12311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		ide_set_pio(drive, arg);
12411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
12511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		if (hwif->host_flags & IDE_HFLAG_SET_PIO_MODE_KEEP_DMA) {
12611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz			if (keep_dma)
12711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz				ide_dma_on(drive);
12811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		}
12911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	}
13011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
13111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	return 0;
13211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz}
13311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
13411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczide_devset_get_flag(unmaskirq, IDE_DFLAG_UNMASK);
13511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
13611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczstatic int set_unmaskirq(ide_drive_t *drive, int arg)
13711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz{
13811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (drive->dev_flags & IDE_DFLAG_NO_UNMASK)
13911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return -EPERM;
14011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
14111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (arg < 0 || arg > 1)
14211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return -EINVAL;
14311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
14411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (arg)
14511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		drive->dev_flags |= IDE_DFLAG_UNMASK;
14611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	else
14711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		drive->dev_flags &= ~IDE_DFLAG_UNMASK;
14811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
14911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	return 0;
15011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz}
15111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
15211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczide_ext_devset_rw_sync(io_32bit, io_32bit);
15311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczide_ext_devset_rw_sync(keepsettings, ksettings);
15411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczide_ext_devset_rw_sync(unmaskirq, unmaskirq);
15511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczide_ext_devset_rw_sync(using_dma, using_dma);
15611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz__IDE_DEVSET(pio_mode, DS_SYNC, NULL, set_pio_mode);
15711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
15811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczint ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting,
15911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		       int arg)
16011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz{
16111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	struct request_queue *q = drive->queue;
16211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	struct request *rq;
16311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	int ret = 0;
16411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
16511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (!(setting->flags & DS_SYNC))
16611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		return setting->set(drive, arg);
16711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
16811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	rq = blk_get_request(q, READ, __GFP_WAIT);
16911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	rq->cmd_type = REQ_TYPE_SPECIAL;
17011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	rq->cmd_len = 5;
17111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	rq->cmd[0] = REQ_DEVSET_EXEC;
17211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	*(int *)&rq->cmd[1] = arg;
17311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	rq->special = setting->set;
17411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
17511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (blk_execute_rq(q, NULL, rq, 0))
17611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		ret = rq->errors;
17711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	blk_put_request(rq);
17811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
17911938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	return ret;
18011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz}
18111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
18211938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewiczide_startstop_t ide_do_devset(ide_drive_t *drive, struct request *rq)
18311938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz{
18411938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	int err, (*setfunc)(ide_drive_t *, int) = rq->special;
18511938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz
18611938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	err = setfunc(drive, *(int *)&rq->cmd[1]);
18711938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	if (err)
18811938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz		rq->errors = err;
1895e955245d6cf49c5ed26c7add7392ff5a6762bf4Bartlomiej Zolnierkiewicz	ide_complete_rq(drive, err, blk_rq_bytes(rq));
19011938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz	return ide_stopped;
19111938c929022bb92b1a42f5e1289524a1e465dc0Bartlomiej Zolnierkiewicz}
192