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]

 



Hello.

On 06-10-2010 11:01, Maulik Mankad wrote:

otg_notify_event is a simpler way to call the notifier and saving
the last_event andd data in otg_transceiver.

otg_get_last_event allow drivers to get the last event
in case the event has been notified before the driver was probed.
It can also help in the future in making state machine based on last event.

Signed-off-by: Arnaud Mandy<ext-arnaud.2.mandy@xxxxxxxxx>

[...]

diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 22dfd43..026b89a 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
[...]
@@ -226,6 +228,22 @@ otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
        return atomic_notifier_chain_register(&otg->notifier, nb);
  }

+static inline int
+otg_notify_event(struct otg_transceiver *otg, enum usb_xceiv_events event,
+               void *data)
+{
+       otg->last_event = event;
+       otg->last_event_data = data;
+
+       return atomic_notifier_call_chain(&otg->notifier, event, data);
+}
+
+static inline int
+otg_get_last_event(struct otg_transceiver *otg)
+{
+       return otg_notify_event(otg, otg->last_event, otg->last_event_data);
+}
+

Should this be static?

If drivers need to get the last event they need to call this function
in which case you need to export this function.

Don't you see that the function is defined in a header file and it's *inline*? Using *static* is kind of mandatory for the *inline* functions.

WBR, Sergei
--
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