Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/67391 )
Change subject: drivers/: Make 'internal_delay' the default unless defined ......................................................................
drivers/: Make 'internal_delay' the default unless defined
Drop the explicit need to specify the default 'internal_delay' callback function pointer. This is a reasonable default for every other driver in the tree with only two exceptions.
Thus this simplifies driver development and paves way to remove the 'programmer' global handle.
Change-Id: I17460bc2c0aebcbb48c8dfa052b260991525cc49 Signed-off-by: Edward O'Callaghan quasisec@google.com --- M atahpt.c M atapromise.c M atavia.c M buspirate_spi.c M dediprog.c M developerbox_spi.c M digilent_spi.c M drkaiser.c M dummyflasher.c M flashrom.c M ft2232_spi.c M gfxnvidia.c M internal.c M it8212.c M jlink_spi.c M linux_mtd.c M linux_spi.c M mediatek_i2c_spi.c M mstarddc_spi.c M ni845x_spi.c M nic3com.c M nicintel.c M nicintel_eeprom.c M nicintel_spi.c M nicnatsemi.c M nicrealtek.c M ogp_spi.c M parade_lspcon.c M pickit2_spi.c M pony_spi.c M raiden_debug_spi.c M rayer_spi.c M realtek_mst_i2c_spi.c M satamv.c M satasii.c M stlinkv3_spi.c M usbblaster_spi.c 37 files changed, 23 insertions(+), 42 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/91/67391/1
diff --git a/atahpt.c b/atahpt.c index 5c636d1..fa69137 100644 --- a/atahpt.c +++ b/atahpt.c @@ -122,5 +122,4 @@ .init = atahpt_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/atapromise.c b/atapromise.c index 63463f5..9a83820 100644 --- a/atapromise.c +++ b/atapromise.c @@ -192,5 +192,4 @@ .init = atapromise_init, .map_flash_region = atapromise_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/atavia.c b/atavia.c index 51530a4..a0be396 100644 --- a/atavia.c +++ b/atavia.c @@ -191,5 +191,4 @@ .init = atavia_init, .map_flash_region = atavia_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/buspirate_spi.c b/buspirate_spi.c index 8fa60f6..041b8db 100644 --- a/buspirate_spi.c +++ b/buspirate_spi.c @@ -715,5 +715,4 @@ .init = buspirate_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/dediprog.c b/dediprog.c index f957be6..99c91e0 100644 --- a/dediprog.c +++ b/dediprog.c @@ -1321,5 +1321,4 @@ .init = dediprog_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/developerbox_spi.c b/developerbox_spi.c index 3774d04..04957a3 100644 --- a/developerbox_spi.c +++ b/developerbox_spi.c @@ -195,5 +195,4 @@ .init = developerbox_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/digilent_spi.c b/digilent_spi.c index 41342a8..85f3884 100644 --- a/digilent_spi.c +++ b/digilent_spi.c @@ -470,5 +470,4 @@ .init = digilent_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/drkaiser.c b/drkaiser.c index b121eec..039e686 100644 --- a/drkaiser.c +++ b/drkaiser.c @@ -124,5 +124,4 @@ .init = drkaiser_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/dummyflasher.c b/dummyflasher.c index 07fcd72..d42f344 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -1425,5 +1425,4 @@ .init = dummy_init, .map_flash_region = dummy_map, .unmap_flash_region = dummy_unmap, - .delay = internal_delay, }; diff --git a/flashrom.c b/flashrom.c index 0e2fa42..7921082 100644 --- a/flashrom.c +++ b/flashrom.c @@ -209,8 +209,12 @@
void programmer_delay(unsigned int usecs) { - if (usecs > 0) - programmer->delay(usecs); + if (usecs > 0) { + if (programmer->delay) + programmer->delay(usecs); + else + internal_delay(usecs); + } }
int read_memmapped(struct flashctx *flash, uint8_t *buf, unsigned int start, @@ -1409,10 +1413,6 @@ msg_gerr("Programmer %s does not have a valid init function!\n", p->name); ret = 1; } - if (p->delay == NULL) { - msg_gerr("Programmer %s does not have a valid delay function!\n", p->name); - ret = 1; - } if (p->map_flash_region == NULL) { msg_gerr("Programmer %s does not have a valid map_flash_region function!\n", p->name); ret = 1; diff --git a/ft2232_spi.c b/ft2232_spi.c index 2971c2e..5a6177c 100644 --- a/ft2232_spi.c +++ b/ft2232_spi.c @@ -712,5 +712,4 @@ .init = ft2232_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/gfxnvidia.c b/gfxnvidia.c index 941f0e8..ca432ac 100644 --- a/gfxnvidia.c +++ b/gfxnvidia.c @@ -151,5 +151,4 @@ .init = gfxnvidia_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/internal.c b/internal.c index 426730f..29e3095 100644 --- a/internal.c +++ b/internal.c @@ -348,5 +348,4 @@ .init = internal_init, .map_flash_region = physmap, .unmap_flash_region = physunmap, - .delay = internal_delay, }; diff --git a/it8212.c b/it8212.c index 18d1173..9b4a263 100644 --- a/it8212.c +++ b/it8212.c @@ -113,5 +113,4 @@ .init = it8212_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/jlink_spi.c b/jlink_spi.c index 52fc786..ef4d9ca 100644 --- a/jlink_spi.c +++ b/jlink_spi.c @@ -538,5 +538,4 @@ .devs.note = "SEGGER J-Link and compatible devices\n", .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/linux_mtd.c b/linux_mtd.c index c5dc451..dfcfd05 100644 --- a/linux_mtd.c +++ b/linux_mtd.c @@ -558,5 +558,4 @@ .init = linux_mtd_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/linux_spi.c b/linux_spi.c index 09ee8a0..b51d9e9 100644 --- a/linux_spi.c +++ b/linux_spi.c @@ -253,5 +253,4 @@ .init = linux_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/mediatek_i2c_spi.c b/mediatek_i2c_spi.c index 39a9cea..727f933 100644 --- a/mediatek_i2c_spi.c +++ b/mediatek_i2c_spi.c @@ -544,5 +544,4 @@ .init = mediatek_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/mstarddc_spi.c b/mstarddc_spi.c index ee5779c..fab002f 100644 --- a/mstarddc_spi.c +++ b/mstarddc_spi.c @@ -256,5 +256,4 @@ .init = mstarddc_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/ni845x_spi.c b/ni845x_spi.c index 3d74fd9..b5cfc06 100644 --- a/ni845x_spi.c +++ b/ni845x_spi.c @@ -637,5 +637,4 @@ .init = ni845x_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/nic3com.c b/nic3com.c index 44710ed..8fafef9 100644 --- a/nic3com.c +++ b/nic3com.c @@ -170,5 +170,4 @@ .init = nic3com_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/nicintel.c b/nicintel.c index 16cb5e4..fa91ff1 100644 --- a/nicintel.c +++ b/nicintel.c @@ -135,5 +135,4 @@ .init = nicintel_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c index 4d3e7d5..01f9075 100644 --- a/nicintel_eeprom.c +++ b/nicintel_eeprom.c @@ -540,5 +540,4 @@ .init = nicintel_ee_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/nicintel_spi.c b/nicintel_spi.c index 851b525..b99da53 100644 --- a/nicintel_spi.c +++ b/nicintel_spi.c @@ -339,5 +339,4 @@ .init = nicintel_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/nicnatsemi.c b/nicnatsemi.c index 779fb33..7236d4d 100644 --- a/nicnatsemi.c +++ b/nicnatsemi.c @@ -129,5 +129,4 @@ .init = nicnatsemi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/nicrealtek.c b/nicrealtek.c index 7bf1ac9..c96f998 100644 --- a/nicrealtek.c +++ b/nicrealtek.c @@ -148,5 +148,4 @@ .init = nicrealtek_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/ogp_spi.c b/ogp_spi.c index 94915a3..52b1d4e 100644 --- a/ogp_spi.c +++ b/ogp_spi.c @@ -180,5 +180,4 @@ .init = ogp_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/parade_lspcon.c b/parade_lspcon.c index 761e46b..72f7600 100644 --- a/parade_lspcon.c +++ b/parade_lspcon.c @@ -509,5 +509,4 @@ .init = parade_lspcon_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/pickit2_spi.c b/pickit2_spi.c index b838234..f550b4f 100644 --- a/pickit2_spi.c +++ b/pickit2_spi.c @@ -513,5 +513,4 @@ .init = pickit2_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/pony_spi.c b/pony_spi.c index 04c3236..05d7cc6 100644 --- a/pony_spi.c +++ b/pony_spi.c @@ -273,5 +273,4 @@ .init = pony_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c index 161471c..1c8b3b6 100644 --- a/raiden_debug_spi.c +++ b/raiden_debug_spi.c @@ -1650,5 +1650,4 @@ .init = raiden_debug_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/rayer_spi.c b/rayer_spi.c index 3867cfc..cd7a066 100644 --- a/rayer_spi.c +++ b/rayer_spi.c @@ -331,5 +331,4 @@ .init = rayer_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c index 74458c8..9637eca 100644 --- a/realtek_mst_i2c_spi.c +++ b/realtek_mst_i2c_spi.c @@ -546,5 +546,4 @@ .init = realtek_mst_i2c_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/satamv.c b/satamv.c index f886076..c3831d1 100644 --- a/satamv.c +++ b/satamv.c @@ -213,5 +213,4 @@ .init = satamv_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/satasii.c b/satasii.c index 44b7331..0f3311f 100644 --- a/satasii.c +++ b/satasii.c @@ -155,5 +155,4 @@ .init = satasii_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c index 38fe9f9..dcbed6d 100644 --- a/stlinkv3_spi.c +++ b/stlinkv3_spi.c @@ -558,5 +558,4 @@ .init = stlinkv3_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, }; diff --git a/usbblaster_spi.c b/usbblaster_spi.c index 2880a3c..c5914c4 100644 --- a/usbblaster_spi.c +++ b/usbblaster_spi.c @@ -234,5 +234,4 @@ .init = usbblaster_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, - .delay = internal_delay, };