Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ata: pass queued command to ->sff_data_xfer method

For Atari Falcon PATA support we need to check the current command
in its ->sff_data_xfer method. Update core code and all users
accordingly.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Bartlomiej Zolnierkiewicz and committed by
Tejun Heo
989e0aac 7563f625

+52 -47
+15 -14
drivers/ata/libata-sff.c
··· 542 542 543 543 /** 544 544 * ata_sff_data_xfer - Transfer data by PIO 545 - * @dev: device to target 545 + * @qc: queued command 546 546 * @buf: data buffer 547 547 * @buflen: buffer length 548 548 * @rw: read/write ··· 555 555 * RETURNS: 556 556 * Bytes consumed. 557 557 */ 558 - unsigned int ata_sff_data_xfer(struct ata_device *dev, unsigned char *buf, 558 + unsigned int ata_sff_data_xfer(struct ata_queued_cmd *qc, unsigned char *buf, 559 559 unsigned int buflen, int rw) 560 560 { 561 - struct ata_port *ap = dev->link->ap; 561 + struct ata_port *ap = qc->dev->link->ap; 562 562 void __iomem *data_addr = ap->ioaddr.data_addr; 563 563 unsigned int words = buflen >> 1; 564 564 ··· 595 595 596 596 /** 597 597 * ata_sff_data_xfer32 - Transfer data by PIO 598 - * @dev: device to target 598 + * @qc: queued command 599 599 * @buf: data buffer 600 600 * @buflen: buffer length 601 601 * @rw: read/write ··· 610 610 * Bytes consumed. 611 611 */ 612 612 613 - unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf, 613 + unsigned int ata_sff_data_xfer32(struct ata_queued_cmd *qc, unsigned char *buf, 614 614 unsigned int buflen, int rw) 615 615 { 616 + struct ata_device *dev = qc->dev; 616 617 struct ata_port *ap = dev->link->ap; 617 618 void __iomem *data_addr = ap->ioaddr.data_addr; 618 619 unsigned int words = buflen >> 2; 619 620 int slop = buflen & 3; 620 621 621 622 if (!(ap->pflags & ATA_PFLAG_PIO32)) 622 - return ata_sff_data_xfer(dev, buf, buflen, rw); 623 + return ata_sff_data_xfer(qc, buf, buflen, rw); 623 624 624 625 /* Transfer multiple of 4 bytes */ 625 626 if (rw == READ) ··· 659 658 660 659 /** 661 660 * ata_sff_data_xfer_noirq - Transfer data by PIO 662 - * @dev: device to target 661 + * @qc: queued command 663 662 * @buf: data buffer 664 663 * @buflen: buffer length 665 664 * @rw: read/write ··· 673 672 * RETURNS: 674 673 * Bytes consumed. 675 674 */ 676 - unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, unsigned char *buf, 675 + unsigned int ata_sff_data_xfer_noirq(struct ata_queued_cmd *qc, unsigned char *buf, 677 676 unsigned int buflen, int rw) 678 677 { 679 678 unsigned long flags; 680 679 unsigned int consumed; 681 680 682 681 local_irq_save(flags); 683 - consumed = ata_sff_data_xfer32(dev, buf, buflen, rw); 682 + consumed = ata_sff_data_xfer32(qc, buf, buflen, rw); 684 683 local_irq_restore(flags); 685 684 686 685 return consumed; ··· 724 723 buf = kmap_atomic(page); 725 724 726 725 /* do the actual data transfer */ 727 - ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size, 726 + ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size, 728 727 do_write); 729 728 730 729 kunmap_atomic(buf); 731 730 local_irq_restore(flags); 732 731 } else { 733 732 buf = page_address(page); 734 - ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size, 733 + ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size, 735 734 do_write); 736 735 } 737 736 ··· 792 791 DPRINTK("send cdb\n"); 793 792 WARN_ON_ONCE(qc->dev->cdb_len < 12); 794 793 795 - ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1); 794 + ap->ops->sff_data_xfer(qc, qc->cdb, qc->dev->cdb_len, 1); 796 795 ata_sff_sync(ap); 797 796 /* FIXME: If the CDB is for DMA do we need to do the transition delay 798 797 or is bmdma_start guaranteed to do it ? */ ··· 869 868 buf = kmap_atomic(page); 870 869 871 870 /* do the actual data transfer */ 872 - consumed = ap->ops->sff_data_xfer(dev, buf + offset, 871 + consumed = ap->ops->sff_data_xfer(qc, buf + offset, 873 872 count, rw); 874 873 875 874 kunmap_atomic(buf); 876 875 local_irq_restore(flags); 877 876 } else { 878 877 buf = page_address(page); 879 - consumed = ap->ops->sff_data_xfer(dev, buf + offset, 878 + consumed = ap->ops->sff_data_xfer(qc, buf + offset, 880 879 count, rw); 881 880 } 882 881
+3 -3
drivers/ata/pata_at91.c
··· 286 286 set_smc_timing(ap->dev, adev, info, &timing); 287 287 } 288 288 289 - static unsigned int pata_at91_data_xfer_noirq(struct ata_device *dev, 289 + static unsigned int pata_at91_data_xfer_noirq(struct ata_queued_cmd *qc, 290 290 unsigned char *buf, unsigned int buflen, int rw) 291 291 { 292 - struct at91_ide_info *info = dev->link->ap->host->private_data; 292 + struct at91_ide_info *info = qc->dev->link->ap->host->private_data; 293 293 unsigned int consumed; 294 294 unsigned int mode; 295 295 unsigned long flags; ··· 301 301 regmap_fields_write(fields.mode, info->cs, (mode & ~AT91_SMC_DBW) | 302 302 AT91_SMC_DBW_16); 303 303 304 - consumed = ata_sff_data_xfer(dev, buf, buflen, rw); 304 + consumed = ata_sff_data_xfer(qc, buf, buflen, rw); 305 305 306 306 /* restore 8bit mode after data is written */ 307 307 regmap_fields_write(fields.mode, info->cs, (mode & ~AT91_SMC_DBW) |
+4 -3
drivers/ata/pata_bf54x.c
··· 1143 1143 1144 1144 /** 1145 1145 * bfin_data_xfer - Transfer data by PIO 1146 - * @adev: device for this I/O 1146 + * @qc: queued command 1147 1147 * @buf: data buffer 1148 1148 * @buflen: buffer length 1149 1149 * @write_data: read/write ··· 1151 1151 * Note: Original code is ata_sff_data_xfer(). 1152 1152 */ 1153 1153 1154 - static unsigned int bfin_data_xfer(struct ata_device *dev, unsigned char *buf, 1154 + static unsigned int bfin_data_xfer(struct ata_queued_cmd *qc, 1155 + unsigned char *buf, 1155 1156 unsigned int buflen, int rw) 1156 1157 { 1157 - struct ata_port *ap = dev->link->ap; 1158 + struct ata_port *ap = qc->dev->link->ap; 1158 1159 void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; 1159 1160 unsigned int words = buflen >> 1; 1160 1161 unsigned short *buf16 = (u16 *)buf;
+2 -2
drivers/ata/pata_ep93xx.c
··· 474 474 } 475 475 476 476 /* Note: original code is ata_sff_data_xfer */ 477 - static unsigned int ep93xx_pata_data_xfer(struct ata_device *adev, 477 + static unsigned int ep93xx_pata_data_xfer(struct ata_queued_cmd *qc, 478 478 unsigned char *buf, 479 479 unsigned int buflen, int rw) 480 480 { 481 - struct ata_port *ap = adev->link->ap; 481 + struct ata_port *ap = qc->dev->link->ap; 482 482 struct ep93xx_pata_data *drv_data = ap->host->private_data; 483 483 u16 *data = (u16 *)buf; 484 484 unsigned int words = buflen >> 1;
+2 -2
drivers/ata/pata_ixp4xx_cf.c
··· 40 40 return 0; 41 41 } 42 42 43 - static unsigned int ixp4xx_mmio_data_xfer(struct ata_device *dev, 43 + static unsigned int ixp4xx_mmio_data_xfer(struct ata_queued_cmd *qc, 44 44 unsigned char *buf, unsigned int buflen, int rw) 45 45 { 46 46 unsigned int i; 47 47 unsigned int words = buflen >> 1; 48 48 u16 *buf16 = (u16 *) buf; 49 - struct ata_port *ap = dev->link->ap; 49 + struct ata_port *ap = qc->dev->link->ap; 50 50 void __iomem *mmio = ap->ioaddr.data_addr; 51 51 struct ixp4xx_pata_data *data = dev_get_platdata(ap->host->dev); 52 52
+9 -6
drivers/ata/pata_legacy.c
··· 303 303 304 304 } 305 305 306 - static unsigned int pdc_data_xfer_vlb(struct ata_device *dev, 306 + static unsigned int pdc_data_xfer_vlb(struct ata_queued_cmd *qc, 307 307 unsigned char *buf, unsigned int buflen, int rw) 308 308 { 309 - int slop = buflen & 3; 309 + struct ata_device *dev = qc->dev; 310 310 struct ata_port *ap = dev->link->ap; 311 + int slop = buflen & 3; 311 312 312 313 /* 32bit I/O capable *and* we need to write a whole number of dwords */ 313 314 if (ata_id_has_dword_io(dev->id) && (slop == 0 || slop == 3) ··· 341 340 } 342 341 local_irq_restore(flags); 343 342 } else 344 - buflen = ata_sff_data_xfer_noirq(dev, buf, buflen, rw); 343 + buflen = ata_sff_data_xfer_noirq(qc, buf, buflen, rw); 345 344 346 345 return buflen; 347 346 } ··· 703 702 return ata_sff_qc_issue(qc); 704 703 } 705 704 706 - static unsigned int vlb32_data_xfer(struct ata_device *adev, unsigned char *buf, 707 - unsigned int buflen, int rw) 705 + static unsigned int vlb32_data_xfer(struct ata_queued_cmd *qc, 706 + unsigned char *buf, 707 + unsigned int buflen, int rw) 708 708 { 709 + struct ata_device *adev = qc->dev; 709 710 struct ata_port *ap = adev->link->ap; 710 711 int slop = buflen & 3; 711 712 ··· 730 727 } 731 728 return (buflen + 3) & ~3; 732 729 } else 733 - return ata_sff_data_xfer(adev, buf, buflen, rw); 730 + return ata_sff_data_xfer(qc, buf, buflen, rw); 734 731 } 735 732 736 733 static int qdi_port(struct platform_device *dev,
+6 -6
drivers/ata/pata_octeon_cf.c
··· 293 293 /** 294 294 * Handle an 8 bit I/O request. 295 295 * 296 - * @dev: Device to access 296 + * @qc: Queued command 297 297 * @buffer: Data buffer 298 298 * @buflen: Length of the buffer. 299 299 * @rw: True to write. 300 300 */ 301 - static unsigned int octeon_cf_data_xfer8(struct ata_device *dev, 301 + static unsigned int octeon_cf_data_xfer8(struct ata_queued_cmd *qc, 302 302 unsigned char *buffer, 303 303 unsigned int buflen, 304 304 int rw) 305 305 { 306 - struct ata_port *ap = dev->link->ap; 306 + struct ata_port *ap = qc->dev->link->ap; 307 307 void __iomem *data_addr = ap->ioaddr.data_addr; 308 308 unsigned long words; 309 309 int count; ··· 332 332 /** 333 333 * Handle a 16 bit I/O request. 334 334 * 335 - * @dev: Device to access 335 + * @qc: Queued command 336 336 * @buffer: Data buffer 337 337 * @buflen: Length of the buffer. 338 338 * @rw: True to write. 339 339 */ 340 - static unsigned int octeon_cf_data_xfer16(struct ata_device *dev, 340 + static unsigned int octeon_cf_data_xfer16(struct ata_queued_cmd *qc, 341 341 unsigned char *buffer, 342 342 unsigned int buflen, 343 343 int rw) 344 344 { 345 - struct ata_port *ap = dev->link->ap; 345 + struct ata_port *ap = qc->dev->link->ap; 346 346 void __iomem *data_addr = ap->ioaddr.data_addr; 347 347 unsigned long words; 348 348 int count;
+3 -3
drivers/ata/pata_pcmcia.c
··· 90 90 91 91 /** 92 92 * ata_data_xfer_8bit - Transfer data by 8bit PIO 93 - * @dev: device to target 93 + * @qc: queued command 94 94 * @buf: data buffer 95 95 * @buflen: buffer length 96 96 * @rw: read/write ··· 101 101 * Inherited from caller. 102 102 */ 103 103 104 - static unsigned int ata_data_xfer_8bit(struct ata_device *dev, 104 + static unsigned int ata_data_xfer_8bit(struct ata_queued_cmd *qc, 105 105 unsigned char *buf, unsigned int buflen, int rw) 106 106 { 107 - struct ata_port *ap = dev->link->ap; 107 + struct ata_port *ap = qc->dev->link->ap; 108 108 109 109 if (rw == READ) 110 110 ioread8_rep(ap->ioaddr.data_addr, buf, buflen);
+2 -2
drivers/ata/pata_samsung_cf.c
··· 263 263 /* 264 264 * pata_s3c_data_xfer - Transfer data by PIO 265 265 */ 266 - static unsigned int pata_s3c_data_xfer(struct ata_device *dev, 266 + static unsigned int pata_s3c_data_xfer(struct ata_queued_cmd *qc, 267 267 unsigned char *buf, unsigned int buflen, int rw) 268 268 { 269 - struct ata_port *ap = dev->link->ap; 269 + struct ata_port *ap = qc->dev->link->ap; 270 270 struct s3c_ide_info *info = ap->host->private_data; 271 271 void __iomem *data_addr = ap->ioaddr.data_addr; 272 272 unsigned int words = buflen >> 1, i;
+2 -2
drivers/ata/sata_rcar.c
··· 447 447 ata_sff_pause(ap); 448 448 } 449 449 450 - static unsigned int sata_rcar_data_xfer(struct ata_device *dev, 450 + static unsigned int sata_rcar_data_xfer(struct ata_queued_cmd *qc, 451 451 unsigned char *buf, 452 452 unsigned int buflen, int rw) 453 453 { 454 - struct ata_port *ap = dev->link->ap; 454 + struct ata_port *ap = qc->dev->link->ap; 455 455 void __iomem *data_addr = ap->ioaddr.data_addr; 456 456 unsigned int words = buflen >> 1; 457 457
+4 -4
include/linux/libata.h
··· 968 968 void (*sff_tf_read)(struct ata_port *ap, struct ata_taskfile *tf); 969 969 void (*sff_exec_command)(struct ata_port *ap, 970 970 const struct ata_taskfile *tf); 971 - unsigned int (*sff_data_xfer)(struct ata_device *dev, 971 + unsigned int (*sff_data_xfer)(struct ata_queued_cmd *qc, 972 972 unsigned char *buf, unsigned int buflen, int rw); 973 973 void (*sff_irq_on)(struct ata_port *); 974 974 bool (*sff_irq_check)(struct ata_port *); ··· 1823 1823 extern void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf); 1824 1824 extern void ata_sff_exec_command(struct ata_port *ap, 1825 1825 const struct ata_taskfile *tf); 1826 - extern unsigned int ata_sff_data_xfer(struct ata_device *dev, 1826 + extern unsigned int ata_sff_data_xfer(struct ata_queued_cmd *qc, 1827 1827 unsigned char *buf, unsigned int buflen, int rw); 1828 - extern unsigned int ata_sff_data_xfer32(struct ata_device *dev, 1828 + extern unsigned int ata_sff_data_xfer32(struct ata_queued_cmd *qc, 1829 1829 unsigned char *buf, unsigned int buflen, int rw); 1830 - extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, 1830 + extern unsigned int ata_sff_data_xfer_noirq(struct ata_queued_cmd *qc, 1831 1831 unsigned char *buf, unsigned int buflen, int rw); 1832 1832 extern void ata_sff_irq_on(struct ata_port *ap); 1833 1833 extern void ata_sff_irq_clear(struct ata_port *ap);