diff options
author | Daniel Leung <daniel.leung@intel.com> | 2016-04-14 09:52:36 -0700 |
---|---|---|
committer | Anas Nashif <nashif@linux.intel.com> | 2016-04-15 22:07:34 +0000 |
commit | a2ff6eaf1c75eab88275da00a02950e0f91e979e (patch) | |
tree | 57ebff28fee21bcd22c1d1b53b1239780ebf6676 /drivers/grove/lcd_rgb.c | |
parent | 6b75db44e63fd5aff33121e7b55202606ccc787f (diff) |
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>
Diffstat (limited to 'drivers/grove/lcd_rgb.c')
-rw-r--r-- | drivers/grove/lcd_rgb.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/grove/lcd_rgb.c b/drivers/grove/lcd_rgb.c index 287734eee..1a9ab6348 100644 --- a/drivers/grove/lcd_rgb.c +++ b/drivers/grove/lcd_rgb.c @@ -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 |