Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp362195pxb; Fri, 8 Jan 2021 06:57:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyO8DCYffgvDjnntDQliYl6qfseKS9ZVVHN1YLaRlZKe53ZtROb6JbJFLQlJLtSzzcntJ2B X-Received: by 2002:a17:907:105e:: with SMTP id oy30mr2867066ejb.495.1610117855981; Fri, 08 Jan 2021 06:57:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610117855; cv=none; d=google.com; s=arc-20160816; b=w92Sxj8zl6WVnSaV7eJADvOL/Wwk5CsPrTlKFZUVkahVAe2yuMRJIAwd2rTa2D3T8f UUN43ThGLapIHLi3quI1aqQPEGctlVr72/zMniybM9GW1rg3ZEnkVsyPbss0rrxEDlqy 7RV2ix7YU35luE95oHgEHsDQtekaGgSkFZNxj0cPLEsVhZP3oNS1mi69TYiHlI/bOUWH xOJKO4WkSqpDPUzdQAAB62LhpLIWR8YEZVBZn8hdmWkUvnPDFPZwvb94jU7mkqOBXELn iCLptyY+Emd8hIixP+rA4+fghHgOLP+FAVR29TJgwdPmGwQHFh1Ltu9CjZuPF/jxHP1x E9wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:message-id:in-reply-to:subject:cc:to:from :date:dkim-signature; bh=xlhs3iiSd7or0jkNzWnj+a798TtvHFCVCGsfF7lnHLw=; b=bphmetiMeYt81+2vDANNswS5LwibaTro6teMyI2euzTe6SyByzkkQBvO4BY/TPWKVG CW7haGak/KFILspogOqd1k00jthOBkW7lfxDWKQFUCQ0aXGB1ICFvCOmiZ3YQFzuqdU7 OR2vT+d9zKPyMd9mH/Dl7pVBLl9taPebdeE1W7ixOth+qBOIG2ihisXp25hfPCfXXT+8 mPDuTsSekSoBz3BYAYwnjtYS/uNQO2217RwOnMnZGeCHn1CuWT++3BMYvckkbTI377Ky qBhKe5DG87nyM0t5KelPL3zB4BFQNrw6STObi1PTRWe5TPojsuTVJVw4C0FAqmPTgv/n YsWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TrvvxQ9y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u9si4003560edf.278.2021.01.08.06.57.05; Fri, 08 Jan 2021 06:57:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TrvvxQ9y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727471AbhAHOz5 (ORCPT + 99 others); Fri, 8 Jan 2021 09:55:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:50498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725817AbhAHOzz (ORCPT ); Fri, 8 Jan 2021 09:55:55 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 83170235FF; Fri, 8 Jan 2021 14:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610117714; bh=b371CPuhZ8sdWbGeXW8xhatSptW+DNr/MiaYoSUDTfo=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=TrvvxQ9yDSdy4XMmsuqZvOuyHORPZXOZ4mwQf1Hozvl0k+hg8hc/QQ7ockGQU707A 7FnkJFtzHpKYJ/SW3vHIDlwye9QFJA33EOPsaFLhL0gDj498YsGGtabRy1iVx4xVMk agNlmmeff1ksvNhVMm606vDTBMB2QRgRz4Hoj+Eo5tiw+6EHwIxFJpsc6nfkKr5Wdu tr9YgNfNCuVV5SK5CVZHzLaryh+w2S52L1AfAP5P4dD4U0ML+xbW36FgAtd/+Xhwq/ PSehSPQlhNxk0Xjni9ab//Yaegw4hPs8xxqcxzFtUqb/xmN1eoLR2+lgfGy+MWYW79 5o/aePNKIbKMg== Date: Fri, 8 Jan 2021 15:55:11 +0100 (CET) From: Jiri Kosina To: =?ISO-8859-15?Q?Filipe_La=EDns?= cc: Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] HID: logitech-hidpp: add support for Unified Battery (1004) feature In-Reply-To: Message-ID: References: <20210104182937.1472673-1-lains@archlinux.org> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 8 Jan 2021, Filipe Laíns wrote: > > > -static int hidpp20_query_battery_info(struct hidpp_device *hidpp) > > > +static int hidpp20_query_battery_info_1000(struct hidpp_device *hidpp) > > > > That '_1000' suffix looks strange to me, as it's not completely obvious > > just from looking at the code what it actually means. Would it perhaps be > > more readable to call it something like hidpp20_query_battery_level(), and > > symmentrically change hidpp20_query_battery_info_1004() to e.g. > > hidpp20_query_battery_voltage() ? > > The problem here is that hidpp20_query_battery_info_1004() does not set the > battery voltage, it is also the battery level. The best alternative I can think > of is replacing the 1000/1004 with slightly mangled HID++ feature names, like we > do on the other feature function. The drawback here is that I think that could > get confusing quickly. > > hidpp20_batterylevel_query_battery_info() > hidpp20_unifiedbattery_query_battery_info() > > Note that this does not provide *that* much more information than the feature > number, though it is probably the best option. What do you think? Alright, what a mess :) Would it perhaps help if there is at least a short comment preceding the function definition, noting what the constants actually are? > > [ ... snip ... ] > > > +       /* if the device supports state of charge (battery percentage) we > > > won't > > > +          export the battery level information. there are 4 possible > > > battery > > > +          levels and they all are optional, this means that the device > > > might > > > +          not support any of them, we are just better off with the battery > > > +          percentage. */ > > > > Could you please use standard kernel commenting style here? > > Oops, sorry. Will do :) Thanks, -- Jiri Kosina SUSE Labs