Received: by 10.223.185.116 with SMTP id b49csp1280377wrg; Sat, 3 Mar 2018 21:10:00 -0800 (PST) X-Google-Smtp-Source: AG47ELuPuo68BG/HBLQ3iLIoCV1MFgvPdDd27NjduUB1Ujdba2m4pLy6lb657CjB29yFXqpxIbUB X-Received: by 10.98.91.66 with SMTP id p63mr9273164pfb.163.1520140200333; Sat, 03 Mar 2018 21:10:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520140200; cv=none; d=google.com; s=arc-20160816; b=wmzQ/ByT3zte/H3RR/vUDa5Tli9GEreJMW3MlJ9ToTf2zByCN4h5MhCCliiLrcfNOw C/HbQrKyWxm9Op7N14xBBqf3MCmE91QF3UWEkkxqvPXXcxb6Df7vie++37u2dmyfCBc9 f0TgeQdKA0fM2T6LzSgcUSMtI5LAu8Ka9JPu3Td1jwHZxv90r6g/VahyvcWEbV+clI8y 5ncl/oCDZp99oxv4jqKwptYvFURdlCZVMs16yKNDBzANUm2YHmzo/nTk7QvbY8Cvm0tY zuG38Up6CpEDLnlu+OjIJnHESYe6KobMH+J5AHKG4zQJuDpFy8C2jCdt1jGJ69Gowhdd QxXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=oz0lfAdZlLLq7vVSCsd0sX6wD+oVKmZWtNHy4+I3PB8=; b=YDRE99pkQy+jOLZ+qqIqNimwUVX5iWAGt+V3Fd4AZhWCocww9v0i/CRqaOSLdULY3r mZwZADmO5Hd1f3abqBTLSKEKaBMw3ARgKXnXiIwN8HLSPApPN3vA27zQau9cjy+wetcE WBVv3XYFy7BqRpBQC3KANU9KM4dovXWlEkilJ6FTlqjMsD73Rlj1RSnBg/TnEgCr6pGG 8exOi5tsVx+IknMRl0GHvkr6kfblLf6DnoiT4kjkienmZLQ5ThU1oR7GHdWJXYQAzuxx Il+qElGw9souV1wRSqOSC6sHO1mGAtUiezYnBjvOI0UbTGS74/3RrhGi0IRgw+VJ5qV8 kkcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g19si6470484pgn.813.2018.03.03.21.09.45; Sat, 03 Mar 2018 21:10:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751981AbeCDFJF (ORCPT + 99 others); Sun, 4 Mar 2018 00:09:05 -0500 Received: from server.atrad.com.au ([150.101.241.2]:48924 "EHLO server.atrad.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750759AbeCDFJD (ORCPT ); Sun, 4 Mar 2018 00:09:03 -0500 Received: from marvin.atrad.com.au (IDENT:1008@marvin.atrad.com.au [192.168.0.2]) by server.atrad.com.au (8.15.2/8.14.9) with ESMTPS id w2458DJq018852 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 4 Mar 2018 15:38:15 +1030 Date: Sun, 4 Mar 2018 15:38:13 +1030 From: Jonathan Woithe To: Andy Shevchenko Cc: Micha?? K??pie?? , Darren Hart , Andy Shevchenko , Platform Driver , Linux Kernel Mailing List Subject: Re: [PATCH 1/7] platform/x86: fujitsu-laptop: Define constants for FUNC operations Message-ID: <20180304050813.GA3129@marvin.atrad.com.au> References: <20180227211539.5708-1-kernel@kempniu.pl> <20180227211539.5708-2-kernel@kempniu.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-MIMEDefang-action: accept X-Scanned-By: MIMEDefang 2.79 on 192.168.0.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 28, 2018 at 06:08:52PM +0200, Andy Shevchenko wrote: > On Tue, Feb 27, 2018 at 11:15 PM, Micha?? K??pie?? wrote: > > Various functions exposed by the firmware through the FUNC interface > > tend to use a consistent set of integers for denoting the type of > > operation to be performed for a specified feature. Use named constants > > instead of integers in each call_fext_func() invocation in order to more > > clearly convey the intent of each call. > > > > Note that FUNC_FLAGS is a bit peculiar: > > > +/* FUNC interface - operations */ > > +#define OP_GET BIT(1) > > +#define OP_GET_CAPS 0 > > +#define OP_GET_EVENTS BIT(0) > > +#define OP_GET_EXT BIT(2) > > +#define OP_SET BIT(0) > > +#define OP_SET_EXT (BIT(2) | BIT(0)) > > Hmm... this looks unordered a bit. It seems to be ordered alphabetically on the identifier. Andy, is it preferred to order defines like this based on resolved numeric order? There is a lack of apparent consistency in the numeric mapping; for example, OP_SET_EXT includes the OP_SET bit, but OP_GET_EXT does not include the OP_GET bit. However, after inspecting the code I think this is simply reflecting what the hardware expects. > And plain 0 doesn't look right in this concept (something like (0 << > 0) would probably do it). Given that all other definitions are in terms of BIT(), to my eye "(0 << 0)" looks as much out of place as plain "0". However, if the convention in this case would be to use the former then I have no objections. I presume the "(0 << 0)" idea comes from the fact that BIT() ultimately expands to some form of shift. Regards jonathan