Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3501405rdb; Wed, 27 Dec 2023 09:17:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFP6rzY/pidQjQHrDU7GtD5QAI9NqYJSn9YQPvVoIN8qbvRO+oi1B50HqCE9B5o5xMi6RBq X-Received: by 2002:a05:6808:4448:b0:3ae:156f:d319 with SMTP id ep8-20020a056808444800b003ae156fd319mr4666080oib.45.1703697442580; Wed, 27 Dec 2023 09:17:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703697442; cv=none; d=google.com; s=arc-20160816; b=FVjvBCxscZmF2tdtP4XT8r36FS4CB/JTHkCXWKq1+/+hkneBAn9qAPZZUG04sAcglN 0KZU9xOOzugHwNdxX9vWx4Dc5kKQJYIsI1dx353UiS3oFcVTVb/nHDkZjI3PWlDNoihA 5kWmBPtUNAuSWNy19EYteXFtaE1MkQXxepi+c2pABSBo+Ig/pDYJAVEQiy08eHbgCs3i kewnRasi/1yvdCFDwyYqjw6mQWN2ngaR6LwlXnS4Kjd2n1QOfdK7tJc2nZQMS4mE89ao JIK2eHwxkGijlrHlixLWLSgNO6OBEcDWMTeFgfplWh5jBl8nXV+XO1jQPneej4SrA2kZ MkKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=bPedzVyGn1YUv58coyEi1rmL+yLvAK5hdbURIerUPtE=; fh=e4rAl2ljcqMpv9PdnIf3NSNlZTfFry/3gVIHbdST6h4=; b=rKMNuqBsuNXIGG9GGz4YWvj2Rf9KcQbaLaBCkGPPRat++a8ZGpjLzUBBUZ4VSXAxK/ jg9FbHt5uxC5YAiQgeOO7tBElAQnI0EAOUvHA5ZpMZvbB9YNAT1LoOzWoxB1lT52CCKy U+hXH1UPXifTlic1Se6i/ebZUdceMYEK/k3R93JPlZAKK2VITjDyz/ZFmgK2oc/J/q/B 29Jf+9tPJOSoEJiXfrGFYEG3aQYqzCk3uGcnz4cDIN7gv7vZ3eM5KD+10juxrBByKqli 7e2UNalYPES3709K5pPILoiFU5X7TAOv3d8akSUhowQcBtYEvsps6znJApkW6PeFn4EB EyFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FJcskC8o; spf=pass (google.com: domain of linux-kernel+bounces-12164-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12164-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o22-20020a05620a2a1600b00780ff1bf9d9si14898101qkp.565.2023.12.27.09.17.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 09:17:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12164-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FJcskC8o; spf=pass (google.com: domain of linux-kernel+bounces-12164-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12164-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 513BF1C2179D for ; Wed, 27 Dec 2023 17:17:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE1F446456; Wed, 27 Dec 2023 17:17:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FJcskC8o" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) (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 8D6AF46524; Wed, 27 Dec 2023 17:17:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703697433; x=1735233433; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=2K3uY8b+MqHzdwOGeEWgpRZaazlE1adyV7pu9tW3Sx8=; b=FJcskC8otDJ/Tn6ogbDHMnX6EgNqfUyyIeOUjGtqSItsz3xxEjViNZLX CfYFkjaklQ9GGFrO77muR/WyfP+RVSrOKdE3Gnk8OAr9LrxdF4WHn5QJe /jMGKysrGAckOqU3JRGKep52cGvP1xerp/IwBkZY2oVbiKhLsTRwXqt6B l2SGOv/xJKqjjuVrWCQ0Dwd1SOO7KrYjuszCIwYAYWWMJmPVeOMhBmO9x OfGqBGr/W6LEn4U+kTnc7ON5MOla1i+f5WQA/r/RK395JqDNjBbDKhl5H o+Q9Ch/T4EtzELP2AeiutYHOyPQTxtULof2zDYZaWq1TItWilEuF7oTwH A==; X-IronPort-AV: E=McAfee;i="6600,9927,10936"; a="376610460" X-IronPort-AV: E=Sophos;i="6.04,309,1695711600"; d="scan'208";a="376610460" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2023 09:17:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10936"; a="896957026" X-IronPort-AV: E=Sophos;i="6.04,309,1695711600"; d="scan'208";a="896957026" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2023 09:17:08 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rIXWj-00000009TNK-0vG1; Wed, 27 Dec 2023 19:17:05 +0200 Date: Wed, 27 Dec 2023 19:17:04 +0200 From: Andy Shevchenko To: Mark Hasemeyer Cc: LKML , AngeloGioacchino Del Regno , Krzysztof Kozlowski , Rob Herring , Konrad Dybcio , Sudeep Holla , Raul Rangel , Tzung-Bi Shih , Mika Westerberg , Wolfram Sang , linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org Subject: Re: [PATCH v3 03/24] i2c: acpi: Modify i2c_acpi_get_irq() to use resource Message-ID: References: <20231226192149.1830592-1-markhas@chromium.org> <20231226122113.v3.3.Ib65096357993ff602e7dd0000dd59a36571c48d8@changeid> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231226122113.v3.3.Ib65096357993ff602e7dd0000dd59a36571c48d8@changeid> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Tue, Dec 26, 2023 at 12:21:07PM -0700, Mark Hasemeyer wrote: > The i2c_acpi_irq_context structure provides redundant information that > can be provided with struct resource. > > Refactor i2c_acpi_get_irq() to use struct resource instead of struct > i2c_acpi_irq_context. ... > Suggested-by: Andy Shevchenko > > Signed-off-by: Mark Hasemeyer No blank line. ... > ret = acpi_dev_get_resources(adev, &resource_list, > - i2c_acpi_add_irq_resource, &irq_ctx); > + i2c_acpi_add_irq_resource, r); > if (ret < 0) > return ret; > > acpi_dev_free_resource_list(&resource_list); > > - if (irq_ctx.irq == -ENOENT) { > - ret = acpi_dev_get_gpio_irq_resource(adev, NULL, 0, &irqres); > - if (ret) > - return ret; > - irq_ctx.irq = irqres.start; > - irq_ctx.wake_capable = irqres.flags & IORESOURCE_IRQ_WAKECAPABLE; > - } > - > - if (irq_ctx.irq < 0) > - return irq_ctx.irq; > + if (!r->flags) > + ret = acpi_dev_get_gpio_irq_resource(adev, NULL, 0, r); > > - if (wake_capable) > - *wake_capable = irq_ctx.wake_capable; > + if (!r->flags) > + return ret; > > - return irq_ctx.irq; > + return r->start; Wondering if we can refactor above as if (r->flags) return r->start; ret = acpi_dev_get_gpio_irq_resource(adev, NULL, 0, r); if (ret) return ret; return r->start; Note also the 'if (ret)' check, the check for flags to return ret seems counter intuitive and possible prone to errors in the future. -- With Best Regards, Andy Shevchenko