From patchwork Mon Nov 14 18:46:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 19997 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2304845wru; Mon, 14 Nov 2022 10:46:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf4KdA4ZVn55FIralTvfI8S+s4Sh5J35V+w4dbK/d9PvLoMm/ugfxpHvct0yfUhRXKh5L/hE X-Received: by 2002:aa7:8dcd:0:b0:56c:674a:16f0 with SMTP id j13-20020aa78dcd000000b0056c674a16f0mr15296859pfr.10.1668451614018; Mon, 14 Nov 2022 10:46:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668451614; cv=none; d=google.com; s=arc-20160816; b=a+tC0+wUfWzljAYY02H2KIGYP2L0RBeH2iqCy88R7exAJYTxv8kJy1zWK4tajWVkB1 xHc4yrmIZZ8bbEZip0uQVUN4tGl8saxW8Uo8pNSYTAvYvIpwwRPNc/sjveW3s1bmA4lL q3UUiJByGjYabGqoxUn1RUCklDIkIG1yL6CT3EfjouwuMCBcYuzm3XnPLoJ4uNxxYCi1 SHcqdgHad8iDsJlbEQF3QkS2ycigRoP2jwY1lCLxUz2R9/kv4zv1e6JGwatVNXHFePkq VSRyY1KJ7oTyG9sGzK6eRAfip9UWBT0MjcJabXbyVGI4kFGuHiRFWqP7fOVKFf9/Vj9r H5EQ== 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=V12irVbihlTsXVU6zzzGu93ToP0vlgdhAbiDjO+KBaM=; b=f3V8WVGXjTSARqA++LqQ+SCLM+W8TCZVL1di2sVBpPq/s31AahIlCkCVATkNHLPq4S jLPSns2bcsMF1RF/ODfJf9lX2y+sYF3hZHav4WsUOJKbWhdCFWEhRO2sf4BeXc22y0pE /cv8BCutvcxpmMe5bBt8zq4jYj6o8b4u3Esg+2tVY4Il7e7nnO8TmjSYp1SwCgg8Ai/5 BbebYUaB72I45u1q1jscQhzhnDnpy/A/dip0yLcH/c3X7K9cax69SaYDFgctaw28koPD P6E2L980WXC516HXiKYo6GCJZF7DJ2zPkS0MpGbOcJTFqrO29fDhi3D8UESwHVuyI7fJ jxRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lXjuic0m; 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 d1-20020a170902cec100b00183f6ff535dsi11485440plg.490.2022.11.14.10.46.38; Mon, 14 Nov 2022 10:46:54 -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=lXjuic0m; 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 S236635AbiKNSqK (ORCPT + 99 others); Mon, 14 Nov 2022 13:46:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236375AbiKNSqH (ORCPT ); Mon, 14 Nov 2022 13:46:07 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25E3595B9; Mon, 14 Nov 2022 10:46:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668451567; x=1699987567; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=/1WKTqJpkjMEr16VW72RtfByJdldDDo4IhA1v1pcwfI=; b=lXjuic0mQOaUiLfVwioPt4V0+NTmgy6+yeBVaJPrT78EUSPhdBgmUZYe fn6JzgjX1EUrMQSwtTEs0TjawvN7lnyqIsbeUhvtlD5W6JcRc0auP/UCO HDk1cc2RnFx3v4KPpqgmoAcMHZZ1ax+llQupNSI04dKUb41lPdQHndLG+ esAsIaTqjLkcC5l6mHKPG0G4xmFdEzecgPgPmx2EbzlMx9ooDDqfXFF8t rJW0+not33jAclqCUZIlFMqYWB5/1kTIzheQVerLyRgyz0Y9tY3c4WN3P aDAnpLDD0moMFywjadJrVipMh+uE8FiVtb8qOmbCyWMYFidiWG9pbZxRp Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="313197441" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="313197441" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 10:46:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="669773432" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="669773432" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 14 Nov 2022 10:46:04 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7A25C2F3; Mon, 14 Nov 2022 20:46:29 +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 v2 1/2] gpiolib: of: Prepare of_mm_gpiochip_add_data() for fwnode Date: Mon, 14 Nov 2022 20:46:25 +0200 Message-Id: <20221114184626.64214-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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?1749498319581922053?= X-GMAIL-MSGID: =?utf-8?q?1749498319581922053?= 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 Reviewed-by: Dmitry Torokhov --- v2: added tag (Linus), modified according to Dmitry's suggestion drivers/gpio/gpiolib-of.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) base-commit: 8dab99c9eab3162bfb4326c35579a3388dbf68f2 diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 4be3c21aa718..d30a5210dfdd 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -935,8 +935,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(of_fwnode_handle(np)); ret = gpiochip_add_data(gc, data); if (ret) From patchwork Mon Nov 14 18:46:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 19996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2304846wru; Mon, 14 Nov 2022 10:46:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf6fToGicDUVH//olPzz0BdmuHpIIRol0KUsBJCzR0hJc85v6cQDutZnfkV+3hrFXVhj4ESp X-Received: by 2002:a62:3287:0:b0:56c:3a0e:cf13 with SMTP id y129-20020a623287000000b0056c3a0ecf13mr15015589pfy.29.1668451614019; Mon, 14 Nov 2022 10:46:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668451614; cv=none; d=google.com; s=arc-20160816; b=0giM6hHyEiBdw9Vn8acNNapyIcV4GYReJg+9lmAGRw6Ul3QcqN7AXAVfih260YLRSy CbvaUA6xsP7dZtXWqlVbUgI8Z1GE69GsKYbC+hhmrUWQWzn198enlGdAwkP6OZ5236Au ljarv7xyddHxUeL9nfYwYEpzbpmhSay37SD7SNhsxNqmmdTu1GKxAOHjgQ5KjB1z9Z+d u6usxVr/4LuQIqUtN0KgU1z5PtciG5E3JxBJyntO9o4NeUtv4qpZKPP/hbzucg0dG9RT 2MTNOnSIWMgo5XaoqCehAJUWJiY237yDj5x/BCj2wqKgiDZD6PcPEi5FQiwMSZEgQNVe PuWg== 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=grMdlWLiOEVms3yDpwrjA0Xb5oE8YKX0A4YdnxvFvXk=; b=HVJNnobjyAJz+l/HGNGi2+ck7eP7XlgZFA6VZ/tj/4TGcUVj7zVmokCODYw/FlEJcM eQ8DDd/xHWZfXn5oIVf046ykx5PaoK+0z9kL1P5HLaJgOrkW47hUwWfjmLWwhroJEuWF Ve/7AOA31ajiWUMGdcymv94vmnZW4LV6AV7qjLvMqd8bnbTWvAHRJZX5zncaOx3pVaju GZ6REZz93k67tAPI/emyM+C1txm6jrReO0NRZOf4tr7FvrVk8ozurP6k3vwtm+BpGt22 q6uVMDd3HfAuimnb0QfQTAXDhwacDjVsOJr7VBC3csYC5RwDFmKsQF8ldtX6lcNWraC7 Oh9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="euXhwPP/"; 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 a13-20020a65654d000000b00476a08c5d9bsi1173750pgw.602.2022.11.14.10.46.39; Mon, 14 Nov 2022 10:46:54 -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="euXhwPP/"; 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 S236679AbiKNSqM (ORCPT + 99 others); Mon, 14 Nov 2022 13:46:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236525AbiKNSqI (ORCPT ); Mon, 14 Nov 2022 13:46:08 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F182013F75; Mon, 14 Nov 2022 10:46:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668451568; x=1699987568; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p9xXZ7oRWXft1etC6JnOSiiOdeH9ZPyYQGV7NIbMwgs=; b=euXhwPP/nmFaGJ25es547rF2Wb0U5pxtFlXQ0OdpvIrK86nvGYpnUik6 isXFnqK/Z8Wf8siiXmVLNG6QNBsdoQl/7L5P9ZOoeJ9EwPY5C0wJV4tni qCHO0aGMqWyX+tw46ProB4DjwK4rke31N7rntOACQb8tLuhb9rwnLGSF8 ed7LnaRKJMaNjlGC/nClm4mQIawUNmo/or0H75bcOGYPQQ/X0h1ekdYTT Vf0aCpd9S3CGrFXFP2/cyU+jwlu+2CEtZoo5QWw+DbwCdK/NM0wDqLCIP E+FBr6t6xKy1k+HSPqfXkBr621GuKnJ9/nKw/YTxKmC/fUjdmcH5XG0Pj Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="313197442" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="313197442" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 10:46:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="669773436" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="669773436" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 14 Nov 2022 10:46:05 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8857DB7; Mon, 14 Nov 2022 20:46:29 +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 v2 2/2] gpiolib: of: Drop redundant check in of_mm_gpiochip_remove() Date: Mon, 14 Nov 2022 20:46:26 +0200 Message-Id: <20221114184626.64214-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221114184626.64214-1-andriy.shevchenko@linux.intel.com> References: <20221114184626.64214-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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?1749498319324070506?= X-GMAIL-MSGID: =?utf-8?q?1749498319324070506?= 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 Acked-by: Linus Walleij Reviewed-by: Dmitry Torokhov --- v2: added tags (Linus, Dmitry) 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 d30a5210dfdd..f96cb6fe6831 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -962,9 +962,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);