From patchwork Wed Nov 9 15:07:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 17631 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp387194wru; Wed, 9 Nov 2022 07:09:08 -0800 (PST) X-Google-Smtp-Source: AMsMyM6KAgT+Wg4Y/9PZd+K9m4e3c2W2r8SRMYsLDIaT4rfN7dNJ6+6fvdfecQXeP9TQvm+x0050 X-Received: by 2002:a50:fb95:0:b0:463:526:308b with SMTP id e21-20020a50fb95000000b004630526308bmr57954356edq.424.1668006548752; Wed, 09 Nov 2022 07:09:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668006548; cv=none; d=google.com; s=arc-20160816; b=ol4OP042UpDkyEoifWDRQHY0yFspAz3iMVBIswT3s/GS8AdWU1Ck3v+xxZ9IKybiBk aZaIa/5AT45JaD4/pKtmyV1Rbfh4i7/cKMLTzhyUjn9CQefgnSOdmbr14G8sPEC9BoL6 m75BTGm0vcJWu7Mihf97ynC3fEuXo7QwfOjhad0OGxGCD2m7/XKjoi7DiSYxc974pbrc 5tCw5FXjKZduk/uu624VSnQFgOSaavHXdIa9wOk3kr06mlZYZeyd9Bkvvabo95m+4BZU bsbhZRdlnKXdSA6lzsCzon7k/X5OThq5sADKB4AB+D4+16aH0ZzqXH/YNiStIHXdU0Ew J0FA== 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=8YUUYxsQE3MvZaH4g/jo3ThC+27CNZiCp37SRlolpyM=; b=WedI6QueBsAhjc2zDJMyaQM4EJ3wxBfc5nsEWJYEaeQPcMJzxt/zUsfuyRIB4uksGj avKbmMxoVbEC7RdfauP42gTh0I578dhkOPfXGtCjshEK9k6Eu+bUY8WIUTRsVL+lCic7 iUjnCWvY6BgDSHrX3EYfuZSsQO/4fsSGJJBhOC8wC4CVL1azBcFEVoS2JOvlOZWely5S SANMjwYKHB10RhH5kwySIOEm41eUTxnEt0V0UHwe8468V5/H88k3j7kd07YF3vS2loU/ szv5Lwkish8AGUmrXTwRrhqFfSNsXRBrnuo+a2HvV6ikxXo1md3EfwpYdRLF2eMGGnON 6Xng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="O/Pv3IVC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a056402344300b004513abe8f74si12909252edc.249.2022.11.09.07.08.44; Wed, 09 Nov 2022 07:09:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="O/Pv3IVC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231893AbiKIPHb (ORCPT + 99 others); Wed, 9 Nov 2022 10:07:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231934AbiKIPHX (ORCPT ); Wed, 9 Nov 2022 10:07:23 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B84A41EAD0; Wed, 9 Nov 2022 07:07:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668006434; x=1699542434; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=12urufDK5YVBXS9P1VBHKN4cADzO9/4e8Qe6/OljC/o=; b=O/Pv3IVCpgAJVoC+NX8vGPw4mu6D5H6ETZVTcdbYIqND0BX6YSVP8Xb3 xtboVIqdFZPK4WA1HTpjnH8OQ/eqByeZdmoHNJkjTxHiKnA+gl/G8K7t2 TCJIKnWwml65jSF713ND4k2jRWXGf4VYO1NPV65GKx/Ogt6Tb/GFtkDZq N8kv1hEZWh1m+Z3vP72hTYOAsz7PWT4y6biabDyvA6L5i1K1/cnFD4a3C ELv7ZR9McSwGPqJxZnH3VZBofoVCG8iY1pqIL57t7RCak/enI26WX9R6O 6x0mcmG6A9fCC41SB3dDCTAYoB2NKxz0YcfbaHLBS35RFvRiFzxJNqHX7 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="312798219" X-IronPort-AV: E=Sophos;i="5.96,150,1665471600"; d="scan'208";a="312798219" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2022 07:07:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="705736958" X-IronPort-AV: E=Sophos;i="5.96,150,1665471600"; d="scan'208";a="705736958" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 09 Nov 2022 07:07:11 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 905DB155; Wed, 9 Nov 2022 17:07:35 +0200 (EET) From: Andy Shevchenko To: Bartosz Golaszewski , Dmitry Torokhov , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , Andy Shevchenko Subject: [PATCH v1 1/2] gpiolib: of: Prepare of_mm_gpiochip_add_data() for fwnode Date: Wed, 9 Nov 2022 17:07:33 +0200 Message-Id: <20221109150734.38874-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749031634937163006?= X-GMAIL-MSGID: =?utf-8?q?1749031634937163006?= GPIO library is getting rid of of_node, fwnode should be utilized instead. Prepare of_mm_gpiochip_add_data() for fwnode. Signed-off-by: Andy Shevchenko Acked-by: Linus Walleij --- drivers/gpio/gpiolib-of.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 4be3c21aa718..feeb9e8e846d 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -919,14 +919,15 @@ int of_mm_gpiochip_add_data(struct device_node *np, struct of_mm_gpio_chip *mm_gc, void *data) { + struct fwnode_handle *fwnode = of_fwnode_handle(np); int ret = -ENOMEM; struct gpio_chip *gc = &mm_gc->gc; - gc->label = kasprintf(GFP_KERNEL, "%pOF", np); + gc->label = kasprintf(GFP_KERNEL, "%pfw", fwnode); if (!gc->label) goto err0; - mm_gc->regs = of_iomap(np, 0); + mm_gc->regs = fwnode_iomap(fwnode, 0); if (!mm_gc->regs) goto err1; @@ -935,8 +936,8 @@ int of_mm_gpiochip_add_data(struct device_node *np, if (mm_gc->save_regs) mm_gc->save_regs(mm_gc); - of_node_put(mm_gc->gc.of_node); - mm_gc->gc.of_node = of_node_get(np); + fwnode_handle_put(mm_gc->gc.fwnode); + mm_gc->gc.fwnode = fwnode_handle_get(fwnode); ret = gpiochip_add_data(gc, data); if (ret) @@ -944,12 +945,12 @@ int of_mm_gpiochip_add_data(struct device_node *np, return 0; err2: - of_node_put(np); + fwnode_handle_put(fwnode); iounmap(mm_gc->regs); err1: kfree(gc->label); err0: - pr_err("%pOF: GPIO chip registration failed with status %d\n", np, ret); + pr_err("%pfw: GPIO chip registration failed with status %d\n", fwnode, ret); return ret; } EXPORT_SYMBOL_GPL(of_mm_gpiochip_add_data);