Skip to content

Commit 171a931

Browse files
Sergey ShtylyovDamien Le Moal
authored andcommitted
ata: pata_legacy: fix pdc20230_set_piomode()
Clang gives a warning when compiling pata_legacy.c with 'make W=1' about the 'rt' local variable in pdc20230_set_piomode() being set but unused. Quite obviously, there is an outb() call missing to write back the updated variable. Moreover, checking the docs by Petr Soucek revealed that bitwise AND should have been done with a negated timing mask and the master/slave timing masks were swapped while updating... Fixes: 669a5db ("[libata] Add a bunch of PATA drivers.") Reported-by: Damien Le Moal <[email protected]> Signed-off-by: Sergey Shtylyov <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent 2ce3a0b commit 171a931

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/ata/pata_legacy.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,10 @@ static void pdc20230_set_piomode(struct ata_port *ap, struct ata_device *adev)
315315
outb(inb(0x1F4) & 0x07, 0x1F4);
316316

317317
rt = inb(0x1F3);
318-
rt &= 0x07 << (3 * adev->devno);
318+
rt &= ~(0x07 << (3 * !adev->devno));
319319
if (pio)
320-
rt |= (1 + 3 * pio) << (3 * adev->devno);
320+
rt |= (1 + 3 * pio) << (3 * !adev->devno);
321+
outb(rt, 0x1F3);
321322

322323
udelay(100);
323324
outb(inb(0x1F2) | 0x01, 0x1F2);

0 commit comments

Comments
 (0)