gpio/pcal_9535a: move driver_api assignment later

This moves the assignment of driver_api to just before
the init function returns. This is in preparation to
make device_get_binding() return NULL if driver
initialization fails.

Change-Id: Ibf08cb107885da7c1037c6e7d207530e1a4708f8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2016-04-05 14:09:46 -07:00 committed by Anas Nashif
commit b8e887a112

View file

@ -567,8 +567,6 @@ int gpio_pcal9535a_init(struct device *dev)
(struct gpio_pcal9535a_drv_data * const)dev->driver_data;
struct device *i2c_master;
dev->driver_api = &gpio_pcal9535a_drv_api_funcs;
/* Find out the device struct of the I2C master */
i2c_master = device_get_binding((char *)config->i2c_master_dev_name);
if (!i2c_master) {
@ -578,6 +576,8 @@ int gpio_pcal9535a_init(struct device *dev)
nano_timer_init(&drv_data->timer, (void *) 0);
dev->driver_api = &gpio_pcal9535a_drv_api_funcs;
return 0;
}