Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1629624pxb; Thu, 4 Mar 2021 16:56:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHnqlsKxm411F9+3JK1OqbarC2qawIlamqnmQ/3ZF32/cRnWC6XU4Wm2vBPA5ngjU19uKY X-Received: by 2002:a02:3e16:: with SMTP id s22mr7140832jas.72.1614905803475; Thu, 04 Mar 2021 16:56:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614905803; cv=none; d=google.com; s=arc-20160816; b=ras9FdolJ6A6x4zh6UK5+OP9s/NSDm3MhPi2Y+mBvrSct+RgBsl9BvpdXZrhRPnJR7 VtWmi/WzY25AfczVD1z3PZE9lPsWkYOU3vKoy1XZ2OLKbA84pheoHjMGVW1RjIlpM4DK ribPwDQrdTDkLHg4oaifQ+3Ipc688jimb1WPilemVvi17VtOXNchJO372Kpp8orvISxW yoUGCLv3FWzpxD0m64xWqD2EuLz6fLfh+9jN5ZqnUgIHUP/SOvjbbEYhKeqXdXalWbCh MyrK6VSIIX/KSoMhGYZ2egk3rSceoZZKdO99TmjQ1HcVcz+R6UtbjLiC6I6Nwv8ggnr1 CjYg== 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 :ironport-sdr:ironport-sdr; bh=xPFKWjQSeWVhLd4jRSjDem9JPpDjRdwyn2p1YYRvzQM=; b=eaTlIsqgVq9AJWPRyRasRWJEQlXJq0BJS+F+eKr/mS9BI/7tD7qMfTBBS02q4kEp+x OzenjVBqjGuBD8rWvc/ljZxI/wxkrVa7Myu/QMDO2uIy5Nf0aRuo3MKuJl76IWWYL35f Gi/GoSjJMU+hS/Rzt3OOlwKNoYfiqSeMGhMyCD+bBwDgu18/N5KNF//ycVw/gYRuY7El VP+cg4JfdX+MAIM05XITHirS7XrtM5yDOr7mNIoey779BrPI+vU9qGrM4gTa/pYHrv3K Gc9LbhdKK14hDFoVEJED6xvhKeqYufnRBmIJXggdl0s2/BuQC0rfSa3XeTZ4lSpSVOcX TwbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si832549ilj.125.2021.03.04.16.56.30; Thu, 04 Mar 2021 16:56:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238447AbhCDUPW (ORCPT + 99 others); Thu, 4 Mar 2021 15:15:22 -0500 Received: from mga01.intel.com ([192.55.52.88]:6975 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231734AbhCDUOt (ORCPT ); Thu, 4 Mar 2021 15:14:49 -0500 IronPort-SDR: pmSfc2n60SSZetXu5lhD3mMRzc7XgTFFf7JhPMjwKHu9qsuFsjpZrvQO2ktQ/Gm6+hMa4844F7 jkICx3PHUT1g== X-IronPort-AV: E=McAfee;i="6000,8403,9913"; a="207217334" X-IronPort-AV: E=Sophos;i="5.81,223,1610438400"; d="scan'208";a="207217334" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2021 12:13:03 -0800 IronPort-SDR: vnRBuhcgY1/n8X16CGB2tqmuUMhu5j4qSZynT7Q+4kaAYs3mq6wjEIvTJni88B1feN1uyn3l72 CTc2xY5aC1vA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,223,1610438400"; d="scan'208";a="406981974" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 04 Mar 2021 12:13:00 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A52C83C1; Thu, 4 Mar 2021 22:13:00 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Mika Westerberg , Linus Walleij , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Marc Zyngier , Jonathan Corbet , Bartosz Golaszewski , Thomas Gleixner , "Rafael J. Wysocki" Subject: [PATCH v3 4/5] gpiolib: Introduce acpi_gpio_dev_init() and call it from core Date: Thu, 4 Mar 2021 22:12:52 +0200 Message-Id: <20210304201253.14652-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210304201253.14652-1-andriy.shevchenko@linux.intel.com> References: <20210304201253.14652-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the ACPI case we may use the firmware node in the similar way as it's done for OF case. We may use that fwnode for other purposes in the future. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- drivers/gpio/gpiolib-acpi.c | 7 +++++++ drivers/gpio/gpiolib-acpi.h | 4 ++++ drivers/gpio/gpiolib.c | 1 + 3 files changed, 12 insertions(+) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 1aacd2a5a1fd..21750be9c489 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -1291,6 +1291,13 @@ void acpi_gpiochip_remove(struct gpio_chip *chip) kfree(acpi_gpio); } +void acpi_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev) +{ + /* Set default fwnode to parent's one if present */ + if (gc->parent) + ACPI_COMPANION_SET(&gdev->dev, ACPI_COMPANION(gc->parent)); +} + static int acpi_gpio_package_count(const union acpi_object *obj) { const union acpi_object *element = obj->package.elements; diff --git a/drivers/gpio/gpiolib-acpi.h b/drivers/gpio/gpiolib-acpi.h index e2edb632b2cc..e476558d9471 100644 --- a/drivers/gpio/gpiolib-acpi.h +++ b/drivers/gpio/gpiolib-acpi.h @@ -36,6 +36,8 @@ struct acpi_gpio_info { void acpi_gpiochip_add(struct gpio_chip *chip); void acpi_gpiochip_remove(struct gpio_chip *chip); +void acpi_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev); + void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); @@ -58,6 +60,8 @@ int acpi_gpio_count(struct device *dev, const char *con_id); static inline void acpi_gpiochip_add(struct gpio_chip *chip) { } static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { } +static inline void acpi_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev) { } + static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 2a3d562eb8c1..46ab1ce67ba0 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -590,6 +590,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, gc->gpiodev = gdev; of_gpio_dev_init(gc, gdev); + acpi_gpio_dev_init(gc, gdev); gdev->id = ida_alloc(&gpio_ida, GFP_KERNEL); if (gdev->id < 0) { -- 2.30.1