Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4034237rwr; Mon, 8 May 2023 01:39:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ69xuTu1JrfnMBWsvhYsDPcJohRxufc89REmBDlRGh4dhfFdrn9ANqaDB8t/JyXn70jwb+4 X-Received: by 2002:a05:6a20:d39b:b0:f6:c920:7870 with SMTP id iq27-20020a056a20d39b00b000f6c9207870mr10685165pzb.59.1683535178430; Mon, 08 May 2023 01:39:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683535178; cv=none; d=google.com; s=arc-20160816; b=B+CTuzvL3TXBh5AoTIu7G6IGi90YUL1SSSm4I+1mcBhNwZ1megmxWTaYWWYJ1vu/ic ND95QTgX67fT1yud68uCB0h3AQzLIc+Fr/EHurO8ByFHm5JsUcRIKxB0wh1BGNpLIH+N NtD/QODmKPyPKih1lM+xUV8gTYt20CeQDZ77aYVJJU9fVFNlBY8YBtuq2aXsvynqIgUz Fvcz6uB+R5m7YKIvFGMslLJrTcpCTrD1Zq8eKODMPjwe3sW0euaLT0L98yt3rPF16o3x J3GoZJyUh08TTIh4swXiDYesvsZyGRsqVKf89BhxdEXFzbO21NBBkNUhDoUXmMLgR5e/ bX6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-id:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=N3W2aEhW9I3uek3+7hqdUA/gj11aWJg7P8EHM+SaK2o=; b=wAlwFCjyGpeD5MkbzfQWO8phYUjS4nK7lIMAF++5cmtnjJE1WV4ByK/xXbkQ2vOVAs eCs6zb+JJAxOuXHCrGlwGQmMX3ctrwoLEC6A1wTXaF/to+V6g0oQLcOILSy+uIKlEpUd eQf57mx2k97Upx0hm1JuAczYP9JfhzZR2gWKSm8hgVVyvnB82d4O0KzdfkpEeKnPnbQr e0H1ov832z2YT4Y4LahMwWl97pYpxF+IUM3N++E/quxSOCv6ZHJopMumRx6TPZginmG/ j1PZfrOz7zswjKHQhwCyA2rVpxU6vMEZp+LpIq+LvH0EgC1z3xQrDAJoi376U28+ZXEQ g2Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Opj9L37u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u76-20020a63794f000000b005302f7ec8c4si147885pgc.845.2023.05.08.01.39.25; Mon, 08 May 2023 01:39:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Opj9L37u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232429AbjEHIWN (ORCPT + 99 others); Mon, 8 May 2023 04:22:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233831AbjEHIVg (ORCPT ); Mon, 8 May 2023 04:21:36 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACC291FAA0; Mon, 8 May 2023 01:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683534075; x=1715070075; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version:content-id; bh=u8U6CpU+Uixx4b0Yc9a9cuI2RB9dOyCILQo/ufHu6C8=; b=Opj9L37u6PB8pm2Um1CR7FqbitSVXooCBj421PHAEtLVyRz8Y99wPde3 lw50uw/oainX1ey1er+lTRMRlidAC5j8NJL2WNlAH1MjEtlIYx08Fq3dk mhcWkdLTvNLM58qG+/P/IxeV0ateYlyn8YA0R7cNXJ2Q6IimVuzQ99qaj SXMMYq5UlI564do58o3wi7LZa/ujOSz4j1Szth5bQ9mLkhSZtpw/oGdqg 2svmvpJ5l5UXpb4UO9d7fzJ7ZRwQzbbLBHnmZXqbC83/NiCZCOKesRpe5 dFRIMpoWFFqBnZjt80pcOkSov1GeyLaqVid+6TZf1tUE3woXi2mSWTVl7 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10703"; a="348416217" X-IronPort-AV: E=Sophos;i="5.99,258,1677571200"; d="scan'208";a="348416217" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 01:21:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10703"; a="944762598" X-IronPort-AV: E=Sophos;i="5.99,258,1677571200"; d="scan'208";a="944762598" Received: from cciobanu-mobl1.ger.corp.intel.com ([10.249.37.159]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 01:21:12 -0700 Date: Mon, 8 May 2023 11:21:10 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Luke Jones cc: platform-driver-x86@vger.kernel.org, LKML , acpi4asus-user@lists.sourceforge.net, hdegoede@redhat.com, corentin.chary@gmail.com, markgross@kernel.org, jdelvare@suse.com, linux@roeck-us.net Subject: Re: [PATCH v2 1/1] platform/x86: asus-wmi: add support for ASUS screenpad In-Reply-To: Message-ID: <39570a-d3a-13b9-f2d-e75b3d60c6c4@linux.intel.com> References: <20230505043013.2622603-1-luke@ljones.dev> <20230505043013.2622603-2-luke@ljones.dev> <9f77e8fd-38fe-818f-2fee-ca3bf4243576@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-487321179-1683533721=:1790" Content-ID: <5dca5e23-df7d-2774-ed31-47f8441772@linux.intel.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-487321179-1683533721=:1790 Content-Type: text/plain; CHARSET=ISO-8859-15 Content-Transfer-Encoding: 8BIT Content-ID: On Sat, 6 May 2023, Luke Jones wrote: > On Fri, May 5 2023 at 16:08:16 +0300, Ilpo J?rvinen > wrote: > > On Fri, 5 May 2023, Luke D. Jones wrote: > > > > > Add support for the WMI methods used to turn off and adjust the > > > brightness of the secondary "screenpad" device found on some high-end > > > ASUS laptops like the GX650P series and others. > > > > > > These methods are utilised in a new backlight device named: > > > - asus_screenpad > > > > > > Signed-off-by: Luke D. Jones > > > --- > > > @@ -3208,6 +3209,129 @@ static int is_display_toggle(int code) > > > return 0; > > > } > > > > > > +/* Screenpad backlight */ > > > + > > > +static int read_screenpad_backlight_power(struct asus_wmi *asus) > > > +{ > > > + int ret = asus_wmi_get_devstate_simple(asus, > > > ASUS_WMI_DEVID_SCREENPAD_POWER); > > > > Please move this to own line because now you have the extra newline > > in between the call and error handling. > > I don't understand what you mean sorry. Remove the new line or: > int ret; > ret = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_SCREENPAD_POWER); Don't do: int func() { int ret = func(); if (ret < 0) return ret; ... } But do: int func() { int ret; ret = func(); if (ret < 0) return ret; ... } This keeps the error handling next to the actual call following the usual error handling pattern (natural logic grouping). The added clarity is well worth the one extra line required. > > > +static int update_screenpad_bl_status(struct backlight_device *bd) > > > +{ > > > + struct asus_wmi *asus = bl_get_data(bd); > > > + int power, err = 0; > > > + u32 ctrl_param; > > > + > > > + power = read_screenpad_backlight_power(asus); > > > + if (power == -ENODEV) > > > + return err; > > > > Just return 0. Or is there perhaps something wrong/missing here? > > I thought the correct thing was to return any possible error state (here, > anything less than 0 would be an error, right?) I think this was covered already but here what I meant, use either: return 0; because err is always 0 at that point, or: return power; Depending on which is correct, I wasn't sure because you had this after it: > > > + else if (power < 0) > > > + return power; ...So I thought you might really intentionally wanted to return 0 there. -- i. --8323329-487321179-1683533721=:1790--