Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp934757pxb; Fri, 22 Apr 2022 14:44:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy79EpaWeTHoz8GgiwZlCHwVmgMnIeJ2s6Wm8avQE5+l+broQ2IcG22kZg95mCVZ9mHzwG7 X-Received: by 2002:a05:6a00:e14:b0:4fe:3cdb:23f with SMTP id bq20-20020a056a000e1400b004fe3cdb023fmr6917772pfb.86.1650663897497; Fri, 22 Apr 2022 14:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650663897; cv=none; d=google.com; s=arc-20160816; b=PlqnrYphL8TaRf+4GaEW7seQ1jydlR5mHcVr/PGHDqlh115a11KwvpAMq7JMU2fEoa c+ONvEC08OiNcI14tecPMHNABkXBJT8zysJUlNw2jZo/hc/umuikrvgaYfwsBroKBJJn 9GNdZvWucglzqTsk3y3vyy0qc5ImCfNg6D/yJDUQhdNonmbRBycgwP2tucGrJTtS3YhB plXOiwdx5P8CUTMbQRD515PI4ABDk9pfMzF11bkgYNNZc5LU2/IZBBaNidI2Vwt0VYhy F6aNWRKUjenlT8Cgphf816vPXe9Zuuv2QlxAxu0VWSAUZRCM69ndaC9vWrKVg/bdhcEO tZyg== 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:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:dkim-signature; bh=eBs7CZQL5YV7OnaTPtslbp1P80YDQjl3qZLiZzB1YUE=; b=hurBSkN7ddrTqdZ70DqsPKEvRdVxBE1MfYp/wll0K8cgAV0xMvvg4EUJHduQvhsED2 4DfOWnocbo+d2wyQ0oKImn/Kt73EKu1+oKaIUaCQA+DmzKStvIDLJDxZBAxg4gF97zYA JumqP/ZJjfGelJ2k82ii4oQsAo75EGEKJYnQOt2PMYkRyN5mo6f9VTY0+HBa2po2k7F1 OZHy3hAaaTSBtcqOnu1+6NORXA3DOethxtz+rmbCAQZ9WlAFM9jlPp8ci4SQZCcFVq9i KFZIK1MUJuD/degCH/l45EX+SQCuVEUCnTDbYlukopcrhl8aofT+pXpBAHY4nKQUYP6s mNdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="gyx4Xa/F"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t8-20020a170902e84800b00158b259cf77si9229081plg.169.2022.04.22.14.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:44:57 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="gyx4Xa/F"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 83E1C2DFD36; Fri, 22 Apr 2022 12:52:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358152AbiDSWDH (ORCPT + 99 others); Tue, 19 Apr 2022 18:03:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232898AbiDSWDG (ORCPT ); Tue, 19 Apr 2022 18:03:06 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E7443BA60; Tue, 19 Apr 2022 15:00:23 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id a10so56060oif.9; Tue, 19 Apr 2022 15:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=eBs7CZQL5YV7OnaTPtslbp1P80YDQjl3qZLiZzB1YUE=; b=gyx4Xa/FJorjPR7T0cDMuH4cSm9a+cnHXKf60tuvv8cj1sjXQhhz5v2LfVyH1GrqJJ TdHTKCFBNLOCt6DUPGakmdgTBYmu7z9C2yKMy3OQRC0YoxW6qtP5r1QOmAebTY+aoPM/ khD+KDZjWdvLTpwZ8xkxfj7VtlJw7Ntc/HdtkujRcAelOfF9oPzatxvXiRQl95C1BDAE bOW/UYm+hB74RDAlpscpp3ORnOqh2KH2GddLgqc1Dp5/6Bg7qdxkPao1eQKDFgBOFKbC 6ju8qFAsB4vyv8Nui1UeiFSSzTfYJmya9GTFExOCOpMa7coY9AHeys7xNqy/qJtgIzre hRIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=eBs7CZQL5YV7OnaTPtslbp1P80YDQjl3qZLiZzB1YUE=; b=LscLGedhUYom0eIb5YtHQ1TIH212+b9YcGEldodLkFWw9U2y4pYDf/lFCRAFsH6xdK qkEHCdBUBq1g7relvZ0muoFyqEhhDSJ4ESkoyh6wZ1RtxOm6ZxkZilR3/q7fw1iBLTrb uAMY/qKl8a/e8vr5Xyx167Lwkg/xduRKhfGWHyzId6fE7gBhpHZscmosAvanphCs2VHZ qVphFADXdjhO9MNrCuX884CaT9FXDrCjUnvzDlqDRaDOSrHPFaADF1dCbDl7nt/Foi1G MbIAZ4QvnH807aaWah1irMY97m9IpgJXg4f4WvcTnhsEL7ooRUBCdOZkLRE0MTE6SzTH b9Eg== X-Gm-Message-State: AOAM531CH7D09GYzO0A2QiDPIM5c2ecUlDwbgosORCuw6o5WatalhqIR lG0+89XtIqPewyaJUCK0js/h08KR5CY= X-Received: by 2002:aca:1117:0:b0:322:4189:8959 with SMTP id 23-20020aca1117000000b0032241898959mr316168oir.254.1650405622469; Tue, 19 Apr 2022 15:00:22 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id m65-20020acabc44000000b002ed13d0fe6fsm5512450oif.23.2022.04.19.15.00.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Apr 2022 15:00:21 -0700 (PDT) Sender: Guenter Roeck Message-ID: <734e748b-941c-5ae1-5140-22cc845bdfc1@roeck-us.net> Date: Tue, 19 Apr 2022 15:00:19 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] hwmod: (pmbus) disable PEC if not enabled Content-Language: en-US To: Adam Wujek Cc: Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220419205228.303952-1-dev_public@wujek.eu> From: Guenter Roeck In-Reply-To: <20220419205228.303952-1-dev_public@wujek.eu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 On 4/19/22 13:53, Adam Wujek wrote: > Explicitly disable PEC when the client does not support it. > Without the explicit disable, when the device with the PEC support is removed > later when a device without PEC support is inserted into the same address, > the driver uses the old value of client->flags which contains the I2C_CLIENT_PEC > flag. As a consequence the PEC is used when it should not. > How can that happen ? I would assume the I2C device gets deleted and re-created in that case, which should clear the PEC flag. Guenter > Signed-off-by: Adam Wujek > --- > drivers/hwmon/pmbus/pmbus_core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c > index 82c3754e21e3..f8ca36759b0a 100644 > --- a/drivers/hwmon/pmbus/pmbus_core.c > +++ b/drivers/hwmon/pmbus/pmbus_core.c > @@ -2014,6 +2014,8 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data, > ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY); > if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK)) > client->flags |= I2C_CLIENT_PEC; > + else > + client->flags &= ~I2C_CLIENT_PEC; > > pmbus_clear_faults(client); > > -- > 2.17.1 > >