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); From patchwork Wed Nov 9 15:07:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 17632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp387326wru; Wed, 9 Nov 2022 07:09:21 -0800 (PST) X-Google-Smtp-Source: AMsMyM4Q7CQ+UARQuQ82Us98OhA+UtVYM74E1R5ryHiCb3k7sIv8eDBAX6IM3QO43p8EsEbufeF8 X-Received: by 2002:a05:6402:3457:b0:463:2017:ae64 with SMTP id l23-20020a056402345700b004632017ae64mr56801626edc.218.1668006561093; Wed, 09 Nov 2022 07:09:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668006561; cv=none; d=google.com; s=arc-20160816; b=LuV4OG04TJN2CFwVjabe2DvAg2GYoZ5Vt3XMsg82iOF3KB7rp/CgrWz40VJvmEisQw g5nM5P/mC26F16GKAKrUmha7c4bqRZm/V0IyR1c/vknj6QN07wzUPLLJMS7ls5nQJGAD bJTHBodQYq3meeRxaD9fG4if4nu4xio3PEE1RLEXyMzuhF+HTWOSK6T4M0c8nzTjzK9h GncE678ONky5A9wn5MHGhffUbjcgAgsJPiWLibdYALFepas6sHWuMmJq+LgoGHe4NXyy WCi/YYh+nGEAEzS4RB/2mrNpmb2tOvuZmLy2mYJal5SQSy4b77X6RnCP9VyiptnuL5gK UFvA== 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=84+Ai4MfAsUeQCK9niTUi97Q2QEGp4zHAKkL0AKPseQ=; b=f/x6azr/14aNsjhtxulhIxiSDmIU9b4+Fwn2edvtKtPAVdPPmwuclEFQRDMcikyDaN OzEruxQ1OhbjgIBBzPue61gpwcFhlYDJGp42FMCzsPagHBBZOmG5DYFQLSmJ7j360EBx 5epjD5047cWrH1+qmXYfYEynKC9bc6b8nODtCD44FFtWR+IoC8lqofkZdWL97A4mZSKl SWqO8nt/uIT7DZYhctqhxM7B25mZSnH0mmxxDRh0MKZeRD4JLOtKjiQV6g2/xDFFOV/d pIqWSaKPncfUaqyWB3b3+FvyIBFUNe8VYuaGFBE3Yb6MeoYT/3TY0tW7wzoTu9PkbF46 Ip7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WLrl5BtT; 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 hp20-20020a1709073e1400b0073da4a0f01csi15663720ejc.743.2022.11.09.07.08.56; Wed, 09 Nov 2022 07:09:21 -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=WLrl5BtT; 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 S231886AbiKIPHf (ORCPT + 99 others); Wed, 9 Nov 2022 10:07:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231940AbiKIPHY (ORCPT ); Wed, 9 Nov 2022 10:07:24 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41D9C1C429; Wed, 9 Nov 2022 07:07:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668006438; x=1699542438; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vkdjifLpDIz2k79GbiPxj/nDQjo5PWlLax+xg6MpmuQ=; b=WLrl5BtTzaQVD6Phu+j9qFgXnRGpIDylL/P7tuN3lr6tTcVQ+NxzDhSX TF7kVX/HPSXWkDNVLjUx/nRxGWFVpHcyOXKcgndaUaakfOb19+1erxxpq bb5vE4UtYAaHqMhMvFR5e42bpNunZBJYgGv9F+7h8qx4EjX/hiOlAZsDp o6sJu8BshdwGnFOItmVarDb2f9Ta+SkfnnWSlGeWJLMcjSWSxtdHfcatf Md4N8c/xI+uM7xYUs3YL8fkdJBV+3amfP/wi0mcV0JFMKln8NpV6q6JYL g7B/ilySBOzi1pjoHV9bNj0VYI+jpqipSpgiiyl3i/n8fN9s2ltMUztmG w==; X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="312798262" X-IronPort-AV: E=Sophos;i="5.96,150,1665471600"; d="scan'208";a="312798262" 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:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="705736999" X-IronPort-AV: E=Sophos;i="5.96,150,1665471600"; d="scan'208";a="705736999" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 09 Nov 2022 07:07:15 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0D08C155; Wed, 9 Nov 2022 17:07:39 +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 2/2] gpiolib: of: Drop redundant check in of_mm_gpiochip_remove() Date: Wed, 9 Nov 2022 17:07:34 +0200 Message-Id: <20221109150734.38874-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221109150734.38874-1-andriy.shevchenko@linux.intel.com> References: <20221109150734.38874-1-andriy.shevchenko@linux.intel.com> 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?1749031647642174538?= X-GMAIL-MSGID: =?utf-8?q?1749031647642174538?= The callers never call the function with invalid pointer. Moreover, compiler quite likely dropped that check anyway because we use that pointer before the check. Signed-off-by: Andy Shevchenko Reviewed-by: Dmitry Torokhov --- drivers/gpio/gpiolib-of.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index feeb9e8e846d..83997434215e 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -963,9 +963,6 @@ void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc) { struct gpio_chip *gc = &mm_gc->gc; - if (!mm_gc) - return; - gpiochip_remove(gc); iounmap(mm_gc->regs); kfree(gc->label);