From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752411AbdASMJP (ORCPT ); Thu, 19 Jan 2017 07:09:15 -0500 Received: from mga07.intel.com ([134.134.136.100]:15240 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751616AbdASMJK (ORCPT ); Thu, 19 Jan 2017 07:09:10 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,253,1477983600"; d="scan'208";a="924332502" Message-ID: <1484827499.2133.228.camel@linux.intel.com> Subject: Re: [PATCH 1/3] pinctrl: Widen the generic pinconf argument from 16 to 24 bits From: Andy Shevchenko To: Mika Westerberg , Linus Walleij Cc: Alexandre Courbot , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 19 Jan 2017 14:04:59 +0200 In-Reply-To: <20170119094820.83595-2-mika.westerberg@linux.intel.com> References: <20170119094820.83595-1-mika.westerberg@linux.intel.com> <20170119094820.83595-2-mika.westerberg@linux.intel.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.3-1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-01-19 at 12:48 +0300, Mika Westerberg wrote: > The current pinconf packed format allows only 16-bit argument limiting > the maximum value 65535. For most types this is enough. However, > debounce time can be in range of hundreths of milliseconds in case of > mechanical switches so we cannot represent the worst case using the > current format. > >  static inline enum pin_config_param pinconf_to_config_param(unsigned > long config) >  { > - return (enum pin_config_param) (config & 0xffffUL); > + return (enum pin_config_param) (config & 0xffUL); >  } >   > -static inline u16 pinconf_to_config_argument(unsigned long config) > +static inline u32 pinconf_to_config_argument(unsigned long config) >  { > - return (enum pin_config_param) ((config >> 16) & 0xffffUL); > + return (enum pin_config_param) ((config >> 8) & 0xffffffUL); Looks like copy'n'paste error in the initial code, I mean casting should go as (u16) -> (u32). Perhaps, in case you submit new version, do the first patch with a fix of this one. Then conversion would look more logical. -- Andy Shevchenko Intel Finland Oy