From patchwork Wed May 11 15:12:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 571682 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 39463C43217 for ; Wed, 11 May 2022 15:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245580AbiEKPMr (ORCPT ); Wed, 11 May 2022 11:12:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245548AbiEKPMj (ORCPT ); Wed, 11 May 2022 11:12:39 -0400 Received: from mail-oa1-x29.google.com (mail-oa1-x29.google.com [IPv6:2001:4860:4864:20::29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99E175F8D0; Wed, 11 May 2022 08:12:38 -0700 (PDT) Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-ed8a3962f8so3174698fac.4; Wed, 11 May 2022 08:12:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lWVV90oYpi4dWYDQ2mZpGM9vUZygMcQs9ZQl2WC1Reo=; b=YMSModPq/NltiVm3CaGLRZJ5MvAnSy6N4eoa4dSUqfmOSzFgoOKcm3D3NcjIxBM+jP WD6+i7dU4d5OIi48RAhaspZ2VRTheb6NdyVbmwYEk64kIb32KgqJQ2LMKaWPu904Sh/q vO8K7Z0pF0OyKhfBZBNETu03BttIXSUaaeKAgD0uZV3UZdjoK8Y5UrdxhW270e8hU4jj vIlte5TKL3UukZvAb5pfHIlzZ5hlU5nKurwMvldxNGaHMPx4taux94vLtsJUmO8Ore0o mZjsnNILOZF06oS7QRyk1NfO2wM6wO1UVfk3SsHGMs6LWNDklWAL75Nh6VUSP22jTYnx fESQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=lWVV90oYpi4dWYDQ2mZpGM9vUZygMcQs9ZQl2WC1Reo=; b=hIv9MUkxbrxkUKVGYxFRGJzBNVyXSl7PJNshegKLfH15mFPxZ6LC+KQ3FN05RopHKE i6FNR685Ego229EQuamaeQRhiK3F6zt7gxWo55iQO4v8hAP84bQFTDgPJd7fKadk5hKg 6pqqUgjcohMFwgfD4PjNe9hkY9YryYPgLp0tr8kcfIxo8xDsJAoK+pmfWoT6WHlDemiq pcSNCV216lvdnBE4xF692rBBU34/3uPuVXx0mmXiin3FiOPWD1yUxk6WG/yS4JfcT1WP jesneedC7Z47qVXB8+BBIEtyic/h08pOv0DuLVecUCSrrgwzDDItFrkehHk/BTVyI5Mo JOpw== X-Gm-Message-State: AOAM533JVcGtcVdlSK0WFmb+PTjkyM6QmMcoUbvaN5oNTPX+t29pARCk nkzriTG16NdQuU3qhUhkh9o= X-Google-Smtp-Source: ABdhPJyZtfT41OEAJN7SYN5skLyaan98nvwQQQ/N3h5pVIAPPFAsizBEODUCEvyMM005MmhHpQoHRg== X-Received: by 2002:a05:6870:2301:b0:e2:d57e:1c22 with SMTP id w1-20020a056870230100b000e2d57e1c22mr3067987oao.244.1652281957985; Wed, 11 May 2022 08:12:37 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id t13-20020a4adbcd000000b0035eb4e5a6b8sm1006421oou.14.2022.05.11.08.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 08:12:37 -0700 (PDT) Sender: Guenter Roeck From: Guenter Roeck To: "Rafael J . Wysocki" Cc: Daniel Lezcano , Amit Kucheria , Zhang Rui , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Guenter Roeck Subject: [PATCH 2/3] thermal/drivers/thermal_hwmon: Use hwmon_device_register_for_thermal() Date: Wed, 11 May 2022 08:12:29 -0700 Message-Id: <20220511151230.2983227-3-linux@roeck-us.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220511151230.2983227-1-linux@roeck-us.net> References: <20220511151230.2983227-1-linux@roeck-us.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The thermal subsystem registers a hwmon device without providing chip information or sysfs attribute groups. While undesirable, it would be difficult to change. On the other side, it abuses the hwmon_device_register_with_info API by not providing that information. Use new API specifically created for the thermal subsystem instead to let us enforce the 'chip' parameter for other callers of hwmon_device_register_with_info(). Signed-off-by: Guenter Roeck --- drivers/thermal/thermal_hwmon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index ad03262cca56..09e49ec8b6f4 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -149,8 +149,8 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) INIT_LIST_HEAD(&hwmon->tz_list); strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH); strreplace(hwmon->type, '-', '_'); - hwmon->device = hwmon_device_register_with_info(&tz->device, hwmon->type, - hwmon, NULL, NULL); + hwmon->device = hwmon_device_register_for_thermal(&tz->device, + hwmon->type, hwmon); if (IS_ERR(hwmon->device)) { result = PTR_ERR(hwmon->device); goto free_mem; @@ -277,3 +277,5 @@ int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) return ret; } EXPORT_SYMBOL_GPL(devm_thermal_add_hwmon_sysfs); + +MODULE_IMPORT_NS(HWMON_THERMAL);