Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp324119pxb; Fri, 22 Apr 2022 01:25:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGYZy2kj/K+Hf0fvzhnd6hSoKEqfJaKJyuIxi9VXDVPQLv7485XWd8fw7dqsEA6iWohED7 X-Received: by 2002:a17:907:7208:b0:6ef:6ca5:2daa with SMTP id dr8-20020a170907720800b006ef6ca52daamr3025585ejc.405.1650615916476; Fri, 22 Apr 2022 01:25:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650615916; cv=none; d=google.com; s=arc-20160816; b=fZ/ax6KWLQipsoKy3i69oHG7Zy3wVLNNS4hHhSPQl1ym0USx2cXC+ES64vnlC7A0CJ jphvoNT7Vi5S/9uEhSnER5chPvKXUurqj8A/R9LSjsdYK/rmaVwPniEX2OiewFYF8eTD 5MbUKvwYg2rdqwnH8LBmvbNGd4Ncdr1czgOi4ajgRNG87ln+74tvtu7vk3/uOSMfUxez VBADrFdYW79DbNe51AIB1dnPuO4+P794sAtXf3F2KACb2wrwtUYubcDuyLeQyMn7ogye geq8Y742oNW9OkSbXqRLGpEFvQPkOT/Ac8fKx5sHTV+pJ3xwkfdp9GvMLHNRKmZs5U31 jkow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :feedback-id:message-id:subject:reply-to:cc:from:dkim-signature:date; bh=n6zmsaqdCt4kKxEu/G00u+G6nFOZOq6snSec48Ro65U=; b=GbP781T8Na7FgYuFq+38zxspoY0NSBMg/w4rgTgF/M+kKg8AkpHEeEgM/gKCwbiLE0 gy4qsBPEpHyJNOm6yWOuH7rId/Xc8ux62fWfAPTTp0cKxslDvhy12xJ9o1ucr8GqTyWZ vSfZDjOOkHUmUm1oasEX/1SGnLaVH0O/hWOS79LQuXi8pp+PiCRYQfn3KXZ3QjxQ1F12 J5UhxjZcwKWVGF7TGQmf+fa2vAUAlZ5jAFXgAxdsJjHh5FLDZLvVI7lsETgNOMt+l8vC 0ogSIuAGkr9/wnFRyNAp6WWqrz0MqabVlUDIR/QkfJjLuewtmb6HMVeluRoYHccK5wNW doKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wujek.eu header.s=protonmail2 header.b=vgZv9S6G; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z7-20020a1709060f0700b006e00177759csi5865313eji.885.2022.04.22.01.24.50; Fri, 22 Apr 2022 01:25:16 -0700 (PDT) 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=fail header.i=@wujek.eu header.s=protonmail2 header.b=vgZv9S6G; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357800AbiDSU4A (ORCPT + 99 others); Tue, 19 Apr 2022 16:56:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357792AbiDSUz7 (ORCPT ); Tue, 19 Apr 2022 16:55:59 -0400 Received: from mail-0201.mail-europe.com (mail-0201.mail-europe.com [51.77.79.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD1AC3EF2A for ; Tue, 19 Apr 2022 13:53:13 -0700 (PDT) Date: Tue, 19 Apr 2022 20:53:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wujek.eu; s=protonmail2; t=1650401589; bh=n6zmsaqdCt4kKxEu/G00u+G6nFOZOq6snSec48Ro65U=; h=Date:From:Cc:Reply-To:Subject:Message-ID:Feedback-ID:From:To:Cc: Date:Subject:Reply-To:Feedback-ID:Message-ID; b=vgZv9S6G4tHoUPR7I65J+UFMD+91LA2wstHK3xACdttBTl+8ENujETD3iuZHOx+w2 bF+TMwz0LSJeKgNbpm3uX11fcKQz+8auSj85YqQ7+Jf+/F3CUJioC52fz5QiAlsUMM tK68ORZe0Q+gPfA8LpsTQVzGydwiyXFIUnuZuCC21JNOk/CprTktgGLIZtfhApJNSS iUvoK8fkjNcCmtNZK+EUUZL9zzfsCAI08vZCznNM2fEFs4NHxjYJldt2EZllQTAtRv 26WXE56f1sECE0jeSSNs3MID++1DWeH1oV83ngOlHs42or2fioiLBfU5iH9jhJZ6uo HiSY8gQyixY8w== From: Adam Wujek Cc: Adam Wujek , Guenter Roeck , Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Adam Wujek Subject: [PATCH] hwmod: (pmbus) disable PEC if not enabled Message-ID: <20220419205228.303952-1-dev_public@wujek.eu> Feedback-ID: 23425257:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MISSING_HEADERS,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Explicitly disable PEC when the client does not support it. Without the explicit disable, when the device with the PEC support is remov= ed 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_CLIEN= T_PEC flag. As a consequence the PEC is used when it should not. 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_c= ore.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 *clien= t, struct pmbus_data *data, =09ret =3D i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY); =09if (ret >=3D 0 && (ret & PB_CAPABILITY_ERROR_CHECK)) =09=09client->flags |=3D I2C_CLIENT_PEC; +=09else +=09=09client->flags &=3D ~I2C_CLIENT_PEC; =09pmbus_clear_faults(client); -- 2.17.1