From patchwork Sat Mar 4 21:31:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 659592 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37350C678D5 for ; Sat, 4 Mar 2023 21:37:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229455AbjCDVh6 (ORCPT ); Sat, 4 Mar 2023 16:37:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbjCDVh5 (ORCPT ); Sat, 4 Mar 2023 16:37:57 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A59E340F9 for ; Sat, 4 Mar 2023 13:37:55 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id j11so4325587edq.4 for ; Sat, 04 Mar 2023 13:37:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ZmoEBPg1RhiKMQ3ukhEU7raAFGZCe7vPRIf7lgCoJpo=; b=FhTQZlEzaVKDjgh0aQXBlX1DCQNr5zBuS2C3tqFJHPOn2ZsP1QTvYoGJGWcSrkuLQp Ku5mAjJpey0k1q1v8IoOpEsv4YlVlkLeZ4ZmRgGFDVjhssaWIUBc41mUgZsPVe4dHzWT 9QphkgvVu2h1fyC49cyVMG5gvAu7L5HbN6bH/tjADCRUS9AEqn3Vrh9nliOAbEC7gnq7 vzH6Tf/B/Xb1ZTBeYM6b00y3DxomnpPCbOEmYbYEV/oNBcmdh7r2Ji/YlyWH2MFGKupr ZKcM87LeJQZSJVrQavMfljIhFrg3JtTETsDrU6B/pFdR4ejb8WvbSZPwHdYeXKfEHPM0 JREw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZmoEBPg1RhiKMQ3ukhEU7raAFGZCe7vPRIf7lgCoJpo=; b=hHvjP25/rE5CmmBZBYMJci5JKpqMbgwOqWyarp0ANIFH5idb2NxPVjUqignFcwSSTl O8LXNY6y2qWgHAWCRPkpRkinNvHq96iMjtZtX9BZLqeT/AksdVMSrmrX5J/jKHSQQysk 1KadG4QoHX0fBG1u48OqcwsHmyKqCLnfkX1d1olY6ZMuD5Mtns0uaShrtd+xN0UN+hQL pgYpFsEDJS7qvxoP50CIY2iuEnKrKPzS/ECCM+Aq0uYU6WPOq28fUBHNWTtT6B17KaUO 8Xfy0GY8LCzPVXCxPDyy4RMrBIJTjEONjiz7NPMOoTG7J6LIi8SBMLlCectVuwyPilwc 4kHw== X-Gm-Message-State: AO0yUKVpzyXHiZ9ZDeUC8DwZCY7QTkzIB3vLwoVrH3azqVMK2FEXRbXV GVDrkvwdy/jTkXVcSqGAW34qsCfkuk4= X-Google-Smtp-Source: AK7set8fc2D5Duy/irTBBO4M+YT8PhoRSt/zSnRv2gXAFkckLVnsK8hTmDkJwPnCUMHwVRSJpDTOfA== X-Received: by 2002:a17:906:a3c2:b0:887:9a7f:4326 with SMTP id ca2-20020a170906a3c200b008879a7f4326mr5522353ejb.8.1677965873610; Sat, 04 Mar 2023 13:37:53 -0800 (PST) Received: from ?IPV6:2a01:c22:72de:8e00:a559:93c8:8a72:3308? (dynamic-2a01-0c22-72de-8e00-a559-93c8-8a72-3308.c22.pool.telefonica.de. [2a01:c22:72de:8e00:a559:93c8:8a72:3308]) by smtp.googlemail.com with ESMTPSA id dc23-20020a170906c7d700b008b17e55e8f7sm2436975ejb.186.2023.03.04.13.37.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Mar 2023 13:37:46 -0800 (PST) Message-ID: Date: Sat, 4 Mar 2023 22:31:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: [PATCH 1/4] i2c: i801: Use i2c_mark_adapter_suspended/resumed Content-Language: en-US From: Heiner Kallweit To: Jean Delvare Cc: "linux-i2c@vger.kernel.org" References: In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org When entering the shutdown/remove/suspend callbacks, at first we should ensure that transfers are finished and I2C core can't start further transfers. Use i2c_mark_adapter_suspended() for this purpose. Signed-off-by: Heiner Kallweit Reviewed-by: Andi Shyti --- drivers/i2c/busses/i2c-i801.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index ac5326747..d6a0c3b53 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1773,6 +1773,8 @@ static void i801_remove(struct pci_dev *dev) { struct i801_priv *priv = pci_get_drvdata(dev); + i2c_mark_adapter_suspended(&priv->adapter); + outb_p(priv->original_hstcnt, SMBHSTCNT(priv)); i801_disable_host_notify(priv); i801_del_mux(priv); @@ -1796,6 +1798,8 @@ static void i801_shutdown(struct pci_dev *dev) { struct i801_priv *priv = pci_get_drvdata(dev); + i2c_mark_adapter_suspended(&priv->adapter); + /* Restore config registers to avoid hard hang on some systems */ outb_p(priv->original_hstcnt, SMBHSTCNT(priv)); i801_disable_host_notify(priv); @@ -1807,6 +1811,7 @@ static int i801_suspend(struct device *dev) { struct i801_priv *priv = dev_get_drvdata(dev); + i2c_mark_adapter_suspended(&priv->adapter); outb_p(priv->original_hstcnt, SMBHSTCNT(priv)); pci_write_config_byte(priv->pci_dev, SMBHSTCFG, priv->original_hstcfg); return 0; @@ -1818,6 +1823,7 @@ static int i801_resume(struct device *dev) i801_setup_hstcfg(priv); i801_enable_host_notify(&priv->adapter); + i2c_mark_adapter_resumed(&priv->adapter); return 0; } From patchwork Sat Mar 4 21:33:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 658885 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FF45C678DB for ; Sat, 4 Mar 2023 21:38:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229556AbjCDVh7 (ORCPT ); Sat, 4 Mar 2023 16:37:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbjCDVh6 (ORCPT ); Sat, 4 Mar 2023 16:37:58 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B5FF4C03 for ; Sat, 4 Mar 2023 13:37:57 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id da10so23926804edb.3 for ; Sat, 04 Mar 2023 13:37:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=qRPpO6yXh0IkTHQKpLrAy/xC5GnYFGhT+3l0PShNvPg=; b=evRA0dswDSpbMSuBclCytREeaKtS8xQ1HNpBg8WUwXxpfFq+KnAVpr9Axs3YD5tK6d sUi0hEYCK3lVCKt0P4oEI6xZ73/gQgJLlrcUaCKgQV8ukXAWSzwO+gXsVtveQDkfZm+r 2d5p41n+yQKqKHgA4O8VaS0KduLnOX8LVueQeG10nlUORqT23q6TnFJWLAFkZSNcBMnf 0c7TqeKcrvAYqtYYh3mUXOdN3cDxdnVFhLkdfswpftrXllVWWDE09jAg8bXY/0Fo4Te6 gg5O97QpJ64JoEZu6o+M7coOedt7C54bQAG1YJVmNHCXEUcU26vJLkF0d8eaD4BTHagm /fsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qRPpO6yXh0IkTHQKpLrAy/xC5GnYFGhT+3l0PShNvPg=; b=T2TV19/foN0627GaeCJcF9VTCkELf8Ofqaqkjn+L1ncTvKAN6FC0iMkV89IgAsOBRx KZXdtEy2MHa5QZ6CYcEZ9PRVgSgnjQQJwyZejTe+fhKrL3qCd8J4gg02RRhajM2WKQ1R tdisLuWBlzO3xNTJ8TWJskJjo9xRhfaWPi+buckuqMn8o6xYqft9dGE0BeVLe1BzH4ry s/xWdf8MyN6fDP04I5hx6ofVxnjKhs1iPK1DWcvZGvF+ZOVG2BEjnZULI9r5jaG5Ip9g y8W1FbXZVTPMJIXlhXZYq9hnyBcjvMjN53g9wXexUPRj+q8OFW7TOSr9vKLQgPSZ8QdC LK9g== X-Gm-Message-State: AO0yUKVv1JIliyDTlZpUC/BN7s4EN8qnw+FKuLoCzrfRV6lkgke0XR6R Hwhqqko2W+KA5uLh6PtOCg8poMzEARU= X-Google-Smtp-Source: AK7set8ejFhXntBAc6Q5gYnRz3fP+t+3480/8T5IrwqocTjtxYbXMmC/PC+DM//8Rtw1uJGS/gosrw== X-Received: by 2002:a17:906:498e:b0:909:4a93:d9d2 with SMTP id p14-20020a170906498e00b009094a93d9d2mr6013211eju.2.1677965875643; Sat, 04 Mar 2023 13:37:55 -0800 (PST) Received: from ?IPV6:2a01:c22:72de:8e00:a559:93c8:8a72:3308? (dynamic-2a01-0c22-72de-8e00-a559-93c8-8a72-3308.c22.pool.telefonica.de. [2a01:c22:72de:8e00:a559:93c8:8a72:3308]) by smtp.googlemail.com with ESMTPSA id j22-20020a1709066dd600b008e6bd130b14sm2475602ejt.64.2023.03.04.13.37.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Mar 2023 13:37:54 -0800 (PST) Message-ID: <8f88906f-c7da-eb3a-2f14-0f4d46202517@gmail.com> Date: Sat, 4 Mar 2023 22:33:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: [PATCH 2/4] i2c: i801: Replace acpi_lock with I2C bus lock Content-Language: en-US From: Heiner Kallweit To: Jean Delvare Cc: "linux-i2c@vger.kernel.org" References: In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org I2C core ensures in i2c_smbus_xfer() that the I2C bus lock is held when calling the smbus_xfer callback. That's i801_access() in our case. I think it's safe in general to assume that the I2C bus lock is held when the smbus_xfer callback is called. Therefore I see no need to define an own mutex. Signed-off-by: Heiner Kallweit Reviewed-by: Andi Shyti --- drivers/i2c/busses/i2c-i801.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index d6a0c3b53..7641bd0ac 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -289,10 +289,9 @@ struct i801_priv { /* * If set to true the host controller registers are reserved for - * ACPI AML use. Protected by acpi_lock. + * ACPI AML use. */ bool acpi_reserved; - struct mutex acpi_lock; }; #define FEATURE_SMBUS_PEC BIT(0) @@ -871,11 +870,8 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, int hwpec, ret; struct i801_priv *priv = i2c_get_adapdata(adap); - mutex_lock(&priv->acpi_lock); - if (priv->acpi_reserved) { - mutex_unlock(&priv->acpi_lock); + if (priv->acpi_reserved) return -EBUSY; - } pm_runtime_get_sync(&priv->pci_dev->dev); @@ -916,7 +912,6 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, pm_runtime_mark_last_busy(&priv->pci_dev->dev); pm_runtime_put_autosuspend(&priv->pci_dev->dev); - mutex_unlock(&priv->acpi_lock); return ret; } @@ -1566,7 +1561,7 @@ i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits, * further access from the driver itself. This device is now owned * by the system firmware. */ - mutex_lock(&priv->acpi_lock); + i2c_lock_bus(&priv->adapter, I2C_LOCK_SEGMENT); if (!priv->acpi_reserved && i801_acpi_is_smbus_ioport(priv, address)) { priv->acpi_reserved = true; @@ -1586,7 +1581,7 @@ i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits, else status = acpi_os_write_port(address, (u32)*value, bits); - mutex_unlock(&priv->acpi_lock); + i2c_unlock_bus(&priv->adapter, I2C_LOCK_SEGMENT); return status; } @@ -1640,7 +1635,6 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) priv->adapter.dev.parent = &dev->dev; ACPI_COMPANION_SET(&priv->adapter.dev, ACPI_COMPANION(&dev->dev)); priv->adapter.retries = 3; - mutex_init(&priv->acpi_lock); priv->pci_dev = dev; priv->features = id->driver_data; From patchwork Sat Mar 4 21:36:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 659591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79882C678D5 for ; Sat, 4 Mar 2023 21:38:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229567AbjCDViB (ORCPT ); Sat, 4 Mar 2023 16:38:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbjCDViA (ORCPT ); Sat, 4 Mar 2023 16:38:00 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCC7E4C03 for ; Sat, 4 Mar 2023 13:37:59 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id cy23so23705644edb.12 for ; Sat, 04 Mar 2023 13:37:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=OkQOVstgTG2CpAyTsVjx/RO70rZF+cGmOO7FygJ4qqY=; b=mqldZ5sWRfFuofF8HN6XF9THjiW4GbehVBDhp/ieRfE/pPrKtm316dMLOxQZuCr+4P PZzYfgi/ccTVVKz4yP+Fk3T32fNhre/g299V6xqenJeIjp2LRamX+GSSdWGftGialE1m jzvd4usFaJUg89pIK02E1u6DhYCbqrkSccXci9+0Mr+dAQy6cC8c6M/zLfTgovcvi418 XBX40gSxcUlqtKaVsBSaMguKU8jsfFv1GhMpYy0HRvYwNw7qF7VWCs7gZQH+DRceSPZ5 lk32cmGNR26uxxCHFE9zd1UksAuNjO+QBhStXT/41oZpC8qZ8XZz8mbd4h8a0V9Ysa4U tSSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OkQOVstgTG2CpAyTsVjx/RO70rZF+cGmOO7FygJ4qqY=; b=DxMgT5hXhAgWCwrwna6697RMYIXpmPsfgWFshw/FJPl2b+gc9au8IlJQpEmGwIah1L +Hr3Q0iXGzpQIyK1Uw+SVkka0DNHHIThuvPgsk94lHVCNJQCgLaDIldDLaniLxemvzrO lrCQN6jrhfq+K2pXS5ePWRFTrYCkRjQD44V1ZWgk8E/ZaTyWcm9Vlr4G8Ao1UrSYFV7G JiaxUvXq+OrdbsO1rl3fUwfFdROaiBJg1mAxyk3CCcpL/KXat4flXc/LGxePHb6orZGk b7OSUxfU4em5RPCSdwmFBuUds08bLm6QWukeuUQm/zbTqkmoHJKvrFT/ervx8LdBbA1q iSug== X-Gm-Message-State: AO0yUKXaA8E5S/JxufCODdiuw1lIsr22u3jREbWcLF1gg3ifC0RDdceN 217jn5YdOFcII7fQ5pOtq0s= X-Google-Smtp-Source: AK7set9d5qzLbCu+rAsO3noC5AUV9xmMJuZPovVesDl+3OqwfYnZU+mmM9n6GFc1VSuB9C8rhkwFTg== X-Received: by 2002:a17:907:86a6:b0:84d:3403:f4f2 with SMTP id qa38-20020a17090786a600b0084d3403f4f2mr7844561ejc.62.1677965877634; Sat, 04 Mar 2023 13:37:57 -0800 (PST) Received: from ?IPV6:2a01:c22:72de:8e00:a559:93c8:8a72:3308? (dynamic-2a01-0c22-72de-8e00-a559-93c8-8a72-3308.c22.pool.telefonica.de. [2a01:c22:72de:8e00:a559:93c8:8a72:3308]) by smtp.googlemail.com with ESMTPSA id se9-20020a170906ce4900b008dd3956c2e3sm2452778ejb.183.2023.03.04.13.37.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Mar 2023 13:37:56 -0800 (PST) Message-ID: <6686b692-0caf-734e-18cd-7879810b29cd@gmail.com> Date: Sat, 4 Mar 2023 22:36:34 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: [PATCH 3/4] i2c: i801: Improve i801_block_transaction_byte_by_byte Content-Language: en-US From: Heiner Kallweit To: Jean Delvare Cc: "linux-i2c@vger.kernel.org" References: In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Here we don't have to write SMBHSTCNT in each iteration of the loop. Bit SMBHSTCNT_START is internally cleared immediately, therefore we don't have to touch the value of SMBHSTCNT until the last byte. Signed-off-by: Heiner Kallweit --- drivers/i2c/busses/i2c-i801.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 7641bd0ac..e1350a8cc 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -677,11 +677,11 @@ static int i801_block_transaction_byte_by_byte(struct i801_priv *priv, for (i = 1; i <= len; i++) { if (i == len && read_write == I2C_SMBUS_READ) smbcmd |= SMBHSTCNT_LAST_BYTE; - outb_p(smbcmd, SMBHSTCNT(priv)); if (i == 1) - outb_p(inb(SMBHSTCNT(priv)) | SMBHSTCNT_START, - SMBHSTCNT(priv)); + outb_p(smbcmd | SMBHSTCNT_START, SMBHSTCNT(priv)); + else if (smbcmd & SMBHSTCNT_LAST_BYTE) + outb_p(smbcmd, SMBHSTCNT(priv)); status = i801_wait_byte_done(priv); if (status) From patchwork Sat Mar 4 21:37:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 658884 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93E23C6FA8E for ; Sat, 4 Mar 2023 21:38:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229563AbjCDViD (ORCPT ); Sat, 4 Mar 2023 16:38:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbjCDViC (ORCPT ); Sat, 4 Mar 2023 16:38:02 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD3A3903F for ; Sat, 4 Mar 2023 13:38:01 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id g3so23938920eda.1 for ; Sat, 04 Mar 2023 13:38:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=hU5NrdF3UUoPMnrdKfubL7fnXLHwpbAzws99DuquZq8=; b=NuG6XR1nMI60feDYc2oupuzd7vR2i0YJ/49Z7RdnIDAFhJUjdLoQmrhDcvuhTtjHvl sR4zAf6xiJP6rtsD6Ysl/nyfhpwD9hQuGnxeZVnWwKsSXL8UCgU4QMDHAyNPgOPPBm0G 4byEo+g3yB23vY9z3d1b8W+Dpn5apHT5hz+SXcRXUffSouYlQERV6R68zXe+QahgpC1z xZutFl/gEtFrdKkAd077QWL4JcfEKdVvzww1T3catrQbMoQLtnCm9JeUiAfRnUh5mjRj 2WwEUL5oUyro+KOI3/i3ItxeJyFhr5hXWcmiVHpdZjGIc4HoWRfB71SiSPT+mLBUabM8 p/ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hU5NrdF3UUoPMnrdKfubL7fnXLHwpbAzws99DuquZq8=; b=F04o1d7h42M5P4nGWQx8V44KoIWcSuUtNNRGuPn6ZybWEN4PZvI6z9eUoHExjY72r8 VTxl69k8agyhSRpjBmrPc6nU/OD2UKpgxQo5b7alcEDKntj3Q3GtbIKvL25aca8HLS3f 3BmmlIVA5iSsW+QO3loCJ0th08xddmXDRVE5jm+KVqr5117H9Ud6fpd7Sxfud5VVqnsx 4LhxUpbqO5jFtknY0d6IJ2Lp+KOYYaNaVHnfzWL1S5kv2kY7oONCh2pNwb+GDmlmk0Px LlS16Qe85FVoiFdEi9LvFrhP22ZbxD+EvqPF032PbcL+0J+MJmMt5LlENZ7IMMOtkkK7 BDQg== X-Gm-Message-State: AO0yUKXf9DmKJcytIomC6r5vdvyKqLfNVgTBjFKdgyABPqYIzGsoM4ej lwr7TfUsjlLC6EFcufQisw/d2EhzT5o= X-Google-Smtp-Source: AK7set+/dNrOOPcUDkT7g6XJe2IWBZxTIS1xE4qz7zoMv3bNBt/I9CBrfeBAVbXV3fMei8FmoeVRFw== X-Received: by 2002:a17:907:6eab:b0:7c0:efb9:bc0e with SMTP id sh43-20020a1709076eab00b007c0efb9bc0emr7881516ejc.62.1677965879742; Sat, 04 Mar 2023 13:37:59 -0800 (PST) Received: from ?IPV6:2a01:c22:72de:8e00:a559:93c8:8a72:3308? (dynamic-2a01-0c22-72de-8e00-a559-93c8-8a72-3308.c22.pool.telefonica.de. [2a01:c22:72de:8e00:a559:93c8:8a72:3308]) by smtp.googlemail.com with ESMTPSA id si7-20020a170906cec700b008e68d2c11d8sm2447601ejb.218.2023.03.04.13.37.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Mar 2023 13:37:58 -0800 (PST) Message-ID: <1de49847-bb13-38b1-2820-15a7aa0fcb9a@gmail.com> Date: Sat, 4 Mar 2023 22:37:34 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: [PATCH 4/4] i2c: i801: Switch to new macro DEFINE_SIMPLE_DEV_PM_OPS Content-Language: en-US From: Heiner Kallweit To: Jean Delvare Cc: "linux-i2c@vger.kernel.org" References: In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org By using the newer macro DEFINE_SIMPLE_DEV_PM_OPS we can get rid of the conditional compiling. Signed-off-by: Heiner Kallweit Reviewed-by: Andi Shyti Reviewed-by: Jean Delvare --- drivers/i2c/busses/i2c-i801.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index e1350a8cc..bd2349768 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1800,7 +1800,6 @@ static void i801_shutdown(struct pci_dev *dev) pci_write_config_byte(dev, SMBHSTCFG, priv->original_hstcfg); } -#ifdef CONFIG_PM_SLEEP static int i801_suspend(struct device *dev) { struct i801_priv *priv = dev_get_drvdata(dev); @@ -1821,9 +1820,8 @@ static int i801_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(i801_pm_ops, i801_suspend, i801_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(i801_pm_ops, i801_suspend, i801_resume); static struct pci_driver i801_driver = { .name = DRV_NAME, @@ -1832,7 +1830,7 @@ static struct pci_driver i801_driver = { .remove = i801_remove, .shutdown = i801_shutdown, .driver = { - .pm = &i801_pm_ops, + .pm = pm_sleep_ptr(&i801_pm_ops), .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, };