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

ata: libata-core: Improve link flags forced settings

Similarly to the horkage flags, introduce the force_lflag_onoff() macro
to define struct ata_force_param entries of the force_tbl array that
allow turning on or off a link flag using the libata.force boot
parameter. To be consistent with naming, the macro force_lflag() is
renamed to force_lflag_on().

Using force_lflag_onoff(), define a new force_tbl entry for the
ATA_LFLAG_NO_DEBOUNCE_DELAY link flag, thus allowing testing if an
adapter requires a link debounce delay or not.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Hannes Reinecke <hare@suse.de>

+22 -10
+22 -10
drivers/ata/libata-core.c
··· 96 96 unsigned long xfer_mask; 97 97 unsigned int horkage_on; 98 98 unsigned int horkage_off; 99 - u16 lflags; 99 + u16 lflags_on; 100 + u16 lflags_off; 100 101 }; 101 102 102 103 struct ata_force_ent { ··· 387 386 } 388 387 389 388 /* let lflags stack */ 390 - if (fe->param.lflags) { 391 - link->flags |= fe->param.lflags; 389 + if (fe->param.lflags_on) { 390 + link->flags |= fe->param.lflags_on; 392 391 ata_link_notice(link, 393 392 "FORCE: link flag 0x%x forced -> 0x%x\n", 394 - fe->param.lflags, link->flags); 393 + fe->param.lflags_on, link->flags); 394 + } 395 + if (fe->param.lflags_off) { 396 + link->flags &= ~fe->param.lflags_off; 397 + ata_link_notice(link, 398 + "FORCE: link flag 0x%x cleared -> 0x%x\n", 399 + fe->param.lflags_off, link->flags); 395 400 } 396 401 } 397 402 } ··· 6117 6110 #define force_xfer(mode, shift) \ 6118 6111 { #mode, .xfer_mask = (1UL << (shift)) } 6119 6112 6120 - #define force_lflag(name, flags) \ 6121 - { #name, .lflags = (flags) } 6113 + #define force_lflag_on(name, flags) \ 6114 + { #name, .lflags_on = (flags) } 6115 + 6116 + #define force_lflag_onoff(name, flags) \ 6117 + { "no" #name, .lflags_on = (flags) }, \ 6118 + { #name, .lflags_off = (flags) } 6122 6119 6123 6120 #define force_horkage_on(name, flag) \ 6124 6121 { #name, .horkage_on = (flag) } ··· 6177 6166 force_xfer(udma/133, ATA_SHIFT_UDMA + 6), 6178 6167 force_xfer(udma7, ATA_SHIFT_UDMA + 7), 6179 6168 6180 - force_lflag(nohrst, ATA_LFLAG_NO_HRST), 6181 - force_lflag(nosrst, ATA_LFLAG_NO_SRST), 6182 - force_lflag(norst, ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST), 6183 - force_lflag(rstonce, ATA_LFLAG_RST_ONCE), 6169 + force_lflag_on(nohrst, ATA_LFLAG_NO_HRST), 6170 + force_lflag_on(nosrst, ATA_LFLAG_NO_SRST), 6171 + force_lflag_on(norst, ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST), 6172 + force_lflag_on(rstonce, ATA_LFLAG_RST_ONCE), 6173 + force_lflag_onoff(dbdelay, ATA_LFLAG_NO_DEBOUNCE_DELAY), 6184 6174 6185 6175 force_horkage_onoff(ncq, ATA_HORKAGE_NONCQ), 6186 6176 force_horkage_onoff(ncqtrim, ATA_HORKAGE_NO_NCQ_TRIM),