linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
	Raul E Rangel <rrangel@chromium.org>,
	Wolfram Sang <wsa@kernel.org>,
	linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	linux-usb@vger.kernel.org
Cc: Robin van der Gracht <robin@protonic.nl>,
	Miguel Ojeda <ojeda@kernel.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH v1 2/3] auxdisplay: ht16k33: Make use of device_get_match_data()
Date: Tue, 21 Feb 2023 15:33:06 +0200	[thread overview]
Message-ID: <20230221133307.20287-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20230221133307.20287-1-andriy.shevchenko@linux.intel.com>

Switching to use device_get_match_data() helps getting of
i2c_of_match_device() API.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/auxdisplay/ht16k33.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 02425991c159..8e2fd2291ea4 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -60,7 +60,8 @@
 #define HT16K33_FB_SIZE		(HT16K33_MATRIX_LED_MAX_COLS * BYTES_PER_ROW)
 
 enum display_type {
-	DISP_MATRIX = 0,
+	DISP_UNKNOWN = 0,
+	DISP_MATRIX,
 	DISP_QUAD_7SEG,
 	DISP_QUAD_14SEG,
 };
@@ -675,6 +676,7 @@ static int ht16k33_seg_probe(struct device *dev, struct ht16k33_priv *priv,
 		return err;
 
 	switch (priv->type) {
+	default:
 	case DISP_MATRIX:
 		/* not handled here */
 		err = -EINVAL;
@@ -713,7 +715,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;
@@ -728,9 +729,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)device_get_match_data(dev);
+
 	i2c_set_clientdata(client, priv);
 
 	err = ht16k33_initialize(priv);
@@ -771,6 +771,9 @@ static int ht16k33_probe(struct i2c_client *client)
 		/* Segment Display */
 		err = ht16k33_seg_probe(dev, priv, dft_brightness);
 		break;
+	default:
+		/* Unknown display; enumerated via user space? */
+		err = 0;
 	}
 	return err;
 }
@@ -795,6 +798,8 @@ static void ht16k33_remove(struct i2c_client *client)
 		device_remove_file(&client->dev, &dev_attr_map_seg7);
 		device_remove_file(&client->dev, &dev_attr_map_seg14);
 		break;
+	default:
+		break;
 	}
 }
 
-- 
2.39.1


  parent reply	other threads:[~2023-02-21 13:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 13:33 [PATCH v1 0/3] i2c: stop using i2c_of_match_device() Andy Shevchenko
2023-02-21 13:33 ` [PATCH v1 1/3] usb: typec: stusb160x: Make use of device_get_match_data() Andy Shevchenko
2023-02-21 13:53   ` Heikki Krogerus
2023-02-21 13:33 ` Andy Shevchenko [this message]
2023-02-21 13:40   ` [PATCH v1 2/3] auxdisplay: ht16k33: " Andy Shevchenko
2023-02-21 16:10     ` Robin van der Gracht
2023-02-21 17:48       ` Andy Shevchenko
2023-02-22 16:46         ` Robin van der Gracht
2023-02-22 17:01           ` Andy Shevchenko
2023-02-22 17:20             ` Andy Shevchenko
2023-02-22 18:46               ` Krzysztof Kozlowski
2023-02-22 19:11                 ` Andy Shevchenko
2023-02-23  9:55                   ` Geert Uytterhoeven
2023-02-23 11:53                     ` Andy Shevchenko
2023-02-23  8:19               ` Robin van der Gracht
2023-02-21 13:33 ` [PATCH v1 3/3] i2c: Unexport i2c_of_match_device() Andy Shevchenko
2023-02-23 13:50 ` [PATCH v1 0/3] i2c: stop using i2c_of_match_device() 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=20230221133307.20287-3-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=robin@protonic.nl \
    --cc=rrangel@chromium.org \
    --cc=wsa@kernel.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;
as well as URLs for NNTP newsgroup(s).