Skip to content

Commit c52391f

Browse files
robherringojeda
authored andcommitted
auxdisplay: img-ascii-lcd: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring <robh@kernel.org> Cc: Paul Burton <paulburton@kernel.org> Link: https://lore.kernel.org/r/20231115210245.3744589-1-robh@kernel.org [ As discussed, used `dev` and moved call to `cfg`'s initialization. ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 2cc14f5 commit c52391f

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

drivers/auxdisplay/img-ascii-lcd.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#include <linux/io.h>
99
#include <linux/mfd/syscon.h>
1010
#include <linux/module.h>
11-
#include <linux/of_address.h>
12-
#include <linux/of_platform.h>
11+
#include <linux/of.h>
1312
#include <linux/platform_device.h>
13+
#include <linux/property.h>
1414
#include <linux/regmap.h>
1515
#include <linux/slab.h>
1616

@@ -225,17 +225,11 @@ MODULE_DEVICE_TABLE(of, img_ascii_lcd_matches);
225225
*/
226226
static int img_ascii_lcd_probe(struct platform_device *pdev)
227227
{
228-
const struct of_device_id *match;
229-
const struct img_ascii_lcd_config *cfg;
230228
struct device *dev = &pdev->dev;
229+
const struct img_ascii_lcd_config *cfg = device_get_match_data(dev);
231230
struct img_ascii_lcd_ctx *ctx;
232231
int err;
233232

234-
match = of_match_device(img_ascii_lcd_matches, dev);
235-
if (!match)
236-
return -ENODEV;
237-
238-
cfg = match->data;
239233
ctx = devm_kzalloc(dev, sizeof(*ctx) + cfg->num_chars, GFP_KERNEL);
240234
if (!ctx)
241235
return -ENOMEM;

0 commit comments

Comments
 (0)