From patchwork Wed Mar 2 15:32:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 63391 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2448793lbc; Wed, 2 Mar 2016 07:35:43 -0800 (PST) X-Received: by 10.98.34.205 with SMTP id p74mr16157759pfj.93.1456932942941; Wed, 02 Mar 2016 07:35:42 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be6si35648781pad.69.2016.03.02.07.35.42; Wed, 02 Mar 2016 07:35:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755428AbcCBPfl (ORCPT + 30 others); Wed, 2 Mar 2016 10:35:41 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37696 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754724AbcCBPe0 (ORCPT ); Wed, 2 Mar 2016 10:34:26 -0500 Received: by mail-wm0-f42.google.com with SMTP id p65so83150044wmp.0 for ; Wed, 02 Mar 2016 07:34:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OYQXdlNFNaiLpWCR7RC7Qrcpnky0BCRFEYOE+7ukRrI=; b=H859G0xvQbMFF0MKcUaTIDyngpXmxzphviB53Mk8Os0q9ieXyZmk4CsB5zjx4RbyuS oqgD1zkj3uJbTiLwjiZ/whB92drLJZto5p6zjizU0UJsD4JcpF49BgiRhMH4zxWA1obB /WM+KNN6lHvZtrCBFGNrbZuq29Qe1OUROSll8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OYQXdlNFNaiLpWCR7RC7Qrcpnky0BCRFEYOE+7ukRrI=; b=NFtJfW0GarN9ZYl6DG9OdiXGnUQbEvvLr8Ws3alEjVuoZNSScmxagBijIMVDX4hTQj PJ8FNCeIbZ/ClzB/FADoFSvgb/OvSVMw4iX0vFGTsE86/4pPtlrG0wzxwuULSplprUU9 o0GXwpL9bgDwEEUbe1GmTqB1Zq0RmHNcxa7eO2kKH26K9vlxRP0n4jhlZEd/zBnRsVeU RHGeWt7QR5Qs6DMbRxQMt75iSZqsB12ziuRN5HFpyQO7e2/atRlDKiSvpXpUoRpdO+e3 /7m580jq/6icADTEfcVrh3f1BUuEIEjwTGvPJhp3SYXPo2232jOujP7nvTQE0NyWj+2N WNNg== X-Gm-Message-State: AD7BkJInEyKJ8sadp/PRuP1WmuVWytbMJZpXdJn0ZYGnx+f6putBtO/25eY3LvFJBdMfMSxU X-Received: by 10.28.144.19 with SMTP id s19mr492541wmd.81.1456932865147; Wed, 02 Mar 2016 07:34:25 -0800 (PST) Received: from localhost.localdomain (host81-154-142-245.range81-154.btcentralplus.com. [81.154.142.245]) by smtp.gmail.com with ESMTPSA id da6sm26941407wjb.24.2016.03.02.07.34.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Mar 2016 07:34:24 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: kernel@stlinux.com, maxime.coquelin@st.com, thierry.reding@gmail.com, linux-pwm@vger.kernel.org, ajitpal.singh@st.com, Lee Jones Subject: [RESEND 11/11] pwm: sti: Take the opportunity to conduct a little house keeping Date: Wed, 2 Mar 2016 15:32:09 +0000 Message-Id: <1456932729-9667-12-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456932729-9667-1-git-send-email-lee.jones@linaro.org> References: <1456932729-9667-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This includes fixing some Coding Style issues and re-ordering/ simplifying a little code. Signed-off-by: Lee Jones --- drivers/pwm/pwm-sti.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) -- 1.9.1 diff --git a/drivers/pwm/pwm-sti.c b/drivers/pwm/pwm-sti.c index 93cf20e..93e3abf 100644 --- a/drivers/pwm/pwm-sti.c +++ b/drivers/pwm/pwm-sti.c @@ -144,13 +144,13 @@ static int sti_pwm_get_prescale(struct sti_pwm_chip *pc, unsigned long period, val = NSEC_PER_SEC / clk_rate; val *= cdata->max_pwm_cnt + 1; - if (period % val) { + if (period % val) return -EINVAL; - } else { - ps = period / val - 1; - if (ps > cdata->max_prescale) - return -EINVAL; - } + + ps = period / val - 1; + if (ps > cdata->max_prescale) + return -EINVAL; + *prescale = ps; return 0; @@ -166,7 +166,7 @@ static int sti_pwm_get_prescale(struct sti_pwm_chip *pc, unsigned long period, * 256 values. */ static int sti_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, - int duty_ns, int period_ns) + int duty_ns, int period_ns) { struct sti_pwm_chip *pc = to_sti_pwmchip(chip); struct sti_pwm_compat_data *cdata = pc->cdata; @@ -212,7 +212,7 @@ static int sti_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, ret = regmap_field_write(pc->prescale_low, - prescale & PWM_PRESCALE_LOW_MASK); + prescale & PWM_PRESCALE_LOW_MASK); if (ret) goto clk_dis; @@ -506,7 +506,7 @@ static int sti_pwm_probe_dt(struct sti_pwm_chip *pc) return PTR_ERR(pc->pwm_cpt_en); pc->pwm_cpt_int_en = devm_regmap_field_alloc(dev, pc->regmap, - reg_fields[PWM_CPT_INT_EN]); + reg_fields[PWM_CPT_INT_EN]); if (IS_ERR(pc->pwm_cpt_int_en)) return PTR_ERR(pc->pwm_cpt_int_en); @@ -570,10 +570,11 @@ static int sti_pwm_probe(struct platform_device *pdev) * Setup PWM data with default values: some values could be replaced * with specific ones provided from Device Tree. */ - cdata->reg_fields = &sti_pwm_regfields[0]; - cdata->max_prescale = 0xff; - cdata->max_pwm_cnt = 255; - cdata->pwm_num_chan = 1; + + cdata->reg_fields = &sti_pwm_regfields[0]; + cdata->max_prescale = 0xff; + cdata->max_pwm_cnt = 255; + cdata->pwm_num_chan = 1; cdata->cpt_num_chan = 0; pc->cdata = cdata;