writeprotect, flashchips: clean up writeprotect fields
This patch deletes old `.wp` entries from the flashchips.c table
and creates a new function, `get_wp_for_flashchip()`, which finds
the appropriate `struct wp` instance for the chip. The `.wp` entry
was used in cli_classic.c, which has been updated accordingly.
`struct flashchip` still contains the `.wp` field, as it is currently
used by the linux_mtd and cros_ec programmers to override writeprotect.c
with their own functionality. This should be cleaned up in the future,
so the wp field can be deleted. However, this patch still significantly
reduces the overall diff with upstream.
The process of researching and verifying this change revealed several
inconsistent and redundant definitions, such as flashchips with `.wp`
fields that did not have any range entries in writeprotect.c and
flashchips that are handled in both the w25 and generic range table
lookup functions. These have all been resolved so as to avoid any change
in the wp field that is associated with each chip, and have been noted
in get_wp_for_flashchip() so they can be fixed later.
Signed-off-by: Nikolai Artemiev <email@example.com>
Reviewed-by: Edward O'Callaghan <firstname.lastname@example.org>
4 files changed