From patchwork Sun Mar 3 15:01:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 15210 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9045C23DEA for ; Sun, 3 Mar 2013 15:01:54 +0000 (UTC) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by fiordland.canonical.com (Postfix) with ESMTP id 3D92CA18204 for ; Sun, 3 Mar 2013 15:01:54 +0000 (UTC) Received: by mail-ve0-f169.google.com with SMTP id 15so4168779vea.0 for ; Sun, 03 Mar 2013 07:01:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :mime-version:content-type:content-transfer-encoding :x-gm-message-state; bh=FEiwOtNfTZm78fGS/ijDEG/5o/5h+7DxevZMy6dbdRw=; b=LGGXfEjdpsE/wBeueJCxS2jokt8iGLVDQcPUczy59hgPixP8Kj5kZAYX5RrmlALWKU U93bp3hQxIK+pWm3IZBoicnXb7BZARMjA2LCnJYm4Ce0zbpdtEzr1X7sPNCno6aNybLE TNPAYltbVif8vEPGc3Rgueb+2TrwfhNQpUpMU1M2E1rc+3mFpN//NMT54GXzQg+SYb72 Nx6lX/RQ1jJxFHVjfIwqqCvrWHKqdP1taNX5TIQIoUzRGY829qD99aPaEEfHU8uQYBhJ zOoX2A0/5IvMrB3eNHd+ICXR5lwejBExWWjQ0g7Au8rTuPEn8NgIBmQLe4zOdFDvf0SD sYxQ== X-Received: by 10.58.84.164 with SMTP id a4mr6746797vez.9.1362322913679; Sun, 03 Mar 2013 07:01:53 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp18227veb; Sun, 3 Mar 2013 07:01:53 -0800 (PST) X-Received: by 10.66.160.70 with SMTP id xi6mr27756740pab.109.1362322912384; Sun, 03 Mar 2013 07:01:52 -0800 (PST) Received: from mail-pb0-f43.google.com (mail-pb0-f43.google.com [209.85.160.43]) by mx.google.com with ESMTPS id t2si18617732pay.48.2013.03.03.07.01.51 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 03 Mar 2013 07:01:52 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.43 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.160.43; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.43 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) smtp.mail=haojian.zhuang@linaro.org Received: by mail-pb0-f43.google.com with SMTP id md12so2597174pbc.2 for ; Sun, 03 Mar 2013 07:01:51 -0800 (PST) X-Received: by 10.66.25.105 with SMTP id b9mr27659399pag.45.1362322911553; Sun, 03 Mar 2013 07:01:51 -0800 (PST) Received: from haojian-E6230.solutionip.com ([118.143.64.130]) by mx.google.com with ESMTPS id z8sm7940742pbt.39.2013.03.03.07.01.48 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 03 Mar 2013 07:01:50 -0800 (PST) From: Haojian Zhuang To: linus.walleij@linaro.org, tony@atomide.com, linux-arm-kernel@lists.infradead.org, fengguang.wu@intel.com Cc: patches@linaro.org, Haojian Zhuang Subject: [PATCH] pinctrl: single: avoid to set read only object Date: Sun, 3 Mar 2013 23:01:44 +0800 Message-Id: <1362322904-19570-1-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlcg2W4fORgDZdX6SP4dbR+g7nO4eI5VI7UwiTRzp+G/ERZiloASjN6uSlOuLGDvq3QCyfR 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 Acked-by: Tony Lindgren --- 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);