public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-kernel@vger.kernel.org
Cc: Robin van der Gracht <robin@protonic.nl>,
	Andy Shevchenko <andy@kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH v1 1/1] auxdisplay: ht16k33: Make use of i2c_get_match_data()
Date: Mon, 30 Sep 2024 16:26:42 +0300	[thread overview]
Message-ID: <20240930133453.3403318-1-andriy.shevchenko@linux.intel.com> (raw)

Get matching data in one step by switching to use i2c_get_match_data().
As a positive side effect the I²C ID table is in sync of OF one.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---

I believe this is correct update. And here is why.

1) The documentation of the I2C user space device instantiation does not
mention a compatible string. it relies on the term 'name', which I believe
has direct link to the field .name in the struct i2c_device_id.

2) The above mentioned documentation says explicitly when user space
instantiation should be used. And for this driver it seems the only last
piece might be the case, i.e. prototyping / DIY configuration. For this
we don't need to rely on vendor ID anyway as in new supported hardware
the DT/ACPI emumeration is assumed.

3) Moreover, the currently used i2c_of_match_device() seems never be
considered to be used outside of i2c subsystem. Note, that it's being
used for device matching and probe, meaning firmware tables and board
info.

Also note, that the other (yes, it's ONLY 2 drivers call this API)
user of that API is going to be updated as well. Taking 3) into account
I think soon we remove that API from bein exported to the modules.

 drivers/auxdisplay/ht16k33.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index b00012a556fb..96ad9e972bd7 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16bf3a36c62fd8k33.c
@@ -657,7 +657,6 @@ static int ht16k33_seg_probe(struct device *dev, struct ht16k33_priv *priv,
 static int ht16k33_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
-	const struct of_device_id *id;
 	struct ht16k33_priv *priv;
 	uint32_t dft_brightness;
 	int err;
@@ -672,9 +671,8 @@ static int ht16k33_probe(struct i2c_client *client)
 		return -ENOMEM;
 
 	priv->client = client;
-	id = i2c_of_match_device(dev->driver->of_match_table, client);
-	if (id)
-		priv->type = (uintptr_t)id->data;
+	priv->type = (uintptr_t)i2c_get_match_data(client);
+
 	i2c_set_clientdata(client, priv);
 
 	err = ht16k33_initialize(priv);
@@ -747,7 +745,9 @@ static void ht16k33_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id ht16k33_i2c_match[] = {
-	{ "ht16k33" },
+	{ "3108", DISP_QUAD_7SEG },
+	{ "3130", DISP_QUAD_14SEG },
+	{ "ht16k33", DISP_MATRIX },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, ht16k33_i2c_match);
-- 
2.43.0.rc1.1336.g36b5255a03ac


             reply	other threads:[~2024-09-30 13:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 13:26 Andy Shevchenko [this message]
2024-10-02 12:08 ` [PATCH v1 1/1] auxdisplay: ht16k33: Make use of i2c_get_match_data() Robin van der Gracht
2024-10-02 14:02   ` Andy Shevchenko

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=20240930133453.3403318-1-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=andy@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin@protonic.nl \
    /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