From patchwork Fri Oct 10 15:50:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 5066511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 279E69F295 for ; Fri, 10 Oct 2014 15:54:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 485802021A for ; Fri, 10 Oct 2014 15:54:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 384F1201FE for ; Fri, 10 Oct 2014 15:54:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XccUB-00067C-9L; Fri, 10 Oct 2014 15:52:07 +0000 Received: from relay1.mentorg.com ([192.94.38.131]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XccTZ-0005tO-6q for linux-arm-kernel@lists.infradead.org; Fri, 10 Oct 2014 15:51:31 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1XccTD-0006H3-Q6 from Vladimir_Zapolskiy@mentor.com ; Fri, 10 Oct 2014 08:51:08 -0700 Received: from eyas.fin.mentorg.com (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 10 Oct 2014 16:51:06 +0100 From: Vladimir Zapolskiy To: Subject: =?UTF-8?q?=5BPATCH=203/3=5D=20pwm=3A=20set=20the=20actual=20number=20of=20pwms=20arguments=20defined=20in=20board=20dts?= Date: Fri, 10 Oct 2014 18:50:07 +0300 Message-ID: <1412956207-24008-4-git-send-email-vladimir_zapolskiy@mentor.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1412956207-24008-1-git-send-email-vladimir_zapolskiy@mentor.com> References: <1412956207-24008-1-git-send-email-vladimir_zapolskiy@mentor.com> MIME-Version: 1.0 X-Originating-IP: [137.202.0.76] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141010_085129_297689_5E465873 X-CRM114-Status: UNSURE ( 9.21 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) Cc: Shawn Guo , Sascha Hauer , Thierry Reding , linux-arm-kernel@lists.infradead.org, =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For backward compatibility board device tree has to define only a minimal amount of mandatory pwms arguments, additional arguments shall be considered as optional, update pc->of_pwm_n_cells according to the actual data taken from device tree file. Signed-off-by: Vladimir Zapolskiy Cc: Lothar Waßmann Cc: Sascha Hauer Cc: Thierry Reding Cc: Shawn Guo --- drivers/pwm/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index ccf1be7..2b77322 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -543,12 +543,13 @@ struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id) goto put; } - if (args.args_count != pc->of_pwm_n_cells) { + if (args.args_count < pc->of_pwm_n_cells) { pr_warn("%s: wrong #pwm-cells for %s\n", np->full_name, args.np->full_name); pwm = ERR_PTR(-EINVAL); goto put; } + pc->of_pwm_n_cells = args.args_count; pwm = pc->of_xlate(pc, &args); if (IS_ERR(pwm))