Switching to use device_get_match_data() helps getting of i2c_of_match_device() API. Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> --- 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