From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752930Ab1EJWhD (ORCPT ); Tue, 10 May 2011 18:37:03 -0400 Received: from mail.perches.com ([173.55.12.10]:1450 "EHLO mail.perches.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751041Ab1EJWhC (ORCPT ); Tue, 10 May 2011 18:37:02 -0400 Subject: Re: [PATCH 1/4] drivers: create a pinmux subsystem From: Joe Perches To: Linus Walleij Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Grant Likely , Lee Jones , Martin Persson In-Reply-To: References: <1304363786-30376-1-git-send-email-linus.walleij@stericsson.com> <1304365077.7792.40.camel@Joe-Laptop> Content-Type: text/plain; charset="UTF-8" Date: Tue, 10 May 2011 15:37:00 -0700 Message-ID: <1305067020.19586.130.camel@Joe-Laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2011-05-11 at 00:18 +0200, Linus Walleij wrote: > 2011/5/2 Joe Perches : > > On Mon, 2011-05-02 at 21:16 +0200, Linus Walleij wrote: > >> From: Linus Walleij > >> diff --git a/drivers/pinmux/core.c b/drivers/pinmux/core.c > > Trivial comments follow > >> +static inline int pin_is_valid(int pin) > >> +{ > >> + return ((unsigned)pin) < MACH_NR_PINS; > >> +} > > Couldn't pin just be declared unsigned or maybe u32? > No, because like in the GPIO subsystem you *may* want to send in invalid > pins, and those are identified by negative numbers. Then I think this is clearer and the compiler should produce the same code. static inline bool pin_is_valid(int pin) { return pin >= 0 && pin < MACH_NR_PINS; } cheers, Joe