[PATCH] nvme: add ctrl state machine pdf creator

Christoph Hellwig hch at lst.de
Thu Jul 28 11:40:22 PDT 2022


On Wed, Jul 27, 2022 at 02:54:24PM -0700, Chaitanya Kulkarni wrote:
> It is not always easy to read the NVMe Host controller state machine
> quickly written in C when debugging the code for various transports.
> 
> This adds a simple dot based state machine for the host controller that
> creates pdf. The resulting pdf is easier to understand and process.

So, the graph looks pretty, but I'm a little worried that having a
separate copy of the transitions somewhere out in Documentation/
just means it will become out of date very quickly.  Can we instead
come up with macros that allow to both generate the code and the
visualization?

e.g.

	switch (new_state) {
	FROM_STATE(NVME_CTRL_LIVE);
		TO_STATE(NVME_CTRL_NEW);
		TO_STATE(NVME_CTRL_RESETTING);
		TO_STATE(NVME_CTRL_CONNECTING);
		END_STATE();
	..




More information about the Linux-nvme mailing list