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

* [PATCH] pinctrl: single: avoid to set read only object
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2013-03-04 19:44 UTC (permalink / raw)
  To: linux-arm-kernel

* Haojian Zhuang <haojian.zhuang@linaro.org> [130303 07:05]:
> 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>

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  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	[flat|nested] 5+ messages in thread

* [PATCH] pinctrl: single: avoid to set read only object
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2013-03-07  7:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Mar 3, 2013 at 4:01 PM, Haojian Zhuang
<haojian.zhuang@linaro.org> wrote:

> 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>

Isn't this fixed by Axel's much simpler patch?

Yours,
Linus Walleij

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

* [PATCH] pinctrl: single: avoid to set read only object
  2013-03-07  7:48 ` Linus Walleij
@ 2013-03-07 15:37   ` Haojian Zhuang
  2013-03-07 16:36     ` Tony Lindgren
  0 siblings, 1 reply; 5+ messages in thread
From: Haojian Zhuang @ 2013-03-07 15:37 UTC (permalink / raw)
  To: linux-arm-kernel

On 7 March 2013 15:48, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Sun, Mar 3, 2013 at 4:01 PM, Haojian Zhuang
> <haojian.zhuang@linaro.org> wrote:
>
>> 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>
>
> Isn't this fixed by Axel's much simpler patch?
>
> Yours,
> Linus Walleij

Yes, I prefer to use Axel's fix.

Regards
Haojian

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

* [PATCH] pinctrl: single: avoid to set read only object
  2013-03-07 15:37   ` Haojian Zhuang
@ 2013-03-07 16:36     ` Tony Lindgren
  0 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2013-03-07 16:36 UTC (permalink / raw)
  To: linux-arm-kernel

* Haojian Zhuang <haojian.zhuang@linaro.org> [130307 07:42]:
> On 7 March 2013 15:48, Linus Walleij <linus.walleij@linaro.org> wrote:
> > On Sun, Mar 3, 2013 at 4:01 PM, Haojian Zhuang
> > <haojian.zhuang@linaro.org> wrote:
> >
> >> 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>
> >
> > Isn't this fixed by Axel's much simpler patch?
> 
> Yes, I prefer to use Axel's fix.

Yes that's better.

Tony

^ permalink raw reply	[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).