From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C102BC4742C for ; Mon, 16 Nov 2020 11:59:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9D292224B for ; Mon, 16 Nov 2020 11:59:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=protonmail.com header.i=@protonmail.com header.b="yGm+dERn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728810AbgKPKmC (ORCPT ); Mon, 16 Nov 2020 05:42:02 -0500 Received: from mail-02.mail-europe.com ([51.89.119.103]:49662 "EHLO mail-02.mail-europe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728873AbgKPKmC (ORCPT ); Mon, 16 Nov 2020 05:42:02 -0500 Date: Mon, 16 Nov 2020 10:41:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1605523318; bh=/WV2tykl7QFI5295MXa4aW9hJf5TbvqqlS+GpFktc8Y=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=yGm+dERn62Ckc987BKG0rfjnxVm0wcqQjKCzSVd2xjMfAF9WJVN6IzHEpcpKjkNqc Dz59k1zrXQNttoKzP79N9k4ApOP5h77nD75ExhTePmp41sRWXhASUS2dBsu1rCFhSX IfNnI3j1QKZTcIFLGPlD9hMOX6gfgpUQP5HvPuJI= To: Mark Pearson From: =?utf-8?Q?Barnab=C3=A1s_P=C5=91cze?= Cc: "rjw@rjwysocki.net" , "hdegoede@redhat.com" , "mgross@linux.intel.com" , "linux-acpi@vger.kernel.org" , "mario.limonciello@dell.com" , "eliadevito@gmail.com" , "hadess@hadess.net" , "bberg@redhat.com" , "platform-driver-x86@vger.kernel.org" , "dvhart@infradead.org" Reply-To: =?utf-8?Q?Barnab=C3=A1s_P=C5=91cze?= Subject: Re: [External] Re: [PATCH v2 3/3] platform/x86: thinkpad_acpi: Add platform profile support Message-ID: In-Reply-To: <746e3f26-bca4-9659-abf2-98d81aa84f63@lenovo.com> References: <20201114150102.340618-1-markpearson@lenovo.com> <20201114150102.340618-3-markpearson@lenovo.com> <746e3f26-bca4-9659-abf2-98d81aa84f63@lenovo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Hi 2020. november 16., h=C3=A9tf=C5=91 0:22 keltez=C3=A9ssel, Mark Pearson = =C3=ADrta: > [...] > >> +static int convert_profile_to_dytc(enum platform_profile_option profi= le, int *perfmode) > >> +{ > >> +=09switch (profile) { > >> +=09case profile_low: > >> +=09=09*perfmode =3D DYTC_MODE_QUIET; > >> +=09=09break; > >> +=09case profile_balance: > >> +=09=09*perfmode =3D DYTC_MODE_BALANCE; > >> +=09=09break; > >> +=09case profile_perform: > >> +=09=09*perfmode =3D DYTC_MODE_PERFORM; > >> +=09=09break; > >> +=09default: /* Unknown profile */ > >> +=09=09return -EOPNOTSUPP; > > > > I personally think EINVAL would be better here, > > just like in `convert_dytc_to_profile()`. > I liked how this worked when testing. > If you put in an invalid profile name then platform_profile returned > EINVAL but if you got this far you'd provided a valid profile setting > that this driver doesn't support and the not supported message seemed > clearer. As an example 'cool' is used on HP platforms but not Lenovo. > I'd like to leave this one as it is please. > > I have just realized that the platform profile module does not check if the profile the user wants to set is supported by the handler. As I've mentioned in my other email, I think that should be checked. You could retu= rn EOPNOTSUPP there (in the platform profile module). After reading the explan= ation why you want to use EOPNOTSUPP, I believe it makes sense and it's fine. > > > >> +=09} > >> +=09return 0; > >> +} > [...] Regards, Barnab=C3=A1s P=C5=91cze