From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752855Ab3KGIxH (ORCPT ); Thu, 7 Nov 2013 03:53:07 -0500 Received: from cantor2.suse.de ([195.135.220.15]:39119 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751563Ab3KGIw4 (ORCPT ); Thu, 7 Nov 2013 03:52:56 -0500 Date: Thu, 07 Nov 2013 09:52:55 +0100 Message-ID: From: Takashi Iwai To: Dan Carpenter Cc: Andrew Morton , Jaroslav Kysela , Bill Pemberton , alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org, Toshi Kani , Ram Pai , linux-kernel@vger.kernel.org Subject: Re: [patch 1/2] resources: clean up pnp_irq() error return In-Reply-To: <20131107081748.GU21844@elgon.mountain> References: <20131107081748.GU21844@elgon.mountain> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Thu, 7 Nov 2013 11:17:49 +0300, Dan Carpenter wrote: > > pnp_irq() returns -1 on error but cast to an unsigned. It is confusing > for callers who assume that it returns a negative value. I have > introduced a new define IORESOURCE_INVALID which is the same value but > hopefully it looks less like a negative value. How about just returning int instead of resource_size_t? IRQ numbers are handled by int in almost all drivers. thanks, Takashi > > Signed-off-by: Dan Carpenter > > diff --git a/include/linux/ioport.h b/include/linux/ioport.h > index 89b7c24..fdccfa5 100644 > --- a/include/linux/ioport.h > +++ b/include/linux/ioport.h > @@ -55,6 +55,8 @@ struct resource { > #define IORESOURCE_AUTO 0x40000000 > #define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */ > > +#define IORESOURCE_INVALID ((resource_size_t)-1) > + > /* PnP IRQ specific bits (IORESOURCE_BITS) */ > #define IORESOURCE_IRQ_HIGHEDGE (1<<0) > #define IORESOURCE_IRQ_LOWEDGE (1<<1) > diff --git a/include/linux/pnp.h b/include/linux/pnp.h > index 195aafc..818669c 100644 > --- a/include/linux/pnp.h > +++ b/include/linux/pnp.h > @@ -151,7 +151,7 @@ static inline resource_size_t pnp_irq(struct pnp_dev *dev, unsigned int bar) > > if (pnp_resource_valid(res)) > return res->start; > - return -1; > + return IORESOURCE_INVALID; > } > > static inline unsigned long pnp_irq_flags(struct pnp_dev *dev, unsigned int bar) >