Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2605124rdg; Mon, 16 Oct 2023 09:11:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFquZuHtXFMQgW0tefRYZYlsCNLVJAYLJgyyG3iQbBjdwNqi+B/mecfbjcxotrb1B6kXpxp X-Received: by 2002:a05:6a00:2d0c:b0:6be:314c:16cb with SMTP id fa12-20020a056a002d0c00b006be314c16cbmr2464405pfb.10.1697472673068; Mon, 16 Oct 2023 09:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697472673; cv=none; d=google.com; s=arc-20160816; b=u/hHaYLm8bzb7kMEw4qNJ2rG/QQsA2F3kahVxao3D9JwL/cDOTuWT0spKL3KHE4D3e vEq1CteZZpJvdIxau2UPh+Xj6Y39OmBW8UvDOF0/WIP6jHgBrqiz75K21ve4HYvU7zVm ESusJi1CJWrX0DzW+qcVswUCjlk1KzLpYw+C1ebXAmsuLRGXlGsr6x6I54PmYK7dJttY enmKRVM5f8D0H6HFiIDdSqdj1m4zj/AoqZAidfCFfPjt84bnpFDJfzz+ZaYeaDiCj7zY aPPlQprimw6wiWvrPcxsYHy5F/lK/0HA5maOTvtaxsUkLwjbdiqKAe1w7MRcTb2pPc0p MTog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rqOOVsAirktxkKKJznLTHNl0T9SRt3OeaDHjnOFENc8=; fh=tUAC4oQq3UuKajr6ZMoB53sspoioCuMU4y0NrDbDhac=; b=iblIC7CQbxI4T51qLiNWXCVl/ZDl/UOFXXDIsamq0xqzfBVJ/Di2xiyCAh2M90gd0D /3rilfy5N5vF6ho1SbJeOsmgOdmvHXk/1dT3tBnHkcdY5OfJ3qcWEk6PhW9s48L83qW8 1LAnLsR6YDD1e6d9Hho/fRAORkdXRomjPPaefDfDhusIWD0YEBdmfpDcP/QjQaMC7lQm A9UZ0dHh9uXQVV/o2NRIdcwSepVDGL15cXiXdHHSPrethCs6Sly1SUf/Gc+hQveH8608 4V5CoBcgkIDF25wPLEWuXuvQFa+6d6De55OH6ydP9KnGisgtWFyvmh3GsTBCnCzt8FH/ ZERw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jQBJ2hwo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id c3-20020a056a00008300b006be062ed5c6si95399pfj.276.2023.10.16.09.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:11:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jQBJ2hwo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2C1898093492; Mon, 16 Oct 2023 09:10:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233757AbjJPQKf (ORCPT + 99 others); Mon, 16 Oct 2023 12:10:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233708AbjJPQKb (ORCPT ); Mon, 16 Oct 2023 12:10:31 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F44AFA; Mon, 16 Oct 2023 09:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697472629; x=1729008629; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=F25NQtPqRcWKTHovw7qS8Bdu+1VMkD5tR6I2DEWwAqs=; b=jQBJ2hwoROkx8FvePD8cc/B7D1l+VXlme1DFt/iGGBKcva08wcvm21sU 7OYV/1S2/wGFX3XV9lxfb+C23cQxCnQJMxX4Q31yYAph+X1TjxkHA39nf MhW6QMxPoM0JhPDi+k1gEDt1HdE/tThYJgG2Hm3fFb0n6+oC5aUPfLpVX HQsbdkID3+lHJDbZ13+zFpZ0zKzm7zRZXDYi6Pc8TulGgSmE3zYn+bj1B mhEGhydFuGMQCg5gmqjK/LYLpzGn4QEghdGhU353lPhh44hvcjOU1H0rx RzPaPqZdSZ0cGp5L/0AzMAgRsOIKSc/nY8mz+9i04oPYkRJRDJEBisRmL Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="7132780" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="7132780" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 09:10:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="785123039" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="785123039" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 16 Oct 2023 09:10:10 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2FDCE988; Mon, 16 Oct 2023 19:10:09 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Pavel Machek , Lee Jones Subject: [PATCH v1 4/6] leds: gpio: Move temporary variable for struct device to gpio_led_probe() Date: Mon, 16 Oct 2023 19:10:03 +0300 Message-Id: <20231016161005.1471768-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231016161005.1471768-1-andriy.shevchenko@linux.intel.com> References: <20231016161005.1471768-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 16 Oct 2023 09:10:51 -0700 (PDT) Use temporary variable for struct device in gpio_led_probe() in order to make code neater. Signed-off-by: Andy Shevchenko --- drivers/leds/leds-gpio.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 7c9c6a93dfd7..fd3f90f95fa2 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -142,9 +142,8 @@ struct gpio_leds_priv { struct gpio_led_data leds[] __counted_by(num_leds); }; -static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) +static struct gpio_leds_priv *gpio_leds_create(struct device *dev) { - struct device *dev = &pdev->dev; struct fwnode_handle *child; struct gpio_leds_priv *priv; int count, ret; @@ -253,13 +252,13 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx, static int gpio_led_probe(struct platform_device *pdev) { - struct gpio_led_platform_data *pdata = dev_get_platdata(&pdev->dev); + struct device *dev = &pdev->dev; + struct gpio_led_platform_data *pdata = dev_get_platdata(dev); struct gpio_leds_priv *priv; int i, ret = 0; if (pdata && pdata->num_leds) { - priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, pdata->num_leds), - GFP_KERNEL); + priv = devm_kzalloc(dev, struct_size(priv, leds, pdata->num_leds), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -272,22 +271,20 @@ static int gpio_led_probe(struct platform_device *pdev) led_dat->gpiod = template->gpiod; else led_dat->gpiod = - gpio_led_get_gpiod(&pdev->dev, - i, template); + gpio_led_get_gpiod(dev, i, template); if (IS_ERR(led_dat->gpiod)) { - dev_info(&pdev->dev, "Skipping unavailable LED gpio %d (%s)\n", + dev_info(dev, "Skipping unavailable LED gpio %d (%s)\n", template->gpio, template->name); continue; } - ret = create_gpio_led(template, led_dat, - &pdev->dev, NULL, + ret = create_gpio_led(template, led_dat, dev, NULL, pdata->gpio_blink_set); if (ret < 0) return ret; } } else { - priv = gpio_leds_create(pdev); + priv = gpio_leds_create(dev); if (IS_ERR(priv)) return PTR_ERR(priv); } -- 2.40.0.1.gaa8946217a0b