.request_recv = NULL, /* no incoming requests */
};
-bool gb_battery_protocol_init(void)
+int gb_battery_protocol_init(void)
{
return gb_protocol_register(&battery_protocol);
}
.request_recv = NULL, /* no incoming requests */
};
-bool gb_gpio_protocol_init(void)
+int gb_gpio_protocol_init(void)
{
return gb_protocol_register(&gpio_protocol);
}
.request_recv = NULL, /* no incoming requests */
};
-bool gb_i2c_protocol_init(void)
+int gb_i2c_protocol_init(void)
{
return gb_protocol_register(&i2c_protocol);
}
return NULL;
}
-/* Returns true if protocol was successfully registered, false otherwise */
-bool gb_protocol_register(struct gb_protocol *protocol)
+int gb_protocol_register(struct gb_protocol *protocol)
{
struct gb_protocol *existing;
u8 id = protocol->id;
/* A matching protocol has already been registered */
spin_unlock_irq(&gb_protocols_lock);
- return false;
+ return -EEXIST;
}
/*
list_add_tail(&protocol->links, &existing->links);
spin_unlock_irq(&gb_protocols_lock);
- return true;
+ return 0;
}
/*
*
* Returns true if successful, false otherwise.
*/
-bool gb_protocol_deregister(struct gb_protocol *protocol)
+int gb_protocol_deregister(struct gb_protocol *protocol)
{
u8 protocol_count = 0;
+ if (!protocol)
+ return 0;
+
spin_lock_irq(&gb_protocols_lock);
protocol = _gb_protocol_find(protocol->id, protocol->major,
protocol->minor);
{
bool ret = true;
- if (!gb_battery_protocol_init()) {
+ if (gb_battery_protocol_init()) {
pr_err("error initializing battery protocol\n");
ret = false;
}
- if (!gb_gpio_protocol_init()) {
+ if (gb_gpio_protocol_init()) {
pr_err("error initializing gpio protocol\n");
ret = false;
}
- if (!gb_i2c_protocol_init()) {
+ if (gb_i2c_protocol_init()) {
pr_err("error initializing i2c protocol\n");
ret = false;
}
- if (!gb_pwm_protocol_init()) {
+ if (gb_pwm_protocol_init()) {
pr_err("error initializing pwm protocol\n");
ret = false;
}
- if (!gb_uart_protocol_init()) {
+ if (gb_uart_protocol_init()) {
pr_err("error initializing uart protocol\n");
ret = false;
}
- if (!gb_sdio_protocol_init()) {
+ if (gb_sdio_protocol_init()) {
pr_err("error initializing sdio protocol\n");
ret = false;
}
- if (!gb_vibrator_protocol_init()) {
+ if (gb_vibrator_protocol_init()) {
pr_err("error initializing vibrator protocol\n");
ret = false;
}
- if (!gb_usb_protocol_init()) {
+ if (gb_usb_protocol_init()) {
pr_err("error initializing usb protocol\n");
ret = false;
}
gb_request_recv_t request_recv;
};
-bool gb_protocol_register(struct gb_protocol *protocol);
-bool gb_protocol_deregister(struct gb_protocol *protocol);
+int gb_protocol_register(struct gb_protocol *protocol);
+int gb_protocol_deregister(struct gb_protocol *protocol);
struct gb_protocol *gb_protocol_get(u8 id, u8 major, u8 minor);
void gb_protocol_put(struct gb_protocol *protocol);
* Declared here for now. They could be added via modules, or maybe
* just use initcalls (which level?).
*/
-extern bool gb_battery_protocol_init(void);
+extern int gb_battery_protocol_init(void);
extern void gb_battery_protocol_exit(void);
-extern bool gb_gpio_protocol_init(void);
+extern int gb_gpio_protocol_init(void);
extern void gb_gpio_protocol_exit(void);
-extern bool gb_i2c_protocol_init(void);
+extern int gb_i2c_protocol_init(void);
extern void gb_i2c_protocol_exit(void);
-extern bool gb_pwm_protocol_init(void);
+extern int gb_pwm_protocol_init(void);
extern void gb_pwm_protocol_exit(void);
-extern bool gb_uart_protocol_init(void);
+extern int gb_uart_protocol_init(void);
extern void gb_uart_protocol_exit(void);
-extern bool gb_sdio_protocol_init(void);
+extern int gb_sdio_protocol_init(void);
extern void gb_sdio_protocol_exit(void);
-extern bool gb_vibrator_protocol_init(void);
+extern int gb_vibrator_protocol_init(void);
extern void gb_vibrator_protocol_exit(void);
-extern bool gb_usb_protocol_init(void);
+extern int gb_usb_protocol_init(void);
extern void gb_usb_protocol_exit(void);
bool gb_protocol_init(void);
.request_recv = NULL, /* no incoming requests */
};
-bool gb_pwm_protocol_init(void)
+int gb_pwm_protocol_init(void)
{
return gb_protocol_register(&pwm_protocol);
}
.request_recv = NULL, /* no incoming requests */
};
-bool gb_sdio_protocol_init(void)
+int gb_sdio_protocol_init(void)
{
return gb_protocol_register(&sdio_protocol);
}
.request_recv = NULL, /* FIXME we have 2 types of requests!!! */
};
-bool gb_uart_protocol_init(void)
+int gb_uart_protocol_init(void)
{
return gb_protocol_register(&uart_protocol);
}
.request_recv = NULL, /* FIXME we have requests!!! */
};
-bool gb_usb_protocol_init(void)
+int gb_usb_protocol_init(void)
{
return gb_protocol_register(&usb_protocol);
}
.request_recv = NULL, /* no incoming requests */
};
-bool gb_vibrator_protocol_init(void)
+int gb_vibrator_protocol_init(void)
{
int retval;