Hi Joursoir,

On Mon, 2022-04-04 at 14:57 +0300, Joursoir wrote:
> Hello Thomas,
> 
> No problem, thanks for your reply. I have one more question. I have
> noticed
> that some programmers already have their own context (for example
> pony_spi.c,
> rayer_spi.c. serprog.c, dediprog.c and others). I note that they are
> all
> SPI. As I understood, they use the following approaches:
> 
> 1. Register a callback by its own
> 
> if (register_shutdown(serprog_shutdown, NULL))
>     goto init_err_cleanup_exit;
> 
> 2. Fill `struct spi_master` shutdown-callback
> 
> static struct spi_master spi_master_dediprog = {
>     ...
>     .shutdown = dediprog_shutdown,
> };
> 
> Is there any significant difference in this approaches? Or does it
> just
> depend on code flow?
> 
The goal is the same. To reduce the global state and the number of
calls to register_something. The differnt is the way how to use the
shutdown stack. The shutdown function as part of the programmer struct
is a more declarative approch. when working this further, the bus
master could also be declared in the programmer struct. But that's a
topic for a different project.

Anastasia may give you more details about the shutdown function in the
*_master struct.

-- Thomas
_______________________________________________
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org

Reply via email to