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]

 



On Wed, Oct 06, 2010 at 03:15:27AM -0500, 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.

what happens, then, if e.g. device has usb charging and devicde starts
to boot when you connect usb cable. Then, by the time link (in this case
musb) probes it will have lost the VBUS notification from phy. Link
needs to know about that somehow. The easiest way is to save the last
event and data and make musb request it during probe().

If otg_get_last_event() is called outside probe(), then there's
something really wrong.

--
balbi
--
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