flash/nor: implement flash bank deallocation in drivers with simple alloc 17/4417/3
authorTomas Vanek <vanekt@fbl.cz>
Thu, 15 Feb 2018 09:25:50 +0000 (10:25 +0100)
committerMatthias Welwarsky <matthias@welwarsky.de>
Wed, 4 Apr 2018 19:14:18 +0000 (20:14 +0100)
All drivers which simply allocate one driver_priv memory block
per each bank now use default_flash_free_driver_priv()

Change-Id: I425bf4213c3632f02dbe11ab819c31eda9b2db62
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4417
Tested-by: jenkins
Reviewed-by: Liviu Dudau <liviu@dudau.co.uk>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
40 files changed:
src/flash/nor/ambiqmicro.c
src/flash/nor/ath79.c
src/flash/nor/atsamv.c
src/flash/nor/avrf.c
src/flash/nor/cfi.c
src/flash/nor/efm32.c
src/flash/nor/em357.c
src/flash/nor/faux.c
src/flash/nor/fm3.c
src/flash/nor/fm4.c
src/flash/nor/jtagspi.c
src/flash/nor/kinetis_ke.c
src/flash/nor/lpc2000.c
src/flash/nor/lpc288x.c
src/flash/nor/lpc2900.c
src/flash/nor/lpcspifi.c
src/flash/nor/mdr.c
src/flash/nor/mrvlqspi.c
src/flash/nor/niietcm4.c
src/flash/nor/numicro.c
src/flash/nor/ocl.c
src/flash/nor/pic32mx.c
src/flash/nor/psoc4.c
src/flash/nor/psoc6.c
src/flash/nor/sim3x.c
src/flash/nor/stellaris.c
src/flash/nor/stm32f1x.c
src/flash/nor/stm32f2x.c
src/flash/nor/stm32h7x.c
src/flash/nor/stm32l4x.c
src/flash/nor/stm32lx.c
src/flash/nor/stmsmi.c
src/flash/nor/str7x.c
src/flash/nor/str9x.c
src/flash/nor/str9xpec.c
src/flash/nor/tms470.c
src/flash/nor/virtual.c
src/flash/nor/xcf.c
src/flash/nor/xmc1xxx.c
src/flash/nor/xmc4xxx.c

index b2c30e6..13b2b26 100644 (file)
@@ -901,4 +901,5 @@ struct flash_driver ambiqmicro_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = ambiqmicro_protect_check,
        .info = get_ambiqmicro_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 451e843..c5f9eed 100644 (file)
