From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
Bill Pemberton <wfp5p@virginia.edu>,
alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org,
Toshi Kani <toshi.kani@hp.com>, Ram Pai <linuxram@us.ibm.com>,
linux-kernel@vger.kernel.org
Subject: [patch 1/2] resources: clean up pnp_irq() error return
Date: Thu, 7 Nov 2013 11:17:49 +0300 [thread overview]
Message-ID: <20131107081748.GU21844@elgon.mountain> (raw)
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.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
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)
next reply other threads:[~2013-11-07 8:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-07 8:17 Dan Carpenter [this message]
2013-11-07 8:52 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131107081748.GU21844@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=alsa-devel@alsa-project.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxram@us.ibm.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
--cc=toshi.kani@hp.com \
--cc=wfp5p@virginia.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®