Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6099855rwl; Mon, 9 Jan 2023 04:19:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXuwZvhx7pFhyvh50yXNenqKry3bvLw24M4vvyLY6Ne+1tLtRUydcSu98+Pe4VUl4S4vvV3/ X-Received: by 2002:a05:6a20:c78d:b0:a4:b615:2239 with SMTP id hk13-20020a056a20c78d00b000a4b6152239mr83062390pzb.24.1673266757725; Mon, 09 Jan 2023 04:19:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673266757; cv=none; d=google.com; s=arc-20160816; b=uAZzcOSp9okaZKeOOBqkCRgG74C6kbTTNj0KGAhJZ2d+DJQA6lOLnH2YcujA6b6Gf7 8oytdDzPB2UpeLghdg1pGFs3/B/pqEXzQ8w5J8Gg/sYYWBw5eLG5znZRaRYu9eBIEY9T 81g09j0gV5tCKqWe01kqn0eF5nOSf92c/qma1kmz9fl1gggcBaPGt7q0bWbCRhLTckLW f4NiC/nc8hwMqWyG4fRTMJSL2ipG6tjf5gWAZGvBeZCq+3mpJiiHiR9P+UkivDotZEaR h/yqkI0FmlG92eptK++tg2ABGNbpz+EOMTxD1czQpjPEy2Q9MzP8XlOSu5keJSHX125x mvYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=q4zLyIG7p1EQVcpYB9xbouaznWvWNmBJl4w7V/27n8I=; b=EozPdcxp6LlAXWUoJvhFqeLQRjGuK3ADnrXktlRy4z6CADqa4hgtywD0mNbDy2Fa1E WwNHMs9Ru30axexzzIa20rdtkZk0LDypY0Ab4aFc3VDFPd2rueZ0eMsley/KaTYxibjN /rj1hYT37CV4YIb3zuEFQ38jR7Bms9POwU9aUZxj+pyWVz4o/w/D0vw2pSB6hYhhhB8Z rPVDrxZWVnNUsRMb7oi2HjNPXJNmCQowGrGP1Ns4w/gPEunaPM9QT8bAN2zXQ3/utsMs 9tH65dBYR+24JDsx/wIF72QfD6DUHcctQYKSevQ38cyczCD1pP9MuTKKedE14ViGlnr9 q7VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CLlhK3Fc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a63b44a000000b004b32dddc071si3374403pgu.411.2023.01.09.04.19.11; Mon, 09 Jan 2023 04:19:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CLlhK3Fc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236418AbjAIMDz (ORCPT + 53 others); Mon, 9 Jan 2023 07:03:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237080AbjAIMDv (ORCPT ); Mon, 9 Jan 2023 07:03:51 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BEC91A208 for ; Mon, 9 Jan 2023 04:03:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673265782; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q4zLyIG7p1EQVcpYB9xbouaznWvWNmBJl4w7V/27n8I=; b=CLlhK3Fcu0M7LanOcaLb5TqSqNVt5dixjd09XHwRqiAdxgeyTZWvxevVjdTCgrbGm94moO kLK0Hj4kuEe401deMYeAnUOTv+1/j1a8Nn5jo+vCN8UddrdFk7Niy8uVAvVq3KNlHXclgS jqNHNmJq8AaxowCe6ErAqc1SaO/MnkY= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-187-UnhgApa6MCWoeEz_BaQCgg-1; Mon, 09 Jan 2023 07:03:00 -0500 X-MC-Unique: UnhgApa6MCWoeEz_BaQCgg-1 Received: by mail-ej1-f71.google.com with SMTP id dr5-20020a170907720500b00808d17c4f27so5227721ejc.6 for ; Mon, 09 Jan 2023 04:03:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=q4zLyIG7p1EQVcpYB9xbouaznWvWNmBJl4w7V/27n8I=; b=oBEK+sECzPoBgK4ynbsoxjNUOfuo1tBDcQXOtTcRqo3UaPblx2+Sxa+f03aKw0lC0e 9LEG4sXicnQsv0Gyzq27McBASJYK52nkeW6ztISKVzJQ4kpd8okiam6/5XLYhP7FaimA 1eioduvvASITeySOwJlKlAoj0GwfhIya0M2B1pYsxz14lIu5KrjHzLPH1CdM6rsnEpPU Hkk/Yx5ojsIBqx2nVVqUDA/AC4Q3Via+WEqXMDX5QxQyTlXPEIWPSSk4x3avf4WtSvhS iWjzN3OE10/SZMhUrfa3hxhIGX9z+XesA5wY4apm2P21AJZGrh6Bg011vtVfPsXlWRNn fmhw== X-Gm-Message-State: AFqh2krCprOf/z2xjhnMSuc+vZmPGr1NKPZXcIAo8eVArDN9cF5f3iX7 qNQ2wwmgsI9YszsZi9bND2BCj1VqOZTzxwIy53aWS8Lakp3BgTk+hV/h7dmNkI/+PquyyYjTkTz qVQqbwLQtQBDnk0SlFNJTd9dk X-Received: by 2002:a17:907:a0cc:b0:78d:f455:b5fa with SMTP id hw12-20020a170907a0cc00b0078df455b5famr54858189ejc.58.1673265779403; Mon, 09 Jan 2023 04:02:59 -0800 (PST) X-Received: by 2002:a17:907:a0cc:b0:78d:f455:b5fa with SMTP id hw12-20020a170907a0cc00b0078df455b5famr54858176ejc.58.1673265779238; Mon, 09 Jan 2023 04:02:59 -0800 (PST) Received: from ?IPV6:2001:1c00:c32:7800:5bfa:a036:83f0:f9ec? (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id c39-20020a509faa000000b00483cccdfeaesm3712742edf.38.2023.01.09.04.02.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Jan 2023 04:02:58 -0800 (PST) Message-ID: Date: Mon, 9 Jan 2023 13:02:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v4] i2c: designware: Fix unbalanced suspended flag Content-Language: en-US, nl To: Wolfram Sang , Richard Fitzgerald , jarkko.nikula@linux.intel.com, andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, jsd@semihalf.com, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com References: <20221219130145.883309-1-rf@opensource.cirrus.com> From: Hans de Goede In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 1/9/23 13:01, Wolfram Sang wrote: > On Mon, Dec 19, 2022 at 01:01:45PM +0000, Richard Fitzgerald wrote: >> Ensure that i2c_mark_adapter_suspended() is always balanced by a call to >> i2c_mark_adapter_resumed(). >> >> dw_i2c_plat_resume() must always be called, so that >> i2c_mark_adapter_resumed() is called. This is not compatible with >> DPM_FLAG_MAY_SKIP_RESUME, so remove the flag. >> >> Since the controller is always resumed on system resume the >> dw_i2c_plat_complete() callback is redundant and has been removed. >> >> The unbalanced suspended flag was introduced by commit c57813b8b288 >> ("i2c: designware: Lock the adapter while setting the suspended flag") >> >> Before that commit, the system and runtime PM used the same functions. The >> DPM_FLAG_MAY_SKIP_RESUME was used to skip the system resume if the driver >> had been in runtime-suspend. If system resume was skipped, the suspended >> flag would be cleared by the next runtime resume. The check of the >> suspended flag was _after_ the call to pm_runtime_get_sync() in >> i2c_dw_xfer(). So either a system resume or a runtime resume would clear >> the flag before it was checked. >> >> Having introduced the unbalanced suspended flag with that commit, a further >> commit 80704a84a9f8 >> ("i2c: designware: Use the i2c_mark_adapter_suspended/resumed() helpers") >> >> changed from using a local suspended flag to using the >> i2c_mark_adapter_suspended/resumed() functions. These use a flag that is >> checked by I2C core code before issuing the transfer to the bus driver, so >> there was no opportunity for the bus driver to runtime resume itself before >> the flag check. >> >> Signed-off-by: Richard Fitzgerald >> Fixes: c57813b8b288 ("i2c: designware: Lock the adapter while setting the suspended flag") >> Reviewed-by: Hans de Goede > > Does this fix a bug when runtime resuming? This is not clear to me. I > tend to put it to for-next rather than for-current. This fixes a system suspend/resume bug, so this really should go to for-current. Regards, Hans