From patchwork Thu Aug 25 16:47:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olliver Schinagl X-Patchwork-Id: 9299599 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2F41660459 for ; Thu, 25 Aug 2016 16:49:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 201AC293A4 for ; Thu, 25 Aug 2016 16:49:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1428F293A8; Thu, 25 Aug 2016 16:49:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 29DA0293A4 for ; Thu, 25 Aug 2016 16:49:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bcxoo-0000vt-OD; Thu, 25 Aug 2016 16:47:54 +0000 Received: from 7of9.schinagl.nl ([88.159.158.68]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bcxok-0000hH-Fq for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2016 16:47:51 +0000 Received: from um-mbp-306.ultimaker.com (unknown [92.69.209.117]) by 7of9.schinagl.nl (Postfix) with ESMTPA id 1404539A548; Thu, 25 Aug 2016 18:47:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=schinagl.nl; s=7of9; t=1472143636; bh=yrOHp/HLSWW+x1/vjEjC2YImtoZ08WFMznCMPCQ1Mxc=; h=From:To:Cc:Subject:Date; b=Jwm4/kgEFUGfkOVOelO7HVoZmxhVuKI5amJuPJvcBFvQV7ZItb+9cMeQkEYRV4K8/ siUw3emBngJq1qban0c94efMl45prI4cto918XtDym6YyB+kE4bafsjBWetkF2N/5E f/jMxsoSBPCk7tAneQoPJ0J7LrxzhGcPjTgsMgeY= From: Olliver Schinagl To: Thierry Reding , Ariel D'Alessandro Subject: [PATCHv2] pwm: lpc-18xx: use pwm_set_chip_data Date: Thu, 25 Aug 2016 18:47:09 +0200 Message-Id: <1472143629-29890-1-git-send-email-oliver@schinagl.nl> X-Mailer: git-send-email 2.8.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160825_094750_926398_07256A51 X-CRM114-Status: GOOD ( 12.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Olliver Schinagl , linux-pwm@vger.kernel.org, Joachim Eastwood , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The lpc18xx driver currently manipulates the pwm_device struct directly rather then using the pwm_set_chip_data. While the current method may save a clock cycle or two, it is more obvious that data is set to the local chip data pointer. Signed-off-by: Olliver Schinagl Reviewed-by: Ariel D'Alessandro --- Hi, This is a resend of a patch-series I sent last year. There was no technical related feedback and so I am re-sending the patch as is. I did rebase it to Linus's current master. Changes since v1: - removed wrongfully added sun4i patch - split patch series into a single patch - added author drivers/pwm/pwm-lpc18xx-sct.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c index 19dc64c..a630fc5 100644 --- a/drivers/pwm/pwm-lpc18xx-sct.c +++ b/drivers/pwm/pwm-lpc18xx-sct.c @@ -413,14 +413,17 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) } for (i = 0; i < lpc18xx_pwm->chip.npwm; i++) { + struct lpc18xx_pwm_data *lpc18xx_data; + pwm = &lpc18xx_pwm->chip.pwms[i]; - pwm->chip_data = devm_kzalloc(lpc18xx_pwm->dev, - sizeof(struct lpc18xx_pwm_data), - GFP_KERNEL); - if (!pwm->chip_data) { + lpc18xx_data = devm_kzalloc(lpc18xx_pwm->dev, + sizeof(struct lpc18xx_pwm_data), + GFP_KERNEL); + if (!lpc18xx_data) { ret = -ENOMEM; goto remove_pwmchip; } + pwm_set_chip_data(pwm, lpc18xx_data); } platform_set_drvdata(pdev, lpc18xx_pwm);