Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1362768lqd; Thu, 25 Apr 2024 13:12:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVmHxcEYYnUl+ardZ7Y+DgmWG4IfLu+jBjH6XU5REGqUwVp/ZtJC05THeVgKW5Ef36rsmaPTl5WbKlMzVCPlBC0XD23P6rI55wo7sGl/Q== X-Google-Smtp-Source: AGHT+IGEyvDtQ3YLtVpIWR4LjUfLnJGVpZsI71x34H3QY6BylCyXUUapdJpGo2U7TIj6gXNHOWw2 X-Received: by 2002:a17:902:784f:b0:1e9:9fdb:567d with SMTP id e15-20020a170902784f00b001e99fdb567dmr624950pln.68.1714075942940; Thu, 25 Apr 2024 13:12:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714075942; cv=pass; d=google.com; s=arc-20160816; b=I4syqqGNRtMczrv+c/yFEefh1GNBhrgRsNCpC5BtfPkVJ1khE+tqlyIN/nOeVEhRCW 2D700BtgKZhrKMMM2qw0tm9XRQIJoj+MXGqKr1Chx/k49MuoWA/KQlfrid8Q5YxHb6WO 2s2qF41iIBgtyQXt4ICDXsZd54XT0jFpUutH+F7bdQ8GxkI5QyhxsHzRQjcUlZxKNN4F DFMqMc/G1e1XIjHe4W2GJgJpc9eoNYU3ApT2vwzmHnTD43438gjB/0sCPw43bD4i8aDk wLupKO13+gSegZA5Y3m1f3MY0g3sgOoIdlhJMs9hevWc/zsYEgLkzspM+Pn+o35o6I3U r4Eg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=Irab9FZJkxiRm4B6CJmsTkrEJSP/m7NedIzibrlMs3s=; fh=h9nNuJWR4ctz4+GxKcJXmDY5jwsz2gCTobzLEpm29x4=; b=up0YiM6bmF3emMfujGTHHKGM2K300GC63+8ueupyYNpoB3SKufagno8Rr+Ux4tOHse SPcoWoMgbSx5JqdFONTOsaafNRMTj2QlYhZP/TpngN0sYOJs5c7tNk+C8GFfatCTtHCg lGIRNML4zPZtUmruyEgjvY8Hbe197yY9o1RGWr7C2uY0Ofr1X48WN2dg7Pd+i+jAd+As miX2fEK0rCufrl711nEjxznQMZ6SVr4hUP+mqiIS1QBS0XCaHsf7Bs2dK6K+wUlGmcHr bhxPwKidm/XMGNlLGTKRovpYTdvmjTeKpsE/dUQD3hssHiq4y8vhLp0S4DR14QfcNVpx Wslw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sh2AigTX; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-159103-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159103-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id mc15-20020a1709032b0f00b001e8f52124b0si11652871plb.52.2024.04.25.13.12.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 13:12:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159103-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sh2AigTX; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-159103-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159103-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3EE09286877 for ; Thu, 25 Apr 2024 20:12:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F15A6152E1C; Thu, 25 Apr 2024 20:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sh2AigTX" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 20454152516; Thu, 25 Apr 2024 20:12:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714075937; cv=none; b=fD7PZDgMY758/WW/+rnw4JD+AEnSIMDo8Ft/4BuvAvI4aqcAlj1Szgd5Nrvo1sM9LBEKn5etI8bncYiKrPtnwkFRKBpaO/rpjqrfWIsf+TOxJXqL+bCz66JFxoeCRMybl3uiH1i4BMsHB728bIda1i0VNnrC3t39tySchnVQYNI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714075937; c=relaxed/simple; bh=uzqhaKfS1s0sqE04vRFRHadopSwBj8lYISF5m8m7AzE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ahdg0Twhbd46B0ObuSNbLPe9zCItJqhB/dXfN9LBhkntqcx36++XIQ459Qmtxwd4wMW8i7Xo/B7ldfAGt3HWdRDJkHU4NdC3rgfnHPv2zPi1SxATSvx4JEsqGWBA6421iqV8g++T30QGEECtUwJ7rg2sX9ryLfV0JA/inS53Oes= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sh2AigTX; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C2D0C113CC; Thu, 25 Apr 2024 20:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714075936; bh=uzqhaKfS1s0sqE04vRFRHadopSwBj8lYISF5m8m7AzE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sh2AigTXt5NNpno9XyNGHCgvgfolk+A9ol4bxASJOaEydEJ4eDzMjxh3W/RFdAOM7 T9DDXbW7ZuuVb8EJTCUaEW/JpCA3Dd2ploLRN9YbGfln/CncG/X/UOXff8ApLnM3CA 3EIepIegDvx5r9QnghXXa7L/rKNuY2j/ejnfmCpF4L2EsfaqQ9amCGQ31fHRAT6LF1 WBLPfPuuHi6t6zkCgoxTOCUxYjLfcwXJi+bWr/LuHGRs721sZdPUDEQ02wXf4ui3oT ozd2/KdJlPabXCkX0IkdkU3/kwGBg3RNSB6AoAvD43l1wu3gVLXZq3EC2st0IaDqXv 0N8PiDkBJ6thg== Received: by pali.im (Postfix) id 0BFE970C; Thu, 25 Apr 2024 22:12:13 +0200 (CEST) Date: Thu, 25 Apr 2024 22:12:13 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Lyndon Sanche Cc: Matthew Garrett , Hans de Goede , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , 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 Message-ID: <20240425201213.apwdxazbdbjddtpr@pali> References: <20240425172758.67831-1-lsanche@lyndeno.ca> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240425172758.67831-1-lsanche@lyndeno.ca> User-Agent: NeoMutt/20180716 On Thursday 25 April 2024 11:27:57 Lyndon Sanche wrote: > +int thermal_init(void) > +{ > + int ret; > + int supported_modes; > + > + ret = thermal_get_supported_modes(&supported_modes); > + > + if (ret != 0 || supported_modes == 0) > + return -ENXIO; > + > + thermal_handler = kzalloc(sizeof(*thermal_handler), GFP_KERNEL); > + if (!thermal_handler) > + return -ENOMEM; > + thermal_handler->profile_get = thermal_platform_profile_get; > + thermal_handler->profile_set = 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 = { > .name = "platform::mute", > .max_brightness = 1, > @@ -2266,6 +2480,11 @@ static int __init dell_init(void) > mute_led_registered = true; > } > > + // Do not fail module if thermal modes not supported, > + // just skip > + if (thermal_init() != 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. > + > if (acpi_video_get_backlight_type() != acpi_backlight_vendor) > return 0;