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=-5.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 9B515C47404 for ; Wed, 9 Oct 2019 18:00:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 667BD218AC for ; Wed, 9 Oct 2019 18:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570644020; bh=OJG+giJe+Q7Ljx6NMncXKgZJ6O3ww3uJa7HPqGYceLk=; h=Date:From:To:cc:Subject:In-Reply-To:References:List-ID:From; b=Gwn0BMryGYefF9plGbufREI3EjxeljYWyz41+DkjFI3UrUt/dEBJT0ttIk4A0hEl3 1UWtFN+TKOYB/lQkHDf9Q+wafM0vhtjNuzO3kYsdv/SfZUrc6Daps+Hy4ToiZa3EaX vkMbTTxykTRxOGamGkcr+oucrVR/sU+Hi9QGPvBg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731477AbfJISAT (ORCPT ); Wed, 9 Oct 2019 14:00:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:34234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731287AbfJISAT (ORCPT ); Wed, 9 Oct 2019 14:00:19 -0400 Received: from pobox.suse.cz (prg-ext-pat.suse.com [213.151.95.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 136BE206C0; Wed, 9 Oct 2019 18:00:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570644018; bh=OJG+giJe+Q7Ljx6NMncXKgZJ6O3ww3uJa7HPqGYceLk=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=tm0GHkhrtvG2djQkr2yzL5Bk6qnl7ExoOkV17uHfLmE2IyLg29ka6jjl4o033K0zV NSKkNh8xzW58S2EhwMRplEhHzDSFD3rNc0AIX7haoViveORm7CwrydGOxwVSwkRZvr XAECrQzVYtWbh241+pJ5wuAfvkHUdsa25SwmgVXI= Date: Wed, 9 Oct 2019 19:59:48 +0200 (CEST) From: Jiri Kosina To: Nicolas Saenz Julienne cc: Candle Sun , benjamin.tissoires@redhat.com, orson.zhai@unisoc.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Candle Sun , Nianfu Bai Subject: Re: [PATCH v2] HID: core: check whether usage page item is after usage id item In-Reply-To: Message-ID: References: <1570625609-11083-1-git-send-email-candlesea@gmail.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 9 Oct 2019, Nicolas Saenz Julienne wrote: > > diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c > > index 3eaee2c..3394222 100644 > > --- a/drivers/hid/hid-core.c > > +++ b/drivers/hid/hid-core.c > > @@ -35,6 +35,8 @@ > > > > #include "hid-ids.h" > > > > +#define GET_COMPLETE_USAGE(page, id) (((page) << 16) + ((id) & 0xffff)) > > Not sure I like the macro. I'd rather have the explicit code. That said, lets > see what Benjamin has to say. Not sure about Benjamin :) but I personally would ask for putting it somewhere into hid.h as static inline. And even if it's for some reason insisted on this staying macro, please at least put it as close to the place(s) it's being used as possible, in order to maintain some code sanity. Thanks, -- Jiri Kosina SUSE Labs