Skip to contentSkip to conversation

auxdisplay: img-ascii-lcd: Use device_get_match_data()

PATCH RESEND Applied Rob Herring 3 participants 7 messages Nov 15, 2023 – Dec 1, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 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.

---
 drivers/auxdisplay/img-ascii-lcd.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/auxdisplay/img-ascii-lcd.c +3 -8
index fa23e415f260..c16a14becdfc 100644
@@ -8,9 +8,9 @@
 #include <linux/io.h>
 #include <linux/mfd/syscon.h>
 #include <linux/module.h>
-#include <linux/of_address.h>
-#include <linux/of_platform.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
 
@@ -225,17 +225,12 @@ MODULE_DEVICE_TABLE(of, img_ascii_lcd_matches);
  */
 static int img_ascii_lcd_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	const struct img_ascii_lcd_config *cfg;
 	struct device *dev = &pdev->dev;
 	struct img_ascii_lcd_ctx *ctx;
 	int err;
 
-	match = of_match_device(img_ascii_lcd_matches, dev);
-	if (!match)
-		return -ENODEV;
-
-	cfg = match->data;
+	cfg = device_get_match_data(&pdev->dev);
 	ctx = devm_kzalloc(dev, sizeof(*ctx) + cfg->num_chars, GFP_KERNEL);
 	if (!ctx)
 		return -ENOMEM;
Signature · 1 line
2.42.0
#1 lore raw
Quoted 2 lines · Rob Herring

+ cfg = device_get_match_data(&pdev->dev);

This sounds good to me, but a couple notes:

- This could be dev since we have it, no?

- Orthogonally, should we just directly initialize cfg since now we can?

Cc'ing Geert as well since he was the last one touching the file (in fact, he added the dev variable).

Cheers,
Miguel

#2 lore raw

Hi Miguel,

Quoted 6 lines · Miguel Ojeda
Quoted 1 line · Rob Herring

+ cfg = device_get_match_data(&pdev->dev);

This sounds good to me, but a couple notes:

- This could be dev since we have it, no?

Indeed.

Quoted 1 line

- Orthogonally, should we just directly initialize cfg since now we can?

Yes we can, it would still fit on an 80-column punched card ;-)

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#3 lore raw
In reply to Miguel Ojeda
Quoted 5 lines · Miguel Ojeda
Quoted 2 lines · Rob Herring

+ cfg = device_get_match_data(&pdev->dev);

Quoted 8 lines

This sounds good to me, but a couple notes:

- This could be dev since we have it, no?

- Orthogonally, should we just directly initialize cfg since now we can?

Cc'ing Geert as well since he was the last one touching the file (in fact, he added the dev variable).

Can you fix that up while applying? This patch has only been ignored for 2 months.

I really only care about getting the includes right so I can apply this[1].

Rob

[1] https://lore.kernel.org/all/[email protected]/

Acked-by
#4 lore raw
Quoted 5 lines · Rob Herring

Can you fix that up while applying? This patch has only been ignored for 2 months.

I really only care about getting the includes right so I can apply this[1].

Then I would recommend saying that in the patch itself.

If you want to take it in your series to go faster, you can take my:

If you want me to apply it, that is also fine and I can do so.

Cheers,
Miguel

#5 lore raw
Quoted 8 lines · Miguel Ojeda
Quoted 5 lines · Rob Herring

Can you fix that up while applying? This patch has only been ignored for 2 months.

I really only care about getting the includes right so I can apply this[1].

Quoted 7 lines

Then I would recommend saying that in the patch itself.

If you want to take it in your series to go faster, you can take my:

If you want me to apply it, that is also fine and I can do so.

Please take it. There's other dependencies already, so I'll be sending the final patch to Linus at the end of the merge window or after rc1.

Rob

Applied
#6 lore raw
Quoted 3 lines · Rob Herring

Please take it. There's other dependencies already, so I'll be sending the final patch to Linus at the end of the merge window or after rc1.

Applied, thanks!

Paul: please double-check/test it (I just compile-tested it) and shout if you do not agree with the change. Otherwise, I will send it to Linus for the next merge window.

    https://github.com/ojeda/linux/commit/c52391fafcefe4c562bdac62088a2735c185b942

Cheers,
Miguel