From 9475cce138baf594e3eb2567fb02da42a50d46f1 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Wed, 10 Apr 2013 15:17:49 +0900 Subject: [PATCH] core: Add start/stop function to devices_ops structure Change-Id: I77a1ff04e601a713734febfb60b50d871d5aac09 Signed-off-by: Chanwoo Choi --- src/core/devices.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/core/devices.h b/src/core/devices.h index 4c98ce2..268a125 100644 --- a/src/core/devices.h +++ b/src/core/devices.h @@ -19,14 +19,34 @@ #ifndef __DEVICES_H__ #define __DEVICES_H__ +#include + struct device_ops { void (*init) (void *data); void (*exit) (void *data); + int (*start) (void); + int (*stop) (void); }; void devices_init(void *data); void devices_exit(void *data); +static inline int device_start(struct device_ops *dev) +{ + if (dev && dev->start) + return dev->start(); + + return -EINVAL; +} + +static inline int device_stop(struct device_ops *dev) +{ + if (dev && dev->stop) + return dev->stop(); + + return -EINVAL; +} + extern const struct device_ops edbus_device_ops; extern const struct device_ops display_device_ops; extern const struct device_ops sysnoti_device_ops; -- 2.7.4