@@ -898,4 +898,5 @@ struct flash_driver ath79_flash = {
        .erase_check = ath79_flash_blank_check,
        .protect_check = ath79_protect_check,
        .info = get_ath79_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 73f0238..9c07bdf 100644 (file)
@@ -739,4 +739,5 @@ struct flash_driver atsamv_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = samv_protect_check,
        .info = samv_get_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 11cc3b2..65ac601 100644 (file)
@@ -487,4 +487,5 @@ struct flash_driver avr_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = avrf_protect_check,
        .info = avrf_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index ac0db82..0ae72d4 100644 (file)
@@ -3128,4 +3128,5 @@ struct flash_driver cfi_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = cfi_protect_check,
        .info = get_cfi_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 282b6bd..1d70bd5 100644 (file)
@@ -1133,4 +1133,5 @@ struct flash_driver efm32_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = efm32x_protect_check,
        .info = get_efm32x_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index a11743b..b14e032 100644 (file)
@@ -941,4 +941,5 @@ struct flash_driver em357_flash = {
        .auto_probe = em357_auto_probe,
        .erase_check = default_flash_blank_check,
        .protect_check = em357_protect_check,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 203eb6f..46eda72 100644 (file)
@@ -136,5 +136,6 @@ struct flash_driver faux_flash = {
        .auto_probe = faux_probe,
        .erase_check = default_flash_blank_check,
        .protect_check = faux_protect_check,
-       .info = faux_info
+       .info = faux_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 6269a65..6c61977 100644 (file)
@@ -997,4 +997,5 @@ struct flash_driver fm3_flash = {
        .probe = fm3_probe,
        .auto_probe = fm3_auto_probe,
        .erase_check = default_flash_blank_check,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index c8fe8b6..f5eab9c 100644 (file)
@@ -719,4 +719,5 @@ struct flash_driver fm4_flash = {
        .erase = fm4_flash_erase,
        .erase_check = default_flash_blank_check,
        .write = fm4_flash_write,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index a73812d..c28ad22 100644 (file)
@@ -432,5 +432,6 @@ struct flash_driver jtagspi_flash = {
        .auto_probe = jtagspi_probe,
        .erase_check = default_flash_blank_check,
        .protect_check = jtagspi_protect_check,
-       .info = jtagspi_info
+       .info = jtagspi_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index b7a6a1e..8103b63 100644 (file)
@@ -1310,4 +1310,5 @@ struct flash_driver kinetis_ke_flash = {
        .erase_check = kinetis_ke_blank_check,
        .protect_check = kinetis_ke_protect_check,
        .info = kinetis_ke_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 9da5da2..8e15c31 100644 (file)
@@ -1579,4 +1579,5 @@ struct flash_driver lpc2000_flash = {
        .erase_check = lpc2000_erase_check,
        .protect_check = lpc2000_protect_check,
        .info = get_lpc2000_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index a4d88de..2472913 100644 (file)
@@ -433,4 +433,5 @@ struct flash_driver lpc288x_flash = {
        .auto_probe = lpc288x_probe,
        .erase_check = lpc288x_erase_check,
        .protect_check = lpc288x_protect_check,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 515a3f7..1c65933 100644 (file)
@@ -1598,4 +1598,5 @@ struct flash_driver lpc2900_flash = {
        .auto_probe = lpc2900_probe,
        .erase_check = lpc2900_erase_check,
        .protect_check = lpc2900_protect_check,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 943c151..828c60c 100644 (file)
@@ -942,4 +942,5 @@ struct flash_driver lpcspifi_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = lpcspifi_protect_check,
        .info = get_lpcspifi_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 8ceb1bf..f3916de 100644 (file)
@@ -633,4 +633,5 @@ struct flash_driver mdr_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = mdr_protect_check,
        .info = get_mdr_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index d799170..eda6cc1 100644 (file)
@@ -955,4 +955,5 @@ struct flash_driver mrvlqspi_flash = {
        .erase_check = mrvlqspi_flash_erase_check,
        .protect_check = mrvlqspi_protect_check,
        .info = mrvlqspi_get_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 4a849fd..fd7d519 100644 (file)
@@ -1741,4 +1741,5 @@ struct flash_driver niietcm4_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = niietcm4_protect_check,
        .info = get_niietcm4_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 992baa5..4d951f0 100644 (file)
@@ -1880,4 +1880,5 @@ struct flash_driver numicro_flash = {
        .auto_probe = numicro_auto_probe,
        .erase_check = default_flash_blank_check,
        .protect_check = numicro_protect_check,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 4ae5652..895c4af 100644 (file)
@@ -340,4 +340,5 @@ struct flash_driver ocl_flash = {
        .erase_check = ocl_erase_check,
        .protect_check = ocl_protect_check,
        .auto_probe = ocl_auto_probe,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 1f148fd..e3b8028 100644 (file)
@@ -980,4 +980,5 @@ struct flash_driver pic32mx_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = pic32mx_protect_check,
        .info = pic32mx_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index a024009..47d60de 100644 (file)
@@ -963,4 +963,5 @@ struct flash_driver psoc4_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = psoc4_protect_check,
        .info = get_psoc4_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 259d667..e5c4197 100644 (file)
@@ -982,4 +982,5 @@ struct flash_driver psoc6_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = psoc6_protect_check,
        .info = psoc6_get_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index ce9a21e..f282ba0 100644 (file)
@@ -1122,5 +1122,6 @@ struct flash_driver sim3x_flash = {
        .auto_probe = sim3x_auto_probe,
        .erase_check = default_flash_blank_check,
        .protect_check = sim3x_flash_protect_check,
-       .info = sim3x_flash_info
+       .info = sim3x_flash_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index d28ceee..79aaf3b 100644 (file)
@@ -1452,4 +1452,5 @@ struct flash_driver stellaris_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = stellaris_protect_check,
        .info = get_stellaris_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index d446707..64c9168 100644 (file)
@@ -1647,4 +1647,5 @@ struct flash_driver stm32f1x_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = stm32x_protect_check,
        .info = get_stm32x_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index b0992b4..8bca62e 100644 (file)
@@ -1634,4 +1634,5 @@ struct flash_driver stm32f2x_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = stm32x_protect_check,
        .info = get_stm32x_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 01e6f06..a15cd25 100644 (file)
@@ -1180,4 +1180,5 @@ struct flash_driver stm32h7x_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = stm32x_protect_check,
        .info = stm32x_get_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 6a1fa07..e2710bd 100644 (file)
@@ -953,4 +953,5 @@ struct flash_driver stm32l4x_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = stm32l4_protect_check,
        .info = get_stm32l4_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index fdfaad4..f4dd686 100644 (file)
@@ -965,6 +965,7 @@ struct flash_driver stm32lx_flash = {
                .erase_check = default_flash_blank_check,
                .protect_check = stm32lx_protect_check,
                .info = stm32lx_get_info,
+               .free_driver_priv = default_flash_free_driver_priv,
 };
 
 /* Static methods implementation */
index 781ea3b..c839bf7 100644 (file)
@@ -654,4 +654,5 @@ struct flash_driver stmsmi_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = stmsmi_protect_check,
        .info = get_stmsmi_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 11179f5..015202a 100644 (file)
@@ -812,4 +812,5 @@ struct flash_driver str7x_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = str7x_protect_check,
        .info = get_str7x_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 3b7ca2a..37700ce 100644 (file)
@@ -679,4 +679,5 @@ struct flash_driver str9x_flash = {
        .auto_probe = str9x_probe,
        .erase_check = default_flash_blank_check,
        .protect_check = str9x_protect_check,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index eb391e8..29e0977 100644 (file)
@@ -1207,4 +1207,5 @@ struct flash_driver str9xpec_flash = {
        .auto_probe = str9xpec_probe,
        .erase_check = str9xpec_erase_check,
        .protect_check = str9xpec_protect_check,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index a70891e..102bf1b 100644 (file)
@@ -1186,4 +1186,5 @@ struct flash_driver tms470_flash = {
        .erase_check = tms470_erase_check,
        .protect_check = tms470_protect_check,
        .info = get_tms470_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 06981f4..d5d688b 100644 (file)
@@ -231,4 +231,5 @@ struct flash_driver virtual_flash = {
        .erase_check = virtual_blank_check,
        .protect_check = virtual_protect_check,
        .info = virtual_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 035791e..bc4b1be 100644 (file)
@@ -636,6 +636,7 @@ static int xcf_probe(struct flash_bank *bank)
        fill_sector_table(bank);
 
        priv->probed = true;
+       /* REVISIT: Why is unchanged bank->driver_priv rewritten by same value? */
        bank->driver_priv = priv;
 
        LOG_INFO("product name: %s", product_name(bank));
@@ -893,5 +894,6 @@ struct flash_driver xcf_flash = {
        .auto_probe         = xcf_auto_probe,
        .erase_check        = xcf_erase_check,
        .protect_check      = xcf_protect_check,
-       .info               = xcf_info
+       .info               = xcf_info,
+       .free_driver_priv   = default_flash_free_driver_priv,
 };
index 0a76b21..4b25398 100644 (file)
@@ -546,4 +546,5 @@ struct flash_driver xmc1xxx_flash = {
        .erase = xmc1xxx_erase,
        .erase_check = xmc1xxx_erase_check,
        .write = xmc1xxx_write,
+       .free_driver_priv = default_flash_free_driver_priv,
 };
index 5677ef0..0b6d48c 100644 (file)
@@ -1356,4 +1356,5 @@ struct flash_driver xmc4xxx_flash = {
        .info = xmc4xxx_get_info_command,
        .protect_check = xmc4xxx_protect_check,
        .protect = xmc4xxx_protect,
+       .free_driver_priv = default_flash_free_driver_priv,
 };