core: Add start/stop function to devices_ops structure 86/14686/1
authorChanwoo Choi <cw00.choi@samsung.com>
Wed, 10 Apr 2013 06:17:49 +0000 (15:17 +0900)
committerKrzysztof Sasiak <k.sasiak@samsung.com>
Thu, 9 Jan 2014 16:36:13 +0000 (17:36 +0100)
Change-Id: I77a1ff04e601a713734febfb60b50d871d5aac09
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/core/devices.h

index 4c98ce2..268a125 100644 (file)
 #ifndef __DEVICES_H__
 #define __DEVICES_H__
 
+#include <errno.h>
+
 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;