Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp745946rdf; Fri, 3 Nov 2023 13:56:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGj4PJGfyw8WPJRpd4r1gO9RAgtv20cvlGS7aSr/2WWsBuBuc6WsYiR4iYjLG8nUD7MhvUN X-Received: by 2002:aa7:de15:0:b0:53d:eca9:742e with SMTP id h21-20020aa7de15000000b0053deca9742emr20726628edv.9.1699044992956; Fri, 03 Nov 2023 13:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699044992; cv=none; d=google.com; s=arc-20160816; b=LR++YymOjjkpGr4wxR+H4CYOEJvzrmtODkoE1f3IAkmIL2wyfRSFpog3jRq8hcar7k xgZuENRJtQR+q1ooMx+XNQJW3PwOt+eUFgJzNV4f6sWTgHCzT5vlTzoEWa+uov3pQu5M q+jO6P8Quq/eUB4JDOtrO1fH3Kkck/vpytgEtw1iTg3SQYHP9zeigK+1/J30i6VNXEfg yBCs1J2wZWzSDfGrSJ6o2zlD2MrnU/2TObuA3cXwgrswCpddJbFo94vGQqkFhjWt3347 vy4umPO3hbxCnV0B7wb8UMLDrGxfpYc1qWMOw4UEeGG/d15MvxwrEGm8mPKJY/LoJXwY iezg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=1me2CMdrf1upczPoXQDcBdEbAu6CUD8o+3lDid/MT8U=; fh=SvhOHfehUV8tt+/DHSWfRHpXzQQzyN3k16tgFjiVtw0=; b=EAOupxo/m56T99mXIULk6LeXxAg/qZnYGrc92M+LPTJV1vaSIdZswTE7TjfPJYknpg SRIZcwe+MQom/4v0hWAGUBVbk5CIioL9F0ZX3bvg7HGHLabYxGdF1Zl8afWXeJmdqUP+ sqIS8rR7/ZXgNJHccLMLwRIOrGFo/zfF8IxM44omIBm7ynCu4/K7TOwB4/2a6U9IpKrS Yy8kn6zZgUHTP7y8lZ4uke7m9u9q4YIM4bwVRDo8PlMsyIj0jExhvpZd5uvxwGRe0WAY 0SJ2lpbdmL0aPtdiQyBKnTJbUtTIP3XJXOv2Kiqgrd7hTyUOQzuzb7cO3E2/jaUzfErv IxjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lZFvyC88; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id b5-20020a509f05000000b00530c46e2b3csi1232807edf.258.2023.11.03.13.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 13:56:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lZFvyC88; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 3B1088312F81; Fri, 3 Nov 2023 13:56:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230050AbjKCUz6 (ORCPT + 99 others); Fri, 3 Nov 2023 16:55:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234477AbjKCTxU (ORCPT ); Fri, 3 Nov 2023 15:53:20 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE7EDD4E; Fri, 3 Nov 2023 12:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699041198; x=1730577198; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=eUuuyUtQ+5betVlsnj9MIgKiK2+aM4+nMSQ8mwzd6Uk=; b=lZFvyC883EjBfQLF5PjSpJENPYHWPQCcvP1e5dyGvpzGxDj+WSFsdOJY Gu4nhdI+CqlYri2Vo2kZ5mX84YgPOPPbjRIdDsWCpUxBY/qSBtdROg65+ iHz/a3qALjcVOQEjEyia2yyKp+MApfUOc+zZf8IJIkK00iNW2KAS+aJKH H7M5Uu9OAK4oDJ0ky1AKxC3cihsNvmSB83Ym3TXqlimP8d7NkzsNbozcf dh3JPzpGXpY3XHviZoRs756vBYrJj4budD5wnhzVPOXrX2sNOraIBFIMJ ybIERmqSKZtbt7SEQRFck4yV34s4OqyhN9SIEByHA7GPuHFE7W740W7jK A==; X-IronPort-AV: E=McAfee;i="6600,9927,10883"; a="1962960" X-IronPort-AV: E=Sophos;i="6.03,275,1694761200"; d="scan'208";a="1962960" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2023 12:53:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10883"; a="761719315" X-IronPort-AV: E=Sophos;i="6.03,275,1694761200"; d="scan'208";a="761719315" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 03 Nov 2023 12:53:14 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id B1E775E2; Fri, 3 Nov 2023 21:53:13 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Linus Walleij , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Pavel Machek , Lee Jones Subject: [PATCH v1 1/4] leds: trigger: gpio: Replace custom code for gpiod_get_optional() Date: Fri, 3 Nov 2023 21:53:07 +0200 Message-Id: <20231103195310.948327-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 03 Nov 2023 13:56:00 -0700 (PDT) gpiod_get_optional() and currently used fwnode_gpiod_get_index() are both wrappers against the same engine internally. Since we have a pointer to struct device there is no reason to use fwnode type of GPIO call. So, replace the current fwnode call by respective gpiod ones. Signed-off-by: Andy Shevchenko --- drivers/leds/trigger/ledtrig-gpio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/leds/trigger/ledtrig-gpio.c b/drivers/leds/trigger/ledtrig-gpio.c index 9b7fe5dd5208..d91ae7fde3cf 100644 --- a/drivers/leds/trigger/ledtrig-gpio.c +++ b/drivers/leds/trigger/ledtrig-gpio.c @@ -89,10 +89,7 @@ static int gpio_trig_activate(struct led_classdev *led) * The generic property "trigger-sources" is followed, * and we hope that this is a GPIO. */ - gpio_data->gpiod = fwnode_gpiod_get_index(dev->fwnode, - "trigger-sources", - 0, GPIOD_IN, - "led-trigger"); + gpio_data->gpiod = gpiod_get_optional(dev, "trigger-sources", GPIOD_IN); if (IS_ERR(gpio_data->gpiod)) { ret = PTR_ERR(gpio_data->gpiod); kfree(gpio_data); @@ -104,6 +101,8 @@ static int gpio_trig_activate(struct led_classdev *led) return -EINVAL; } + gpiod_set_consumer_name(gpio_data->gpiod, "led-trigger"); + gpio_data->led = led; led_set_trigger_data(led, gpio_data); -- 2.40.0.1.gaa8946217a0b