Re: [PATCH 2/2] usb: otg: introduce otg_notify_event and otg_get_last_event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ext David Brownell wrote:
It can also help in the future in making state machine
based on last event.

Which I hope sounds like as bad an idea to
everyone else as it does to me ...

If you want a state machine, code it to make
state transitions based on events, not history.
"If I came from <here>" is a notoriously error
prone software structure, closely affiliated with
spaghetti code (and meatball programmers.  (Plus of
course garlic bread and cheap red wine.)

Maybe you're not sufficiently de-coupling some
state machine from a specific driver.  Events are
only supposed to cause state transitions, and the
drivers are allowed to care about, and expose, such
states ... they should largely ignore events, except
maybe to issue them, in favor of states.


The comment can be removed in the next version to avoid myself and other meatball programmers to use it this way, but as felipe mentioned, there is still a point in having this patch.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux