Commit 9d6a9429 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: jr3_pci: use struct jr3_block instead of jr3_t

`struct jr3_t` contains a single array member `block` of member type
`struct jr3_block`.  Rather than using pointers to `struct jr3_t`, just
use pointers to `struct jr3_block` instead and treat it as an array.
Replace the local variables `struct jr3_t __iomem *iobase` with `struct
jr3_block __iomem *block`.  Remove the definition of `struct jr3_t` as
it is no longer needed.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4e861f0f
...@@ -372,7 +372,7 @@ static int jr3_check_firmware(struct comedi_device *dev, ...@@ -372,7 +372,7 @@ static int jr3_check_firmware(struct comedi_device *dev,
static void jr3_write_firmware(struct comedi_device *dev, static void jr3_write_firmware(struct comedi_device *dev,
int subdev, const u8 *data, size_t size) int subdev, const u8 *data, size_t size)
{ {
struct jr3_t __iomem *iobase = dev->mmio; struct jr3_block __iomem *block = dev->mmio;
u32 __iomem *lo; u32 __iomem *lo;
u32 __iomem *hi; u32 __iomem *hi;
int more = 1; int more = 1;
...@@ -405,8 +405,8 @@ static void jr3_write_firmware(struct comedi_device *dev, ...@@ -405,8 +405,8 @@ static void jr3_write_firmware(struct comedi_device *dev,
unsigned int data1 = 0; unsigned int data1 = 0;
unsigned int data2 = 0; unsigned int data2 = 0;
lo = &iobase->block[subdev].program_lo[addr]; lo = &block[subdev].program_lo[addr];
hi = &iobase->block[subdev].program_hi[addr]; hi = &block[subdev].program_hi[addr];
more = more && more = more &&
read_idm_word(data, size, &pos, &data1); read_idm_word(data, size, &pos, &data1);
...@@ -630,7 +630,7 @@ static void jr3_pci_poll_dev(unsigned long data) ...@@ -630,7 +630,7 @@ static void jr3_pci_poll_dev(unsigned long data)
static struct jr3_pci_subdev_private * static struct jr3_pci_subdev_private *
jr3_pci_alloc_spriv(struct comedi_device *dev, struct comedi_subdevice *s) jr3_pci_alloc_spriv(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
struct jr3_t __iomem *iobase = dev->mmio; struct jr3_block __iomem *block = dev->mmio;
struct jr3_pci_subdev_private *spriv; struct jr3_pci_subdev_private *spriv;
int j; int j;
int k; int k;
...@@ -639,7 +639,7 @@ jr3_pci_alloc_spriv(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -639,7 +639,7 @@ jr3_pci_alloc_spriv(struct comedi_device *dev, struct comedi_subdevice *s)
if (!spriv) if (!spriv)
return NULL; return NULL;
spriv->sensor = &iobase->block[s->index].sensor; spriv->sensor = &block[s->index].sensor;
for (j = 0; j < 8; j++) { for (j = 0; j < 8; j++) {
spriv->range[j].l.length = 1; spriv->range[j].l.length = 1;
...@@ -661,17 +661,17 @@ jr3_pci_alloc_spriv(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -661,17 +661,17 @@ jr3_pci_alloc_spriv(struct comedi_device *dev, struct comedi_subdevice *s)
spriv->maxdata_list[57] = 0xffff; spriv->maxdata_list[57] = 0xffff;
dev_dbg(dev->class_dev, "p->sensor %p %p (%tx)\n", dev_dbg(dev->class_dev, "p->sensor %p %p (%tx)\n",
spriv->sensor, iobase, spriv->sensor, block,
((char __iomem *)spriv->sensor - ((char __iomem *)spriv->sensor -
(char __iomem *)iobase)); (char __iomem *)block));
return spriv; return spriv;
} }
static void jr3_pci_show_copyright(struct comedi_device *dev) static void jr3_pci_show_copyright(struct comedi_device *dev)
{ {
struct jr3_t __iomem *iobase = dev->mmio; struct jr3_block __iomem *block = dev->mmio;
struct jr3_sensor __iomem *sensor0 = &iobase->block[0].sensor; struct jr3_sensor __iomem *sensor0 = &block[0].sensor;
char copy[ARRAY_SIZE(sensor0->copyright) + 1]; char copy[ARRAY_SIZE(sensor0->copyright) + 1];
int i; int i;
...@@ -688,7 +688,7 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, ...@@ -688,7 +688,7 @@ static int jr3_pci_auto_attach(struct comedi_device *dev,
static const struct jr3_pci_board *board; static const struct jr3_pci_board *board;
struct jr3_pci_dev_private *devpriv; struct jr3_pci_dev_private *devpriv;
struct jr3_pci_subdev_private *spriv; struct jr3_pci_subdev_private *spriv;
struct jr3_t __iomem *iobase; struct jr3_block __iomem *block;
struct comedi_subdevice *s; struct comedi_subdevice *s;
int ret; int ret;
int i; int i;
...@@ -719,7 +719,7 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, ...@@ -719,7 +719,7 @@ static int jr3_pci_auto_attach(struct comedi_device *dev,
if (!dev->mmio) if (!dev->mmio)
return -ENOMEM; return -ENOMEM;
iobase = dev->mmio; block = dev->mmio;
ret = comedi_alloc_subdevices(dev, board->n_subdevs); ret = comedi_alloc_subdevices(dev, board->n_subdevs);
if (ret) if (ret)
...@@ -744,7 +744,7 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, ...@@ -744,7 +744,7 @@ static int jr3_pci_auto_attach(struct comedi_device *dev,
/* Reset DSP card */ /* Reset DSP card */
for (i = 0; i < dev->n_subdevices; i++) for (i = 0; i < dev->n_subdevices; i++)
writel(0, &iobase->block[i].reset); writel(0, &block[i].reset);
ret = comedi_load_firmware(dev, &comedi_to_pci_dev(dev)->dev, ret = comedi_load_firmware(dev, &comedi_to_pci_dev(dev)->dev,
"comedi/jr3pci.idm", "comedi/jr3pci.idm",
......
...@@ -732,7 +732,3 @@ struct jr3_block { ...@@ -732,7 +732,3 @@ struct jr3_block {
u32 reset; /* 0x60000 - 0x60004 */ u32 reset; /* 0x60000 - 0x60004 */
char pad3[0x20000 - 0x00004]; /* 0x60004 - 0x80000 */ char pad3[0x20000 - 0x00004]; /* 0x60004 - 0x80000 */
}; };
struct jr3_t {
struct jr3_block block[4];
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment