From patchwork Mon Jul 6 08:58:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 50697 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AA560229FC for ; Mon, 6 Jul 2015 08:59:27 +0000 (UTC) Received: by wgbbj7 with SMTP id bj7sf47818218wgb.2 for ; Mon, 06 Jul 2015 01:59:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=zZnkQcf2VsBTULJow5e+G7fgbwmOvOsJRKX6rXG8U4A=; b=FXX4wpY94ELdCN6/LXVY8nyudZf/QenWreD5UnaRKTHRUU86aA03G3wMqkAiLHpZQ7 mrpNx+NS3eEtDxku9zMVqQymgV2Cmr9XIG7YD8nPDUhBv16/wdZKqW3QKNrYqV8MBhrU KZFB4f2k0Sv0sqSXIyCS9CdwgLd3YJLz8CIFlT/w7Mbp85UJ/uDnEMlGBkMjcx/TsPvt 3ZN8SXRI9aDXCBHHTQdS3RL6QxqJLuRb5ogmb2q9jY9qwcjAxeaeLt0wQ9dcsZQhmutL BZcEV+erEbhfafKUyHBgmO/nq+F31PcCJl82UxlAe80NFrdfKJrlDHplCEnJbcUFWDml f1bw== X-Gm-Message-State: ALoCoQkFaOJ8lvUG99D1yWGZ00J/pHQ0BcMJJIAlhNbVlQsBkCHcsG1fKlhutKhkfMPb/BTxPAfO X-Received: by 10.180.87.201 with SMTP id ba9mr14838961wib.3.1436173166996; Mon, 06 Jul 2015 01:59:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.179.39 with SMTP id dd7ls675777lac.60.gmail; Mon, 06 Jul 2015 01:59:26 -0700 (PDT) X-Received: by 10.152.6.196 with SMTP id d4mr7795835laa.77.1436173166540; Mon, 06 Jul 2015 01:59:26 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id 2si14696218lav.112.2015.07.06.01.59.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 01:59:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lazt12 with SMTP id t12so1142167laz.2 for ; Mon, 06 Jul 2015 01:59:26 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr47628364lay.72.1436173166438; Mon, 06 Jul 2015 01:59:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1581901lbb; Mon, 6 Jul 2015 01:59:25 -0700 (PDT) X-Received: by 10.67.30.102 with SMTP id kd6mr102746071pad.132.1436173164451; Mon, 06 Jul 2015 01:59:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si1963275pdi.17.2015.07.06.01.59.23; Mon, 06 Jul 2015 01:59:24 -0700 (PDT) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755082AbbGFI7V (ORCPT + 29 others); Mon, 6 Jul 2015 04:59:21 -0400 Received: from mail-wg0-f54.google.com ([74.125.82.54]:32971 "EHLO mail-wg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754677AbbGFI6w (ORCPT ); Mon, 6 Jul 2015 04:58:52 -0400 Received: by wgck11 with SMTP id k11so134033108wgc.0 for ; Mon, 06 Jul 2015 01:58:51 -0700 (PDT) X-Received: by 10.194.185.236 with SMTP id ff12mr100419438wjc.134.1436173131393; Mon, 06 Jul 2015 01:58:51 -0700 (PDT) Received: from localhost.localdomain (host86-178-207-130.range86-178.btcentralplus.com. [86.178.207.130]) by mx.google.com with ESMTPSA id d7sm18085910wij.0.2015.07.06.01.58.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Jul 2015 01:58:50 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: kernel@stlinux.com, broonie@kernel.org, lgirdwood@gmail.com, Lee Jones Subject: [RESEND 10/10] regulator: pwm-regulator: Don't assign structure attributes right away Date: Mon, 6 Jul 2015 09:58:32 +0100 Message-Id: <1436173112-21397-11-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436173112-21397-1-git-send-email-lee.jones@linaro.org> References: <1436173112-21397-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Perhaps this is just personal preference, but ... This patch introduces a new local variable to receive and test regulator initialisation data. It simplifies and cleans up the code making it that little bit easier to read and maintain. The local value is assigned to the structure attribute when all the others are. This is the way we usually do things. Signed-off-by: Lee Jones --- drivers/regulator/pwm-regulator.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c index d5cb267..cb48208 100644 --- a/drivers/regulator/pwm-regulator.c +++ b/drivers/regulator/pwm-regulator.c @@ -218,6 +218,7 @@ static int pwm_regulator_init_continuous(struct platform_device *pdev, static int pwm_regulator_probe(struct platform_device *pdev) { + const struct regulator_init_data *init_data; struct pwm_regulator_data *drvdata; struct regulator_dev *regulator; struct regulator_config config = { }; @@ -240,14 +241,15 @@ static int pwm_regulator_probe(struct platform_device *pdev) if (ret) return ret; - config.init_data = of_get_regulator_init_data(&pdev->dev, np, - &pwm_regulator_desc); - if (!config.init_data) + init_data = of_get_regulator_init_data(&pdev->dev, np, + &pwm_regulator_desc); + if (!init_data) return -ENOMEM; config.of_node = np; config.dev = &pdev->dev; config.driver_data = drvdata; + config.init_data = init_data; drvdata->pwm = devm_pwm_get(&pdev->dev, NULL); if (IS_ERR(drvdata->pwm)) {