linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: single: avoid to set read only object
@ 2013-03-03 15:01 Haojian Zhuang
  2013-03-04 19:44 ` Tony Lindgren
  2013-03-07  7:48 ` Linus Walleij
  0 siblings, 2 replies; 5+ messages in thread
From: Haojian Zhuang @ 2013-03-03 15:01 UTC (permalink / raw)
  To: linux-arm-kernel

drivers/pinctrl/pinctrl-single.c:1441:3: error: assignment of member
?is_generic? in read-only object
make[2]: *** [drivers/pinctrl/pinctrl-single.o] Error 1

Since pcs_pinconf_ops is changed to read only structure, probe()
function can't set is_generic variable any more. So append new
pcs_pinconf_generic_ops.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 drivers/pinctrl/pinctrl-single.c |   27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 4cdcf85..c80ffa8 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -734,6 +734,18 @@ static const struct pinconf_ops pcs_pinconf_ops = {
 	.pin_config_dbg_show = pcs_pinconf_dbg_show,
 	.pin_config_group_dbg_show = pcs_pinconf_group_dbg_show,
 	.pin_config_config_dbg_show = pcs_pinconf_config_dbg_show,
+	.is_generic = false,
+};
+
+static const struct pinconf_ops pcs_pinconf_generic_ops = {
+	.pin_config_get = pcs_pinconf_get,
+	.pin_config_set = pcs_pinconf_set,
+	.pin_config_group_get = pcs_pinconf_group_get,
+	.pin_config_group_set = pcs_pinconf_group_set,
+	.pin_config_dbg_show = pcs_pinconf_dbg_show,
+	.pin_config_group_dbg_show = pcs_pinconf_group_dbg_show,
+	.pin_config_config_dbg_show = pcs_pinconf_config_dbg_show,
+	.is_generic = true,
 };
 
 /**
@@ -1435,10 +1447,8 @@ static int pcs_probe(struct platform_device *pdev)
 	pcs->desc.name = DRIVER_NAME;
 	pcs->desc.pctlops = &pcs_pinctrl_ops;
 	pcs->desc.pmxops = &pcs_pinmux_ops;
-	pcs->desc.confops = &pcs_pinconf_ops;
+	pcs->desc.confops = match->data;
 	pcs->desc.owner = THIS_MODULE;
-	if (match->data)
-		pcs_pinconf_ops.is_generic = true;
 
 	ret = pcs_allocate_pin_table(pcs);
 	if (ret < 0)
@@ -1479,9 +1489,14 @@ static int pcs_remove(struct platform_device *pdev)
 }
 
 static struct of_device_id pcs_of_match[] = {
-	{ .compatible = "pinctrl-single", .data = (void *)false },
-	{ .compatible = "pinconf-single", .data = (void *)true },
-	{ },
+	{
+		.compatible = "pinctrl-single",
+		.data = (void *)&pcs_pinconf_ops,
+	}, {
+		.compatible = "pinconf-single",
+		.data = (void *)&pcs_pinconf_generic_ops,
+       	}, {
+	},
 };
 MODULE_DEVICE_TABLE(of, pcs_of_match);
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-07 16:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-03 15:01 [PATCH] pinctrl: single: avoid to set read only object Haojian Zhuang
2013-03-04 19:44 ` Tony Lindgren
2013-03-07  7:48 ` Linus Walleij
2013-03-07 15:37   ` Haojian Zhuang
2013-03-07 16:36     ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).