Skip to contentSkip to conversation

eeprom: at24: use of_match_ptr()

PATCH In review Bartosz Golaszewski 1 participant 2 messages Nov 23, 2023 – Nov 29, 2023

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

PATCH v2 1/1 eeprom: at24: use of_match_ptr()

From: Bartosz Golaszewski <[email protected]>

This driver does not depend on CONFIG_OF so using of_match_ptr() makes sense to reduce the size a bit.

---
v1 -> v2:
- use __maybe_unused to avoid warnings about at24_of_match not being used

 drivers/misc/eeprom/at24.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/misc/eeprom/at24.c +3 -2
index f61a80597a22..8279adade07e 100644
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/nvmem-provider.h>
+#include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/property.h>
@@ -242,7 +243,7 @@ static const struct i2c_device_id at24_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, at24_ids);
 
-static const struct of_device_id at24_of_match[] = {
+static const struct of_device_id __maybe_unused at24_of_match[] = {
 	{ .compatible = "atmel,24c00",		.data = &at24_data_24c00 },
 	{ .compatible = "atmel,24c01",		.data = &at24_data_24c01 },
 	{ .compatible = "atmel,24cs01",		.data = &at24_data_24cs01 },
@@ -812,7 +813,7 @@ static struct i2c_driver at24_driver = {
 	.driver = {
 		.name = "at24",
 		.pm = &at24_pm_ops,
-		.of_match_table = at24_of_match,
+		.of_match_table = of_match_ptr(at24_of_match),
 		.acpi_match_table = ACPI_PTR(at24_acpi_ids),
 	},
 	.probe = at24_probe,
Signature · 1 line
2.40.1
#1 lore raw
Quoted 45 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

This driver does not depend on CONFIG_OF so using of_match_ptr() makes sense to reduce the size a bit.

---
v1 -> v2:
- use __maybe_unused to avoid warnings about at24_of_match not being used

 drivers/misc/eeprom/at24.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/misc/eeprom/at24.c +3 -3
index f61a80597a22..8279adade07e 100644
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/nvmem-provider.h>
+#include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/property.h>
@@ -242,7 +243,7 @@ static const struct i2c_device_id at24_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, at24_ids);
 
-static const struct of_device_id at24_of_match[] = {
+static const struct of_device_id __maybe_unused at24_of_match[] = {
        { .compatible = "atmel,24c00",          .data = &at24_data_24c00 },
        { .compatible = "atmel,24c01",          .data = &at24_data_24c01 },
        { .compatible = "atmel,24cs01",         .data = &at24_data_24cs01 },
@@ -812,7 +813,7 @@ static struct i2c_driver at24_driver = {
        .driver = {
                .name = "at24",
                .pm = &at24_pm_ops,
-               .of_match_table = at24_of_match,
+               .of_match_table = of_match_ptr(at24_of_match),
                .acpi_match_table = ACPI_PTR(at24_acpi_ids),
        },
        .probe = at24_probe,
--
Quoted 2 lines

2.40.1

Patch applied.

Bart