Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp165013rdb; Thu, 21 Dec 2023 06:02:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHzyPH5H8O7W9Laqr3GcHJZAjvFwRAFx0s59L4LJW4t0NksMOwsLmEXCVTtcYEZBDLYhxPF X-Received: by 2002:a17:906:8f:b0:a26:9346:9e44 with SMTP id 15-20020a170906008f00b00a2693469e44mr779440ejc.42.1703167324516; Thu, 21 Dec 2023 06:02:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703167324; cv=none; d=google.com; s=arc-20160816; b=Ma8D4qhBtZxqkzhf/enDQkdapo/ULqBufBMRJ1b7ODbpbeayQwV9YgmyJfNGZ7JV+F 2zguIY1pxVglBGdFvOH+OoaH+IXgDzoGb3VTsUYKyz2m1p1GJ2RDvf9bmoWsVFhH4Uyt v9T/9sFzENAZ9yIiAdHZ68jekFpzGMkGLdmNd9vTO3lnVyt7pgEqKvUOUD8cRfMhZf7b AZVuNgRJn8ctXBRnLknIsXXx1YKfCTn9979b/J08oV3ebgdVhblszarZLjtdAiHhkA/w R2liH2r7EkcuQhAfiwTv0sGxAybZqeFWhUTkhHdAls+9bH3eBwpw7ypb7Pejrzirzasw y/Lg== 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=hXxWqQmtiZplugC0K4ZK6blePLYqyQNaR4pKOJ/0GWs=; fh=13Qi+kZleTGVQffYzkYktZhFqrKtpQkK9Lp856v1T+E=; b=N7ZbzTzRwic2vIAJvGqTA0zJkG2p/7aAiaQVzQiUhVZyAIad4aDkfJwWQCYZiPkz56 iql+eHWnHEu2k3YhyGgO8wg7xWAAhdDVskuU4SBLp1oAJ6/i7TBz5HzyOoHjYj/NUgVt qosLFLMmo2Kz8c4ka2lMZrXsLmVEhTyYu0ba/eXab+OsQVwW/zHpGopIiZXWNd89S5fB d15Tmt57JL7dvGLUIqAdgKBkN64TLXR+tkpVaRMEy5c6zQ4hgutRgF9uvLuYsLwy1Jpe UdeGoOFQLJ1g3uahBl++NJQO2tkvFsEIY1gTkaQLZ5DqMAwwrVUw0OKIkS48txWa45F+ dT8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=F3oIk2pK; spf=pass (google.com: domain of linux-kernel+bounces-8535-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8535-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id e17-20020a1709062d5100b00a26a25cbdb5si701884eji.451.2023.12.21.06.02.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 06:02:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8535-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=F3oIk2pK; spf=pass (google.com: domain of linux-kernel+bounces-8535-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8535-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8A68B1F2418D for ; Thu, 21 Dec 2023 14:02:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA6D57691C; Thu, 21 Dec 2023 13:51:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="F3oIk2pK" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) (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 6621E745DA; Thu, 21 Dec 2023 13:51:35 +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=1703166695; x=1734702695; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=MW/VQMh0lV18jKfLyDKMM1MKJVVzFTeS8LzjzUBd4Mo=; b=F3oIk2pK9K+aty22CTcVX2VDLZtQ804YcVsu0zeX0KXeF6QqdtlohILk k3sHJ6IIyKlrYls8ADagkA8uYEu8lOBqe5vGapIrAYMCx+OIqlgRzPZ9j OKDJIOuNZ8IrTpICUVGCDPJAThG7eSSoRmdBwbfhWkulvCLOPP8mh9Omg n5DfuM/y4/+X+UOA1QUO4m2ZJ8m5fyCzztCxYBFj00nojRGs4ySugouEC l/q7gz2hqgd1FJ/4BdVmWP+NtVt3U1AmwAJ0fQX4R8X7QDaNtwswNKR+X l4xXThjfpXO8NIee6tuiWQ/kMV2sIvwJ9BVXE73N3AL54JPXSI4QtYZdQ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="399804414" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="399804414" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 05:51:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="920329264" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="920329264" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga001.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 05:51:15 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rGJSC-00000007rfr-0jfj; Thu, 21 Dec 2023 15:51:12 +0200 Date: Thu, 21 Dec 2023 15:51:11 +0200 From: Andy Shevchenko To: Mark Hasemeyer Cc: LKML , AngeloGioacchino Del Regno , Krzysztof Kozlowski , Tzung-Bi Shih , Raul Rangel , Konrad Dybcio , Rob Herring , Sudeep Holla , Mika Westerberg , Wolfram Sang , linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org Subject: Re: [PATCH v2 02/22] i2c: acpi: Modify i2c_acpi_get_irq() to use resource Message-ID: References: <20231220235459.2965548-1-markhas@chromium.org> <20231220165423.v2.2.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: <20231220165423.v2.2.Ib65096357993ff602e7dd0000dd59a36571c48d8@changeid> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Wed, Dec 20, 2023 at 04:54:16PM -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? ... > static int i2c_acpi_add_irq_resource(struct acpi_resource *ares, void *data) > { > - struct i2c_acpi_irq_context *irq_ctx = data; > - struct resource r; > + struct resource *r = data; > - if (irq_ctx->irq > 0) > + if (r->start > 0) > return 1; Checking flags is more robust. if (r->flags) return 1; > - if (!acpi_dev_resource_interrupt(ares, 0, &r)) > + if (!acpi_dev_resource_interrupt(ares, 0, r)) > return 1; > > - irq_ctx->irq = i2c_dev_irq_from_resources(&r, 1); > - irq_ctx->wake_capable = r.flags & IORESOURCE_IRQ_WAKECAPABLE; > + i2c_dev_irq_from_resources(r, 1); > > return 1; /* No need to add resource to the list */ > } ... > + if (IS_ERR_OR_NULL(r)) > + return -EINVAL; Hmm... Do we expect this to be an error pointer in some cases? ... > + ret = acpi_dev_get_gpio_irq_resource(adev, NULL, 0, r); > + if (!ret) > + return r->start; > > - return irq_ctx.irq; > + return ret; What's wrong with the standard pattern? if (ret) return ret; ... return ...; ... > + struct resource r = {0}; '0' is redundant. ... > + irq = i2c_acpi_get_irq(client, &r); > + if (irq > 0 && r.flags & IORESOURCE_IRQ_WAKECAPABLE) Why checking just flags is not enough? > client->flags |= I2C_CLIENT_WAKE; -- With Best Regards, Andy Shevchenko