Skip to content

Commit 81c3e3e

Browse files
Sergey Shtylyovgregkh
authored andcommitted
ata: pata_legacy: fix pdc20230_set_piomode()
[ Upstream commit 171a931 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent fe8362c commit 81c3e3e

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
@@ -292,9 +292,10 @@ static void pdc20230_set_piomode(struct ata_port *ap, struct ata_device *adev)
292292
outb(inb(0x1F4) & 0x07, 0x1F4);
293293

294294
rt = inb(0x1F3);
295-
rt &= 0x07 << (3 * adev->devno);
295+
rt &= ~(0x07 << (3 * !adev->devno));
296296
if (pio)
297-
rt |= (1 + 3 * pio) << (3 * adev->devno);
297+
rt |= (1 + 3 * pio) << (3 * !adev->devno);
298+
outb(rt, 0x1F3);
298299

299300
udelay(100);
300301
outb(inb(0x1F2) | 0x01, 0x1F2);

0 commit comments

Comments
 (0)