From: Olof Johansson <olof@lixom.net>
To: Christoph Hellwig <hch@lst.de>
Cc: Matthew Wilcox <matthew@wil.cx>,
linux-pcmcia@lists.infradead.org, linux-kernel@vger.kernel.org,
linuxppc-dev@ozlabs.org,
Andrew Morton <akpm@linux-foundation.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH v3] pcmcia: Convert io_req_t to use unsigned int
Date: Fri, 19 Oct 2007 15:17:20 -0500 [thread overview]
Message-ID: <20071019201720.GA13234@lixom.net> (raw)
In-Reply-To: <20070922091303.GA12525@lst.de>
[PCMCIA] Convert some internal-only ioaddr_t to unsigned int
Convert the io_req_t members to unsigned int, to allow use on machines
with more than 16 bits worth of IO ports (i.e. secondary busses on
ppc64, etc).
There was only a couple of places in drivers where a change was needed. I
left printk formats alone (there are lots of %04x-style formats in there),
mostly to not change the format on the platforms that only have 16-bit
io addresses, but also because the padding doesn't really add all that
much value most of the time.
I found only one sprintf of an address, and upsized the string accordingly
(I doubt anyone will have anywhere near INT_MAX as irq value, but at
least there's room for it now).
Signed-off-by: Olof Johansson <olof@lixom.net>
---
On Sat, Sep 22, 2007 at 11:13:03AM +0200, Christoph Hellwig wrote:
> On Sat, Sep 22, 2007 at 12:25:51AM -0600, Matthew Wilcox wrote:
> > > What about the formatting and field widths ?
> > >
> > > ulong would probably be a lot saner than kio_addr_t and yet more type
> > > obfuscation.
> >
> > I don't think anyone uses ioports > 32bit. Certainly i386 takes an int
> > port as parameter to {in,out}[bwl] (and it really only uses 16-bits).
> > parisc uses 24 bits. I don't know what the various ppcs do, but pci
> > bars can only be 32-bit for ioports. So my opinion is that ioports
> > should be uint, not ulong.
>
> The kernel seems to mostly use int, sometimes uint. I never quite got
> why pcmcia had to have it's own strange typedef for them.
Ok, so let's switch to unsigned int. Only exception I made was to stick
to u_int in the struct itself to keep it common with the style in the
rest of it.
This also resulted in a much smaller diff, since I didn't have to change
any printk formats (see above about 0-padding).
-Olof
Index: k.org/drivers/char/pcmcia/cm4000_cs.c
===================================================================
--- k.org.orig/drivers/char/pcmcia/cm4000_cs.c
+++ k.org/drivers/char/pcmcia/cm4000_cs.c
@@ -308,7 +308,7 @@ static unsigned int calc_baudv(unsigned
return (wcrcf / wbrcf);
}
-static unsigned short io_read_num_rec_bytes(ioaddr_t iobase, unsigned short *s)
+static unsigned short io_read_num_rec_bytes(unsigned int iobase, unsigned short *s)
{
unsigned short tmp;
@@ -426,7 +426,7 @@ static struct card_fixup card_fixups[] =
static void set_cardparameter(struct cm4000_dev *dev)
{
int i;
- ioaddr_t iobase = dev->p_dev->io.BasePort1;
+ unsigned int iobase = dev->p_dev->io.BasePort1;
u_int8_t stopbits = 0x02; /* ISO default */
DEBUGP(3, dev, "-> set_cardparameter\n");
@@ -459,7 +459,7 @@ static int set_protocol(struct cm4000_de
unsigned short num_bytes_read;
unsigned char pts_reply[4];
ssize_t rc;
- ioaddr_t iobase = dev->p_dev->io.BasePort1;
+ unsigned int iobase = dev->p_dev->io.BasePort1;
rc = 0;
@@ -610,7 +610,7 @@ exit_setprotocol:
return rc;
}
-static int io_detect_cm4000(ioaddr_t iobase, struct cm4000_dev *dev)
+static int io_detect_cm4000(unsigned int iobase, struct cm4000_dev *dev)
{
/* note: statemachine is assumed to be reset */
@@ -671,7 +671,7 @@ static void terminate_monitor(struct cm4
static void monitor_card(unsigned long p)
{
struct cm4000_dev *dev = (struct cm4000_dev *) p;
- ioaddr_t iobase = dev->p_dev->io.BasePort1;
+ unsigned int iobase = dev->p_dev->io.BasePort1;
unsigned short s;
struct ptsreq ptsreq;
int i, atrc;
@@ -933,7 +933,7 @@ static ssize_t cmm_read(struct file *fil
loff_t *ppos)
{
struct cm4000_dev *dev = filp->private_data;
- ioaddr_t iobase = dev->p_dev->io.BasePort1;
+ unsigned int iobase = dev->p_dev->io.BasePort1;
ssize_t rc;
int i, j, k;
@@ -1054,7 +1054,7 @@ static ssize_t cmm_write(struct file *fi
size_t count, loff_t *ppos)
{
struct cm4000_dev *dev = (struct cm4000_dev *) filp->private_data;
- ioaddr_t iobase = dev->p_dev->io.BasePort1;
+ unsigned int iobase = dev->p_dev->io.BasePort1;
unsigned short s;
unsigned char tmp;
unsigned char infolen;
@@ -1408,7 +1408,7 @@ static int cmm_ioctl(struct inode *inode
unsigned long arg)
{
struct cm4000_dev *dev = filp->private_data;
- ioaddr_t iobase = dev->p_dev->io.BasePort1;
+ unsigned int iobase = dev->p_dev->io.BasePort1;
struct pcmcia_device *link;
int size;
int rc;
Index: k.org/drivers/pcmcia/pcmcia_resource.c
===================================================================
--- k.org.orig/drivers/pcmcia/pcmcia_resource.c
+++ k.org/drivers/pcmcia/pcmcia_resource.c
@@ -65,23 +65,23 @@ extern int ds_pc_debug;
* Special stuff for managing IO windows, because they are scarce
*/
-static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base,
- ioaddr_t num, u_int lines)
+static int alloc_io_space(struct pcmcia_socket *s, u_int attr,
+ unsigned int *base, unsigned int num, u_int lines)
{
int i;
- kio_addr_t try, align;
+ unsigned int try, align;
align = (*base) ? (lines ? 1<<lines : 0) : 1;
if (align && (align < num)) {
if (*base) {
- ds_dbg(s, 0, "odd IO request: num %#x align %#lx\n",
+ ds_dbg(s, 0, "odd IO request: num %#x align %#x\n",
num, align);
align = 0;
} else
while (align && (align < num)) align <<= 1;
}
if (*base & ~(align-1)) {
- ds_dbg(s, 0, "odd IO request: base %#x align %#lx\n",
+ ds_dbg(s, 0, "odd IO request: base %#x align %#x\n",
*base, align);
align = 0;
}
@@ -132,8 +132,8 @@ static int alloc_io_space(struct pcmcia_
} /* alloc_io_space */
-static void release_io_space(struct pcmcia_socket *s, ioaddr_t base,
- ioaddr_t num)
+static void release_io_space(struct pcmcia_socket *s, unsigned int base,
+ unsigned int num)
{
int i;
Index: k.org/include/pcmcia/cs.h
===================================================================
--- k.org.orig/include/pcmcia/cs.h
+++ k.org/include/pcmcia/cs.h
@@ -147,11 +147,11 @@ typedef struct config_req_t {
/* For RequestIO and ReleaseIO */
typedef struct io_req_t {
- ioaddr_t BasePort1;
- ioaddr_t NumPorts1;
+ u_int BasePort1;
+ u_int NumPorts1;
u_int Attributes1;
- ioaddr_t BasePort2;
- ioaddr_t NumPorts2;
+ u_int BasePort2;
+ u_int NumPorts2;
u_int Attributes2;
u_int IOAddrLines;
} io_req_t;
Index: k.org/drivers/scsi/pcmcia/fdomain_stub.c
===================================================================
--- k.org.orig/drivers/scsi/pcmcia/fdomain_stub.c
+++ k.org/drivers/scsi/pcmcia/fdomain_stub.c
@@ -130,7 +130,7 @@ static int fdomain_config(struct pcmcia_
cisparse_t parse;
int i, last_ret, last_fn;
u_char tuple_data[64];
- char str[16];
+ char str[22];
struct Scsi_Host *host;
DEBUG(0, "fdomain_config(0x%p)\n", link);
WARNING: multiple messages have this Message-ID (diff)
From: Olof Johansson <olof@lixom.net>
To: Christoph Hellwig <hch@lst.de>
Cc: Matthew Wilcox <matthew@wil.cx>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
linuxppc-dev@ozlabs.org,
Andrew Morton <akpm@linux-foundation.org>,
linux-pcmcia@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3] pcmcia: Convert io_req_t to use unsigned int
Date: Fri, 19 Oct 2007 15:17:20 -0500 [thread overview]
Message-ID: <20071019201720.GA13234@lixom.net> (raw)
In-Reply-To: <20070922091303.GA12525@lst.de>
[PCMCIA] Convert some internal-only ioaddr_t to unsigned int
Convert the io_req_t members to unsigned int, to allow use on machines
with more than 16 bits worth of IO ports (i.e. secondary busses on
ppc64, etc).
There was only a couple of places in drivers where a change was needed. I
left printk formats alone (there are lots of %04x-style formats in there),
mostly to not change the format on the platforms that only have 16-bit
io addresses, but also because the padding doesn't really add all that
much value most of the time.
I found only one sprintf of an address, and upsized the string accordingly
(I doubt anyone will have anywhere near INT_MAX as irq value, but at
least there's room for it now).
Signed-off-by: Olof Johansson <olof@lixom.net>
---
On Sat, Sep 22, 2007 at 11:13:03AM +0200, Christoph Hellwig wrote:
> On Sat, Sep 22, 2007 at 12:25:51AM -0600, Matthew Wilcox wrote:
> > > What about the formatting and field widths ?
> > >
> > > ulong would probably be a lot saner than kio_addr_t and yet more type
> > > obfuscation.
> >
> > I don't think anyone uses ioports > 32bit. Certainly i386 takes an int
> > port as parameter to {in,out}[bwl] (and it really only uses 16-bits).
> > parisc uses 24 bits. I don't know what the various ppcs do, but pci
> > bars can only be 32-bit for ioports. So my opinion is that ioports
> > should be uint, not ulong.
>
> The kernel seems to mostly use int, sometimes uint. I never quite got
> why pcmcia had to have it's own strange typedef for them.
Ok, so let's switch to unsigned int. Only exception I made was to stick
to u_int in the struct itself to keep it common with the style in the
rest of it.
This also resulted in a much smaller diff, since I didn't have to change
any printk formats (see above about 0-padding).
-Olof
Index: k.org/drivers/char/pcmcia/cm4000_cs.c
===================================================================
--- k.org.orig/drivers/char/pcmcia/cm4000_cs.c
+++ k.org/drivers/char/pcmcia/cm4000_cs.c
@@ -308,7 +308,7 @@ static unsigned int calc_baudv(unsigned
return (wcrcf / wbrcf);
}
-static unsigned short io_read_num_rec_bytes(ioaddr_t iobase, unsigned short *s)
+static unsigned short io_read_num_rec_bytes(unsigned int iobase, unsigned short *s)
{
unsigned short tmp;
@@ -426,7 +426,7 @@ static struct card_fixup card_fixups[] =
static void set_cardparameter(struct cm4000_dev *dev)
{
int i;
- ioaddr_t iobase = dev->p_dev->io.BasePort1;
+ unsigned int iobase = dev->p_dev->io.BasePort1;
u_int8_t stopbits = 0x02; /* ISO default */
DEBUGP(3, dev, "-> set_cardparameter\n");
@@ -459,7 +459,7 @@ static int set_protocol(struct cm4000_de
unsigned short num_bytes_read;
unsigned char pts_reply[4];
ssize_t rc;
- ioaddr_t iobase = dev->p_dev->io.BasePort1;
+ unsigned int iobase = dev->p_dev->io.BasePort1;
rc = 0;
@@ -610,7 +610,7 @@ exit_setprotocol:
return rc;
}
-static int io_detect_cm4000(ioaddr_t iobase, struct cm4000_dev *dev)
+static int io_detect_cm4000(unsigned int iobase, struct cm4000_dev *dev)
{
/* note: statemachine is assumed to be reset */
@@ -671,7 +671,7 @@ static void terminate_monitor(struct cm4
static void monitor_card(unsigned long p)
{
struct cm4000_dev *dev = (struct cm4000_dev *) p;
- ioaddr_t iobase = dev->p_dev->io.BasePort1;
+ unsigned int iobase = dev->p_dev->io.BasePort1;
unsigned short s;
struct ptsreq ptsreq;
int i, atrc;
@@ -933,7 +933,7 @@ static ssize_t cmm_read(struct file *fil
loff_t *ppos)
{
struct cm4000_dev *dev = filp->private_data;
- ioaddr_t iobase = dev->p_dev->io.BasePort1;
+ unsigned int iobase = dev->p_dev->io.BasePort1;
ssize_t rc;
int i, j, k;
@@ -1054,7 +1054,7 @@ static ssize_t cmm_write(struct file *fi
size_t count, loff_t *ppos)
{
struct cm4000_dev *dev = (struct cm4000_dev *) filp->private_data;
- ioaddr_t iobase = dev->p_dev->io.BasePort1;
+ unsigned int iobase = dev->p_dev->io.BasePort1;
unsigned short s;
unsigned char tmp;
unsigned char infolen;
@@ -1408,7 +1408,7 @@ static int cmm_ioctl(struct inode *inode
unsigned long arg)
{
struct cm4000_dev *dev = filp->private_data;
- ioaddr_t iobase = dev->p_dev->io.BasePort1;
+ unsigned int iobase = dev->p_dev->io.BasePort1;
struct pcmcia_device *link;
int size;
int rc;
Index: k.org/drivers/pcmcia/pcmcia_resource.c
===================================================================
--- k.org.orig/drivers/pcmcia/pcmcia_resource.c
+++ k.org/drivers/pcmcia/pcmcia_resource.c
@@ -65,23 +65,23 @@ extern int ds_pc_debug;
* Special stuff for managing IO windows, because they are scarce
*/
-static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base,
- ioaddr_t num, u_int lines)
+static int alloc_io_space(struct pcmcia_socket *s, u_int attr,
+ unsigned int *base, unsigned int num, u_int lines)
{
int i;
- kio_addr_t try, align;
+ unsigned int try, align;
align = (*base) ? (lines ? 1<<lines : 0) : 1;
if (align && (align < num)) {
if (*base) {
- ds_dbg(s, 0, "odd IO request: num %#x align %#lx\n",
+ ds_dbg(s, 0, "odd IO request: num %#x align %#x\n",
num, align);
align = 0;
} else
while (align && (align < num)) align <<= 1;
}
if (*base & ~(align-1)) {
- ds_dbg(s, 0, "odd IO request: base %#x align %#lx\n",
+ ds_dbg(s, 0, "odd IO request: base %#x align %#x\n",
*base, align);
align = 0;
}
@@ -132,8 +132,8 @@ static int alloc_io_space(struct pcmcia_
} /* alloc_io_space */
-static void release_io_space(struct pcmcia_socket *s, ioaddr_t base,
- ioaddr_t num)
+static void release_io_space(struct pcmcia_socket *s, unsigned int base,
+ unsigned int num)
{
int i;
Index: k.org/include/pcmcia/cs.h
===================================================================
--- k.org.orig/include/pcmcia/cs.h
+++ k.org/include/pcmcia/cs.h
@@ -147,11 +147,11 @@ typedef struct config_req_t {
/* For RequestIO and ReleaseIO */
typedef struct io_req_t {
- ioaddr_t BasePort1;
- ioaddr_t NumPorts1;
+ u_int BasePort1;
+ u_int NumPorts1;
u_int Attributes1;
- ioaddr_t BasePort2;
- ioaddr_t NumPorts2;
+ u_int BasePort2;
+ u_int NumPorts2;
u_int Attributes2;
u_int IOAddrLines;
} io_req_t;
Index: k.org/drivers/scsi/pcmcia/fdomain_stub.c
===================================================================
--- k.org.orig/drivers/scsi/pcmcia/fdomain_stub.c
+++ k.org/drivers/scsi/pcmcia/fdomain_stub.c
@@ -130,7 +130,7 @@ static int fdomain_config(struct pcmcia_
cisparse_t parse;
int i, last_ret, last_fn;
u_char tuple_data[64];
- char str[16];
+ char str[22];
struct Scsi_Host *host;
DEBUG(0, "fdomain_config(0x%p)\n", link);
next prev parent reply other threads:[~2007-10-19 20:10 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-05 14:27 [PATCH] pcmcia: Convert io_req_t to use kio_addr_t Olof Johansson
2007-09-05 14:27 ` Olof Johansson
2007-09-14 10:48 ` Andrew Morton
2007-09-14 10:48 ` Andrew Morton
2007-09-14 16:52 ` Olof Johansson
2007-09-14 16:52 ` Olof Johansson
2007-09-21 22:15 ` [PATCH v2] " Olof Johansson
2007-09-21 22:15 ` Olof Johansson
2007-09-21 22:39 ` Alan Cox
2007-09-21 22:39 ` Alan Cox
2007-09-22 6:25 ` Matthew Wilcox
2007-09-22 6:25 ` Matthew Wilcox
2007-09-22 9:13 ` Christoph Hellwig
2007-09-22 9:13 ` Christoph Hellwig
2007-10-19 20:17 ` Olof Johansson [this message]
2007-10-19 20:17 ` [PATCH v3] pcmcia: Convert io_req_t to use unsigned int Olof Johansson
2007-10-28 13:44 ` Dominik Brodowski
2007-10-28 13:44 ` Dominik Brodowski
2007-10-28 20:10 ` [PATCH] pcmcia: Remove replace kio_addr_t with unsigned int everywhere Olof Johansson
2007-10-28 20:18 ` [PATCH v2] " Olof Johansson
2007-10-28 23:50 ` Stephen Rothwell
2007-10-28 23:50 ` Stephen Rothwell
2007-10-29 0:16 ` Olof Johansson
2007-10-29 0:16 ` Olof Johansson
2007-11-04 9:11 ` Komuro
2007-11-04 9:11 ` Komuro
2007-09-22 15:11 ` [PATCH v2] pcmcia: Convert io_req_t to use kio_addr_t Olof Johansson
2007-09-22 15:11 ` Olof Johansson
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=20071019201720.GA13234@lixom.net \
--to=olof@lixom.net \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pcmcia@lists.infradead.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=matthew@wil.cx \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.