grove/lcd_rgb: assign magic number to driver_api

Since device_get_binding() will not return any reference to
a driver instance if port->driver_api is NULL and grove_lcd
does not have any API struct, just populate it with some
magic number so grove_lcd can be referenced.

Change-Id: I16bdd13dfb49c54b5bdff34c4a4124af229aa20c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2016-04-14 09:52:36 -07:00 committed by Anas Nashif
commit a2ff6eaf1c

View file

@ -27,6 +27,8 @@
#include <i2c.h>
#include <display/grove_lcd.h>
#include <misc/util.h>
#define SYS_LOG_DOMAIN "Grove LCD"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_GROVE_LEVEL
#include <misc/sys_log.h>
@ -281,6 +283,17 @@ int glcd_initialize(struct device *port)
return -EPERM;
}
/* Since device_get_binding() will not return any
* reference to a driver instance if port->driver_api
* is NULL and grove_lcd does not have any API struct,
* just populate it with some magic number
* so grove_lcd can be referenced.
*
* Since dev is probably still in registers.
* use that to minimize code addition.
*/
port->driver_api = (void *)dev;
/*
* Initialization sequence from the data sheet:
* 1 - Power on