By having the entire i2c dependent initialzation in a single place, it is easier to make it optional later. Signed-off-by: Michael Tretter <m.tretter@xxxxxxxxxxxxxx> --- drivers/video/ssd1307fb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c index 88c88e3253cf..1538a1b640a3 100644 --- a/drivers/video/ssd1307fb.c +++ b/drivers/video/ssd1307fb.c @@ -387,7 +387,6 @@ static const struct of_device_id ssd1307fb_of_match[] = { static int ssd1307fb_probe(struct device_d *dev) { - struct i2c_client *client = to_i2c_client(dev); struct fb_info *info; struct device_node *node = dev->device_node; const struct of_device_id *match = @@ -410,10 +409,12 @@ static int ssd1307fb_probe(struct device_d *dev) info->priv = par; par->info = info; - par->client = client; par->device_info = (struct ssd1307fb_deviceinfo *)match->data; + par->client = to_i2c_client(dev); + i2c_set_clientdata(par->client, par); + par->reset = of_get_named_gpio_flags(node, "reset-gpios", 0, &of_flags); if (!gpio_is_valid(par->reset) && par->reset == -EPROBE_DEFER) { @@ -519,8 +520,6 @@ static int ssd1307fb_probe(struct device_d *dev) if (ret < 0) goto reset_oled_error; - i2c_set_clientdata(client, info); - if (par->reset > 0) { /* Reset the screen */ gpio_set_active(par->reset, 1); -- 2.30.2 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox