Skip to contentSkip to conversation

mfd: syscon: Removed unneeded field "dev" from private driver structure

PATCH RESEND Superseded Alexander Shiyan 1 participant 2 messages Mar 16, 2013

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

PATCH RESEND v7 1/2 mfd: syscon: Removed unneeded field "dev" from private driver structure

---
 drivers/mfd/syscon.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mfd/syscon.c +1 -4
index 61aea63..674af14 100644
@@ -25,17 +25,15 @@
 static struct platform_driver syscon_driver;
 
 struct syscon {
-	struct device *dev;
 	void __iomem *base;
 	struct regmap *regmap;
 };
 
 static int syscon_match(struct device *dev, void *data)
 {
-	struct syscon *syscon = dev_get_drvdata(dev);
 	struct device_node *dn = data;
 
-	return (syscon->dev->of_node == dn) ? 1 : 0;
+	return (dev->of_node == dn) ? 1 : 0;
 }
 
 struct regmap *syscon_node_to_regmap(struct device_node *np)
@@ -130,7 +128,6 @@ static int syscon_probe(struct platform_device *pdev)
 		return PTR_ERR(syscon->regmap);
 	}
 
-	syscon->dev = dev;
 	platform_set_drvdata(pdev, syscon);
 
 	dev_info(dev, "syscon regmap start 0x%x end 0x%x registered\n",
Signature · 1 line
1.7.12.4
#1 lore raw

PATCH RESEND v7 2/2 mfd: syscon: Add non-DT support

This patch allow using syscon driver from the platform data, i.e. possibility using driver on systems without oftree support. For search syscon device from the client drivers, "syscon_regmap_lookup_by_pdevname" function was added.

---
 drivers/mfd/Kconfig        |  1 -
 drivers/mfd/syscon.c       | 75 +++++++++++++++++++++++++++-------------------
 include/linux/mfd/syscon.h |  1 +
 3 files changed, 46 insertions(+), 31 deletions(-)
drivers/mfd/Kconfig +0 -1
index 671f5b1..8fdd87e 100644
@@ -1070,7 +1070,6 @@ config MFD_STA2X11
 
 config MFD_SYSCON
 	bool "System Controller Register R/W Based on Regmap"
-	depends on OF
 	select REGMAP_MMIO
 	help
 	  Select this option to enable accessing system control registers
drivers/mfd/syscon.c +45 -30

122 lines not on this page · raw message

include/linux/mfd/syscon.h +1 -0
index 6aeb6b8..5c9ee6e 100644
@@ -17,6 +17,7 @@
 
 extern struct regmap *syscon_node_to_regmap(struct device_node *np);
 extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
+extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s);
 extern struct regmap *syscon_regmap_lookup_by_phandle(
 					struct device_node *np,
 					const char *property);
Signature · 1 line
1.7.12.4