Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1888352lqo; Mon, 13 May 2024 01:04:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVbwm1/gUxjeq4mLIzC+PmX14NnpJ9tqOB7BGizyEJNpMtagC9JrecTaV1mY8GoS0aRgBjgXRNAlneAUi2ojjQ1RZubG1j8Sewji+hBFg== X-Google-Smtp-Source: AGHT+IH38VP6aS25SMTSLkckXEl2BAgVH53JL3b9982o5yKHgFz7ELer3F2Qk8lecNXUCobRGbO6 X-Received: by 2002:a17:90a:4285:b0:2b9:461d:5777 with SMTP id 98e67ed59e1d1-2b9461d57e7mr317211a91.11.1715587483056; Mon, 13 May 2024 01:04:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715587483; cv=pass; d=google.com; s=arc-20160816; b=uCudG6T4OJbH3ECQzdLe2/M6WZho5SENA1TGUIYne6L23rRrYuV+yWXA7UWVCgqIBt i3pO/HbzFRJkqJE45nqhNWqDQrobdyn3NJNdUD9Wya8aSq/KMriJQJ17LmH+oDvGtqpc k72CDOy13u9wYIJ0SLYD75kJe6u4KlJ0paYfrd1oYk8AdKwb/ncLTq4PcoLnm4GHeR9y BR5LYdbppjF41QCja/wsEK8GJAWVILjpGs7POo19u9WRCfa7R0YlpREuZsMgPKzuqgW+ R0169LZGDxLVPQT/Ty7tacPUjtZPcNN+XvMcKaaCUWCPHYaZ3jvob+nG43O7ebe/CDZ+ v4gQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=XJ2QoMFraApfHeVQasQ/WBnP806XcOUFshLKlF9JH5Q=; fh=rFznAGM/4vePjpBvFZq2vMElPVB6Zf6dsA8Bi6dnzDE=; b=OIrWyHMbL4s91ZPoIJ1PWQ+NvR+cc7IkG/Sw1zyiTe+lO5PQVxLhMcTET2dIBfUzgI nrqyLGWn0hNcusZ1Newi1gEAkDeq4heKbQkuWQ//9o3Di/AJBddGFoxyINGaAAbLIxU2 a2L3sy6JmndgZTuV0tSLx1ROad9T3qnvVXDkVlgPV49xCzhmaXfjZjAU/9PVUXtWOa0E 1oB/15mFPW0tv/f+4TNjcQERi9NFb5bm3m/qX66kK63g7TeLL8B9M7877P1ixsFSP0f3 ofSqPWe3ewWrp6fZS6PdLfuU7Zmj/o5QSgcojzBQKS8u2fjjPHlF1R6vu5Byk2LNJsai is7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-177316-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177316-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b92a25735esi905848a91.106.2024.05.13.01.04.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 01:04:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177316-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-177316-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177316-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7BD19281D87 for ; Mon, 13 May 2024 08:04:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E2F7146D66; Mon, 13 May 2024 08:04:02 +0000 (UTC) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BE977E777; Mon, 13 May 2024 08:03:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.35 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715587442; cv=none; b=aiZy4gOd4ywOKHEce4DBqivO/2K3q64wirBnm5AzKjNB2n3mbPJ1XeGf2nMyhxdD6+KThxKAxw1TRuo+HQY6qklYQfLnKfAXlrt9+f2ybz1SHdcT/m5V36JQQnN0n4D2pd2lHlkEk6ew6gALf2acpUoCCBUwuLDGxkQVnBiClOg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715587442; c=relaxed/simple; bh=fN65sI7/R50fanyXFbOo8aZsXNpfT1Dm6SRRmg2Km1s=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=kfwwuhkCVNFLNoftdQymrdkChWKWYfxD1ebycoPAQN3tOXjCftQq39qPZdd/yiEHxnvvPXfzD+e39uVnTaixI4qlV7LGC+qis/JmmFZHNIcVY5kFSf3iFuDuv2I0KI2bb0IK1dvCyDMiR9E8ik3K7+5152Xe2rhsNzrDF62Z5oo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4VdBk25BW5z1RJHb; Mon, 13 May 2024 16:00:26 +0800 (CST) Received: from kwepemm600002.china.huawei.com (unknown [7.193.23.29]) by mail.maildlp.com (Postfix) with ESMTPS id EA83E14011B; Mon, 13 May 2024 16:03:47 +0800 (CST) Received: from localhost.localdomain (10.90.30.45) by kwepemm600002.china.huawei.com (7.193.23.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 13 May 2024 16:03:47 +0800 From: Devyn Liu To: , CC: , , , , , , , , , , Subject: [PATCH] gpiolib: acpi: Fix failed in acpi_gpiochip_find() by adding parent node match Date: Mon, 13 May 2024 15:59:01 +0800 Message-ID: <20240513075901.2030293-1-liudingyuan@huawei.com> X-Mailer: git-send-email 2.30.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600002.china.huawei.com (7.193.23.29) Previous patch modified the standard used by acpi_gpiochip_find() to match device nodes. Using the device node set in gc->gpiodev->d- ev instead of gc->parent. However, there is a situation in gpio-dwapb where the GPIO device driver will set gc->fwnode for each port corresponding to a child node under a GPIO device, so gc->gpiodev->dev will be assigned the value of each child node in gpiochip_add_data(). gpio-dwapb.c: 128,31 static int dwapb_gpio_add_port(struct dwapb_gpio *gpio, struct dwapb_port_property *pp, unsigned int offs); port->gc.fwnode = pp->fwnode; 693,39 static int dwapb_gpio_probe; err = dwapb_gpio_add_port(gpio, &pdata->properties[i], i); When other drivers request GPIO pin resources through the GPIO device node provided by ACPI (corresponding to the parent node), the change of the matching object to gc->gpiodev->dev in acpi_gpiochip_find() only allows finding the value of each port (child node), resulting in a failed request. Reapply the condition of using gc->parent for match in acpi_gpio- chip_find() in the code can compatible with the problem of gpio-dwapb, and will not affect the two cases mentioned in the patch: 1. There is no setting for gc->fwnode. 2. The case that depends on using gc->fwnode for match. Fixes: 5062e4c14b75 ("gpiolib: acpi: use the fwnode in acpi_gpiochip_find()") Fixes: 067dbc1ea5ce ("gpiolib: acpi: Don't use GPIO chip fwnode in acpi_gpiochip_find()") Signed-off-by: Devyn Liu --- drivers/gpio/gpiolib-acpi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 7f140df40f35..6078fea3e021 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -128,7 +128,8 @@ static bool acpi_gpio_deferred_req_irqs_done; static int acpi_gpiochip_find(struct gpio_chip *gc, const void *data) { - return device_match_acpi_handle(&gc->gpiodev->dev, data); + return device_match_acpi_handle(&gc->gpiodev->dev, data) || + (gc->parent && device_match_acpi_handle(gc->parent, data)); } /** -- 2.30.0