Skip to contentSkip to conversation

fpga: lattice-sysconfig-spi: Ad-hoc cleanups

PATCH Applied Andy Shevchenko 2 participants 5 messages May 8 – May 11 FPGA manager framework

lore
Share & tools
lore
#0 lore raw

cover fpga: lattice-sysconfig-spi: Ad-hoc cleanups

While converting the driver to use modern SPI APIs, I have noticed more things to improve, hence this mini-series. Note, it's independent to the above mentioned conversion patch and may be applied before or after (separately).

Andy Shevchenko (3):
fpga: lattice-sysconfig-spi: Fix the terminator entries in ID tables
fpga: lattice-sysconfig-spi: Drop of_match_ptr() protection
fpga: lattice-sysconfig-spi: Don't use "proxy" headers

 drivers/fpga/lattice-sysconfig-spi.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
Signature · 1 line
2.50.1
#1 lore raw

PATCH 1/3 fpga: lattice-sysconfig-spi: Fix the terminator entries in ID tables

The whole purpose of the terminator entry is to be the last one. The trailing comma makes this statement prone to failure. On top of that the style is used for the entries is unusual. Standardize this all by moving terminator entries to their own lines and drop trailing commas.

---
 drivers/fpga/lattice-sysconfig-spi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/fpga/lattice-sysconfig-spi.c +4 -2
index 6a906df45941..d8d5a33a25b7 100644
@@ -116,7 +116,8 @@ static const struct spi_device_id sysconfig_spi_ids[] = {
 	{
 		.name = "sysconfig-ecp5",
 		.driver_data = (kernel_ulong_t)&ecp5_spi_max_speed_hz,
-	}, {},
+	},
+	{}
 };
 MODULE_DEVICE_TABLE(spi, sysconfig_spi_ids);
 
@@ -125,7 +126,8 @@ static const struct of_device_id sysconfig_of_ids[] = {
 	{
 		.compatible = "lattice,sysconfig-ecp5",
 		.data = &ecp5_spi_max_speed_hz,
-	}, {},
+	},
+	{}
 };
 MODULE_DEVICE_TABLE(of, sysconfig_of_ids);
 #endif /* IS_ENABLED(CONFIG_OF) */
Signature · 1 line
2.50.1
#2 lore raw

PATCH 2/3 fpga: lattice-sysconfig-spi: Drop of_match_ptr() protection

In reply to Andy Shevchenko

Limiting the scope of devicetree support to CONFIG_OF prevents use of this driver with ACPI via PRP0001. Drop the dependency.

---
 drivers/fpga/lattice-sysconfig-spi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/fpga/lattice-sysconfig-spi.c +1 -3
index d8d5a33a25b7..76df5d7ad1f4 100644
@@ -121,7 +121,6 @@ static const struct spi_device_id sysconfig_spi_ids[] = {
 };
 MODULE_DEVICE_TABLE(spi, sysconfig_spi_ids);
 
-#if IS_ENABLED(CONFIG_OF)
 static const struct of_device_id sysconfig_of_ids[] = {
 	{
 		.compatible = "lattice,sysconfig-ecp5",
@@ -130,14 +129,13 @@ static const struct of_device_id sysconfig_of_ids[] = {
 	{}
 };
 MODULE_DEVICE_TABLE(of, sysconfig_of_ids);
-#endif /* IS_ENABLED(CONFIG_OF) */
 
 static struct spi_driver lattice_sysconfig_driver = {
 	.probe = sysconfig_spi_probe,
 	.id_table = sysconfig_spi_ids,
 	.driver = {
 		.name = "lattice_sysconfig_spi_fpga_mgr",
-		.of_match_table = of_match_ptr(sysconfig_of_ids),
+		.of_match_table = sysconfig_of_ids,
 	},
 };
 module_spi_driver(lattice_sysconfig_driver);
Signature · 1 line
2.50.1
#3 lore raw

PATCH 3/3 fpga: lattice-sysconfig-spi: Don't use "proxy" headers

In reply to Andy Shevchenko

Update header inclusions to follow IWYU (Include What You Use) principle.

---
 drivers/fpga/lattice-sysconfig-spi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/fpga/lattice-sysconfig-spi.c +7 -1
index 76df5d7ad1f4..8462bc4be06e 100644
@@ -3,8 +3,14 @@
  * Lattice FPGA programming over slave SPI sysCONFIG interface.
  */
 
-#include <linux/of.h>
+#include <linux/dev_printk.h>
+#include <linux/device/devres.h>
+#include <linux/errno.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/spi/spi.h>
+#include <linux/types.h>
 
 #include "lattice-sysconfig.h"
 
Signature · 1 line
2.50.1
Reviewed-by on the v1 series Applied
#4 lore raw
In reply to Andy Shevchenko
Quoted 5 lines · Andy Shevchenko

While converting the driver to use modern SPI APIs, I have noticed more things to improve, hence this mini-series. Note, it's independent to the above mentioned conversion patch and may be applied before or after (separately).

Quoted 7 lines

Andy Shevchenko (3):
fpga: lattice-sysconfig-spi: Fix the terminator entries in ID tables
fpga: lattice-sysconfig-spi: Drop of_match_ptr() protection
fpga: lattice-sysconfig-spi: Don't use "proxy" headers

 drivers/fpga/lattice-sysconfig-spi.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Applied to for-next.

Quoted 5 lines
Signature · 2 lines
-- 
2.50.1