From patchwork Wed Aug 10 05:26:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zev Weiss X-Patchwork-Id: 12940235 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 6CA7BC00140 for ; Wed, 10 Aug 2022 05:26:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229986AbiHJF05 (ORCPT ); Wed, 10 Aug 2022 01:26:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229636AbiHJF04 (ORCPT ); Wed, 10 Aug 2022 01:26:56 -0400 Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [71.19.156.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9FAD785A0 for ; Tue, 9 Aug 2022 22:26:54 -0700 (PDT) Received: from hatter.bewilderbeest.net (97-113-235-229.tukw.qwest.net [97.113.235.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id 53851344; Tue, 9 Aug 2022 22:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1660109214; bh=CC7nntUX8aC+aGxK3LnvD+EzTXAtWc+ZtVg5B0tO35Q=; h=From:To:Cc:Subject:Date:From; b=cxSrSJJWHYUbTTRTqFmpSSSKB5UWQ4jd4biI3irWvW5hLE010+JeOfx6XdPpzhI/p TtXMUkHOe6N8OBxcc+bkPW6wPDHqpwgvqFURxW9rrAEfKD1+Vx59fvdK2OU0Zl9Ffu l+ojgqEssY3Ba1C3glLaJu58wfug9qx/EuWKuh6I= From: Zev Weiss To: linux-hwmon@vger.kernel.org, Guenter Roeck Cc: Jean Delvare , linux-kernel@vger.kernel.org, Zev Weiss , =?utf-8?b?Wm9sdMOhbiBLxZF2w6Fnw7M=?= , stable@kernel.org Subject: [PATCH] hwmon: (nct6775) Fix platform driver suspend regression Date: Tue, 9 Aug 2022 22:26:46 -0700 Message-Id: <20220810052646.13825-1-zev@bewilderbeest.net> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Commit c3963bc0a0cf ("hwmon: (nct6775) Split core and platform driver") introduced a slight change in nct6775_suspend() in order to avoid an otherwise-needless symbol export for nct6775_update_device(), replacing a call to that function with a simple dev_get_drvdata() instead. Though the exact details of how this happens aren't yet fully known, it turns out that this breaks suspend/resume in at least some circumstances. To fix this (possibly only temporarily until the problem is better understood), just add the symbol export and return to using nct6775_update_device() as was employed previously. Reported-by: Zoltán Kővágó Tested-by: Zoltán Kővágó Fixes: c3963bc0a0cf ("hwmon: (nct6775) Split core and platform driver") Cc: stable@kernel.org Signed-off-by: Zev Weiss --- drivers/hwmon/nct6775-core.c | 3 ++- drivers/hwmon/nct6775-platform.c | 2 +- drivers/hwmon/nct6775.h | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c index 446964cbae4c..da9ec6983e13 100644 --- a/drivers/hwmon/nct6775-core.c +++ b/drivers/hwmon/nct6775-core.c @@ -1480,7 +1480,7 @@ static int nct6775_update_pwm_limits(struct device *dev) return 0; } -static struct nct6775_data *nct6775_update_device(struct device *dev) +struct nct6775_data *nct6775_update_device(struct device *dev) { struct nct6775_data *data = dev_get_drvdata(dev); int i, j, err = 0; @@ -1615,6 +1615,7 @@ static struct nct6775_data *nct6775_update_device(struct device *dev) mutex_unlock(&data->update_lock); return err ? ERR_PTR(err) : data; } +EXPORT_SYMBOL_GPL(nct6775_update_device); /* * Sysfs callback functions diff --git a/drivers/hwmon/nct6775-platform.c b/drivers/hwmon/nct6775-platform.c index ab30437221ce..41c97cfacfb8 100644 --- a/drivers/hwmon/nct6775-platform.c +++ b/drivers/hwmon/nct6775-platform.c @@ -359,7 +359,7 @@ static int __maybe_unused nct6775_suspend(struct device *dev) { int err; u16 tmp; - struct nct6775_data *data = dev_get_drvdata(dev); + struct nct6775_data *data = nct6775_update_device(dev); if (IS_ERR(data)) return PTR_ERR(data); diff --git a/drivers/hwmon/nct6775.h b/drivers/hwmon/nct6775.h index 93f708148e65..be41848c3cd2 100644 --- a/drivers/hwmon/nct6775.h +++ b/drivers/hwmon/nct6775.h @@ -196,6 +196,8 @@ static inline int nct6775_write_value(struct nct6775_data *data, u16 reg, u16 va return regmap_write(data->regmap, reg, value); } +struct nct6775_data *nct6775_update_device(struct device *dev); + bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg); int nct6775_probe(struct device *dev, struct nct6775_data *data, const struct regmap_config *regmapcfg);