Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1370602lqd; Thu, 25 Apr 2024 13:29:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVc77nFkkxPRcs26V6fdQwMP00871oEvjRyRTOSaGxuAp/m8BAoOXi95xm9xh1sPTfQFbqpoj6ULvJ9k/z3MoW5hR5DhoqH8pwmnfGTPg== X-Google-Smtp-Source: AGHT+IFQXALcyFU1B/GyGUomHibR5PnzYTcgs5RuPviWM5p9rpdDawgDa+/ep9FiIRUkNZvL1/mm X-Received: by 2002:a19:434a:0:b0:519:5fb9:5a4e with SMTP id m10-20020a19434a000000b005195fb95a4emr359239lfj.40.1714076955859; Thu, 25 Apr 2024 13:29:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714076955; cv=pass; d=google.com; s=arc-20160816; b=k3ycwH5KWwZUcTrNtGsEbNoa33zraUtfh0F1pGJngdJ+L8hnioPZrFpilxFc11eE/g BjU9cJl9HIcX1BUDZKuF7SLLvcCEsGh/ohvoup2FBifQkyQrZan2EiSEXZ4CJdVPy2bQ 2G3vzNw9vfpgef64a8axq+iWWKJT2UP+hzay3NFG4/MumoWsfIDgaoxRwEIVZcKxody/ dogKJE1mVmQ0qrdV3V0/cDiGe3FJ16bN2guNGNfke555dpsbS+h+AdvxF7MLbcRCzgxl OLNXlnXmcV3shsAtSR6Trx66fIuvE9fjuXRGAAWizD1JvMAk6PQatOThnZ+tFa0MDDKU NuiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:subject:cc:to:from:date:references :in-reply-to:message-id:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:user-agent:feedback-id:dkim-signature :dkim-signature; bh=zXPU98xIFonWd2oKiecGlx8Xw7dR9ggDvf74tP8NE2I=; fh=dzmz719k8sFmT8mjavrPUIkdf1AasEatlw3HG35j1rM=; b=Vp2FebZPoquOUfi+3xvObq5I9GtX4azxiEIinDXxusX1b63buSeRzQOeOVIdFIQk6v ba1wBFybU2l2mB8YBD6bzXQ2aKMcwABVte4EnAR3tIBSVPlr7emyfTarMT3DTJiv81oQ Vu01t6vmjLGwEZNj37JioQq1vPGrQ4cq8ZH6gk53Zb1QOjXjQHgEVW3vxh5g/WN2XgEz YNeLA4hxp4pAPP86k7OAwv4Ynmrlvii3imgKkonoelxte2M/NU+pKFF752vbREfm+0FO qdvvkfrbf50EzA86BUilBgcEbRgWJAXJaBSA6YdzZHORSC2mcmbl+w4INLN6SAmpBKn/ ExoQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lyndeno.ca header.s=fm2 header.b="O/n3A6gN"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=PXJZFKg4; arc=pass (i=1 spf=pass spfdomain=lyndeno.ca dkim=pass dkdomain=lyndeno.ca dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=lyndeno.ca); spf=pass (google.com: domain of linux-kernel+bounces-159136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lyndeno.ca Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s11-20020a170906060b00b00a5555b468b9si9671118ejb.177.2024.04.25.13.29.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 13:29:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@lyndeno.ca header.s=fm2 header.b="O/n3A6gN"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=PXJZFKg4; arc=pass (i=1 spf=pass spfdomain=lyndeno.ca dkim=pass dkdomain=lyndeno.ca dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=lyndeno.ca); spf=pass (google.com: domain of linux-kernel+bounces-159136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lyndeno.ca Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2BE2E1F21706 for ; Thu, 25 Apr 2024 20:29:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBB14153812; Thu, 25 Apr 2024 20:27:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lyndeno.ca header.i=@lyndeno.ca header.b="O/n3A6gN"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="PXJZFKg4" Received: from wfout6-smtp.messagingengine.com (wfout6-smtp.messagingengine.com [64.147.123.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F09EB1534E6; Thu, 25 Apr 2024 20:27:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714076877; cv=none; b=GsP0+LkQTkJ8mzYpVS9dVxNvHL+O5xCst3VClDvZi6Jpeb+UcTZs39ZJBzNbW3ub0Wpvw5PvIVt/PgjkLh4JysWNAabYHXI2R9SAO6AxXqCfbNTiSMN7HiSHiSQyNamYuz64Dh4H30QWqCzs743TgcVcwZoyDBDusAtHSUqQPLk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714076877; c=relaxed/simple; bh=0hvitMNES5HdanLiWjeyAzACH8peCKF8XQu82Szogd0=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=DXCoC8U+aEZKCeGovcnGiYDmmE9b4Q60si2kp/WaWCWUOQWqXaE+r1oz9nRXmBi92niDWTwnNoaukt1RpZb7Yy0+dmmVMzCQAYntvu/VPfp4bc0CQNa2krbbyUcY6xknJo0QhCBxoZ3EW2h/Ww8Mjnc7SRoeDGQzH2242TfdqN4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lyndeno.ca; spf=pass smtp.mailfrom=lyndeno.ca; dkim=pass (2048-bit key) header.d=lyndeno.ca header.i=@lyndeno.ca header.b=O/n3A6gN; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=PXJZFKg4; arc=none smtp.client-ip=64.147.123.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lyndeno.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lyndeno.ca Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.west.internal (Postfix) with ESMTP id 413EB1C00119; Thu, 25 Apr 2024 16:27:54 -0400 (EDT) Received: from imap52 ([10.202.2.102]) by compute5.internal (MEProxy); Thu, 25 Apr 2024 16:27:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lyndeno.ca; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1714076873; x=1714163273; bh=zXPU98xIFonWd2oKiecGlx8Xw7dR9ggDvf74tP8NE2I=; b= O/n3A6gNIiYzQJZuxU/EfqENSb8MDLTwfWpmUffHbo/XO9H/ZXOkAXJZa5M2uHiw KPJZcYA8JMSgZLGL7M51AxIRw5VFxy4teLOe0/nYC2YZBqK6hMu0WDimNCBbRLTk 7RJPFphiEVyHlQavmtoquHXMsClAnu7KT4kM9bXb8knUwZw+W6F15B6ukBvSJhGA bw2SB+aEA7Ghvct6ZWOfFg6MC3I9v6Fg0WmmEIv7coDiD1x4OpOVBwaLrRfsnrpY rEsOMjmGNMV1DPIngE5ZpyMW76gONr5o56gJ19q0ZKAUHmS8Cf4ceEFD9FgXyx8H t/27+zE2dYa2a9cYXMlmxg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1714076873; x= 1714163273; bh=zXPU98xIFonWd2oKiecGlx8Xw7dR9ggDvf74tP8NE2I=; b=P XJZFKg42LtIGnRd/3n2smH2N0gHrSw7GOCpy72l+7qqJi82lR1Hj4RT2gRdFtyL3 zEjDoGLNQNm3MokNVVuX5Norzaj8FNnqoN/snL4SNq0znIKbubm7Rrs2EOHM53Lw xGm49+lI5y+bIxNc9Q0DotKLFZ4iRdwKELo0pwjZ7hi0jL1R0ksgX6D3BV0QOJcl nk+XJd+5qQVPofpkb7PEAv6tBOlLiTm5A1Tjg1e8x4eCYp4DVzSSRZAe1D4wKsJU zD7kzDAzszr42AqH9nIWuCmBeTgn0Y6NVAWvZMnfOxrbUvydV54+f/QWY3xne1qn 6rwHelz+herVsP0LXzgTw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeljedgudehtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedf nfihnhguohhnucfurghntghhvgdfuceolhhsrghntghhvgeslhihnhguvghnohdrtggrqe enucggtffrrghtthgvrhhnpeehfefgveejieevvdekgfeftddugfetgfetueelieduffet ieelheetieevvdefkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehlshgrnhgthhgvsehlhihnuggvnhhordgtrg X-ME-Proxy: Feedback-ID: i1719461a:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 0D0A8C60097; Thu, 25 Apr 2024 16:27:52 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-386-g4cb8e397f9-fm-20240415.001-g4cb8e397 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: In-Reply-To: <20240425201213.apwdxazbdbjddtpr@pali> References: <20240425172758.67831-1-lsanche@lyndeno.ca> <20240425201213.apwdxazbdbjddtpr@pali> Date: Thu, 25 Apr 2024 14:27:32 -0600 From: "Lyndon Sanche" To: =?UTF-8?Q?Pali_Roh=C3=A1r?= Cc: "Matthew Garrett" , "Hans de Goede" , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Dell.Client.Kernel@dell.com Subject: Re: [PATCH] platform/x86: dell-laptop: Implement platform_profile Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, Apr 25, 2024, at 2:12 PM, Pali Roh=C3=A1r wrote: > On Thursday 25 April 2024 11:27:57 Lyndon Sanche wrote: >> +int thermal_init(void) >> +{ >> + int ret; >> + int supported_modes; >> + >> + ret =3D thermal_get_supported_modes(&supported_modes); >> + >> + if (ret !=3D 0 || supported_modes =3D=3D 0) >> + return -ENXIO; >> + >> + thermal_handler =3D kzalloc(sizeof(*thermal_handler), GFP_KERNEL); >> + if (!thermal_handler) >> + return -ENOMEM; >> + thermal_handler->profile_get =3D thermal_platform_profile_get; >> + thermal_handler->profile_set =3D thermal_platform_profile_set; >> + >> + if ((supported_modes >> DELL_QUIET) & 1) >> + set_bit(PLATFORM_PROFILE_QUIET, thermal_handler->choices); >> + if ((supported_modes >> DELL_COOL_BOTTOM) & 1) >> + set_bit(PLATFORM_PROFILE_COOL, thermal_handler->choices); >> + if ((supported_modes >> DELL_BALANCED) & 1) >> + set_bit(PLATFORM_PROFILE_BALANCED, thermal_handler->choices); >> + if ((supported_modes >> DELL_PERFORMANCE) & 1) >> + set_bit(PLATFORM_PROFILE_PERFORMANCE, thermal_handler->choices); >> + >> + platform_profile_register(thermal_handler); >> + >> + return 0; >> +} >> + >> +void thermal_cleanup(void) >> +{ >> + platform_profile_remove(); >> + kfree(thermal_handler); >> +} >> + >> static struct led_classdev mute_led_cdev =3D { >> .name =3D "platform::mute", >> .max_brightness =3D 1, >> @@ -2266,6 +2480,11 @@ static int __init dell_init(void) >> mute_led_registered =3D true; >> } >> =20 >> + // Do not fail module if thermal modes not supported, >> + // just skip >> + if (thermal_init() !=3D 0) >> + pr_warn("Unable to setup platform_profile, skipping"); > > I think that -ENOMEM error should be failure of the loading the driver. > It does not make sense to continue of memory allocation failed. > > On the other hand when the thermal modes are not support (e.g. old > Latitude models) then there should not be a warning message. It is > expected that on systems without thermal modes the setup fails. Thank you for your feedback. I agree with your suggestion. -ENOMEM would indicate something bigger is= amiss. I can add a check: If -ENOMEM, fail driver. If anything other error, skip, but do not show a message. Lyndon