From patchwork Thu Sep 17 22:33:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 255402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBEE3C43464 for ; Thu, 17 Sep 2020 22:34:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A61AD2087D for ; Thu, 17 Sep 2020 22:34:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nic.cz header.i=@nic.cz header.b="tmtTVYUa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726553AbgIQWeo (ORCPT ); Thu, 17 Sep 2020 18:34:44 -0400 Received: from mail.nic.cz ([217.31.204.67]:35842 "EHLO mail.nic.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726344AbgIQWeS (ORCPT ); Thu, 17 Sep 2020 18:34:18 -0400 Received: from dellmb.labs.office.nic.cz (unknown [IPv6:2001:1488:fffe:6:cac7:3539:7f1f:463]) by mail.nic.cz (Postfix) with ESMTP id 88985142066; Fri, 18 Sep 2020 00:34:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1600382041; bh=KyoQbN7zEtG1uv+Pu41Y0V6Z7eh7NxeLV28us6kXmE8=; h=From:To:Date; b=tmtTVYUaZxj57qHSwsrDrCOHMwRCTfX6m4ST8tOxjUYS8FNAqPlKj97GPxK+WxHSF 44alVESairypb+d5e1dSTnrJVYKkRKp4c08WGUiLPvlu2jOtpNkAmiOdPEVH55YcK1 1F6H74x3SSJ8VoRGaKk8qOBNB4ufuYsUmbHeo8bE= From: =?utf-8?q?Marek_Beh=C3=BAn?= To: linux-leds@vger.kernel.org Cc: Pavel Machek , Dan Murphy , =?utf-8?q?On?= =?utf-8?q?d=C5=99ej_Jirman?= , linux-kernel@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= , Simon Guinot , Simon Guinot , Vincent Donnefort , Thomas Petazzoni , Linus Walleij Subject: [PATCH leds v2 44/50] leds: ns2: cosmetic change: use helper variable Date: Fri, 18 Sep 2020 00:33:32 +0200 Message-Id: <20200917223338.14164-45-marek.behun@nic.cz> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200917223338.14164-1-marek.behun@nic.cz> References: <20200917223338.14164-1-marek.behun@nic.cz> MIME-Version: 1.0 X-Spamd-Bar: / X-Virus-Scanned: clamav-milter 0.102.2 at mail X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Use helper variable dev instead of always writing &pdev->dev. Signed-off-by: Marek BehĂșn Cc: Simon Guinot Cc: Simon Guinot Cc: Vincent Donnefort Cc: Thomas Petazzoni Cc: Linus Walleij --- drivers/leds/leds-ns2.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c index 912db40c51183..801b7f851be7a 100644 --- a/drivers/leds/leds-ns2.c +++ b/drivers/leds/leds-ns2.c @@ -185,7 +185,7 @@ static struct attribute *ns2_led_attrs[] = { ATTRIBUTE_GROUPS(ns2_led); static int -create_ns2_led(struct platform_device *pdev, struct ns2_led *led, +create_ns2_led(struct device *dev, struct ns2_led *led, const struct ns2_led_of_one *template) { int ret; @@ -216,7 +216,7 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led *led, led->sata = (mode == NS_V2_LED_SATA) ? 1 : 0; led->cdev.brightness = (mode == NS_V2_LED_OFF) ? LED_OFF : LED_FULL; - return devm_led_classdev_register(&pdev->dev, &led->cdev); + return devm_led_classdev_register(dev, &led->cdev); } static int ns2_leds_parse_one(struct device *dev, struct device_node *np, @@ -313,28 +313,27 @@ MODULE_DEVICE_TABLE(of, of_ns2_leds_match); static int ns2_led_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct ns2_led_of *ofdata; struct ns2_led *leds; int i; int ret; - ofdata = devm_kzalloc(&pdev->dev, sizeof(struct ns2_led_of), - GFP_KERNEL); + ofdata = devm_kzalloc(dev, sizeof(struct ns2_led_of), GFP_KERNEL); if (!ofdata) return -ENOMEM; - ret = ns2_leds_parse_of(&pdev->dev, ofdata); + ret = ns2_leds_parse_of(dev, ofdata); if (ret) return ret; - leds = devm_kzalloc(&pdev->dev, array_size(sizeof(*leds), - ofdata->num_leds), + leds = devm_kzalloc(dev, array_size(sizeof(*leds), ofdata->num_leds), GFP_KERNEL); if (!leds) return -ENOMEM; for (i = 0; i < ofdata->num_leds; i++) { - ret = create_ns2_led(pdev, &leds[i], &ofdata->leds[i]); + ret = create_ns2_led(dev, &leds[i], &ofdata->leds[i]); if (ret < 0) return ret; }