Felix Singer has submitted this change. ( https://review.coreboot.org/c/flashrom/+/67391 )
(
6 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )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 in the programmer_entry struct. This is a reasonable default for every other driver in the tree with only the two exceptions of ch341a_spi.c and serprog.c.
Thus this simplifies driver development.
Change-Id: I17460bc2c0aebcbb48c8dfa052b260991525cc49 Signed-off-by: Edward O'Callaghan quasisec@google.com Reviewed-on: https://review.coreboot.org/c/flashrom/+/67391 Reviewed-by: Peter Marheine pmarheine@chromium.org Reviewed-by: Angel Pons th3fanbus@gmail.com Reviewed-by: Thomas Heijligen src@posteo.de Reviewed-by: Felix Singer felixsinger@posteo.net Reviewed-by: Nikolai Artemiev nartemiev@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- 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, 30 insertions(+), 42 deletions(-)
Approvals: build bot (Jenkins): Verified Felix Singer: Looks good to me, approved Thomas Heijligen: Looks good to me, but someone else must approve Angel Pons: Looks good to me, but someone else must approve Peter Marheine: Looks good to me, but someone else must approve Nikolai Artemiev: Looks good to me, but someone else must approve
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 d4a3aa8..5de0921 100644 --- a/atapromise.c +++ b/atapromise.c @@ -186,5 +186,4 @@ .init = atapromise_init, .map_flash_region = fallback_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 0704887..121c7e5 100644 --- a/buspirate_spi.c +++ b/buspirate_spi.c @@ -716,5 +716,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 49a541b..b2a41c6 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -1426,5 +1426,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 2604594..3328a71 100644 --- a/flashrom.c +++ b/flashrom.c @@ -219,8 +219,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, @@ -1419,10 +1423,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 5b45d7e..6d7aa6a 100644 --- a/ft2232_spi.c +++ b/ft2232_spi.c @@ -713,5 +713,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 ff510ef..cab408c 100644 --- a/gfxnvidia.c +++ b/gfxnvidia.c @@ -152,5 +152,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 6a8db5e..2558cde 100644 --- a/internal.c +++ b/internal.c @@ -349,5 +349,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 c0147f6..26244a8 100644 --- a/linux_mtd.c +++ b/linux_mtd.c @@ -559,5 +559,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 af46b24..88a4afa 100644 --- a/mstarddc_spi.c +++ b/mstarddc_spi.c @@ -257,5 +257,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 ebeac94..63359d2 100644 --- a/pony_spi.c +++ b/pony_spi.c @@ -274,5 +274,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 28cab06..9ded585 100644 --- a/raiden_debug_spi.c +++ b/raiden_debug_spi.c @@ -1651,5 +1651,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, };