From patchwork Sun Aug 1 14:16:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 490210 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFAACC4338F for ; Sun, 1 Aug 2021 14:24:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D8BE60F36 for ; Sun, 1 Aug 2021 14:24:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231945AbhHAOY4 (ORCPT ); Sun, 1 Aug 2021 10:24:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231577AbhHAOY4 (ORCPT ); Sun, 1 Aug 2021 10:24:56 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D263C06175F for ; Sun, 1 Aug 2021 07:24:48 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id h14so18190712wrx.10 for ; Sun, 01 Aug 2021 07:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=M8jq2GSwxUyQHPbFcbHhL19hRaynArgfI2wbsJp+rRM=; b=ms8DDCHxgHTgTL4xhcrbDL9/wkqiNPnyc+i/yVe+U68xwTH1JkzUh2cE1m8RSlRcA8 X2LPnsfye4ennPOFOhFo8AISry+ViECtmZ/ibn1yWBmFi8W270asj++gL/okck8Id0pM 92BJbnS9aQftFAvcU/65icFXBbZbJkMSJeN4okllPSF+uBu2al9ZiB0KLJNplbq1IkIT 7Nc6ptQCgRIi/ylSaSrNqS6CfvOT8UkYh2xqj1R0pEwAFQmABD42vx/tlmsFoHXhS6+a MGiUUu3esuCshGNJLqzGH+Fbwu7m+6BpxzCmkJgwL6Q9ZwCAkHKrXASFoaJgUADhF1ds SPKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=M8jq2GSwxUyQHPbFcbHhL19hRaynArgfI2wbsJp+rRM=; b=kg9YaGn8DNJjaDTFXRvghd70Xvy22gJxlvym4s8jUpTm4B2ggYA9K+YsTbs5boc6iA ih9jQjSS823ryrjdUR1BTh+9hN42yuokXGZHg0hrt97ITQ2xJs53L6HVn6Xb3GcqhdDc vrkweUKMTYjXAjngwKy+QrXaH7d9IDhwoK9XrQKwG0bW+8JuFaVHODc7m7KZ2kkRMlYn apr8D5MBbL7PKjH/iMX2mVPLgASTBMYRWSIGoSk9e8ILS/TLjyOl7pHeYoY97nLgUm42 pRExj+pf6Bn62L4+nlTSnTO0P4WRxeOR1WooW1V2j6bItKJklMHqlKf4HXo7mHLojWr2 lzTg== X-Gm-Message-State: AOAM532t9WQpRe8/lDh93BEctjSjzpD3wYSQL7REaevr+JvHYwF0M/GZ 1kWZAsu+AKvjU7yp0C4qPuWEtwirtaB5AQ== X-Google-Smtp-Source: ABdhPJzn4ztkBn4/Sa2p6xm1+MFmTPki0WPuWQm7U4YhTIpRcLdDzFU1sZhGrJSR9H641xr0Cnt3hg== X-Received: by 2002:adf:e5cf:: with SMTP id a15mr12934920wrn.362.1627827885879; Sun, 01 Aug 2021 07:24:45 -0700 (PDT) Received: from ?IPv6:2003:ea:8f10:c200:9d9e:757:f317:c524? (p200300ea8f10c2009d9e0757f317c524.dip0.t-ipconnect.de. [2003:ea:8f10:c200:9d9e:757:f317:c524]) by smtp.googlemail.com with ESMTPSA id i7sm8509841wre.64.2021.08.01.07.24.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Aug 2021 07:24:45 -0700 (PDT) Subject: [PATCH 01/10] i2c: i801: Don't call pm_runtime_allow From: Heiner Kallweit To: Jean Delvare Cc: "linux-i2c@vger.kernel.org" References: <7a1581de-7566-15da-d1af-08cbf8c5e46f@gmail.com> Message-ID: Date: Sun, 1 Aug 2021 16:16:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <7a1581de-7566-15da-d1af-08cbf8c5e46f@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Drivers should not call pm_runtime_allow(), see Documentation/power/pci.rst. Therefore remove the call and leave this to user space. Also remove the not needed call to pm_runtime_forbid(). Signed-off-by: Heiner Kallweit --- drivers/i2c/busses/i2c-i801.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 92ec291c0..362e74761 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1891,7 +1891,6 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) pm_runtime_set_autosuspend_delay(&dev->dev, 1000); pm_runtime_use_autosuspend(&dev->dev); pm_runtime_put_autosuspend(&dev->dev); - pm_runtime_allow(&dev->dev); return 0; } @@ -1900,7 +1899,6 @@ static void i801_remove(struct pci_dev *dev) { struct i801_priv *priv = pci_get_drvdata(dev); - pm_runtime_forbid(&dev->dev); pm_runtime_get_noresume(&dev->dev); i801_disable_host_notify(priv); From patchwork Sun Aug 1 14:18:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 490209 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB95BC4338F for ; Sun, 1 Aug 2021 14:24:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8833060F36 for ; Sun, 1 Aug 2021 14:24:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231992AbhHAOY7 (ORCPT ); Sun, 1 Aug 2021 10:24:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231980AbhHAOY6 (ORCPT ); Sun, 1 Aug 2021 10:24:58 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 785ADC06175F for ; Sun, 1 Aug 2021 07:24:49 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id p5so18247257wro.7 for ; Sun, 01 Aug 2021 07:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=PEkqY2dSUnOtZJbRz80mcbikOXejOWVLD+AfhqwVeWo=; b=QUrdPFMTlAkeMObGIOMoCRKCo+OGnyoNFqbj0oy/1nwIbE65aoupJFM4qUBWy4+wpD z5zO5GZM9xwQ7AcxPhpDoT5+wEo20EFoQjmaiRHFtYsmBo16icN3cZw+jDD6vJojO0OT JZWP0/Vplis8wWEvF5JQeIj+Wph+JGExV7exwPtG1R6DrY08L18HeZPekqxVODOq62X+ iIWihf43yioOSz+RsW+UkmHpSpZFNB8GMvUyHH//pFD3Beh6oUUYNhkTeNGQxQYYAWB8 ppzm/diMVpBzMAHuoAWtwqCNxvsmxbzKp+1xVz+vUmygYBsEjzq6uNEqn8JsRz0h6V6X AbDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PEkqY2dSUnOtZJbRz80mcbikOXejOWVLD+AfhqwVeWo=; b=l1BsLpXg1oS0ju3L441u5MPt9Da832497aSxNf5igGReDTCxOncy8Gt7Hb2iZAywed YZSfKrYq9feEEhWozEo5lK78bjbVbZdsbTybeJWHaE9ASIS0TEKKXolhVfdRD2QkA/Ni RLu7m4IjIN/wTvLTAMx/ZlP8aIjut5mSsrRIhE8kVMvxiqwOTVjngj7RXPKl8iMLjiRM NxlrRqHQWZ+09s9A1qcLTdzuPQplL24XDKqtJW/AEPyJMoB7WARKodqmTbS/OVLfl2hX tAtjvb1xUFso/jo+5LVP9CVZazOfcOiiU6xarKHvJuHkYLN5R1g4mUxIX+HrzQL4e3qy ZUdQ== X-Gm-Message-State: AOAM531IGum8LzGKX1dwNVeuIlzpeQ3I6NtfNWmIBuAnvMIKGSIgtJNn 6vRYWaK5xlSHd+Y/admJXIqKovNTt84oOQ== X-Google-Smtp-Source: ABdhPJxgLZi7z7uVfhWTEP47jExoRk3tlj8DSKdVY8O7Pd1HruCfk3qqNSYlu2Q3ya1LoOJPeE3ZHg== X-Received: by 2002:adf:eb82:: with SMTP id t2mr12910175wrn.337.1627827887929; Sun, 01 Aug 2021 07:24:47 -0700 (PDT) Received: from ?IPv6:2003:ea:8f10:c200:9d9e:757:f317:c524? (p200300ea8f10c2009d9e0757f317c524.dip0.t-ipconnect.de. [2003:ea:8f10:c200:9d9e:757:f317:c524]) by smtp.googlemail.com with ESMTPSA id w13sm9658324wru.72.2021.08.01.07.24.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Aug 2021 07:24:47 -0700 (PDT) Subject: [PATCH 03/10] i2c: i801: Make p2sb_spinlock a mutex From: Heiner Kallweit To: Jean Delvare Cc: "linux-i2c@vger.kernel.org" References: <7a1581de-7566-15da-d1af-08cbf8c5e46f@gmail.com> Message-ID: <2e727b49-b59b-fad9-6ed3-febc5b98b8d4@gmail.com> Date: Sun, 1 Aug 2021 16:18:38 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <7a1581de-7566-15da-d1af-08cbf8c5e46f@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org p2sb_spinlock is used in i801_add_tco_spt() only and in process context only. Therefore a mutex is sufficient, and we can make the definition local to i801_add_tco_spt(). Signed-off-by: Heiner Kallweit Reviewed-by: Jean Delvare Reviewed-by: Mika Westerberg --- drivers/i2c/busses/i2c-i801.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index bdb619bc0..504f02e1e 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1492,12 +1492,11 @@ static const struct itco_wdt_platform_data spt_tco_platform_data = { .version = 4, }; -static DEFINE_SPINLOCK(p2sb_spinlock); - static struct platform_device * i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev, struct resource *tco_res) { + static DEFINE_MUTEX(p2sb_mutex); struct resource *res; unsigned int devfn; u64 base64_addr; @@ -1510,7 +1509,7 @@ i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev, * enumerated by the PCI subsystem, so we need to unhide/hide it * to lookup the P2SB BAR. */ - spin_lock(&p2sb_spinlock); + mutex_lock(&p2sb_mutex); devfn = PCI_DEVFN(PCI_SLOT(pci_dev->devfn), 1); @@ -1528,7 +1527,7 @@ i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev, /* Hide the P2SB device, if it was hidden before */ if (hidden) pci_bus_write_config_byte(pci_dev->bus, devfn, 0xe1, hidden); - spin_unlock(&p2sb_spinlock); + mutex_unlock(&p2sb_mutex); res = &tco_res[1]; if (pci_dev->device == PCI_DEVICE_ID_INTEL_DNV_SMBUS) From patchwork Sun Aug 1 14:20:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 490208 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FCB6C432BE for ; Sun, 1 Aug 2021 14:24:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4A437610D0 for ; Sun, 1 Aug 2021 14:24:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231791AbhHAOZA (ORCPT ); Sun, 1 Aug 2021 10:25:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231985AbhHAOY7 (ORCPT ); Sun, 1 Aug 2021 10:24:59 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91DB7C06175F for ; Sun, 1 Aug 2021 07:24:51 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id l34-20020a05600c1d22b02902573c214807so6719332wms.2 for ; Sun, 01 Aug 2021 07:24:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=THrbrie+Vh0KKkuFl0McSHXgJQC8/w5Pw5ZKEogEChI=; b=uzIh3+GxNBwfFMa3vVWWKSG3IxyJFCgXWDnfwm7lwW88dz1z4VuJHPGYi2MF0nu6k+ XiHMeyOfk8dFZUE9xT3/IM5uRbbzGvX9nBG1xWmKuR07yJGHIL6EF63BJcBbisZSovfq 1yBGiN0dA+inhq/rlgcxmSpGPpASkmNXO+vq/hqTSUAoXuGALswLwF1Qo5HO4X+19ySN tcVfyza5R7kcFzpKfdCwhECzblhXhGbR+sQB7xuW4mSsL8D3sbMVijHUR1/EPLTdgU/H inJiXkimfJH93MlqVW1DE1NkyPGMKUKzmmnBxxADGukQzKzS6FJM5hGA2bBkqx413fOJ o3Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=THrbrie+Vh0KKkuFl0McSHXgJQC8/w5Pw5ZKEogEChI=; b=gJnkFoKQrpfpXIpThxmAHy9hC0uP4JwjpGaAFjlwD18cuvR9NVA85iivxKxOh7BxnC 7FJvsjz1ptovEqrLD+fYykk0Epf8Jp7TZ41m5TzlRNlbJSZdW4F8oRxPQ5QEMRv+nun5 7JwRhsMI6DLfMZZZQvGu3Rf3q8vtpUWRP6JGLSzUSbSEa/fiPmKqJ2vuPc3RU9ku2QJF 05EWrO4+KH8OHZiwtTHwX90HsSoyLWrdP839zCuVltnGezxrwN/ka7/H6XCGI+seI0oS J8gkiTdbVgEJ2zR9Rj5j4dogArU4IRUOqPOatXIjEdiCy8da0Qijfqw2cB5fF87b58g/ bjFA== X-Gm-Message-State: AOAM533lCFiwrsRuAQ50HvpJfUp1XDvfAHb4YsHJyUh11I38QYg06yNX P+b4REaQnx3eQG2+9eIF/ZLTST75GqCPeQ== X-Google-Smtp-Source: ABdhPJwUai6IY/DbjwJ6GdV+UjgmPZepbaqtFsJjd8KmVd9nXrasUYuHL+2Huc0BdsPyotUp5fnPFg== X-Received: by 2002:a7b:c749:: with SMTP id w9mr12422390wmk.98.1627827889914; Sun, 01 Aug 2021 07:24:49 -0700 (PDT) Received: from ?IPv6:2003:ea:8f10:c200:9d9e:757:f317:c524? (p200300ea8f10c2009d9e0757f317c524.dip0.t-ipconnect.de. [2003:ea:8f10:c200:9d9e:757:f317:c524]) by smtp.googlemail.com with ESMTPSA id d67sm8944562wmd.9.2021.08.01.07.24.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Aug 2021 07:24:49 -0700 (PDT) Subject: [PATCH 05/10] i2c: i801: Improve is_dell_system_with_lis3lv02d From: Heiner Kallweit To: Jean Delvare Cc: "linux-i2c@vger.kernel.org" References: <7a1581de-7566-15da-d1af-08cbf8c5e46f@gmail.com> Message-ID: Date: Sun, 1 Aug 2021 16:20:19 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <7a1581de-7566-15da-d1af-08cbf8c5e46f@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Replace the ugly cast of the return_value pointer with proper usage. In addition use dmi_match() instead of open-coding it. Signed-off-by: Heiner Kallweit Reviewed-by: Jean Delvare --- drivers/i2c/busses/i2c-i801.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index d971ee20c..a6287c520 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1191,7 +1191,7 @@ static acpi_status check_acpi_smo88xx_device(acpi_handle obj_handle, kfree(info); - *((bool *)return_value) = true; + *return_value = obj_handle; return AE_CTRL_TERMINATE; smo88xx_not_found: @@ -1201,13 +1201,10 @@ static acpi_status check_acpi_smo88xx_device(acpi_handle obj_handle, static bool is_dell_system_with_lis3lv02d(void) { - bool found; - const char *vendor; + acpi_handle found = NULL; - vendor = dmi_get_system_info(DMI_SYS_VENDOR); - if (!vendor || strcmp(vendor, "Dell Inc.")) + if (!dmi_match(DMI_SYS_VENDOR, "Dell Inc.")) return false; - /* * Check that ACPI device SMO88xx is present and is functioning. * Function acpi_get_devices() already filters all ACPI devices @@ -1216,9 +1213,7 @@ static bool is_dell_system_with_lis3lv02d(void) * accelerometer but unfortunately ACPI does not provide any other * information (like I2C address). */ - found = false; - acpi_get_devices(NULL, check_acpi_smo88xx_device, NULL, - (void **)&found); + acpi_get_devices(NULL, check_acpi_smo88xx_device, NULL, &found); return found; } From patchwork Sun Aug 1 14:21:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 490207 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 308BFC4338F for ; Sun, 1 Aug 2021 14:24:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 179FE610A7 for ; Sun, 1 Aug 2021 14:24:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232001AbhHAOZB (ORCPT ); Sun, 1 Aug 2021 10:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232000AbhHAOZB (ORCPT ); Sun, 1 Aug 2021 10:25:01 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93CBEC0613D3 for ; Sun, 1 Aug 2021 07:24:53 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id i10-20020a05600c354ab029025a0f317abfso2411350wmq.3 for ; Sun, 01 Aug 2021 07:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=RtKvxFwfRPKLm7OELVP+Bl55ZgNk4VFlkYGAmJZWKok=; b=Nz4q8KOUvjdBeUWmUGzrqM1P/04dJGorbWgdAyFyHY1oavvVTLVhhIQRpJGvbDEmt5 J0rrRVtclopDvKQpzJdAq9paxRqyZCLv1ID6n4BTark1vKrwGEqGxZ/HzdBLSbD8rIHd NxYLAYjiNdCGGjk+1kc2o4DHnw+9Kn/DDDpp4YJskDtsM4UldH6zoN/o4ZpUJKonONEz PTTM3BXloOGzmb++iVKVWxDycUaHNubD+yfXOE1O172BT/vKiRmkWUHD2/0W3SAoXGip WSCsjIA6jnDjKIyHCz4nSv4tWZEl2NvMKeREaBDaGLt0uccqlg9M+IIXL33vzRj5rASZ QGxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RtKvxFwfRPKLm7OELVP+Bl55ZgNk4VFlkYGAmJZWKok=; b=NzM5qVCS+0AkYrDxShvng7qcCMypYJC2G/WoxgJamPaprpaFMcmzLG1Nqa2qBl976I 2KPXpuOeRf6AhqXpYQy2r3MBFWY5YUyqDYQ6b0xcwqQlkb0aNcvQ+DystNmigZHXy3m+ 0ZgesNVh4yBPhdc3WTcfb+w4F3uFNPLchedZOkIyPg4F9o1tfOkWk8leKlf9Kx71jYEW dD6oalLcEnljG0QM8IGWsZ81p8P3+yE5sOmI91ePIYK1O0RlB6FpouphKQxY3hv1/F51 7+0kRKuRa9CzqDst9R+LF2YwOnP8nWv8DQSKYEVF7B08V1IqJfiwbCrWTJFb2ynWpOww WMwg== X-Gm-Message-State: AOAM531VdhJ0Asgn8M05662j+Xq6fMmxrluYTEGB7Git9BIy0rG+IT87 3gvvoalG/EoOLAC2anbqvhKiJkK3j3TS3Q== X-Google-Smtp-Source: ABdhPJzBqdmgZb3GQXgIuKONOpMCP+IBhZvXBCM0NN9OIOq/IbdCBkLkcGlcgvJ/fkTrFYKL3xX1iw== X-Received: by 2002:a1c:1f10:: with SMTP id f16mr3106692wmf.140.1627827891987; Sun, 01 Aug 2021 07:24:51 -0700 (PDT) Received: from ?IPv6:2003:ea:8f10:c200:9d9e:757:f317:c524? (p200300ea8f10c2009d9e0757f317c524.dip0.t-ipconnect.de. [2003:ea:8f10:c200:9d9e:757:f317:c524]) by smtp.googlemail.com with ESMTPSA id a16sm8312093wrx.7.2021.08.01.07.24.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Aug 2021 07:24:51 -0700 (PDT) Subject: [PATCH 07/10] i2c: i801: Improve i801_acpi_probe/remove functions From: Heiner Kallweit To: Jean Delvare Cc: "linux-i2c@vger.kernel.org" References: <7a1581de-7566-15da-d1af-08cbf8c5e46f@gmail.com> Message-ID: <064c1f0b-9f79-3fb2-cac1-35ef26c33296@gmail.com> Date: Sun, 1 Aug 2021 16:21:54 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <7a1581de-7566-15da-d1af-08cbf8c5e46f@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org By using ACPI_HANDLE() the handler argument can be retrieved directly. Both address space handler functions check the handler argument and return an error if it's NULL. This allows to further simplify the code. Signed-off-by: Heiner Kallweit Reviewed-by: Jean Delvare Tested-by: Jean Delvare Reviewed-by: Mika Westerberg --- drivers/i2c/busses/i2c-i801.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 5b9eebc1c..5fa8dc1cb 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1633,31 +1633,22 @@ i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits, static int i801_acpi_probe(struct i801_priv *priv) { - struct acpi_device *adev; + acpi_handle ah = ACPI_HANDLE(&priv->pci_dev->dev); acpi_status status; - adev = ACPI_COMPANION(&priv->pci_dev->dev); - if (adev) { - status = acpi_install_address_space_handler(adev->handle, - ACPI_ADR_SPACE_SYSTEM_IO, i801_acpi_io_handler, - NULL, priv); - if (ACPI_SUCCESS(status)) - return 0; - } + status = acpi_install_address_space_handler(ah, ACPI_ADR_SPACE_SYSTEM_IO, + i801_acpi_io_handler, NULL, priv); + if (ACPI_SUCCESS(status)) + return 0; return acpi_check_resource_conflict(&priv->pci_dev->resource[SMBBAR]); } static void i801_acpi_remove(struct i801_priv *priv) { - struct acpi_device *adev; - - adev = ACPI_COMPANION(&priv->pci_dev->dev); - if (!adev) - return; + acpi_handle ah = ACPI_HANDLE(&priv->pci_dev->dev); - acpi_remove_address_space_handler(adev->handle, - ACPI_ADR_SPACE_SYSTEM_IO, i801_acpi_io_handler); + acpi_remove_address_space_handler(ah, ACPI_ADR_SPACE_SYSTEM_IO, i801_acpi_io_handler); } #else static inline int i801_acpi_probe(struct i801_priv *priv) { return 0; } From patchwork Sun Aug 1 14:22:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 490206 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69361C4320A for ; Sun, 1 Aug 2021 14:24:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E72A60F36 for ; Sun, 1 Aug 2021 14:24:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232000AbhHAOZE (ORCPT ); Sun, 1 Aug 2021 10:25:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232012AbhHAOZD (ORCPT ); Sun, 1 Aug 2021 10:25:03 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98FB7C06175F for ; Sun, 1 Aug 2021 07:24:54 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id k4so7412596wrc.0 for ; Sun, 01 Aug 2021 07:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=TmnI1DA9qy/cXtkHhmO57MjxX6J0GiS83vJ7Yq4S73s=; b=BuE7w4vmksI1OCz8kRN/pAWThkZ2l+bHRvXmyY7z3Zx2hdj+asV2Ytx3HXo+hXbXZG jx/20YsOTsp5+hHvZN7kc0f3BFTAgO+tfZ57grp0XrQztLYVFSRUWccbP+YBFxkOnhrO o66OkS9H+xgZVg5aGmFD4MBBlQmz0pSAukF237O3O7SWu9TjKxDxgjbdtp3bhhpzabsn eQJYFeMu9IJg4djpRhMf1v0eX0Hv/vMKtM+V4emQJ9U8U/c+FPF3J7RKA41iuuaZaa3E r4mRO1z/lYJykP0meQMeHLbAsebskQygHgzLHiL8PyVcW4MAEDhaysPYQX2+E/SS3uTD lTeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=TmnI1DA9qy/cXtkHhmO57MjxX6J0GiS83vJ7Yq4S73s=; b=KjQTV1tr0EYC17d37TVU7ct+vgC3rGIUCWyPfU3lWBuR8Hjt3nCnDNaivwNSC/LV+n ax/Hu6466G4XtbiAdoE/cVA4riW22qqcUPmTf7CM2fyfAdRrkrByzKxV+gf74Qc3aavK EIXwyvgduR6y9jeXc8C1mD/+ew6q+3EYvkyIuUVkT2kP2Mvx1AAXePV3CH7sWlUxPswt lgh1ZhwLyUpmLEYVftwOJ1fdBt4V6pnD8zUP+pNGoK9KjvM/jV56fv6p217PSqz5atzv x6WM1+Z2UY24vo68PKIiKGQev1wKNQviXDMzSOavqRwoac9w2oIJ3OtUQyycPyUGp8bM uXJw== X-Gm-Message-State: AOAM530X7dDM2jWDO8fnCd+YKWW0KKQYHG7fR9W08170JAEWISFrFg/C 9/Z2aZMlBCKh5Yz17yuYKEzlAPaThfuIYQ== X-Google-Smtp-Source: ABdhPJx05WiCO4BUyqCnP1ydy6klaSD2flBzJRCOPoPV3fNSnHeGDMoJS4kVU068CxjNx+BP8PGvNg== X-Received: by 2002:adf:d4c5:: with SMTP id w5mr12813393wrk.381.1627827892976; Sun, 01 Aug 2021 07:24:52 -0700 (PDT) Received: from ?IPv6:2003:ea:8f10:c200:9d9e:757:f317:c524? (p200300ea8f10c2009d9e0757f317c524.dip0.t-ipconnect.de. [2003:ea:8f10:c200:9d9e:757:f317:c524]) by smtp.googlemail.com with ESMTPSA id t8sm8573868wmj.5.2021.08.01.07.24.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Aug 2021 07:24:52 -0700 (PDT) Subject: [PATCH 08/10] i2c: i801: Improve i801_add_mux From: Heiner Kallweit To: Jean Delvare Cc: "linux-i2c@vger.kernel.org" References: <7a1581de-7566-15da-d1af-08cbf8c5e46f@gmail.com> Message-ID: <12a96946-c857-b6f8-9623-407b1c71d2c5@gmail.com> Date: Sun, 1 Aug 2021 16:22:31 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <7a1581de-7566-15da-d1af-08cbf8c5e46f@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The return value of i801_add_mux() isn't used, so let's change it to void. In addition remove the not needed cast to struct gpiod_lookup. GPIO_LOOKUP() uses GPIO_LOOKUP_IDX() that includes this cast. Signed-off-by: Heiner Kallweit Reviewed-by: Jean Delvare Tested-by: Jean Delvare --- drivers/i2c/busses/i2c-i801.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 5fa8dc1cb..958b2e14b 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1389,7 +1389,7 @@ static const struct dmi_system_id mux_dmi_table[] = { }; /* Setup multiplexing if needed */ -static int i801_add_mux(struct i801_priv *priv) +static void i801_add_mux(struct i801_priv *priv) { struct device *dev = &priv->adapter.dev; const struct i801_mux_config *mux_config; @@ -1398,7 +1398,7 @@ static int i801_add_mux(struct i801_priv *priv) int i; if (!priv->mux_drvdata) - return 0; + return; mux_config = priv->mux_drvdata; /* Prepare the platform data */ @@ -1414,13 +1414,11 @@ static int i801_add_mux(struct i801_priv *priv) struct_size(lookup, table, mux_config->n_gpios + 1), GFP_KERNEL); if (!lookup) - return -ENOMEM; + return; lookup->dev_id = "i2c-mux-gpio"; - for (i = 0; i < mux_config->n_gpios; i++) { - lookup->table[i] = (struct gpiod_lookup) - GPIO_LOOKUP(mux_config->gpio_chip, - mux_config->gpios[i], "mux", 0); - } + for (i = 0; i < mux_config->n_gpios; i++) + lookup->table[i] = GPIO_LOOKUP(mux_config->gpio_chip, + mux_config->gpios[i], "mux", 0); gpiod_add_lookup_table(lookup); priv->lookup = lookup; @@ -1438,8 +1436,6 @@ static int i801_add_mux(struct i801_priv *priv) gpiod_remove_lookup_table(lookup); dev_err(dev, "Failed to register i2c-mux-gpio device\n"); } - - return PTR_ERR_OR_ZERO(priv->mux_pdev); } static void i801_del_mux(struct i801_priv *priv) @@ -1469,7 +1465,7 @@ static unsigned int i801_get_adapter_class(struct i801_priv *priv) return class; } #else -static inline int i801_add_mux(struct i801_priv *priv) { return 0; } +static inline void i801_add_mux(struct i801_priv *priv) { } static inline void i801_del_mux(struct i801_priv *priv) { } static inline unsigned int i801_get_adapter_class(struct i801_priv *priv)