Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2312151pxb; Tue, 23 Feb 2021 04:08:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9oPlSyeNK7ns4SZOnmKCXU4NoYoMd/1pm6gM0uy/9A+04KHd2g5g69QLrkuBc83ZiU7fv X-Received: by 2002:a17:907:262b:: with SMTP id aq11mr25002961ejc.360.1614082116879; Tue, 23 Feb 2021 04:08:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614082116; cv=none; d=google.com; s=arc-20160816; b=jECjDJqw7gTV/jzOK2tQ6kZVePD92BqNYE1XaaRq8rB9uA3E+5H2JKh9nlrA+Kw9y/ LLlj5K+ylHjvsS6jKJrTuq/5tBQTpMf/xilrsafdN5EBL23WKoJoVAFad+bhRFERr7kX RgNxF9Nk9DnGyEDL8LGtTsdhaGbSFs12YgF7M5915lLm/ICFPLkrpSoKFH7IDAr/wt+L FpvnRF0F7iOelT8JZut/vMjMov8lg9yJcDABSb5G7GYHgm1rEOS/qaq/FBkjqWp50s7I 4zZIa3oO0NnVvipsSPr/lJ513kTy3qaORSz0v8DuYDbmRFXn9vJb2X8wVKPHrzTqjAPC Ncrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=q3MhbkLP70m8wxCKN3fke/penkLZy8QQS6ODd3LoUu8=; b=0oP64ncChEB/v3kC/nna9gWH9OI0cUTa1yjSVZPzRMlwbSnOLCsQ4ZQ8GUlv7GLU5/ NponGB1hYESSgE1H9G8+2zNtffOwi5oQ5qOtrgBCL1VONY1fo34lyeq1/sG4jNrDIAhG Y+gET60qpzMfUiGsSgnZySSWS6D7il5ttRzQtcOjzZFdfr3srvbwpoljFnEMJiVDBJT3 wKulZ1YxsM6s9KgqUnV32GFZ1BbqATmP/N5zSG9K6KilVEl+IBSgpmugBDtN0p+CC7PI xAmIE6vWPXXxqrkee+SgQ2P3WGAczQV1Hdx+sOhW1q/CCrR5GWgnx2R2riIbstPBKxBM pjKQ== 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn20si6174220ejc.593.2021.02.23.04.08.10; Tue, 23 Feb 2021 04:08:36 -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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232707AbhBWMGY (ORCPT + 99 others); Tue, 23 Feb 2021 07:06:24 -0500 Received: from mga01.intel.com ([192.55.52.88]:12810 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232468AbhBWMC3 (ORCPT ); Tue, 23 Feb 2021 07:02:29 -0500 IronPort-SDR: VEDBMz3yblLb9Se+iAKZeBXHvMOeT0l5snrU2BlzgF0Ole6fs4bg2tnafpOnty4daaH0DJmgpM 1NpTd+LIVa+w== X-IronPort-AV: E=McAfee;i="6000,8403,9903"; a="204204601" X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="204204601" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 04:01:35 -0800 IronPort-SDR: vArlr3KrePNBRYNfBwiKlzekovfISugTKtVeSAQotiJWMWn7rBgZV9Z/BBRjs+ywQPZ+rbI0DZ z4kqlVJiVX1A== X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="432679629" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 04:01:29 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lEWNZ-007Nkk-W1; Tue, 23 Feb 2021 14:01:25 +0200 Date: Tue, 23 Feb 2021 14:01:25 +0200 From: Andy Shevchenko To: Daniel Scally Cc: Tomasz Figa , Sakari Ailus , Rajmohan Mani , "Rafael J. Wysocki" , Len Brown , Mika Westerberg , Linus Walleij , Bartosz Golaszewski , Wolfram Sang , Lee Jones , kieran.bingham+renesas@ideasonboard.com, Laurent Pinchart , Hans de Goede , Mark Gross , Maximilian Luz , Robert Moore , Erik Kaneda , me@fabwu.ch, Linux Kernel Mailing List , ACPI Devel Maling List , "open list:GPIO SUBSYSTEM" , linux-i2c , Platform Driver , devel@acpica.org Subject: Re: [PATCH v3 5/6] platform/x86: Add intel_skl_int3472 driver Message-ID: References: <20210222130735.1313443-1-djrscally@gmail.com> <20210222130735.1313443-6-djrscally@gmail.com> <534849f6-c7b5-19b0-a09f-cd410cde93bd@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <534849f6-c7b5-19b0-a09f-cd410cde93bd@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 22, 2021 at 10:35:44PM +0000, Daniel Scally wrote: > On 22/02/2021 14:58, Andy Shevchenko wrote: > > On Mon, Feb 22, 2021 at 3:12 PM Daniel Scally wrote: ... > >> + if (obj->buffer.length > sizeof(*cldb)) { > >> + dev_err(&adev->dev, "The CLDB buffer is too large\n"); > >> + ret = -EINVAL; > > ENOSPC? ENOMEM? > > I still think EINVAL actually, as in this case the problem isn't that > space couldn't be allocated but that the buffer in the SSDB is larger > than I expect it to be, which means the definition of it has changed / > this device isn't actually supported. OK! ... > >> + if (!IS_ERR_OR_NULL(sensor_config) && sensor_config->function_maps) { > > Hmm... > > > > Would > > > > if (IS_ERR_OR_NULL(sensor_config)) > > return 0; > > > > if (!_maps) > > return 0; > > > > with respective comments working here? > > No, because the absence of either sensor_config or > sensor_config->function_maps is not a failure mode. We only need to > provide sensor_configs for some platforms, and function_maps for even > fewer. So if that check is false, the rest of the function should still > execute. I see, thanks for elaboration. ... > >> + if (ares->type != ACPI_RESOURCE_TYPE_GPIO || > >> + ares->data.gpio.connection_type != ACPI_RESOURCE_GPIO_TYPE_IO) > >> + return 1; /* Deliberately positive so parsing continues */ > > I don't like to lose control over ACPI_RESOURCE_TYPE_GPIO, i.e. > > spreading it over kernel code (yes, I know about one existing TS > > case). > > Consider to provide a helper in analogue to acpi_gpio_get_irq_resource(). > > Sure, but I probably name it acpi_gpio_is_io_resource() - a function > named "get" which returns a bool seems a bit funny to me. But don't you need the resource itself? You may extract and check resource at the same time as acpi_gpio_get_irq_resource() does. ... > >> + struct int3472_discrete_device *int3472 = platform_get_drvdata(pdev); > >> + if (int3472->gpios.dev_id) > >> + gpiod_remove_lookup_table(&int3472->gpios); > > gpiod_remove_lookup_table() is now NULL-aware. > > But in any case I guess you don't need the above check. > > Sorry; forgot to call out that I didn't follow that suggestion; > int3472->gpios is a _struct_ rather than a pointer, so &int3472->gpios > won't be NULL, even if I haven't filled anything in to there yet because > it failed before it got to that point. So, not sure that it quite works > there. I think if you initialize the ->list member you can remove without check. -- With Best Regards, Andy Shevchenko