From: Michael Tretter <m.tretter@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/5] video: ssd1307fb: move i2c setup to single place
Date: Fri, 17 Dec 2021 19:22:58 +0100 [thread overview]
Message-ID: <20211217182300.3768235-4-m.tretter@pengutronix.de> (raw)
In-Reply-To: <20211217182300.3768235-1-m.tretter@pengutronix.de>
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@pengutronix.de>
---
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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-12-17 18:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-17 18:22 [PATCH 0/5] video: ssd1307fb: Add SPI support Michael Tretter
2021-12-17 18:22 ` [PATCH 1/5] video: ssd1307fb: pass par instead of i2c client to write Michael Tretter
2021-12-17 18:22 ` [PATCH 2/5] video: ssd1307fb: don't use i2c client for logging Michael Tretter
2021-12-17 18:22 ` Michael Tretter [this message]
2021-12-17 18:22 ` [PATCH 4/5] video: ssd1307fb: use function pointer for write Michael Tretter
2021-12-17 18:23 ` [PATCH 5/5] video: ssd1307fb: add spi support Michael Tretter
2021-12-17 19:00 ` Ahmad Fatoum
2021-12-17 21:13 ` Michael Tretter
2021-12-18 6:20 ` Ahmad Fatoum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211217182300.3768235-4-m.tretter@pengutronix.de \
--to=m.tretter@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox