linux_spi.c: Extract get_max_kernel_buf_size() as a function

To get max_kernel_buf_size is a piece of logic on its own, it opens
resources and closes resources, also has some local variables only
for this task. Extracting get_max_kernel_buf_size() as a separate
function simplifies init flow and allows to remove global state from linux_spi
(see next patches in this chain).

Change-Id: I4b8c5775fb8f4b0dff702fcc0fb258221254c659
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/52283
Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72167
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
1 file changed