Commit ff04715bd5171d6d5c4ddff40c7bdc8d2dc90f7d
Committed by
Jeff Garzik
1 parent
d127ea7b86
Exists in
master
and in
7 other branches
pata_via: clean up recent tf_load changes
Commit bfce5e0179ad059035df28558724ff60af708e09 implemented custom tf_load for pata_via. This patch cleans it up a bit. * Instead of duplicating whole body, copy tf and set ATA_TFLAG_DEVICE when necessary. * Rename via_ata_tf_load() to via_tf_load(). * No need to set .tf_load in via_port_ops_noirq as it inherits from via_port_ops. * Clean up indentation. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Joseph Chan <JosephChan@via.com.tw> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Showing 1 changed file with 11 additions and 48 deletions Side-by-side Diff
drivers/ata/pata_via.c
... | ... | @@ -324,62 +324,26 @@ |
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
327 | - * via_ata_sff_tf_load - send taskfile registers to host controller | |
327 | + * via_tf_load - send taskfile registers to host controller | |
328 | 328 | * @ap: Port to which output is sent |
329 | 329 | * @tf: ATA taskfile register set |
330 | 330 | * |
331 | 331 | * Outputs ATA taskfile to standard ATA host controller. |
332 | 332 | * |
333 | 333 | * Note: This is to fix the internal bug of via chipsets, which |
334 | - * will reset the device register after changing the IEN bit on | |
335 | - * ctl register | |
334 | + * will reset the device register after changing the IEN bit on | |
335 | + * ctl register | |
336 | 336 | */ |
337 | -static void via_ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | |
337 | +static void via_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | |
338 | 338 | { |
339 | - struct ata_ioports *ioaddr = &ap->ioaddr; | |
340 | - unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | |
339 | + struct ata_taskfile tmp_tf; | |
341 | 340 | |
342 | - if (tf->ctl != ap->last_ctl) { | |
343 | - iowrite8(tf->ctl, ioaddr->ctl_addr); | |
344 | - iowrite8(tf->device, ioaddr->device_addr); | |
345 | - ap->last_ctl = tf->ctl; | |
346 | - ata_wait_idle(ap); | |
341 | + if (ap->ctl != ap->last_ctl && !(tf->flags & ATA_TFLAG_DEVICE)) { | |
342 | + tmp_tf = *tf; | |
343 | + tmp_tf.flags |= ATA_TFLAG_DEVICE; | |
344 | + tf = &tmp_tf; | |
347 | 345 | } |
348 | - | |
349 | - if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { | |
350 | - iowrite8(tf->hob_feature, ioaddr->feature_addr); | |
351 | - iowrite8(tf->hob_nsect, ioaddr->nsect_addr); | |
352 | - iowrite8(tf->hob_lbal, ioaddr->lbal_addr); | |
353 | - iowrite8(tf->hob_lbam, ioaddr->lbam_addr); | |
354 | - iowrite8(tf->hob_lbah, ioaddr->lbah_addr); | |
355 | - VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n", | |
356 | - tf->hob_feature, | |
357 | - tf->hob_nsect, | |
358 | - tf->hob_lbal, | |
359 | - tf->hob_lbam, | |
360 | - tf->hob_lbah); | |
361 | - } | |
362 | - | |
363 | - if (is_addr) { | |
364 | - iowrite8(tf->feature, ioaddr->feature_addr); | |
365 | - iowrite8(tf->nsect, ioaddr->nsect_addr); | |
366 | - iowrite8(tf->lbal, ioaddr->lbal_addr); | |
367 | - iowrite8(tf->lbam, ioaddr->lbam_addr); | |
368 | - iowrite8(tf->lbah, ioaddr->lbah_addr); | |
369 | - VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", | |
370 | - tf->feature, | |
371 | - tf->nsect, | |
372 | - tf->lbal, | |
373 | - tf->lbam, | |
374 | - tf->lbah); | |
375 | - } | |
376 | - | |
377 | - if (tf->flags & ATA_TFLAG_DEVICE) { | |
378 | - iowrite8(tf->device, ioaddr->device_addr); | |
379 | - VPRINTK("device 0x%X\n", tf->device); | |
380 | - } | |
381 | - | |
382 | - ata_wait_idle(ap); | |
346 | + ata_sff_tf_load(ap, tf); | |
383 | 347 | } |
384 | 348 | |
385 | 349 | static struct scsi_host_template via_sht = { |
386 | 350 | |
... | ... | @@ -392,13 +356,12 @@ |
392 | 356 | .set_piomode = via_set_piomode, |
393 | 357 | .set_dmamode = via_set_dmamode, |
394 | 358 | .prereset = via_pre_reset, |
395 | - .sff_tf_load = via_ata_tf_load, | |
359 | + .sff_tf_load = via_tf_load, | |
396 | 360 | }; |
397 | 361 | |
398 | 362 | static struct ata_port_operations via_port_ops_noirq = { |
399 | 363 | .inherits = &via_port_ops, |
400 | 364 | .sff_data_xfer = ata_sff_data_xfer_noirq, |
401 | - .sff_tf_load = via_ata_tf_load, | |
402 | 365 | }; |
403 | 366 | |
404 | 367 | /** |