Re: [PATCH 03/13] staging: comedi: pcmuio: tidy up pcmuio_handle_asic_interrupt()

2013-12-06 Thread Dan Carpenter
On Thu, Dec 05, 2013 at 04:54:05PM -0700, H Hartley Sweeten wrote:
> Unfortunatly, since there could be two asics, we can't use dev->read_subdev
> to get the subdevice. But, the comedi_subdevice associated with the 'asic'
> can easily be calculated. This allows removing the for () loop that searched
> for the correct subdevice.
> 
> Tidy up the function.

Signed-off-by is missing.

> ---

regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 01/31] staging: comedi: ni_at_2150: tidy up irq/dma request

2013-12-06 Thread Ian Abbott

On 2013-12-05 20:43, H Hartley Sweeten wrote:

This driver needs both an irq and dma in order to support async
commands. If the irq and dma are not available the driver will
still function for single analog input reads.

Tidy up the code that does the irq and dma requests so that the
driver will still attach if they are not avaliable. The attach
will still fail, with -ENOMEM, if the dma buffer cannot be allocated.

Remove the noise about the irq and dma during the attach.

Only hook up the async commands support if the irq and dma are
available. Remove the then unnecessary sanity check in a2150_ai_cmd().

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  drivers/staging/comedi/drivers/ni_at_a2150.c | 79 
  1 file changed, 33 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c 
b/drivers/staging/comedi/drivers/ni_at_a2150.c
index cc69dde..0876bc5 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -395,11 +395,6 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
unsigned int old_config_bits = devpriv->config_bits;
unsigned int trigger_bits;

-   if (!dev->irq || !devpriv->dma) {
-   comedi_error(dev,
-" irq and dma required, cannot do hardware 
conversions");
-   return -1;
-   }
if (cmd->flags & TRIG_RT) {
comedi_error(dev,
 " dma incompatible with hard real-time interrupt 
(TRIG_RT), aborting");
@@ -703,46 +698,35 @@ static int a2150_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
if (ret)
return ret;

-   /* grab our IRQ */
-   if (irq) {
-   /*  check that irq is supported */
-   if (irq < 3 || irq == 8 || irq == 13 || irq > 15) {
-   printk(" invalid irq line %u\n", irq);
-   return -EINVAL;
-   }
-   if (request_irq(irq, a2150_interrupt, 0,
-   dev->driver->driver_name, dev)) {
-   printk("unable to allocate irq %u\n", irq);
-   return -EINVAL;
+   dev->board_ptr = a2150_boards + a2150_probe(dev);
+   thisboard = comedi_board(dev);
+   dev->board_name = thisboard->name;
+
+   if ((irq >= 3 && irq <= 7) || (irq >= 9 && irq <= 12) ||
+   irq == 14 || irq == 15) {


I'd have gone with `if (irq >= 3 && irq <= 15 && irq != 8 && irq != 
13)`, but as long as it does the same thing it doesn't matter!



+   ret = request_irq(irq, a2150_interrupt, 0,
+ dev->board_name, dev);
+   if (ret == 0) {
+   devpriv->irq_dma_bits |= IRQ_LVL_BITS(irq);
+   dev->irq = irq;
}
-   devpriv->irq_dma_bits |= IRQ_LVL_BITS(irq);
-   dev->irq = irq;
}
-   /*  initialize dma */
-   if (dma) {
-   if (dma == 4 || dma > 7) {
-   printk(" invalid dma channel %u\n", dma);
-   return -EINVAL;
-   }
-   if (request_dma(dma, dev->driver->driver_name)) {
-   printk(" failed to allocate dma channel %u\n", dma);
-   return -EINVAL;
-   }
-   devpriv->dma = dma;
-   devpriv->dma_buffer =
-   kmalloc(A2150_DMA_BUFFER_SIZE, GFP_KERNEL | GFP_DMA);
-   if (devpriv->dma_buffer == NULL)
-   return -ENOMEM;

-   disable_dma(dma);
-   set_dma_mode(dma, DMA_MODE_READ);
+   if (dev->irq && ((dma >= 0 && dma <= 4) || (dma >= 5 && dma <= 7))) {


Since `dma` is unsigned, I'd have gone with `if (dev->irq && dma <= 7 && 
dma != 4)`, but it doesn't really matter, although your `dma >= 0` is 
always true.



+   ret = request_dma(dma, dev->board_name);
+   if (ret == 0) {
+   devpriv->dma = dma;
+   devpriv->dma_buffer = kmalloc(A2150_DMA_BUFFER_SIZE,
+ GFP_KERNEL | GFP_DMA);
+   if (!devpriv->dma_buffer)
+   return -ENOMEM;

-   devpriv->irq_dma_bits |= DMA_CHAN_BITS(dma);
-   }
+   disable_dma(dma);
+   set_dma_mode(dma, DMA_MODE_READ);

-   dev->board_ptr = a2150_boards + a2150_probe(dev);
-   thisboard = comedi_board(dev);
-   dev->board_name = thisboard->name;
+   devpriv->irq_dma_bits |= DMA_CHAN_BITS(dma);
+   }
+   }

ret = comedi_alloc_subdevices(dev, 1);
if (ret)
@@ -750,17 +734,20 @@ static int a2150_attach(struct comedi_device *dev, struct 
comedi_devconfig *i

Re: [PATCH v2 30/31] staging: comedi: ni_pcidio: request_irq() before seting up subdevices

2013-12-06 Thread Ian Abbott

On 2013-12-05 20:43, H Hartley Sweeten wrote:

Do the request_irq() before setting up the subdevices. Only hook up
the command support of the irq was sucessfully requested.

Note that, because of the IRQF_SHARED flag, nidio_interrupt() _may_
be called before the device is ready and the subdevices are setup.
This condition is handled by the (!dev->attached) sanity check. The
initialzation of the local variable pointers before this test is
still safe since we are just getting addresses and not dereferencing
them.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  drivers/staging/comedi/drivers/ni_pcidio.c | 38 +++---
  1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c 
b/drivers/staging/comedi/drivers/ni_pcidio.c
index 30c46a3..8ab8a87 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -1011,6 +1011,14 @@ static int nidio_auto_attach(struct comedi_device *dev,

nidio_reset_board(dev);

+   irq = mite_irq(devpriv->mite);
+   if (irq) {
+   ret = request_irq(irq, nidio_interrupt, IRQF_SHARED,
+ dev->board_name, dev);
+   if (ret == 0)
+   dev->irq = irq;
+   }
+
ret = comedi_alloc_subdevices(dev, 1);


Unfortunately, the interrupt handler `nidio_interrupt()` still 
dereferences the subdevice pointer before it tests `dev->attached`:


struct comedi_subdevice *s = dev->read_subdev;
struct comedi_async *async = s->async;
/* ... */
if (!dev->attached) {
return IRQ_NONE;
}

so this can still fail if `dev->read_subdev` hasn't been set yet.


if (ret)
return ret;
@@ -1019,31 +1027,23 @@ static int nidio_auto_attach(struct comedi_device *dev,
 readb(devpriv->mite->daq_io_addr + Chip_Version));

s = &dev->subdevices[0];
-
-   dev->read_subdev = s;
s->type = COMEDI_SUBD_DIO;
-   s->subdev_flags =
-   SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_PACKED |
-   SDF_CMD_READ;
+   s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_PACKED;
s->n_chan = 32;
s->range_table = &range_digital;
s->maxdata = 1;
s->insn_config = &ni_pcidio_insn_config;
s->insn_bits = &ni_pcidio_insn_bits;
-   s->do_cmd = &ni_pcidio_cmd;
-   s->do_cmdtest = &ni_pcidio_cmdtest;
-   s->cancel = &ni_pcidio_cancel;
-   s->len_chanlist = 32;/* XXX */
-   s->buf_change = &ni_pcidio_change;
-   s->async_dma_dir = DMA_BIDIRECTIONAL;
-   s->poll = &ni_pcidio_poll;
-
-   irq = mite_irq(devpriv->mite);
-   if (irq) {
-   ret = request_irq(irq, nidio_interrupt, IRQF_SHARED,
- dev->board_name, dev);
-   if (ret == 0)
-   dev->irq = irq;
+   if (dev->irq) {
+   dev->read_subdev = s;
+   s->subdev_flags |= SDF_CMD_READ;
+   s->async_dma_dir = DMA_BIDIRECTIONAL;
+   s->len_chanlist = s->n_chan;
+   s->do_cmd = ni_pcidio_cmd;
+   s->do_cmdtest = ni_pcidio_cmdtest;
+   s->cancel = ni_pcidio_cancel;
+   s->poll = ni_pcidio_poll;
+   s->buf_change = ni_pcidio_change;
}

return 0;




--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 00/31] staging: comedi: cleanup irq requests

2013-12-06 Thread Ian Abbott

On 2013-12-05 20:43, H Hartley Sweeten wrote:

The comedi subsystem only requires the drivers to support interrupts if one
or more of the subdevices support async commands. Since this is optional:

1) don't fail the attach if the irq is not available
2) only hookup the async command support if the irq is available
3) remove any async command init from subdevices that don't need it
4) remove any unnecessary sanity checks in the async command functions

Make use of the comedi_device 'read_subdev' and 'write_subdev' pointers
instead of accessing the dev->subdevices array directly with "magic" numbers
to the correct subdevice.

Also, remove any unnecessary debug noise associated with the irq requests.

This series was originally posted on 3 Dec 2013 as:

   [PATCH 00/51] staging: comedi: cleanup irq requests

The first 17 patches of that series hare already been applied to Greg
Kroah-Hartman's staging tree. This series is a repost of the remaining
patches after addressing some issues pointed out by Ian Abbott.

H Hartley Sweeten (31):
   staging: comedi: ni_at_2150: tidy up irq/dma request
   staging: comedi: me4000: use dev->read_subdev
   staging: comedi: me4000: refactor request_irq() during attach
   staging: comedi: me4000: remove unnecessary check in the irq handler
   staging: comedi: das1800: tidy up irq request
   staging: comedi: das1800: use dev->read_subdev
   staging: comedi: das16m1: remove unnecessary 'dev->irq' test
   staging: comedi: adl_pci9111: fix incorrect irq passed to request_irq()
   staging: comedi: adl_pci9111: the irq is only needed for async command 
support
   staging: comedi: dt2814: use dev->read_subdev
   staging: comedi: dt282x: use dev->read_subdev
   staging: comedi: dt282x: use dev->write_subdev
   staging: comedi: amplc_pci230: tidy up irq request
   staging: comedi: adl_pci9118: tidy up irq request
   staging: comedi: adv_pci1710: only init async command members when needed
   staging: comedi: adv_pci1710: use dev->read_subdev
   staging: comedi: dt3000: don't fail attach if irq is not available
   staging: comedi: dt3000: use dev->read_subdev
   staging: comedi: s626: use dev->read_subdev
   staging: comedi: hwrdv_apci3120: use dev->read_subdev
   staging: comedi: hwrdv_apci3200: use dev->read_subdev
   staging: comedi: adl_pci9118: use dev->read_subdev
   staging: comedi: amplc_pc236: use dev->read_subdev
   staging: comedi: amplc_pci224: use dev->write_subdev
   staging: comedi: ni_65xx: use dev->read_subdev
   staging: comedi: ni_atmio16d: use dev->read_subdev
   staging: comedi: rtd520: use dev->read_subdev
   staging: comedi: ni_pcidio: factor board reset out of attach
   staging: comedi: ni_pcidio: use dev->read_subdev
   staging: comedi: ni_pcidio: request_irq() before seting up subdevices
   staging: comedi: multiq3: pass subdevice to encoder_reset()

  .../comedi/drivers/addi-data/hwdrv_apci3120.c  |  6 +-
  .../comedi/drivers/addi-data/hwdrv_apci3200.c  |  2 +-
  drivers/staging/comedi/drivers/adl_pci9111.c   | 31 
  drivers/staging/comedi/drivers/adl_pci9118.c   | 45 +--
  drivers/staging/comedi/drivers/adv_pci1710.c   | 10 +--
  drivers/staging/comedi/drivers/amplc_pc236.c   |  2 +-
  drivers/staging/comedi/drivers/amplc_pci224.c  |  2 +-
  drivers/staging/comedi/drivers/amplc_pci230.c  | 27 +++
  drivers/staging/comedi/drivers/das16m1.c   |  5 --
  drivers/staging/comedi/drivers/das1800.c   | 88 ++
  drivers/staging/comedi/drivers/dt2814.c|  4 +-
  drivers/staging/comedi/drivers/dt282x.c| 10 +--
  drivers/staging/comedi/drivers/dt3000.c| 29 +++
  drivers/staging/comedi/drivers/me4000.c| 37 -
  drivers/staging/comedi/drivers/multiq3.c   |  6 +-
  drivers/staging/comedi/drivers/ni_65xx.c   |  2 +-
  drivers/staging/comedi/drivers/ni_at_a2150.c   | 79 ---
  drivers/staging/comedi/drivers/ni_atmio16d.c   |  2 +-
  drivers/staging/comedi/drivers/ni_pcidio.c | 64 +---
  drivers/staging/comedi/drivers/rtd520.c|  2 +-
  drivers/staging/comedi/drivers/s626.c  |  8 +-
  21 files changed, 206 insertions(+), 255 deletions(-)


Patch 30 is still wrong.  Patches 01 to 29 and 31 are fine (although I 
have minor niggles with patch 01).


It is possible for Greg to apply everything except patch 30.

Reviewed-by: Ian Abbott 

--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv5][ 3/8] staging: imx-drm: Correct BGR666 and the board's dts that use them.

2013-12-06 Thread Thierry Reding
On Thu, Dec 05, 2013 at 07:28:07PM +0100, Denis Carikli wrote:
[...]
> diff --git a/arch/arm/boot/dts/imx51-apf51dev.dts 
> b/arch/arm/boot/dts/imx51-apf51dev.dts
> index f36a3aa..3b6de6a 100644
> --- a/arch/arm/boot/dts/imx51-apf51dev.dts
> +++ b/arch/arm/boot/dts/imx51-apf51dev.dts
> @@ -19,7 +19,7 @@
>   display@di1 {
   

I know this isn't introduced by your patch, but WTF???

Thierry


pgpeRNOPkx7Jk.pgp
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv5][ 2/8] staging: imx-drm: Add RGB666 support for parallel display.

2013-12-06 Thread Thierry Reding
On Thu, Dec 05, 2013 at 07:28:06PM +0100, Denis Carikli wrote:
[...]
> diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c 
> b/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
[...]
> @@ -155,6 +156,8 @@ static int ipu_pixfmt_to_map(u32 fmt)
>   return IPU_DC_MAP_BGR666;
>   case V4L2_PIX_FMT_BGR24:
>   return IPU_DC_MAP_BGR24;
> + case V4L2_PIX_FMT_RGB666:
> + return IPU_DC_MAP_RGB666;

Why is this DRM driver even using V4L2 pixel formats in the first place?

Thierry


pgpT_HOy9ANzp.pgp
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv5][ 5/8] staging: imx-drm: parallel display: add regulator support.

2013-12-06 Thread Thierry Reding
On Thu, Dec 05, 2013 at 07:28:09PM +0100, Denis Carikli wrote:
[...]
> diff --git a/drivers/staging/imx-drm/parallel-display.c 
> b/drivers/staging/imx-drm/parallel-display.c
[...]
> @@ -260,6 +275,13 @@ static int imx_pd_probe(struct platform_device *pdev)
>   if (ret)
>   return ret;
>  
> + imxpd->disp_reg = devm_regulator_get(&pdev->dev, "display");
> + if (PTR_ERR(imxpd->disp_reg) == -EPROBE_DEFER)
> + return -EPROBE_DEFER;
> +
> + if (IS_ERR(imxpd->disp_reg))
> + dev_dbg(&pdev->dev, "Operating without display regulator.\n");

I don't think this is necessary. There is code in the regulator core
nowadays that supplies a dummy regulator if one hasn't been hooked up in
devicetree explicitly. So any error that you get at this point is likely
a valid one rather than just a missing regulator.

The advantage is that you no longer have to check at every step of the
way that the regulator is valid before calling the regulator API.

Thierry


pgpOzaX7uYTJz.pgp
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv5][ 2/8] staging: imx-drm: Add RGB666 support for parallel display.

2013-12-06 Thread Lucas Stach
Am Freitag, den 06.12.2013, 14:14 +0100 schrieb Thierry Reding:
> On Thu, Dec 05, 2013 at 07:28:06PM +0100, Denis Carikli wrote:
> [...]
> > diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c 
> > b/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
> [...]
> > @@ -155,6 +156,8 @@ static int ipu_pixfmt_to_map(u32 fmt)
> > return IPU_DC_MAP_BGR666;
> > case V4L2_PIX_FMT_BGR24:
> > return IPU_DC_MAP_BGR24;
> > +   case V4L2_PIX_FMT_RGB666:
> > +   return IPU_DC_MAP_RGB666;
> 
> Why is this DRM driver even using V4L2 pixel formats in the first place?
> 
Because imx-drm is actually a misnomer. The i.MX IPU is a multifunction
device, which as one part has the display controllers, but also camera
interfaces and mem-to-mem scaler devices, which are hooked up via the
V4L2 interface.

The generic IPU part, which is used for example for programming the DMA
channels is using V4L2 pixel formats as a common base. We have patches
to split this out and make this fact more visible. (The IPU core will be
placed aside the Tegra host1x driver)

Regards,
Lucas
-- 
Pengutronix e.K.   | Lucas Stach |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 |
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/7] staging: et131x: reduce split lines in et131x_rx_dma_memory_free

2013-12-06 Thread ZHAO Gang
Signed-off-by: ZHAO Gang 
---
 drivers/staging/et131x/et131x.c | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 17ac711..b6ce68e 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -2361,6 +2361,7 @@ static void et131x_rx_dma_memory_free(struct 
et131x_adapter *adapter)
u32 pktstat_ringsize;
struct rfd *rfd;
struct rx_ring *rx_ring;
+   struct fbr_lookup *fbr;
 
/* Setup some convenience pointers */
rx_ring = &adapter->rx_ring;
@@ -2379,34 +2380,34 @@ static void et131x_rx_dma_memory_free(struct 
et131x_adapter *adapter)
 
/* Free Free Buffer Rings */
for (id = 0; id < NUM_FBRS; id++) {
-   if (!rx_ring->fbr[id]->ring_virtaddr)
+   fbr = rx_ring->fbr[id];
+
+   if (!fbr->ring_virtaddr)
continue;
 
/* First the packet memory */
-   for (index = 0;
-index < (rx_ring->fbr[id]->num_entries / FBR_CHUNKS);
+   for (index = 0; index < fbr->num_entries / FBR_CHUNKS;
 index++) {
-   if (rx_ring->fbr[id]->mem_virtaddrs[index]) {
-   bufsize =
-   rx_ring->fbr[id]->buffsize * FBR_CHUNKS;
+   if (fbr->mem_virtaddrs[index]) {
+   bufsize = fbr->buffsize * FBR_CHUNKS;
 
dma_free_coherent(&adapter->pdev->dev,
-   bufsize,
-   rx_ring->fbr[id]->mem_virtaddrs[index],
-   rx_ring->fbr[id]->mem_physaddrs[index]);
+ bufsize,
+ fbr->mem_virtaddrs[index],
+ fbr->mem_physaddrs[index]);
 
-   rx_ring->fbr[id]->mem_virtaddrs[index] = NULL;
+   fbr->mem_virtaddrs[index] = NULL;
}
}
 
-   bufsize =
-   sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries;
+   bufsize = sizeof(struct fbr_desc) * fbr->num_entries;
 
-   dma_free_coherent(&adapter->pdev->dev, bufsize,
-   rx_ring->fbr[id]->ring_virtaddr,
-   rx_ring->fbr[id]->ring_physaddr);
+   dma_free_coherent(&adapter->pdev->dev,
+ bufsize,
+ fbr->ring_virtaddr,
+ fbr->ring_physaddr);
 
-   rx_ring->fbr[id]->ring_virtaddr = NULL;
+   fbr->ring_virtaddr = NULL;
}
 
/* Free Packet Status Ring */
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/7] staging: et131x: reduce split lines in et131x_rx_dma_memory_alloc

2013-12-06 Thread ZHAO Gang
Signed-off-by: ZHAO Gang 
---
 drivers/staging/et131x/et131x.c | 48 -
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index ee231f2..17ac711 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -2202,6 +2202,7 @@ static int et131x_rx_dma_memory_alloc(struct 
et131x_adapter *adapter)
u32 pktstat_ringsize;
u32 fbr_chunksize;
struct rx_ring *rx_ring;
+   struct fbr_lookup *fbr;
 
/* Setup some convenience pointers */
rx_ring = &adapter->rx_ring;
@@ -2245,20 +2246,18 @@ static int et131x_rx_dma_memory_alloc(struct 
et131x_adapter *adapter)
rx_ring->fbr[1]->num_entries = 128;
}
 
-   adapter->rx_ring.psr_num_entries =
-   adapter->rx_ring.fbr[0]->num_entries +
-   adapter->rx_ring.fbr[1]->num_entries;
+   rx_ring->psr_num_entries = rx_ring->fbr[0]->num_entries +
+  rx_ring->fbr[1]->num_entries;
 
for (id = 0; id < NUM_FBRS; id++) {
+   fbr = rx_ring->fbr[id];
/* Allocate an area of memory for Free Buffer Ring */
-   bufsize =
-   (sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries);
-   rx_ring->fbr[id]->ring_virtaddr =
-   dma_alloc_coherent(&adapter->pdev->dev,
-   bufsize,
-   &rx_ring->fbr[id]->ring_physaddr,
-   GFP_KERNEL);
-   if (!rx_ring->fbr[id]->ring_virtaddr) {
+   bufsize = sizeof(struct fbr_desc) * fbr->num_entries;
+   fbr->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev,
+   bufsize,
+   &fbr->ring_physaddr,
+   GFP_KERNEL);
+   if (!fbr->ring_virtaddr) {
dev_err(&adapter->pdev->dev,
   "Cannot alloc memory for Free Buffer Ring %d\n", id);
return -ENOMEM;
@@ -2266,25 +2265,25 @@ static int et131x_rx_dma_memory_alloc(struct 
et131x_adapter *adapter)
}
 
for (id = 0; id < NUM_FBRS; id++) {
-   fbr_chunksize = (FBR_CHUNKS * rx_ring->fbr[id]->buffsize);
+   fbr = rx_ring->fbr[id];
+   fbr_chunksize = (FBR_CHUNKS * fbr->buffsize);
 
-   for (i = 0;
-i < (rx_ring->fbr[id]->num_entries / FBR_CHUNKS); i++) {
+   for (i = 0; i < fbr->num_entries / FBR_CHUNKS; i++) {
dma_addr_t fbr_tmp_physaddr;
 
-   rx_ring->fbr[id]->mem_virtaddrs[i] = dma_alloc_coherent(
+   fbr->mem_virtaddrs[i] = dma_alloc_coherent(
&adapter->pdev->dev, fbr_chunksize,
-   &rx_ring->fbr[id]->mem_physaddrs[i],
+   &fbr->mem_physaddrs[i],
GFP_KERNEL);
 
-   if (!rx_ring->fbr[id]->mem_virtaddrs[i]) {
+   if (!fbr->mem_virtaddrs[i]) {
dev_err(&adapter->pdev->dev,
"Could not alloc memory\n");
return -ENOMEM;
}
 
/* See NOTE in "Save Physical Address" comment above */
-   fbr_tmp_physaddr = rx_ring->fbr[id]->mem_physaddrs[i];
+   fbr_tmp_physaddr = fbr->mem_physaddrs[i];
 
for (j = 0; j < FBR_CHUNKS; j++) {
u32 index = (i * FBR_CHUNKS) + j;
@@ -2292,26 +2291,25 @@ static int et131x_rx_dma_memory_alloc(struct 
et131x_adapter *adapter)
/* Save the Virtual address of this index for
 * quick access later
 */
-   rx_ring->fbr[id]->virt[index] =
- (u8 *) rx_ring->fbr[id]->mem_virtaddrs[i] +
- (j * rx_ring->fbr[id]->buffsize);
+   fbr->virt[index] = (u8 *)fbr->mem_virtaddrs[i] +
+  (j * fbr->buffsize);
 
/* now store the physical address in the
 * descriptor so the device can access it
 */
-   rx_ring->fbr[id]->bus_high[index] =
+   fbr->bus_high[index] =
upper_32_bits(fbr_tmp_physaddr);
-   

[PATCH 5/7] staging: et131x: reduce split lines in nic_rx_pkts

2013-12-06 Thread ZHAO Gang
Signed-off-by: ZHAO Gang 
---
 drivers/staging/et131x/et131x.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 3e34c2e..8d75a3f 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -2577,6 +2577,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter 
*adapter)
u32 word0;
u32 word1;
struct sk_buff *skb;
+   struct fbr_lookup *fbr;
 
/* RX Status block is written by the DMA engine prior to every
 * interrupt. It contains the next to be used entry in the Packet
@@ -2598,6 +2599,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter 
*adapter)
 */
len = psr->word1 & 0x;
ring_index = (psr->word1 >> 26) & 0x03;
+   fbr = rx_local->fbr[ring_index];
buff_index = (psr->word1 >> 16) & 0x3FF;
word0 = psr->word0;
 
@@ -2613,8 +2615,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter 
*adapter)
 
writel(rx_local->local_psr_full, &adapter->regs->rxdma.psr_full_offset);
 
-   if (ring_index > 1 ||
-   buff_index > rx_local->fbr[ring_index]->num_entries - 1) {
+   if (ring_index > 1 || buff_index > fbr->num_entries - 1) {
/* Illegal buffer or ring index cannot be used by S/W*/
dev_err(&adapter->pdev->dev,
"NICRxPkts PSR Entry %d indicates length of %d and/or 
bad bi(%d)\n",
@@ -2667,7 +2668,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter 
*adapter)
   && !(adapter->packet_filter & ET131X_PACKET_TYPE_PROMISCUOUS)
   && !(adapter->packet_filter &
ET131X_PACKET_TYPE_ALL_MULTICAST)) {
-   buf = rx_local->fbr[ring_index]->virt[buff_index];
+   buf = fbr->virt[buff_index];
 
/* Loop through our list to see if the destination
 * address of this packet matches one in our list.
@@ -2720,9 +2721,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter 
*adapter)
 
adapter->net_stats.rx_bytes += rfd->len;
 
-   memcpy(skb_put(skb, rfd->len),
-  rx_local->fbr[ring_index]->virt[buff_index],
-  rfd->len);
+   memcpy(skb_put(skb, rfd->len), fbr->virt[buff_index], rfd->len);
 
skb->protocol = eth_type_trans(skb, adapter->netdev);
skb->ip_summed = CHECKSUM_NONE;
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/7] staging: et131x: reduce split lines in et131x_config_rx_dma_regs

2013-12-06 Thread ZHAO Gang
Signed-off-by: ZHAO Gang 
---
 drivers/staging/et131x/et131x.c | 26 --
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index e3a71d3..ee231f2 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -1821,6 +1821,9 @@ static void et131x_config_rx_dma_regs(struct 
et131x_adapter *adapter)
u32 __iomem *min_des;
u32 __iomem *base_hi;
u32 __iomem *base_lo;
+   struct fbr_lookup *fbr;
+
+   fbr = rx_local->fbr[id];
 
if (id == 0) {
num_des = &rx_dma->fbr0_num_des;
@@ -1837,12 +1840,10 @@ static void et131x_config_rx_dma_regs(struct 
et131x_adapter *adapter)
}
 
/* Now's the best time to initialize FBR contents */
-   fbr_entry =
-   (struct fbr_desc *) rx_local->fbr[id]->ring_virtaddr;
-   for (entry = 0;
-entry < rx_local->fbr[id]->num_entries; entry++) {
-   fbr_entry->addr_hi = rx_local->fbr[id]->bus_high[entry];
-   fbr_entry->addr_lo = rx_local->fbr[id]->bus_low[entry];
+   fbr_entry = (struct fbr_desc *) fbr->ring_virtaddr;
+   for (entry = 0; entry < fbr->num_entries; entry++) {
+   fbr_entry->addr_hi = fbr->bus_high[entry];
+   fbr_entry->addr_lo = fbr->bus_low[entry];
fbr_entry->word2 = entry;
fbr_entry++;
}
@@ -1850,19 +1851,16 @@ static void et131x_config_rx_dma_regs(struct 
et131x_adapter *adapter)
/* Set the address and parameters of Free buffer ring 1 and 0
 * into the 1310's registers
 */
-   writel(upper_32_bits(rx_local->fbr[id]->ring_physaddr),
-  base_hi);
-   writel(lower_32_bits(rx_local->fbr[id]->ring_physaddr),
-  base_lo);
-   writel(rx_local->fbr[id]->num_entries - 1, num_des);
+   writel(upper_32_bits(fbr->ring_physaddr), base_hi);
+   writel(lower_32_bits(fbr->ring_physaddr), base_lo);
+   writel(fbr->num_entries - 1, num_des);
writel(ET_DMA10_WRAP, full_offset);
 
/* This variable tracks the free buffer ring 1 full position,
 * so it has to match the above.
 */
-   rx_local->fbr[id]->local_full = ET_DMA10_WRAP;
-   writel(((rx_local->fbr[id]->num_entries *
-   LO_MARK_PERCENT_FOR_RX) / 100) - 1,
+   fbr->local_full = ET_DMA10_WRAP;
+   writel(((fbr->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
   min_des);
}
 
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 6/7] staging: et131x: remove item that have been done in TODO file

2013-12-06 Thread ZHAO Gang
Signed-off-by: ZHAO Gang 
---
 drivers/staging/et131x/README | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/et131x/README b/drivers/staging/et131x/README
index 8da96a6..3befc45 100644
--- a/drivers/staging/et131x/README
+++ b/drivers/staging/et131x/README
@@ -13,10 +13,6 @@ TODO:
- Implement NAPI support
- In et131x_tx(), don't return NETDEV_TX_BUSY, just drop the packet 
with kfree_skb().
- Reduce the number of split lines by careful consideration of variable 
names etc.
-   - Do this in et131x.c:
-struct fbr_lookup *fbr;
-fbr = rx_local->fbr[id];
- Then replace all the instances of "rx_local->fbr[id]" with fbr.
 
 Please send patches to:
Greg Kroah-Hartman 
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/7] staging: et131x: reduce split lines in nic_return_rfd

2013-12-06 Thread ZHAO Gang
Signed-off-by: ZHAO Gang 
---
 drivers/staging/et131x/et131x.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index b6ce68e..3e34c2e 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -2505,8 +2505,12 @@ static void nic_return_rfd(struct et131x_adapter 
*adapter, struct rfd *rfd)
 * need to clean up OOB data
 */
if (buff_index < rx_local->fbr[ring_index]->num_entries) {
+   u32 free_buff_ring;
u32 __iomem *offset;
struct fbr_desc *next;
+   struct fbr_lookup *fbr;
+
+   fbr = rx_local->fbr[ring_index];
 
spin_lock_irqsave(&adapter->fbr_lock, flags);
 
@@ -2515,22 +2519,20 @@ static void nic_return_rfd(struct et131x_adapter 
*adapter, struct rfd *rfd)
else
offset = &rx_dma->fbr1_full_offset;
 
-   next = (struct fbr_desc *)
-  (rx_local->fbr[ring_index]->ring_virtaddr) +
-   INDEX10(rx_local->fbr[ring_index]->local_full);
+   next = (struct fbr_desc *)(fbr->ring_virtaddr) +
+  INDEX10(fbr->local_full);
 
/* Handle the Free Buffer Ring advancement here. Write
 * the PA / Buffer Index for the returned buffer into
 * the oldest (next to be freed)FBR entry
 */
-   next->addr_hi = rx_local->fbr[ring_index]->bus_high[buff_index];
-   next->addr_lo = rx_local->fbr[ring_index]->bus_low[buff_index];
+   next->addr_hi = fbr->bus_high[buff_index];
+   next->addr_lo = fbr->bus_low[buff_index];
next->word2 = buff_index;
 
-   writel(bump_free_buff_ring(
- &rx_local->fbr[ring_index]->local_full,
- rx_local->fbr[ring_index]->num_entries - 1),
-  offset);
+   free_buff_ring = bump_free_buff_ring(&fbr->local_full,
+fbr->num_entries - 1);
+   writel(free_buff_ring, offset);
 
spin_unlock_irqrestore(&adapter->fbr_lock, flags);
} else {
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 7/7] staging: et131x: remove unnecessary pointer typecast

2013-12-06 Thread ZHAO Gang
Signed-off-by: ZHAO Gang 
---
 drivers/staging/et131x/et131x.c | 22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 8d75a3f..1abea42 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -1840,7 +1840,7 @@ static void et131x_config_rx_dma_regs(struct 
et131x_adapter *adapter)
}
 
/* Now's the best time to initialize FBR contents */
-   fbr_entry = (struct fbr_desc *) fbr->ring_virtaddr;
+   fbr_entry = fbr->ring_virtaddr;
for (entry = 0; entry < fbr->num_entries; entry++) {
fbr_entry->addr_hi = fbr->bus_high[entry];
fbr_entry->addr_lo = fbr->bus_low[entry];
@@ -2370,8 +2370,8 @@ static void et131x_rx_dma_memory_free(struct 
et131x_adapter *adapter)
WARN_ON(rx_ring->num_ready_recv != rx_ring->num_rfd);
 
while (!list_empty(&rx_ring->recv_list)) {
-   rfd = (struct rfd *) list_entry(rx_ring->recv_list.next,
-   struct rfd, list_node);
+   rfd = list_entry(rx_ring->recv_list.next,
+struct rfd, list_node);
 
list_del(&rfd->list_node);
rfd->skb = NULL;
@@ -2627,7 +2627,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter 
*adapter)
spin_lock_irqsave(&adapter->rcv_lock, flags);
 
element = rx_local->recv_list.next;
-   rfd = (struct rfd *) list_entry(element, struct rfd, list_node);
+   rfd = list_entry(element, struct rfd, list_node);
 
if (!rfd) {
spin_unlock_irqrestore(&adapter->rcv_lock, flags);
@@ -2808,11 +2808,10 @@ static int et131x_tx_dma_memory_alloc(struct 
et131x_adapter *adapter)
return -ENOMEM;
 
desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX);
-   tx_ring->tx_desc_ring =
-   (struct tx_desc *) dma_alloc_coherent(&adapter->pdev->dev,
- desc_size,
- &tx_ring->tx_desc_ring_pa,
- GFP_KERNEL);
+   tx_ring->tx_desc_ring = dma_alloc_coherent(&adapter->pdev->dev,
+  desc_size,
+  &tx_ring->tx_desc_ring_pa,
+  GFP_KERNEL);
if (!adapter->tx_ring.tx_desc_ring) {
dev_err(&adapter->pdev->dev,
"Cannot alloc memory for Tx Ring\n");
@@ -3200,9 +3199,8 @@ static inline void free_send_packet(struct et131x_adapter 
*adapter,
 * they point to
 */
do {
-   desc = (struct tx_desc *)
-   (adapter->tx_ring.tx_desc_ring +
-   INDEX10(tcb->index_start));
+   desc = adapter->tx_ring.tx_desc_ring +
+  INDEX10(tcb->index_start);
 
dma_addr = desc->addr_lo;
dma_addr |= (u64)desc->addr_hi << 32;
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv5][ 2/8] staging: imx-drm: Add RGB666 support for parallel display.

2013-12-06 Thread Thierry Reding
On Fri, Dec 06, 2013 at 02:29:22PM +0100, Lucas Stach wrote:
> Am Freitag, den 06.12.2013, 14:14 +0100 schrieb Thierry Reding:
> > On Thu, Dec 05, 2013 at 07:28:06PM +0100, Denis Carikli wrote:
> > [...]
> > > diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c 
> > > b/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
> > [...]
> > > @@ -155,6 +156,8 @@ static int ipu_pixfmt_to_map(u32 fmt)
> > >   return IPU_DC_MAP_BGR666;
> > >   case V4L2_PIX_FMT_BGR24:
> > >   return IPU_DC_MAP_BGR24;
> > > + case V4L2_PIX_FMT_RGB666:
> > > + return IPU_DC_MAP_RGB666;
> > 
> > Why is this DRM driver even using V4L2 pixel formats in the first place?
> > 
> Because imx-drm is actually a misnomer. The i.MX IPU is a multifunction
> device, which as one part has the display controllers, but also camera
> interfaces and mem-to-mem scaler devices, which are hooked up via the
> V4L2 interface.
> 
> The generic IPU part, which is used for example for programming the DMA
> channels is using V4L2 pixel formats as a common base. We have patches
> to split this out and make this fact more visible. (The IPU core will be
> placed aside the Tegra host1x driver)

Have you considered splitting thing up further and move out the display
controller driver to DRM and the camera driver to V4L2? I mean, if that
is even possible with a reasonable amount of work.

Is the "mem-to-mem" the same as the "DMA channels" you mentioned? If it
only does DMA, why does it even need to worry about pixel formats?

Thierry


pgpEc5WPsAN7a.pgp
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: crystalhd: Fix typo in crystalhd

2013-12-06 Thread Masanari Iida
Correct spelling typo.

Signed-off-by: Masanari Iida 
---
 drivers/staging/crystalhd/bc_dts_glob_lnx.h | 2 +-
 drivers/staging/crystalhd/crystalhd_cmds.c  | 2 +-
 drivers/staging/crystalhd/crystalhd_cmds.h  | 2 +-
 drivers/staging/crystalhd/crystalhd_fw_if.h | 2 +-
 drivers/staging/crystalhd/crystalhd_hw.c| 2 +-
 drivers/staging/crystalhd/crystalhd_hw.h| 6 +++---
 drivers/staging/crystalhd/crystalhd_lnx.h   | 2 +-
 drivers/staging/crystalhd/crystalhd_misc.c  | 4 ++--
 drivers/staging/crystalhd/crystalhd_misc.h  | 2 +-
 9 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/crystalhd/bc_dts_glob_lnx.h 
b/drivers/staging/crystalhd/bc_dts_glob_lnx.h
index 981708f..92b0cff 100644
--- a/drivers/staging/crystalhd/bc_dts_glob_lnx.h
+++ b/drivers/staging/crystalhd/bc_dts_glob_lnx.h
@@ -229,7 +229,7 @@ enum BC_DRV_CMD {
DRV_CMD_REG_RD, /* Read Device Register */
DRV_CMD_REG_WR, /* Write Device Register */
DRV_CMD_FPGA_RD,/* Read FPGA Register */
-   DRV_CMD_FPGA_WR,/* Wrtie FPGA Reister */
+   DRV_CMD_FPGA_WR,/* Write FPGA Register */
DRV_CMD_MEM_RD, /* Read Device Memory */
DRV_CMD_MEM_WR, /* Write Device Memory */
DRV_CMD_RD_PCI_CFG, /* Read PCI Config Space */
diff --git a/drivers/staging/crystalhd/crystalhd_cmds.c 
b/drivers/staging/crystalhd/crystalhd_cmds.c
index 3972b52..642f438 100644
--- a/drivers/staging/crystalhd/crystalhd_cmds.c
+++ b/drivers/staging/crystalhd/crystalhd_cmds.c
@@ -798,7 +798,7 @@ static const struct crystalhd_cmd_tbl   
g_crystalhd_cproc_tbl[] = {
  *
  * Current gstreamer frame work does not provide any power management
  * related notification to user mode decoder plug-in. As a work-around
- * we pass on the power mangement notification to our plug-in by completing
+ * we pass on the power management notification to our plug-in by completing
  * all outstanding requests with BC_STS_IO_USER_ABORT return code.
  */
 enum BC_STATUS crystalhd_suspend(struct crystalhd_cmd *ctx,
diff --git a/drivers/staging/crystalhd/crystalhd_cmds.h 
b/drivers/staging/crystalhd/crystalhd_cmds.h
index 377cd9d..b5bf59d 100644
--- a/drivers/staging/crystalhd/crystalhd_cmds.h
+++ b/drivers/staging/crystalhd/crystalhd_cmds.h
@@ -29,7 +29,7 @@
 
 /*
  * NOTE:: This is the main interface file between the Linux layer
- *and the harware layer. This file will use the definitions
+ *and the hardware layer. This file will use the definitions
  *from _dts_glob and dts_defs etc.. which are defined for
  *windows.
  */
diff --git a/drivers/staging/crystalhd/crystalhd_fw_if.h 
b/drivers/staging/crystalhd/crystalhd_fw_if.h
index 4b363a5..05615e2 100644
--- a/drivers/staging/crystalhd/crystalhd_fw_if.h
+++ b/drivers/staging/crystalhd/crystalhd_fw_if.h
@@ -115,7 +115,7 @@ struct fgt_sei {
unsigned char model_id; /* Model id. */
 
/* +unused SE based on Thomson spec */
-   unsigned char color_desc_flag;  /* Separate color descrition flag. */
+   unsigned char color_desc_flag;  /* Separate color description flag. */
unsigned char bit_depth_luma;   /* Bit depth luma minus 8. */
unsigned char bit_depth_chroma; /* Bit depth chroma minus 8. */
unsigned char full_range_flag;  /* Full range flag. */
diff --git a/drivers/staging/crystalhd/crystalhd_hw.c 
b/drivers/staging/crystalhd/crystalhd_hw.c
index 043bd49..8d0680d 100644
--- a/drivers/staging/crystalhd/crystalhd_hw.c
+++ b/drivers/staging/crystalhd/crystalhd_hw.c
@@ -398,7 +398,7 @@ static void crystalhd_hw_free_rx_pkt(struct crystalhd_hw 
*hw,
  * Call back from TX - IOQ deletion.
  *
  * This routine will release the TX DMA rings allocated
- * druing setup_dma rings interface.
+ * during setup_dma rings interface.
  *
  * Memory is allocated per DMA ring basis. This is just
  * a place holder to be able to create the dio queues.
diff --git a/drivers/staging/crystalhd/crystalhd_hw.h 
b/drivers/staging/crystalhd/crystalhd_hw.h
index 3780944..d5cb68d 100644
--- a/drivers/staging/crystalhd/crystalhd_hw.h
+++ b/drivers/staging/crystalhd/crystalhd_hw.h
@@ -46,7 +46,7 @@
 #define Cpu2HstMbx10x00100F04
 #define MbxStat1   0x00100F08
 #define Stream2Host_Intr_Sts   0x00100F24
-#define C011_RET_SUCCESS   0x0 /* Reutrn status of firmware command. */
+#define C011_RET_SUCCESS   0x0 /* Return status of firmware command. */
 
 /* TS input status register */
 #define TS_StreamAFIFOStatus   0x0010044C
@@ -141,7 +141,7 @@ union link_misc_perst_deco_ctrl {
uint32_treserved0:3;/* Reserved.No Effect*/
uint32_tstop_bcm_7412_clk:1;/* 1 ->Stops branch of
27MHz clk used to clk BCM7412*/
-   uint32_treserved1:27;   /* Reseved. No Effect*/
+   uint32_treserved1:27;   /* Reserv

Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper

2013-12-06 Thread gre...@linuxfoundation.org
On Fri, Dec 06, 2013 at 08:05:38AM +0200, Ivajlo Dimitrov wrote:
> Hi Greg,
> 
> On 01.12.2013 19:07, Ivaylo DImitrov wrote:
> > From: Ivaylo Dimitrov 
> >
> > Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't
> > need to be exported. It can also be made way simpler by using sscanf.
> >
> > Signed-off-by: Ivaylo Dimitrov 
> > ---
> >   drivers/staging/tidspbridge/Makefile   |2 +-
> >   drivers/staging/tidspbridge/gen/uuidutil.c |   85 
> > 
> >   .../tidspbridge/include/dspbridge/uuidutil.h   |   18 
> >   drivers/staging/tidspbridge/rmgr/dbdcd.c   |   42 +-
> >   4 files changed, 39 insertions(+), 108 deletions(-)
> >   delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c
> >
> 
> I guess the initial mail somehow didn't make it through your spam filter:
> https://lkml.org/lkml/2013/12/1/70

It did, but I thought that people asked for it to be changed in the
thread afterwards, so I was expecting an updated version from you.

Care to fix things up and resend it?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/13] staging: comedi: pcmuio: cleanup driver

2013-12-06 Thread Ian Abbott

On 2013-12-05 23:54, H Hartley Sweeten wrote:

I orignally posted this series on 07/24/2013. At that time Ian Abbott had
some comments on it. I finally got around to addressing them.

This series cleans up the interrupt support and private data usage. It
also does a bit of cleanup to clarify the driver.

H Hartley Sweeten (13):
   staging: comedi: pcmuio: fix interrupt requests
   staging: comedi: pcmuio: spinlock protect pcmuio_{write,read}()
   staging: comedi: pcmuio: tidy up pcmuio_handle_asic_interrupt()
   staging: comedi: pcmuio: remove 'asic' member from subdevice private data
   staging: comedi: pcmuio: remove subdevice private data
   staging: comedi: pcmuio: fix pcmuio_dio_insn_bits()
   staging: comedi: pcmuio: remove unnecessary mask of triggered channels
   staging: comedi: pcmuio: add inline helpers to get the 'iobase', 'asic', and 
'port'
   staging: comedi: pcmuio: document the spinlock_t variables
   staging: comedi: pcmuio: fix types of some private data variables
   staging: comedi: pcmuio: remove unneeded include
   staging: comedi: pcmuio: tidy up pcmuio_attach()
   staging: comedi: pcmuio: tidy up pcmuio_start_intr()

  drivers/staging/comedi/drivers/pcmuio.c | 428 
  1 file changed, 213 insertions(+), 215 deletions(-)



Looks good!  Just needs the Signed-off-by line on patch 03, as spotted 
by Dan Carpenter.


--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: crystalhd: Fix typo in crystalhd

2013-12-06 Thread Randy Dunlap
On 12/06/13 06:27, Masanari Iida wrote:
> Correct spelling typo.
> 
> Signed-off-by: Masanari Iida 

Acked-by: Randy Dunlap 

Thanks.

> ---
>  drivers/staging/crystalhd/bc_dts_glob_lnx.h | 2 +-
>  drivers/staging/crystalhd/crystalhd_cmds.c  | 2 +-
>  drivers/staging/crystalhd/crystalhd_cmds.h  | 2 +-
>  drivers/staging/crystalhd/crystalhd_fw_if.h | 2 +-
>  drivers/staging/crystalhd/crystalhd_hw.c| 2 +-
>  drivers/staging/crystalhd/crystalhd_hw.h| 6 +++---
>  drivers/staging/crystalhd/crystalhd_lnx.h   | 2 +-
>  drivers/staging/crystalhd/crystalhd_misc.c  | 4 ++--
>  drivers/staging/crystalhd/crystalhd_misc.h  | 2 +-
>  9 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/crystalhd/bc_dts_glob_lnx.h 
> b/drivers/staging/crystalhd/bc_dts_glob_lnx.h
> index 981708f..92b0cff 100644
> --- a/drivers/staging/crystalhd/bc_dts_glob_lnx.h
> +++ b/drivers/staging/crystalhd/bc_dts_glob_lnx.h
> @@ -229,7 +229,7 @@ enum BC_DRV_CMD {
>   DRV_CMD_REG_RD, /* Read Device Register */
>   DRV_CMD_REG_WR, /* Write Device Register */
>   DRV_CMD_FPGA_RD,/* Read FPGA Register */
> - DRV_CMD_FPGA_WR,/* Wrtie FPGA Reister */
> + DRV_CMD_FPGA_WR,/* Write FPGA Register */
>   DRV_CMD_MEM_RD, /* Read Device Memory */
>   DRV_CMD_MEM_WR, /* Write Device Memory */
>   DRV_CMD_RD_PCI_CFG, /* Read PCI Config Space */
> diff --git a/drivers/staging/crystalhd/crystalhd_cmds.c 
> b/drivers/staging/crystalhd/crystalhd_cmds.c
> index 3972b52..642f438 100644
> --- a/drivers/staging/crystalhd/crystalhd_cmds.c
> +++ b/drivers/staging/crystalhd/crystalhd_cmds.c
> @@ -798,7 +798,7 @@ static const struct crystalhd_cmd_tbl 
> g_crystalhd_cproc_tbl[] = {
>   *
>   * Current gstreamer frame work does not provide any power management
>   * related notification to user mode decoder plug-in. As a work-around
> - * we pass on the power mangement notification to our plug-in by completing
> + * we pass on the power management notification to our plug-in by completing
>   * all outstanding requests with BC_STS_IO_USER_ABORT return code.
>   */
>  enum BC_STATUS crystalhd_suspend(struct crystalhd_cmd *ctx,
> diff --git a/drivers/staging/crystalhd/crystalhd_cmds.h 
> b/drivers/staging/crystalhd/crystalhd_cmds.h
> index 377cd9d..b5bf59d 100644
> --- a/drivers/staging/crystalhd/crystalhd_cmds.h
> +++ b/drivers/staging/crystalhd/crystalhd_cmds.h
> @@ -29,7 +29,7 @@
>  
>  /*
>   * NOTE:: This is the main interface file between the Linux layer
> - *and the harware layer. This file will use the definitions
> + *and the hardware layer. This file will use the definitions
>   *from _dts_glob and dts_defs etc.. which are defined for
>   *windows.
>   */
> diff --git a/drivers/staging/crystalhd/crystalhd_fw_if.h 
> b/drivers/staging/crystalhd/crystalhd_fw_if.h
> index 4b363a5..05615e2 100644
> --- a/drivers/staging/crystalhd/crystalhd_fw_if.h
> +++ b/drivers/staging/crystalhd/crystalhd_fw_if.h
> @@ -115,7 +115,7 @@ struct fgt_sei {
>   unsigned char model_id; /* Model id. */
>  
>   /* +unused SE based on Thomson spec */
> - unsigned char color_desc_flag;  /* Separate color descrition flag. */
> + unsigned char color_desc_flag;  /* Separate color description flag. */
>   unsigned char bit_depth_luma;   /* Bit depth luma minus 8. */
>   unsigned char bit_depth_chroma; /* Bit depth chroma minus 8. */
>   unsigned char full_range_flag;  /* Full range flag. */
> diff --git a/drivers/staging/crystalhd/crystalhd_hw.c 
> b/drivers/staging/crystalhd/crystalhd_hw.c
> index 043bd49..8d0680d 100644
> --- a/drivers/staging/crystalhd/crystalhd_hw.c
> +++ b/drivers/staging/crystalhd/crystalhd_hw.c
> @@ -398,7 +398,7 @@ static void crystalhd_hw_free_rx_pkt(struct crystalhd_hw 
> *hw,
>   * Call back from TX - IOQ deletion.
>   *
>   * This routine will release the TX DMA rings allocated
> - * druing setup_dma rings interface.
> + * during setup_dma rings interface.
>   *
>   * Memory is allocated per DMA ring basis. This is just
>   * a place holder to be able to create the dio queues.
> diff --git a/drivers/staging/crystalhd/crystalhd_hw.h 
> b/drivers/staging/crystalhd/crystalhd_hw.h
> index 3780944..d5cb68d 100644
> --- a/drivers/staging/crystalhd/crystalhd_hw.h
> +++ b/drivers/staging/crystalhd/crystalhd_hw.h
> @@ -46,7 +46,7 @@
>  #define Cpu2HstMbx1  0x00100F04
>  #define MbxStat1 0x00100F08
>  #define Stream2Host_Intr_Sts 0x00100F24
> -#define C011_RET_SUCCESS 0x0 /* Reutrn status of firmware command. */
> +#define C011_RET_SUCCESS 0x0 /* Return status of firmware command. */
>  
>  /* TS input status register */
>  #define TS_StreamAFIFOStatus 0x0010044C
> @@ -141,7 +141,7 @@ union link_misc_perst_deco_ctrl {
>   uint32_treserved0:3;/* Reserved.No Effect*/
>   uint32_tstop_bcm_7412_clk:1;/* 1 ->Stops 

RE: [PATCH 03/13] staging: comedi: pcmuio: tidy up pcmuio_handle_asic_interrupt()

2013-12-06 Thread Hartley Sweeten
On Friday, December 06, 2013 1:19 AM, Dan Carpenter wrote:
>
> Signed-off-by is missing.

Oops... Just reposted that patch with the sign off.

Sorry about that,
Hartley

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v2 30/31] staging: comedi: ni_pcidio: request_irq() before seting up subdevices

2013-12-06 Thread Hartley Sweeten
On Friday, December 06, 2013 3:34 AM, Ian Abbott wrote:
> On 2013-12-05 20:43, H Hartley Sweeten wrote:

[snip]
>> +irq = mite_irq(devpriv->mite);
>> +if (irq) {
>> +ret = request_irq(irq, nidio_interrupt, IRQF_SHARED,
>> +  dev->board_name, dev);
>> +if (ret == 0)
>> +dev->irq = irq;
>> +}
>> +
>>  ret = comedi_alloc_subdevices(dev, 1);
>
> Unfortunately, the interrupt handler `nidio_interrupt()` still 
> dereferences the subdevice pointer before it tests `dev->attached`:
>
>   struct comedi_subdevice *s = dev->read_subdev;
>   struct comedi_async *async = s->async;  
>   /* ... */
>   if (!dev->attached) {
>   return IRQ_NONE;
>   }
>
> so this can still fail if `dev->read_subdev` hasn't been set yet.

I just posted a v3 of this patch to fix the possible dereference of 's'.

Thanks,
Hartley

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 30/31] staging: comedi: ni_pcidio: request_irq() before setting up subdevices

2013-12-06 Thread Ian Abbott

On 2013-12-06 16:57, H Hartley Sweeten wrote:

Do the request_irq() before setting up the subdevices. Only hook up
the command support of the irq was sucessfully requested.

Note that, because of the IRQF_SHARED flag, nidio_interrupt() _may_
be called before the device is ready and the subdevices are setup.
This condition is handled by the (!dev->attached) sanity check. The
'dev->read_subdev' pointer might not be valid at this point so there
is an extra check to get the pointer to the comedi_async buffer.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
v3: fix a possible dereference of 's' in nido_interrupt()

  drivers/staging/comedi/drivers/ni_pcidio.c | 40 +++---
  1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c 
b/drivers/staging/comedi/drivers/ni_pcidio.c
index 30c46a3..8f1b64d 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -385,7 +385,7 @@ static irqreturn_t nidio_interrupt(int irq, void *d)
struct comedi_device *dev = d;
struct nidio96_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
-   struct comedi_async *async = s->async;
+   struct comedi_async *async = s ? s->async : NULL;
struct mite_struct *mite = devpriv->mite;


It should work, but wouldn't it be better to leave `async` unassigned 
until after the `dev->attached` check?


--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 03/13] staging: comedi: pcmuio: tidy up pcmuio_handle_asic_interrupt()

2013-12-06 Thread H Hartley Sweeten
Unfortunatly, since there could be two asics, we can't use dev->read_subdev
to get the subdevice. But, the comedi_subdevice associated with the 'asic'
can easily be calculated. This allows removing the for () loop that searched
for the correct subdevice.

Tidy up the function.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
v2: add missing Signed-off-by

 drivers/staging/comedi/drivers/pcmuio.c | 44 +++--
 1 file changed, 15 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcmuio.c 
b/drivers/staging/comedi/drivers/pcmuio.c
index f7032fe..8752d4d 100644
--- a/drivers/staging/comedi/drivers/pcmuio.c
+++ b/drivers/staging/comedi/drivers/pcmuio.c
@@ -354,38 +354,24 @@ done:
 
 static int pcmuio_handle_asic_interrupt(struct comedi_device *dev, int asic)
 {
-   struct pcmuio_subdev_private *subpriv;
+   /* there are could be two asics so we can't use dev->read_subdev */
+   struct comedi_subdevice *s = &dev->subdevices[asic * 2];
unsigned long iobase = dev->iobase + (asic * PCMUIO_ASIC_IOSIZE);
-   unsigned int triggered = 0;
-   int got1 = 0;
-   unsigned char int_pend;
-   int i;
-
-   int_pend = inb(iobase + PCMUIO_INT_PENDING_REG) & 0x07;
-   if (int_pend) {
-   triggered = pcmuio_read(dev, asic, PCMUIO_PAGE_INT_ID, 0);
-   pcmuio_write(dev, 0, asic, PCMUIO_PAGE_INT_ID, 0);
+   unsigned int val;
 
-   ++got1;
-   }
+   /* are there any interrupts pending */
+   val = inb(iobase + PCMUIO_INT_PENDING_REG) & 0x07;
+   if (!val)
+   return 0;
 
-   if (triggered) {
-   struct comedi_subdevice *s;
-   /* TODO here: dispatch io lines to subdevs with commands.. */
-   for (i = 0; i < dev->n_subdevices; i++) {
-   s = &dev->subdevices[i];
-   subpriv = s->private;
-   if (subpriv->intr.asic == asic) {
-   /*
-* This is an interrupt subdev, and it
-* matches this asic!
-*/
-   pcmuio_handle_intr_subdev(dev, s,
- triggered);
-   }
-   }
-   }
-   return got1;
+   /* get, and clear, the pending interrupts */
+   val = pcmuio_read(dev, asic, PCMUIO_PAGE_INT_ID, 0);
+   pcmuio_write(dev, 0, asic, PCMUIO_PAGE_INT_ID, 0);
+
+   /* handle the pending interrupts */
+   pcmuio_handle_intr_subdev(dev, s, val);
+
+   return 1;
 }
 
 static irqreturn_t pcmuio_interrupt(int irq, void *d)
-- 
1.8.4.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 30/31] staging: comedi: ni_pcidio: request_irq() before setting up subdevices

2013-12-06 Thread H Hartley Sweeten
Do the request_irq() before setting up the subdevices. Only hook up
the command support of the irq was sucessfully requested.

Note that, because of the IRQF_SHARED flag, nidio_interrupt() _may_
be called before the device is ready and the subdevices are setup.
This condition is handled by the (!dev->attached) sanity check. The
'dev->read_subdev' pointer might not be valid at this point so there
is an extra check to get the pointer to the comedi_async buffer.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
v3: fix a possible dereference of 's' in nido_interrupt()

 drivers/staging/comedi/drivers/ni_pcidio.c | 40 +++---
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c 
b/drivers/staging/comedi/drivers/ni_pcidio.c
index 30c46a3..8f1b64d 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -385,7 +385,7 @@ static irqreturn_t nidio_interrupt(int irq, void *d)
struct comedi_device *dev = d;
struct nidio96_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
-   struct comedi_async *async = s->async;
+   struct comedi_async *async = s ? s->async : NULL;
struct mite_struct *mite = devpriv->mite;
 
/* int i, j; */
@@ -1011,6 +1011,14 @@ static int nidio_auto_attach(struct comedi_device *dev,
 
nidio_reset_board(dev);
 
+   irq = mite_irq(devpriv->mite);
+   if (irq) {
+   ret = request_irq(irq, nidio_interrupt, IRQF_SHARED,
+ dev->board_name, dev);
+   if (ret == 0)
+   dev->irq = irq;
+   }
+
ret = comedi_alloc_subdevices(dev, 1);
if (ret)
return ret;
@@ -1019,31 +1027,23 @@ static int nidio_auto_attach(struct comedi_device *dev,
 readb(devpriv->mite->daq_io_addr + Chip_Version));
 
s = &dev->subdevices[0];
-
-   dev->read_subdev = s;
s->type = COMEDI_SUBD_DIO;
-   s->subdev_flags =
-   SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_PACKED |
-   SDF_CMD_READ;
+   s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_PACKED;
s->n_chan = 32;
s->range_table = &range_digital;
s->maxdata = 1;
s->insn_config = &ni_pcidio_insn_config;
s->insn_bits = &ni_pcidio_insn_bits;
-   s->do_cmd = &ni_pcidio_cmd;
-   s->do_cmdtest = &ni_pcidio_cmdtest;
-   s->cancel = &ni_pcidio_cancel;
-   s->len_chanlist = 32;   /* XXX */
-   s->buf_change = &ni_pcidio_change;
-   s->async_dma_dir = DMA_BIDIRECTIONAL;
-   s->poll = &ni_pcidio_poll;
-
-   irq = mite_irq(devpriv->mite);
-   if (irq) {
-   ret = request_irq(irq, nidio_interrupt, IRQF_SHARED,
- dev->board_name, dev);
-   if (ret == 0)
-   dev->irq = irq;
+   if (dev->irq) {
+   dev->read_subdev = s;
+   s->subdev_flags |= SDF_CMD_READ;
+   s->async_dma_dir = DMA_BIDIRECTIONAL;
+   s->len_chanlist = s->n_chan;
+   s->do_cmd = ni_pcidio_cmd;
+   s->do_cmdtest = ni_pcidio_cmdtest;
+   s->cancel = ni_pcidio_cancel;
+   s->poll = ni_pcidio_poll;
+   s->buf_change = ni_pcidio_change;
}
 
return 0;
-- 
1.8.4.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[GIT PULL] Staging driver fixes for 3.13-rc3

2013-12-06 Thread Greg KH
The following changes since commit dc1ccc48159d63eca5089e507c82c7d22ef60839:

  Linux 3.13-rc2 (2013-11-29 12:57:14 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ 
tags/staging-3.13-rc3

for you to fetch changes up to 55ef003e4ae684d5660f984eb2352df12572d9df:

  Merge tag 'iio-fixes-for-3.13b' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus 
(2013-12-03 13:24:58 -0800)



staging driver fixes for 3.13-rc3

Here are some bugfixes for the staging and IIO drivers for 3.13-rc3.

The resolve the vm memory issue in the tidspbridge driver, fix a much-reported
build failure in an ARM driver, and some other IIO bugfixes that have been
reported.

Signed-off-by: Greg Kroah-Hartman 


Greg Kroah-Hartman (1):
  Merge tag 'iio-fixes-for-3.13b' of git://git.kernel.org/.../jic23/iio 
into staging-linus

Ivaylo Dimitrov (1):
  Staging: TIDSPBRIDGE: Use vm_iomap_memory for mmap-ing instead of 
remap_pfn_range

Russell King - ARM Linux (1):
  Fix build failure for gp2ap020a00f.c

Srinivas Pandruvada (2):
  HID: hid-sensor-hub: Add logical min and max
  iio: hid-sensors: Fix power and report state

 drivers/hid/hid-sensor-hub.c| 20 
 drivers/iio/common/hid-sensors/Kconfig  |  9 -
 drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 20 +++-
 drivers/iio/light/Kconfig   |  1 +
 drivers/staging/tidspbridge/rmgr/drv_interface.c| 13 +
 include/linux/hid-sensor-hub.h  |  2 ++
 include/linux/hid-sensor-ids.h  | 12 
 7 files changed, 43 insertions(+), 34 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv2] iio: mxs-lradc: compute temperature from channel 8 and 9

2013-12-06 Thread Alexandre Belloni
The mxs LRADC is able to read an internal die temperature sensor. The
temperature has to be calculated from the value read on channel 8 and channel 9.
To be able to expose the result to hwmon, implement iio channel 8 as
(channel 9 - channel 8). Then, implement IIO_CHAN_INFO_SCALE and
IIO_CHAN_INFO_OFFSET so that it can be processed by hwmon through the in kernel
provider/consumer mechanism.

Signed-off-by: Alexandre Belloni 
Signed-off-by: Maxime Ripard 
Reviewed-by: Lars-Peter Clausen 
---
Changes in v2:
  - rebased on v3.13.0-rc3

 drivers/staging/iio/adc/mxs-lradc.c | 91 +++--
 1 file changed, 78 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/iio/adc/mxs-lradc.c 
b/drivers/staging/iio/adc/mxs-lradc.c
index e2dd7830b320..5a4499c3d22a 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -759,20 +759,11 @@ static void mxs_lradc_handle_touch(struct mxs_lradc 
*lradc)
 /*
  * Raw I/O operations
  */
-static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
-   const struct iio_chan_spec *chan,
-   int *val, int *val2, long m)
+static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val)
 {
struct mxs_lradc *lradc = iio_priv(iio_dev);
int ret;
 
-   if (m != IIO_CHAN_INFO_RAW)
-   return -EINVAL;
-
-   /* Check for invalid channel */
-   if (chan->channel > LRADC_MAX_TOTAL_CHANS)
-   return -EINVAL;
-
/*
 * See if there is no buffered operation in progess. If there is, simply
 * bail out. This can be improved to support both buffered and raw IO at
@@ -797,7 +788,7 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
 
/* Clean the slot's previous content, then set new one. */
mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(0), 
LRADC_CTRL4);
-   mxs_lradc_reg_set(lradc, chan->channel, LRADC_CTRL4);
+   mxs_lradc_reg_set(lradc, chan, LRADC_CTRL4);
 
mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(0));
 
@@ -824,6 +815,71 @@ err:
return ret;
 }
 
+static int mxs_lradc_read_temp(struct iio_dev *iio_dev, int *val)
+{
+   int ret, min, max;
+
+   ret = mxs_lradc_read_single(iio_dev, 8, &min);
+   if (ret != IIO_VAL_INT)
+   return ret;
+
+   ret = mxs_lradc_read_single(iio_dev, 9, &max);
+   if (ret != IIO_VAL_INT)
+   return ret;
+
+   *val = max - min;
+
+   return IIO_VAL_INT;
+}
+
+static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
+   const struct iio_chan_spec *chan,
+   int *val, int *val2, long m)
+{
+   /* Check for invalid channel */
+   if (chan->channel > LRADC_MAX_TOTAL_CHANS)
+   return -EINVAL;
+
+   switch (m) {
+   case IIO_CHAN_INFO_RAW:
+   if (chan->type == IIO_TEMP)
+   return mxs_lradc_read_temp(iio_dev, val);
+
+   return mxs_lradc_read_single(iio_dev, chan->channel, val);
+
+   case IIO_CHAN_INFO_SCALE:
+   if (chan->type == IIO_TEMP) {
+   /* From the datasheet, we have to multiply by 1.012 and
+* divide by 4
+*/
+   *val = 0;
+   *val2 = 253000;
+   return IIO_VAL_INT_PLUS_MICRO;
+   }
+
+   return -EINVAL;
+
+   case IIO_CHAN_INFO_OFFSET:
+   if (chan->type == IIO_TEMP) {
+   /* The calculated value from the ADC is in Kelvin, we
+* want Celsius for hwmon so the offset is
+* -272.15 * scale
+*/
+   *val = -1075;
+   *val2 = 691699;
+
+   return IIO_VAL_INT_PLUS_MICRO;
+   }
+
+   return -EINVAL;
+
+   default:
+   break;
+   }
+
+   return -EINVAL;
+}
+
 static const struct iio_info mxs_lradc_iio_info = {
.driver_module  = THIS_MODULE,
.read_raw   = mxs_lradc_read_raw,
@@ -1151,8 +1207,17 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] 
= {
MXS_ADC_CHAN(5, IIO_VOLTAGE),
MXS_ADC_CHAN(6, IIO_VOLTAGE),
MXS_ADC_CHAN(7, IIO_VOLTAGE),   /* VBATT */
-   MXS_ADC_CHAN(8, IIO_TEMP),  /* Temp sense 0 */
-   MXS_ADC_CHAN(9, IIO_TEMP),  /* Temp sense 1 */
+   /* Combined Temperature sensors */
+   {
+   .type = IIO_TEMP,
+   .indexed = 1,
+   .scan_index = 8,
+   .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
+ BIT(IIO_CHAN_INFO_OFFSET) |
+ BIT(IIO_CHAN_INFO_SCALE),
+   .channel = 8,
+   .scan_type = {.sign = 'u', .realbits = 18, .storagebits = 32,},
+   },
M

Re: [PATCH 1/7] staging: et131x: reduce split lines in et131x_config_rx_dma_regs

2013-12-06 Thread Mark Einon
On Fri, Dec 06, 2013 at 09:35:00PM +0800, ZHAO Gang wrote:
> Signed-off-by: ZHAO Gang 
> ---
>  drivers/staging/et131x/et131x.c | 26 --
>  1 file changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
> index e3a71d3..ee231f2 100644
> --- a/drivers/staging/et131x/et131x.c
> +++ b/drivers/staging/et131x/et131x.c
> @@ -1821,6 +1821,9 @@ static void et131x_config_rx_dma_regs(struct 
> et131x_adapter *adapter)
>   u32 __iomem *min_des;
>   u32 __iomem *base_hi;
>   u32 __iomem *base_lo;
> + struct fbr_lookup *fbr;
> +
> + fbr = rx_local->fbr[id];

There's no reason why these three new lines can't be combined into one, i.e.

struct fbr_lookup *fbr = rx_local->fbr[id];

The rest of the patch is good.

Mark
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/7] staging: et131x: reduce split lines in et131x_rx_dma_memory_alloc

2013-12-06 Thread Mark Einon
On Fri, Dec 06, 2013 at 09:35:01PM +0800, ZHAO Gang wrote:
> Signed-off-by: ZHAO Gang 

Acked-by: Mark Einon 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 4/7] staging: et131x: reduce split lines in nic_return_rfd

2013-12-06 Thread Mark Einon
On Fri, Dec 06, 2013 at 09:35:03PM +0800, ZHAO Gang wrote:
> Signed-off-by: ZHAO Gang 
> ---
>  drivers/staging/et131x/et131x.c | 20 +++-
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
> index b6ce68e..3e34c2e 100644
> --- a/drivers/staging/et131x/et131x.c
> +++ b/drivers/staging/et131x/et131x.c
> @@ -2505,8 +2505,12 @@ static void nic_return_rfd(struct et131x_adapter 
> *adapter, struct rfd *rfd)
>* need to clean up OOB data
>*/
>   if (buff_index < rx_local->fbr[ring_index]->num_entries) {
> + u32 free_buff_ring;
>   u32 __iomem *offset;
>   struct fbr_desc *next;
> + struct fbr_lookup *fbr;
> +
> + fbr = rx_local->fbr[ring_index];

This can be written as one line instead of three. The rest of the patch
is good.

Cheers,

Mark
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/7] staging: et131x: reduce split lines in et131x_rx_dma_memory_free

2013-12-06 Thread Mark Einon
On Fri, Dec 06, 2013 at 09:35:02PM +0800, ZHAO Gang wrote:
> Signed-off-by: ZHAO Gang 
> ---
>  drivers/staging/et131x/et131x.c | 33 +
>  1 file changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
> index 17ac711..b6ce68e 100644
> --- a/drivers/staging/et131x/et131x.c
> +++ b/drivers/staging/et131x/et131x.c
> @@ -2361,6 +2361,7 @@ static void et131x_rx_dma_memory_free(struct 
> et131x_adapter *adapter)
>   u32 pktstat_ringsize;
>   struct rfd *rfd;
>   struct rx_ring *rx_ring;
> + struct fbr_lookup *fbr;
>  
>   /* Setup some convenience pointers */
>   rx_ring = &adapter->rx_ring;
> @@ -2379,34 +2380,34 @@ static void et131x_rx_dma_memory_free(struct 
> et131x_adapter *adapter)
>  
>   /* Free Free Buffer Rings */
>   for (id = 0; id < NUM_FBRS; id++) {
> - if (!rx_ring->fbr[id]->ring_virtaddr)
> + fbr = rx_ring->fbr[id];
> +
> + if (!fbr->ring_virtaddr)
>   continue;
>  
>   /* First the packet memory */
> - for (index = 0;
> -  index < (rx_ring->fbr[id]->num_entries / FBR_CHUNKS);
> + for (index = 0; index < fbr->num_entries / FBR_CHUNKS;
>index++) {

Either fit the whole for statement on one line (if possible), or keep it
as one part per line, as it was. Your change is less readable.

> - if (rx_ring->fbr[id]->mem_virtaddrs[index]) {
> - bufsize =
> - rx_ring->fbr[id]->buffsize * FBR_CHUNKS;
> + if (fbr->mem_virtaddrs[index]) {
> + bufsize = fbr->buffsize * FBR_CHUNKS;
>  
>   dma_free_coherent(&adapter->pdev->dev,
> - bufsize,
> - rx_ring->fbr[id]->mem_virtaddrs[index],
> - rx_ring->fbr[id]->mem_physaddrs[index]);
> +   bufsize,
> +   fbr->mem_virtaddrs[index],
> +   fbr->mem_physaddrs[index]);
>  
> - rx_ring->fbr[id]->mem_virtaddrs[index] = NULL;
> + fbr->mem_virtaddrs[index] = NULL;
>   }
>   }
>  
> - bufsize =
> - sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries;
> + bufsize = sizeof(struct fbr_desc) * fbr->num_entries;
>  
> - dma_free_coherent(&adapter->pdev->dev, bufsize,
> - rx_ring->fbr[id]->ring_virtaddr,
> - rx_ring->fbr[id]->ring_physaddr);
> + dma_free_coherent(&adapter->pdev->dev,
> +   bufsize,
> +   fbr->ring_virtaddr,
> +   fbr->ring_physaddr);

You've done the right thing here. The rest of the patch is good - just
the issue above.

Cheers,

Mark

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 5/7] staging: et131x: reduce split lines in nic_rx_pkts

2013-12-06 Thread Mark Einon
On Fri, Dec 06, 2013 at 09:35:04PM +0800, ZHAO Gang wrote:
> Signed-off-by: ZHAO Gang 

This is good, thanks.

Acked-by: Mark Einon 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 4/7] staging: et131x: reduce split lines in nic_return_rfd

2013-12-06 Thread Mark Einon
On Fri, Dec 06, 2013 at 08:40:17PM +, Mark Einon wrote:
> On Fri, Dec 06, 2013 at 09:35:03PM +0800, ZHAO Gang wrote:
> > Signed-off-by: ZHAO Gang 
> > ---
> >  drivers/staging/et131x/et131x.c | 20 +++-
> >  1 file changed, 11 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/staging/et131x/et131x.c 
> > b/drivers/staging/et131x/et131x.c
> > index b6ce68e..3e34c2e 100644
> > --- a/drivers/staging/et131x/et131x.c
> > +++ b/drivers/staging/et131x/et131x.c
> > @@ -2505,8 +2505,12 @@ static void nic_return_rfd(struct et131x_adapter 
> > *adapter, struct rfd *rfd)
> >  * need to clean up OOB data
> >  */
> > if (buff_index < rx_local->fbr[ring_index]->num_entries) {
> > +   u32 free_buff_ring;
> > u32 __iomem *offset;
> > struct fbr_desc *next;
> > +   struct fbr_lookup *fbr;
> > +
> > +   fbr = rx_local->fbr[ring_index];
> 
> This can be written as one line instead of three. The rest of the patch
> is good.

Actually, you can also define *fbr at the top of the function and use it to 
change:

if (buff_index < rx_local->fbr[ring_index]->num_entries) {
to
if (buff_index < fbr->num_entries) {

Cheers,

Mark


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 03/13] staging: comedi: pcmuio: tidy up pcmuio_handle_asic_interrupt()

2013-12-06 Thread Greg KH
Minor nit, can you name your "v2" patches like:
[PATCH 03/13 v2] ...
so that when I sort them in mutt, they show up in the proper order with
the other patches in the series?

Don't worry about this one, I got it, but in the future it would be
great.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 7/7] staging: et131x: remove unnecessary pointer typecast

2013-12-06 Thread Mark Einon
On Fri, Dec 06, 2013 at 09:35:06PM +0800, ZHAO Gang wrote:
> Signed-off-by: ZHAO Gang 

Thanks.

Acked-by: Mark Einon 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: dwc2: don't issue traffic to LS devices in FS mode

2013-12-06 Thread Paul Zimmerman
From: Nick Hudson 

I fell over the problem reported in
https://github.com/raspberrypi/linux/pull/390:

"Issuing low-speed packets when the root port is in full-speed mode
 causes the root port to stop responding. Explicitly fail when
 enqueuing URBs to a LS endpoint on a FS bus."

with my dwc2 testing in NetBSD, so I adapted the change to dwc2.

Signed-off-by: Nick Hudson 
[paulz: fixed up the patch to compile under Linux, and tested it]
Signed-off-by: Paul Zimmerman 
---
 drivers/staging/dwc2/hcd.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/staging/dwc2/hcd.c b/drivers/staging/dwc2/hcd.c
index 24b57d7..07dfe85 100644
--- a/drivers/staging/dwc2/hcd.c
+++ b/drivers/staging/dwc2/hcd.c
@@ -355,6 +355,7 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg,
unsigned long flags;
u32 intr_mask;
int retval;
+   int dev_speed;
 
if (!hsotg->flags.b.port_connect_status) {
/* No longer connected */
@@ -362,6 +363,19 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg,
return -ENODEV;
}
 
+   dev_speed = dwc2_host_get_speed(hsotg, urb->priv);
+
+   /* Some configurations cannot support LS traffic on a FS root port */
+   if ((dev_speed == USB_SPEED_LOW) &&
+   (hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED) &&
+   (hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_UTMI)) {
+   u32 hprt0 = readl(hsotg->regs + HPRT0);
+   u32 prtspd = (hprt0 & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT;
+
+   if (prtspd == HPRT0_SPD_FULL_SPEED)
+   return -ENODEV;
+   }
+
qtd = kzalloc(sizeof(*qtd), mem_flags);
if (!qtd)
return -ENOMEM;
-- 
1.8.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/7 RESEND] staging: et131x: reduce split lines in et131x_config_rx_dma_regs

2013-12-06 Thread ZHAO Gang
Signed-off-by: ZHAO Gang 
---
 drivers/staging/et131x/et131x.c | 25 +++--
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index e3a71d3..0372f23 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -1822,6 +1822,8 @@ static void et131x_config_rx_dma_regs(struct 
et131x_adapter *adapter)
u32 __iomem *base_hi;
u32 __iomem *base_lo;
 
+   struct fbr_lookup *fbr = rx_local->fbr[id];
+
if (id == 0) {
num_des = &rx_dma->fbr0_num_des;
full_offset = &rx_dma->fbr0_full_offset;
@@ -1837,12 +1839,10 @@ static void et131x_config_rx_dma_regs(struct 
et131x_adapter *adapter)
}
 
/* Now's the best time to initialize FBR contents */
-   fbr_entry =
-   (struct fbr_desc *) rx_local->fbr[id]->ring_virtaddr;
-   for (entry = 0;
-entry < rx_local->fbr[id]->num_entries; entry++) {
-   fbr_entry->addr_hi = rx_local->fbr[id]->bus_high[entry];
-   fbr_entry->addr_lo = rx_local->fbr[id]->bus_low[entry];
+   fbr_entry = (struct fbr_desc *) fbr->ring_virtaddr;
+   for (entry = 0; entry < fbr->num_entries; entry++) {
+   fbr_entry->addr_hi = fbr->bus_high[entry];
+   fbr_entry->addr_lo = fbr->bus_low[entry];
fbr_entry->word2 = entry;
fbr_entry++;
}
@@ -1850,19 +1850,16 @@ static void et131x_config_rx_dma_regs(struct 
et131x_adapter *adapter)
/* Set the address and parameters of Free buffer ring 1 and 0
 * into the 1310's registers
 */
-   writel(upper_32_bits(rx_local->fbr[id]->ring_physaddr),
-  base_hi);
-   writel(lower_32_bits(rx_local->fbr[id]->ring_physaddr),
-  base_lo);
-   writel(rx_local->fbr[id]->num_entries - 1, num_des);
+   writel(upper_32_bits(fbr->ring_physaddr), base_hi);
+   writel(lower_32_bits(fbr->ring_physaddr), base_lo);
+   writel(fbr->num_entries - 1, num_des);
writel(ET_DMA10_WRAP, full_offset);
 
/* This variable tracks the free buffer ring 1 full position,
 * so it has to match the above.
 */
-   rx_local->fbr[id]->local_full = ET_DMA10_WRAP;
-   writel(((rx_local->fbr[id]->num_entries *
-   LO_MARK_PERCENT_FOR_RX) / 100) - 1,
+   fbr->local_full = ET_DMA10_WRAP;
+   writel(((fbr->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
   min_des);
}
 
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/7 RESEND] staging: et131x: reduce split lines in et131x_rx_dma_memory_free

2013-12-06 Thread ZHAO Gang
Signed-off-by: ZHAO Gang 
---
 drivers/staging/et131x/et131x.c | 32 +---
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 63d28ae..881ae4f 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -2360,6 +2360,7 @@ static void et131x_rx_dma_memory_free(struct 
et131x_adapter *adapter)
u32 pktstat_ringsize;
struct rfd *rfd;
struct rx_ring *rx_ring;
+   struct fbr_lookup *fbr;
 
/* Setup some convenience pointers */
rx_ring = &adapter->rx_ring;
@@ -2378,34 +2379,35 @@ static void et131x_rx_dma_memory_free(struct 
et131x_adapter *adapter)
 
/* Free Free Buffer Rings */
for (id = 0; id < NUM_FBRS; id++) {
-   if (!rx_ring->fbr[id]->ring_virtaddr)
+   fbr = rx_ring->fbr[id];
+
+   if (!fbr->ring_virtaddr)
continue;
 
/* First the packet memory */
for (index = 0;
-index < (rx_ring->fbr[id]->num_entries / FBR_CHUNKS);
+index < fbr->num_entries / FBR_CHUNKS;
 index++) {
-   if (rx_ring->fbr[id]->mem_virtaddrs[index]) {
-   bufsize =
-   rx_ring->fbr[id]->buffsize * FBR_CHUNKS;
+   if (fbr->mem_virtaddrs[index]) {
+   bufsize = fbr->buffsize * FBR_CHUNKS;
 
dma_free_coherent(&adapter->pdev->dev,
-   bufsize,
-   rx_ring->fbr[id]->mem_virtaddrs[index],
-   rx_ring->fbr[id]->mem_physaddrs[index]);
+ bufsize,
+ fbr->mem_virtaddrs[index],
+ fbr->mem_physaddrs[index]);
 
-   rx_ring->fbr[id]->mem_virtaddrs[index] = NULL;
+   fbr->mem_virtaddrs[index] = NULL;
}
}
 
-   bufsize =
-   sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries;
+   bufsize = sizeof(struct fbr_desc) * fbr->num_entries;
 
-   dma_free_coherent(&adapter->pdev->dev, bufsize,
-   rx_ring->fbr[id]->ring_virtaddr,
-   rx_ring->fbr[id]->ring_physaddr);
+   dma_free_coherent(&adapter->pdev->dev,
+ bufsize,
+ fbr->ring_virtaddr,
+ fbr->ring_physaddr);
 
-   rx_ring->fbr[id]->ring_virtaddr = NULL;
+   fbr->ring_virtaddr = NULL;
}
 
/* Free Packet Status Ring */
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/7 RESEND] staging: et131x: reduce split lines in nic_return_rfd

2013-12-06 Thread ZHAO Gang
Signed-off-by: ZHAO Gang 
---
 drivers/staging/et131x/et131x.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 881ae4f..90ef45b 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -2495,16 +2495,19 @@ static void et131x_set_rx_dma_timer(struct 
et131x_adapter *adapter)
  */
 static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd)
 {
+   unsigned long flags;
+
struct rx_ring *rx_local = &adapter->rx_ring;
struct rxdma_regs __iomem *rx_dma = &adapter->regs->rxdma;
u16 buff_index = rfd->bufferindex;
u8 ring_index = rfd->ringindex;
-   unsigned long flags;
+   struct fbr_lookup *fbr = rx_local->fbr[ring_index];
 
/* We don't use any of the OOB data besides status. Otherwise, we
 * need to clean up OOB data
 */
-   if (buff_index < rx_local->fbr[ring_index]->num_entries) {
+   if (buff_index < fbr->num_entries) {
+   u32 free_buff_ring;
u32 __iomem *offset;
struct fbr_desc *next;
 
@@ -2515,22 +2518,20 @@ static void nic_return_rfd(struct et131x_adapter 
*adapter, struct rfd *rfd)
else
offset = &rx_dma->fbr1_full_offset;
 
-   next = (struct fbr_desc *)
-  (rx_local->fbr[ring_index]->ring_virtaddr) +
-   INDEX10(rx_local->fbr[ring_index]->local_full);
+   next = (struct fbr_desc *)(fbr->ring_virtaddr) +
+  INDEX10(fbr->local_full);
 
/* Handle the Free Buffer Ring advancement here. Write
 * the PA / Buffer Index for the returned buffer into
 * the oldest (next to be freed)FBR entry
 */
-   next->addr_hi = rx_local->fbr[ring_index]->bus_high[buff_index];
-   next->addr_lo = rx_local->fbr[ring_index]->bus_low[buff_index];
+   next->addr_hi = fbr->bus_high[buff_index];
+   next->addr_lo = fbr->bus_low[buff_index];
next->word2 = buff_index;
 
-   writel(bump_free_buff_ring(
- &rx_local->fbr[ring_index]->local_full,
- rx_local->fbr[ring_index]->num_entries - 1),
-  offset);
+   free_buff_ring = bump_free_buff_ring(&fbr->local_full,
+fbr->num_entries - 1);
+   writel(free_buff_ring, offset);
 
spin_unlock_irqrestore(&adapter->fbr_lock, flags);
} else {
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/9] Staging: bcm: DDRInit: replaced multiple tabs with tab.

2013-12-06 Thread Gary Rookard
This is second in a series of patches.

Signed-off-by: Gary Alan Rookard 
---
On branch staging-next
 drivers/staging/bcm/DDRInit.c | 910 +-
 1 file changed, 455 insertions(+), 455 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index f550567..e014759 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -248,286 +248,286 @@ static struct bcm_ddr_setting asT3B_DDRSetting133MHz[] 
= {//  # DPLL Clock S
 
 #define T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9  //index for 0x0F007000
 static struct bcm_ddr_setting asT3B_DDRSetting80MHz[] = {//   # DPLL Clock 
Setting
-   
{0x0f000810,0x0F95},
-   
{0x0f000820,0x07F13FFF},
-   
{0x0f000840,0x0FFF1F00},
-   
{0x0f000880,0x03DD},
-   
{0x0f000860,0x},
+   {0x0f000810,0x0F95},
+   {0x0f000820,0x07F13FFF},
+   {0x0f000840,0x0FFF1F00},
+   {0x0f000880,0x03DD},
+   {0x0f000860,0x},
 
-   
{0x0F00a044,0x1fff},
-   
{0x0F00a040,0x1f00},
-   
{0x0F00a084,0x1Cff},
-   
{0x0F00a080,0x1C00},
-   
{0x0F00a000,0x0016},
+   {0x0F00a044,0x1fff},
+   {0x0F00a040,0x1f00},
+   {0x0F00a084,0x1Cff},
+   {0x0F00a080,0x1C00},
+   {0x0F00a000,0x0016},

//Memcontroller Default values
-   
{0x0F007000,0x00010001},
-   
{0x0F007004,0x0100},
-   
{0x0F007008,0x0101},
-   
{0x0F00700c,0x},
-   
{0x0F007010,0x0100},
-   
{0x0F007014,0x01000100},
-   
{0x0F007018,0x0100},
-   
{0x0F00701c,0x0102},
-   
{0x0F007020,0x04020107},
-   
{0x0F007024,0x0007},
-   
{0x0F007028,0x02020201},
-   
{0x0F00702c,0x0204040a},
-   
{0x0F007030,0x0400},
-   
{0x0F007034,0x0202},
-   
{0x0F007038,0x1F060202},
-   
{0x0F00703C,0x1C1F},
-   
{0x0F007040,0x8A006600},
-   
{0x0F007044,0x221a0800},
-   
{0x0F007048,0x02690204},
-   
{0x0F00704c,0x},
-   
{0x0F007050,0x011c},
-   
{0x0F007054,0x},
-   
{0x0F007058,0x},
-   
{0x0F00705c,0x},
-   
{0x0F007060,0x000A15D6},
-   
{0x0F007064,0x000A},
-

[PATCH 1/9] Staging: bcm: DDRInit: Replaced spaces with tabs.

2013-12-06 Thread Gary Rookard
This is the first patch of a series.

Signed:off-by: Gary Alan Rookard 
---
On branch staging-next
 drivers/staging/bcm/DDRInit.c | 398 +-
 1 file changed, 199 insertions(+), 199 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index 9f7e30f..f550567 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -8,242 +8,242 @@
 //DDR INIT-133Mhz
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12  //index for 0x0F007000
 static struct bcm_ddr_setting asT3_DDRSetting133MHz[]= {//  # DPLL Clock 
Setting
-{0x0F000800,0x7212},
-{0x0f000820,0x07F13FFF},
-{0x0f000810,0x0F95},
-{0x0f000860,0x},
-{0x0f000880,0x03DD},
+   {0x0F000800,0x7212},
+   {0x0f000820,0x07F13FFF},
+   {0x0f000810,0x0F95},
+   {0x0f000860,0x},
+   {0x0f000880,0x03DD},
 // Changed source for X-bar and MIPS 
clock to APLL
-{0x0f000840,0x0FFF1B00},
-{0x0f000870,0x0002},
-{0x0F00a044,0x1fff},
-{0x0F00a040,0x1f00},
-{0x0F00a084,0x1Cff},
-{0x0F00a080,0x1C00},
-{0x0F00a04C,0x000C},
+   {0x0f000840,0x0FFF1B00},
+   {0x0f000870,0x0002},
+   {0x0F00a044,0x1fff},
+   {0x0F00a040,0x1f00},
+   {0x0F00a084,0x1Cff},
+   {0x0F00a080,0x1C00},
+   {0x0F00a04C,0x000C},
 //Memcontroller Default values
-{0x0F007000,0x00010001},
-{0x0F007004,0x01010100},
-{0x0F007008,0x0101},
-{0x0F00700c,0x},
-{0x0F007010,0x0100},
-{0x0F007014,0x01000100},
-{0x0F007018,0x0100},
-{0x0F00701c,0x01020001},// POP - 
0x00020001 Normal 0x01020001
-{0x0F007020,0x04030107}, //Normal - 
0x04030107 POP - 0x05030107
-{0x0F007024,0x0207},
-{0x0F007028,0x02020202},
-{0x0F00702c,0x0206060a},//ROB- 
0x0205050a,//0x0206060a
-{0x0F007030,0x0500},
-{0x0F007034,0x0003},
-{0x0F007038,0x110a0200},//ROB - 
0x110a0200,//0x180a0200,// 0x1f0a0200
-{0x0F00703C,0x02101010},//ROB - 
0x02101010,//0x02101018},
-{0x0F007040,0x45751200},//ROB - 
0x45751200,//0x450f1200},
-{0x0F007044,0x110a0d00},//ROB - 
0x110a0d00//0x111f0d00
-{0x0F007048,0x081b0306},
-{0x0F00704c,0x},
-{0x0F007050,0x001c},
-{0x0F007054,0x},
-{0x0F007058,0x},
-{0x0F00705c,0x},
-{0x0F007060,0x0010246c},
-{0x0F007064,0x0010},
-{0x0F007068,0x},
-{0x0F00706c,0x0001},
-{0x0F007070,0x7000},
-{0x0F007074,0x},
-{0x0F007078,0x},
-{0x0F00707C,0x},
-{0x0F007080,0x},
-{0x0F007084,0x},
+   {0x0F007000,0x00010001},
+   {0x0F007004,0x01010100},
+   {0x0F007008,0x0101},
+   {0x0F00700c,0x},
+   {0x0F007010,0x0100},
+   {0x0F007014,0x01000100},
+   {0x0F007018,0x0100},
+   {0x0F00701c,0x01020001},// POP - 0x00020001 Normal 0x01020001
+   {0x0F007020,0x04030107}, //Normal - 0x04030107 POP - 0x05030107
+   {0x0F007024,0x0207},
+   {0x0F007028,0x02020202},
+   {0x0F00702c,0x0206060a},//ROB- 0x0205050a,//0x0206060a
+   {0x0F007030,0x0500},
+  

[PATCH 3/9] Staging: bcm: DDRInit: added space after commas.

2013-12-06 Thread Gary Rookard
Signed-off-by: Gary Alan Rookard 
---
On branch staging-next
 drivers/staging/bcm/DDRInit.c | 1332 -
 1 file changed, 666 insertions(+), 666 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index e014759..ed4dfe9 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -8,526 +8,526 @@
 //DDR INIT-133Mhz
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12  //index for 0x0F007000
 static struct bcm_ddr_setting asT3_DDRSetting133MHz[]= {//  # DPLL Clock 
Setting
-   {0x0F000800,0x7212},
-   {0x0f000820,0x07F13FFF},
-   {0x0f000810,0x0F95},
-   {0x0f000860,0x},
-   {0x0f000880,0x03DD},
+   {0x0F000800, 0x7212},
+   {0x0f000820, 0x07F13FFF},
+   {0x0f000810, 0x0F95},
+   {0x0f000860, 0x},
+   {0x0f000880, 0x03DD},
 // Changed source for X-bar and MIPS 
clock to APLL
-   {0x0f000840,0x0FFF1B00},
-   {0x0f000870,0x0002},
-   {0x0F00a044,0x1fff},
-   {0x0F00a040,0x1f00},
-   {0x0F00a084,0x1Cff},
-   {0x0F00a080,0x1C00},
-   {0x0F00a04C,0x000C},
+   {0x0f000840, 0x0FFF1B00},
+   {0x0f000870, 0x0002},
+   {0x0F00a044, 0x1fff},
+   {0x0F00a040, 0x1f00},
+   {0x0F00a084, 0x1Cff},
+   {0x0F00a080, 0x1C00},
+   {0x0F00a04C, 0x000C},
 //Memcontroller Default values
-   {0x0F007000,0x00010001},
-   {0x0F007004,0x01010100},
-   {0x0F007008,0x0101},
-   {0x0F00700c,0x},
-   {0x0F007010,0x0100},
-   {0x0F007014,0x01000100},
-   {0x0F007018,0x0100},
-   {0x0F00701c,0x01020001},// POP - 0x00020001 Normal 0x01020001
-   {0x0F007020,0x04030107}, //Normal - 0x04030107 POP - 0x05030107
-   {0x0F007024,0x0207},
-   {0x0F007028,0x02020202},
-   {0x0F00702c,0x0206060a},//ROB- 0x0205050a,//0x0206060a
-   {0x0F007030,0x0500},
-   {0x0F007034,0x0003};
-   {0x0F007038,0x110a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200
-   {0x0F00703C,0x02101010},//ROB - 0x02101010,//0x02101018},
-   {0x0F007040,0x45751200},//ROB - 0x45751200,//0x450f1200},
-   {0x0F007044,0x110a0d00},//ROB - 0x110a0d00//0x111f0d00
-   {0x0F007048,0x081b0306},
-   {0x0F00704c,0x},
-   {0x0F007050,0x001c},
-   {0x0F007054,0x},
-   {0x0F007058,0x},
-   {0x0F00705c,0x},
-   {0x0F007060,0x0010246c},
-   {0x0F007064,0x0010},
-   {0x0F007068,0x},
-   {0x0F00706c,0x0001},
-   {0x0F007070,0x7000},
-   {0x0F007074,0x},
-   {0x0F007078,0x},
-   {0x0F00707C,0x},
-   {0x0F007080,0x},
-   {0x0F007084,0x},
+   {0x0F007000, 0x00010001},
+   {0x0F007004, 0x01010100},
+   {0x0F007008, 0x0101},
+   {0x0F00700c, 0x},
+   {0x0F007010, 0x0100},
+   {0x0F007014, 0x01000100},
+   {0x0F007018, 0x0100},
+   {0x0F00701c, 0x01020001},// POP - 0x00020001 Normal 0x01020001
+   {0x0F007020, 0x04030107}, //Normal - 0x04030107 POP - 0x05030107
+   {0x0F007024, 0x0207},
+   {0x0F007028, 0x02020202},
+   {0x0F00702c, 0x0206060a},//ROB- 0x0205050a,//0x0206060a
+   {0x0F007030, 0x0500},
+   {0x0F007034, 0x0003};
+   {0x0F007038, 0x110a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200
+   {0x0F00703C, 0x02101010},//ROB - 0x02101010,//0x02101018},
+   {0x0F007040, 0x45751200},//ROB - 0x45751200,//0x450f1200},
+   {0x0F007044, 0x110a0d00},//ROB - 0x110a0d00//0x111f0d00
+   {0x0F007048, 0x081b0306},
+   {0x0F00704c, 0x},
+   {0x0F007050, 0x001c},
+   {0x0F007054, 0x},
+   {0x0F007058, 0x},
+   {0x0F00705c, 0x},
+   {0x0F007060, 0x0010246c},
+   {0x0F007064, 0x0010},
+   {0x0F007068, 0x},
+   {0x0F00706c, 0x0001},
+   {0x0F007070, 0x7000},
+   {0x0F007074, 0x},
+   {0x0F007078, 0x},
+   {0x0F00707C, 0x},
+   {0x0F007080, 0x},
+   {0x0F007084, 0x},
 //# Enable BW improvement within 
memory controller
-   {0x0F007094,0x0104},
+   {0x0F007094, 0x0104},
 //# Enable 2 ports within X-bar
-   {0x0F00A000,0x0016},
+   {0x0F00A000, 0x0016},
 //# Enable start bit within memory 
controller
-   {0x0F007018,0x0101}
+   {0x0F007018, 0x0101}
 };
 //80Mhz
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10  //index for 0x0F007000
 static struct bcm_ddr_setting asT3_DDRSetting80MHz[]= {//   # DPLL Clock 
Setting
-   {0x0f000810,0x0F

[PATCH 4/9] Staging: bcm: DDRInit: added spaces around operators.

2013-12-06 Thread Gary Rookard
This is the fourth patch of a series.

Signed-off-by: Gary Alan Rookard 
---
On branch-staging-next
 drivers/staging/bcm/DDRInit.c | 86 +--
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index ed4dfe9..cb4dd53 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -7,7 +7,7 @@
 
 //DDR INIT-133Mhz
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12  //index for 0x0F007000
-static struct bcm_ddr_setting asT3_DDRSetting133MHz[]= {//  # DPLL Clock 
Setting
+static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = {//  # DPLL Clock 
Setting
{0x0F000800, 0x7212},
{0x0f000820, 0x07F13FFF},
{0x0f000810, 0x0F95},
@@ -65,7 +65,7 @@ static struct bcm_ddr_setting asT3_DDRSetting133MHz[]= {//
  # DPLL Clock Set
 };
 //80Mhz
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10  //index for 0x0F007000
-static struct bcm_ddr_setting asT3_DDRSetting80MHz[]= {//   # DPLL Clock 
Setting
+static struct bcm_ddr_setting asT3_DDRSetting80MHz[] = {//   # DPLL Clock 
Setting
{0x0f000810, 0x0F95},
{0x0f000820, 0x07f1},
{0x0f000860, 0x},
@@ -117,7 +117,7 @@ static struct bcm_ddr_setting asT3_DDRSetting80MHz[]= {//   
# DPLL Clock Setting
 };
 //100Mhz
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 13  //index for 0x0F007000
-static struct bcm_ddr_setting asT3_DDRSetting100MHz[]= {//  # DPLL Clock 
Setting
+static struct bcm_ddr_setting asT3_DDRSetting100MHz[] = {//  # DPLL Clock 
Setting
{0x0F000800, 0x7008},
{0x0f000810, 0x0F95},
{0x0f000820, 0x07F13E3F},
@@ -356,7 +356,7 @@ static struct bcm_ddr_setting asT3B_DDRSetting100MHz[] = 
{//  # DPLL Clock S
 
 
 #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 9  //index for 0x0F007000
-static struct bcm_ddr_setting asT3LP_DDRSetting133MHz[]= {//   # DPLL Clock 
Setting
+static struct bcm_ddr_setting asT3LP_DDRSetting133MHz[] = {//  # DPLL Clock 
Setting
{0x0f000820, 0x03F1365B},
{0x0f000810, 0x2F95},
{0x0f000880, 0x03DD},
@@ -416,7 +416,7 @@ static struct bcm_ddr_setting asT3LP_DDRSetting133MHz[]= 
{//# DPLL Clock Settin
 };
 
 #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 11  //index for 0x0F007000
-static struct bcm_ddr_setting asT3LP_DDRSetting100MHz[]= {//   # DPLL Clock 
Setting
+static struct bcm_ddr_setting asT3LP_DDRSetting100MHz[] = {//  # DPLL Clock 
Setting
{0x0f000810, 0x2F95},
{0x0f000820, 0x03F1369B},
{0x0f000840, 0x0fff},
@@ -476,7 +476,7 @@ static struct bcm_ddr_setting asT3LP_DDRSetting100MHz[]= 
{//# DPLL Clock Settin
 };
 
 #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9  //index for 0x0F007000
-static struct bcm_ddr_setting asT3LP_DDRSetting80MHz[]= {//# DPLL Clock 
Setting
+static struct bcm_ddr_setting asT3LP_DDRSetting80MHz[] = {//   # DPLL Clock 
Setting
{0x0f000820, 0x07F13FFF},
{0x0f000810, 0x2F95},
{0x0f000860, 0x},
@@ -536,7 +536,7 @@ static struct bcm_ddr_setting asT3LP_DDRSetting80MHz[]= {// 
# DPLL Clock Setting
 ///T3 LP-B (UMA-B)
 
 #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_160MHZ 7  //index for 0x0F007000
-static struct bcm_ddr_setting asT3LPB_DDRSetting160MHz[]= {//  # DPLL Clock 
Setting
+static struct bcm_ddr_setting asT3LPB_DDRSetting160MHz[] = {// # DPLL Clock 
Setting
 
{0x0f000820, 0x03F137DB},
{0x0f000810, 0x01842795},
@@ -594,7 +594,7 @@ static struct bcm_ddr_setting asT3LPB_DDRSetting160MHz[]= 
{//   # DPLL Clock Setti
 
 
 #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 7  //index for 0x0F007000
-static struct bcm_ddr_setting asT3LPB_DDRSetting133MHz[]= {//  # DPLL Clock 
Setting
+static struct bcm_ddr_setting asT3LPB_DDRSetting133MHz[] = {// # DPLL Clock 
Setting
{0x0f000820, 0x03F1365B},
{0x0f000810, 0x2F95},
{0x0f000880, 0x03DD},
@@ -655,7 +655,7 @@ static struct bcm_ddr_setting asT3LPB_DDRSetting133MHz[]= 
{//   # DPLL Clock Setti
 };
 
 #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 8  //index for 0x0F007000
-static struct bcm_ddr_setting asT3LPB_DDRSetting100MHz[]= {//  # DPLL Clock 
Setting
+static struct bcm_ddr_setting asT3LPB_DDRSetting100MHz[] = {// # DPLL Clock 
Setting
{0x0f000810, 0x2F95},
{0x0f000820, 0x03F1369B},
{0x0f000840, 0x0fff},
@@ -716,7 +716,7 @@ static struct bcm_ddr_setting asT3LPB_DDRSetting100MHz[]= 
{//   # DPLL Clock Setti
 };
 
 #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 7  //index for 0x0F007000
-static struct bcm_ddr_setting asT3LPB_DDRSetting80MHz[]= {//   # DPLL Clock 
Setting
+static struct bcm_ddr_setting asT3LPB_DDRSetting80MHz[] = {//  # DPLL Clock 
Setting
{0x0f000820, 0x07F13FFF},
{0x0f000810, 0x2F95},
{0x0f000860, 0x},
@@ -774,8 +774,8 @@ static struct bcm_

[PATCH 6/9] Staging: bcm: DDRInit: tidy up bracing issues.

2013-12-06 Thread Gary Rookard
This is the sixth patch of a series.

Signed-off-by: Gary Alan Rookard 
---
On branch staging-next
 drivers/staging/bcm/DDRInit.c | 174 +++---
 1 file changed, 63 insertions(+), 111 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index 1a08b17..8bb3283 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -62,7 +62,7 @@ static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = { 
/* # DPLL Clock Se
{0x0F00A000, 0x0016},
 /* # Enable start bit within memory 
controller */
{0x0F007018, 0x0101}
-};
+};
 /* 80Mhz */
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10  /* index for 0x0F007000 */
 static struct bcm_ddr_setting asT3_DDRSetting80MHz[] = { /*  # DPLL Clock 
Setting */
@@ -114,7 +114,7 @@ static struct bcm_ddr_setting asT3_DDRSetting80MHz[] = { /* 
 # DPLL Clock Settin
{0x0F007094, 0x0104},
 /*# Enable start bit within memory 
controller */
{0x0F007018, 0x0101}
-};
+};
 /* 100Mhz */
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 13  /* index for 0x0F007000 */
 static struct bcm_ddr_setting asT3_DDRSetting100MHz[] = {/*  # DPLL Clock 
Setting */
@@ -173,7 +173,7 @@ static struct bcm_ddr_setting asT3_DDRSetting100MHz[] = {/* 
 # DPLL Clock Settin
{0x0F007094, 0x0104},
 /* # Enable start bit within memory controller 
*/
{0x0F007018, 0x0101}
-};
+};
 
 /* Net T3B DDR Settings */
 /* DDR INIT-133Mhz */
@@ -186,7 +186,7 @@ static struct bcm_ddr_setting asDPLL_266MHZ[] = {
 /* Changed source for X-bar and MIPS 
clock to APLL */
{0x0f000840, 0x0FFF1B00},
{0x0f000870, 0x0002}
- };
+};
 
 #define T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 11  /* index for 0x0F007000 */
 static struct bcm_ddr_setting asT3B_DDRSetting133MHz[] = {/* # DPLL Clock 
Setting */
@@ -244,7 +244,7 @@ static struct bcm_ddr_setting asT3B_DDRSetting133MHz[] = 
{/* # DPLL Clock Settin
{0x0F007094, 0x0104},
 /* # Enable start bit within memory 
controller */
{0x0F007018, 0x0101},
-};
+};
 
 #define T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9  /*index for 0x0F007000 */
 static struct bcm_ddr_setting asT3B_DDRSetting80MHz[] = {/* # DPLL Clock 
Setting */
@@ -297,7 +297,7 @@ static struct bcm_ddr_setting asT3B_DDRSetting80MHz[] = {/* 
# DPLL Clock Setting
{0x0F007094, 0x0104},

/* # Enable start bit within memory controller */
{0x0F007018, 0x0101}
-   };
+};
 
 /* 100Mhz */
 #define T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 9  /* index for 0x0F007000 */
@@ -352,7 +352,7 @@ static struct bcm_ddr_setting asT3B_DDRSetting100MHz[] = 
{/* # DPLL Clock Settin
{0x0F007094, 0x0104},
/* # Enable 
start bit within memory controller */
{0x0F007018, 0x0101}
-   };
+};
 
 
 #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 9  /*index for 0x0F007000 */
@@ -781,11 +781,9 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
UINT uiClockSetting = 0;
int retval = STATUS_SUCCESS;
 
-switch (Adapter->chip_id)
-   {
+switch (Adapter->chip_id) {
case 0xbece3200:
-   switch (Adapter->DDRSetting)
-   {
+   switch (Adapter->DDRSetting) {
case DDR_80_MHZ:
psDDRSetting = asT3LP_DDRSetting80MHz;
RegCount = (sizeof(asT3LP_DDRSetting80MHz)/
@@ -800,14 +798,10 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
psDDRSetting = asT3LP_DDRSetting133MHz;
RegCount = (sizeof(asT3LP_DDRSetting133MHz)/
sizeof(struct bcm_ddr_setting));
-   if(Adapter->bMipsConfig == MIPS_200_MHZ)
-   {
+   if (Adapter->bMipsConfig == MIPS_200_MHZ)
uiClockSetting = 0x03F13652;
-   }
else
-   {
uiClockSetting = 0x03F1365B;
-   }
break;
default:
return -EINVAL;
@@ -822,24 +816,22 @@ int ddr_init(struct bcm_mini_adapter *Adapter)

[PATCH 7/9] Staging: bcm: DDRInit: removed extra lines

2013-12-06 Thread Gary Rookard
This is the seventh patch of a series.

Signed-off-by: Gary Alan Rookard 
---
On branch staging-next
 drivers/staging/bcm/DDRInit.c | 163 +++---
 1 file changed, 43 insertions(+), 120 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index 8bb3283..57e6023 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -6,23 +6,21 @@
 #define MIPS_CLOCK_REG 0x0f000820
 
 /* DDR INIT-133Mhz */
-#define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12  /* index for 0x0F00700 */0
+#define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12  /* index for 0x0F007000 */
 static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = { /* # DPLL Clock 
Setting */
{0x0F000800, 0x7212},
{0x0f000820, 0x07F13FFF},
{0x0f000810, 0x0F95},
{0x0f000860, 0x},
{0x0f000880, 0x03DD},
-/* Changed source for X-bar and MIPS 
clock to APLL */
-   {0x0f000840, 0x0FFF1B00},
+   {0x0f000840, 0x0FFF1B00},   /* Changed source for X-bar and MIPS 
clock to APLL */
{0x0f000870, 0x0002},
{0x0F00a044, 0x1fff},
{0x0F00a040, 0x1f00},
{0x0F00a084, 0x1Cff},
{0x0F00a080, 0x1C00},
{0x0F00a04C, 0x000C},
-/* Memcontroller Default values */
-   {0x0F007000, 0x00010001},
+   {0x0F007000, 0x00010001},   /* Memcontroller Default values */
{0x0F007004, 0x01010100},
{0x0F007008, 0x0101},
{0x0F00700c, 0x},
@@ -56,12 +54,9 @@ static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = {
 /* # DPLL Clock Se
{0x0F00707C, 0x},
{0x0F007080, 0x},
{0x0F007084, 0x},
-/* # Enable BW improvement within 
memory controller */
-   {0x0F007094, 0x0104},
-/* # Enable 2 ports within X-bar */
-   {0x0F00A000, 0x0016},
-/* # Enable start bit within memory 
controller */
-   {0x0F007018, 0x0101}
+{0x0F007094, 0x0104},   /* # Enable BW improvement within 
memory controller */
+   {0x0F00A000, 0x0016},   /* # Enable 2 ports within X-bar */
+   {0x0F007018, 0x0101}/* # Enable start bit within memory 
controller */
 };
 /* 80Mhz */
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10  /* index for 0x0F007000 */
@@ -76,8 +71,7 @@ static struct bcm_ddr_setting asT3_DDRSetting80MHz[] = { /*  
# DPLL Clock Settin
{0x0F00a080, 0x1C00},
{0x0F00a000, 0x0016},
{0x0F00a04C, 0x000C},
-/* Memcontroller Default values */
-   {0x0F007000, 0x00010001},
+   {0x0F007000, 0x00010001},  /* Memcontroller Default values */
{0x0F007004, 0x0100},
{0x0F007008, 0x0101},
{0x0F00700c, 0x},
@@ -112,8 +106,7 @@ static struct bcm_ddr_setting asT3_DDRSetting80MHz[] = { /* 
 # DPLL Clock Settin
{0x0F007080, 0x},
{0x0F007084, 0x},
{0x0F007094, 0x0104},
-/*# Enable start bit within memory 
controller */
-   {0x0F007018, 0x0101}
+   {0x0F007018, 0x0101}/* # Enable start bit within memory 
controller */
 };
 /* 100Mhz */
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 13  /* index for 0x0F007000 */
@@ -123,19 +116,16 @@ static struct bcm_ddr_setting asT3_DDRSetting100MHz[] = 
{/*  # DPLL Clock Settin
{0x0f000820, 0x07F13E3F},
{0x0f000860, 0x},
{0x0f000880, 0x03DD},
-/* Changed source for X-bar and MIPS clock to 
APLL */
-/* 0x0f000840,0x0FFF1800, */
-   {0x0f000840, 0x0FFF1B00},
+   {0x0f000840, 0x0FFF1B00}, /* Changed source for X-bar and MIPS clock to 
APLL */
+   /* 0x0f000840,0x0FFF1800, */
{0x0f000870, 0x0002},
{0x0F00a044, 0x1fff},
{0x0F00a040, 0x1f00},
{0x0F00a084, 0x1Cff},
{0x0F00a080, 0x1C00},
{0x0F00a04C, 0x000C},
-/* # Enable 2 ports within X-bar */
-   {0x0F00A000, 0x0016},
-/*Memcontroller Default values */
-   {0x0F007000, 0x00010001},
+   {0x0F00A000, 0x0016},  /* # Enable 2 ports within X-bar */
+   {0x0F007000, 0x00010001},  /*Memcontroller Default values */
{0x0F007004, 0x01010100},
{0x0F007008, 0x0101},
{0x0F00700c, 0x},
@@ -169,12 +159,9 @@ static struct bcm_ddr_setting asT3_DDRSetting100MHz[] = 
{/*  # DPLL Clock Settin
{0x0F00707C, 0x},
{0x0F007080, 0x},
{0x0F007084, 0x},
-/* # Enable BW improvement within memory 
controller */
- 

[PATCH 8/9] Staging: bcm: DDRInit: tidy up indentation.

2013-12-06 Thread Gary Rookard
This is the eighth patch of a series.

Signed-off-by: Gary Alan Rookard 
---
On branch stanging-next
 drivers/staging/bcm/DDRInit.c | 394 +-
 1 file changed, 195 insertions(+), 199 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index 57e6023..c808bc5 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -54,7 +54,7 @@ static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = { 
/* # DPLL Clock Se
{0x0F00707C, 0x},
{0x0F007080, 0x},
{0x0F007084, 0x},
-{0x0F007094, 0x0104},   /* # Enable BW improvement within 
memory controller */
+   {0x0F007094, 0x0104},   /* # Enable BW improvement within 
memory controller */
{0x0F00A000, 0x0016},   /* # Enable 2 ports within X-bar */
{0x0F007018, 0x0101}/* # Enable start bit within memory 
controller */
 };
@@ -722,31 +722,31 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
UINT uiClockSetting = 0;
int retval = STATUS_SUCCESS;
 
-switch (Adapter->chip_id) {
+   switch (Adapter->chip_id) {
case 0xbece3200:
-   switch (Adapter->DDRSetting) {
-   case DDR_80_MHZ:
-   psDDRSetting = asT3LP_DDRSetting80MHz;
-   RegCount = (sizeof(asT3LP_DDRSetting80MHz)/
-   sizeof(struct bcm_ddr_setting));
-   break;
-   case DDR_100_MHZ:
-   psDDRSetting = asT3LP_DDRSetting100MHz;
-   RegCount = (sizeof(asT3LP_DDRSetting100MHz)/
-   sizeof(struct bcm_ddr_setting));
-   break;
-   case DDR_133_MHZ:
-   psDDRSetting = asT3LP_DDRSetting133MHz;
-   RegCount = (sizeof(asT3LP_DDRSetting133MHz)/
-   sizeof(struct bcm_ddr_setting));
+   switch (Adapter->DDRSetting) {
+   case DDR_80_MHZ:
+   psDDRSetting = asT3LP_DDRSetting80MHz;
+   RegCount = (sizeof(asT3LP_DDRSetting80MHz)/
+   sizeof(struct bcm_ddr_setting));
+   break;
+   case DDR_100_MHZ:
+   psDDRSetting = asT3LP_DDRSetting100MHz;
+   RegCount = (sizeof(asT3LP_DDRSetting100MHz)/
+   sizeof(struct bcm_ddr_setting));
+   break;
+   case DDR_133_MHZ:
+   psDDRSetting = asT3LP_DDRSetting133MHz;
+   RegCount = (sizeof(asT3LP_DDRSetting133MHz)/
+   sizeof(struct bcm_ddr_setting));
if (Adapter->bMipsConfig == MIPS_200_MHZ)
uiClockSetting = 0x03F13652;
else
-   uiClockSetting = 0x03F1365B;
+   uiClockSetting = 0x03F1365B;
break;
-   default:
-   return -EINVAL;
-}
+   default:
+   return -EINVAL;
+   }
break;
case T3LPB:
case BCS220_2:
@@ -756,10 +756,10 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
/* Set bit 2 and bit 6 to 1 for BBIC 2mA drive
 * (please check current value and additionally set these bits)
 */
-   if ((Adapter->chip_id !=  BCS220_2) &&
-   (Adapter->chip_id !=  BCS220_2BC) &&
-   (Adapter->chip_id != BCS220_3)) {
-   retval = rdmalt(Adapter, (UINT)0x0f000830, 
&uiResetValue, sizeof(uiResetValue));
+   if ((Adapter->chip_id !=  BCS220_2) &&
+   (Adapter->chip_id !=  BCS220_2BC) &&
+   (Adapter->chip_id != BCS220_3)) {
+   retval = rdmalt(Adapter, (UINT)0x0f000830, 
&uiResetValue, sizeof(uiResetValue));
if (retval < 0) {
BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, 
DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__);
return retval;
@@ -770,96 +770,95 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, 
DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__);
return retval;
}
-   }
+   }
switch (Adapter->DDRSetting) {
-   case DDR_80_MHZ:
-   psDDRSetting = asT3LPB_DDRSetting80MHz;
-   RegCount = (sizeof(asT3B_DDRSetting80MHz)/
-   

[PATCH 9/9] Staging: bcm: DDRInit: removed space from front of semicolon.

2013-12-06 Thread Gary Rookard
This is the ninth patch of a series.

Signed-off-by: Gary Alan Rookard 

---
On branch staging-next
 drivers/staging/bcm/DDRInit.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index c808bc5..1b73819 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -3,7 +3,7 @@
 
 
 #define DDR_DUMP_INTERNAL_DEVICE_MEMORY 0xBFC02B00
-#define MIPS_CLOCK_REG 0x0f000820
+#define MIPS_CLOCK_REG 0x0f000820
 
 /* DDR INIT-133Mhz */
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12  /* index for 0x0F007000 */
@@ -1005,20 +1005,20 @@ int download_ddr_settings(struct bcm_mini_adapter 
*Adapter)
case DDR_80_MHZ:
psDDRSetting = asT3LP_DDRSetting80MHz;
RegCount = ARRAY_SIZE(asT3LP_DDRSetting80MHz);
-   RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
+   RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
break;
case DDR_100_MHZ:
psDDRSetting = asT3LP_DDRSetting100MHz;
RegCount = ARRAY_SIZE(asT3LP_DDRSetting100MHz);
-   RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
+   RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
break;
case DDR_133_MHZ:
bOverrideSelfRefresh = TRUE;
psDDRSetting = asT3LP_DDRSetting133MHz;
RegCount = ARRAY_SIZE(asT3LP_DDRSetting133MHz);
-   RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
+   RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
break;
default:
@@ -1034,20 +1034,20 @@ int download_ddr_settings(struct bcm_mini_adapter 
*Adapter)
case DDR_80_MHZ:
psDDRSetting = asT3LPB_DDRSetting80MHz;
RegCount = ARRAY_SIZE(asT3LPB_DDRSetting80MHz);
-   RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
+   RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
break;
case DDR_100_MHZ:
psDDRSetting = asT3LPB_DDRSetting100MHz;
RegCount = ARRAY_SIZE(asT3LPB_DDRSetting100MHz);
-   RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
+   RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
break;
case DDR_133_MHZ:
bOverrideSelfRefresh = TRUE;
psDDRSetting = asT3LPB_DDRSetting133MHz;
RegCount = ARRAY_SIZE(asT3LPB_DDRSetting133MHz);
-   RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
+   RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
break;
case DDR_160_MHZ:
@@ -1066,20 +1066,20 @@ int download_ddr_settings(struct bcm_mini_adapter 
*Adapter)
case DDR_80_MHZ:
psDDRSetting = asT3_DDRSetting80MHz;
RegCount = ARRAY_SIZE(asT3_DDRSetting80MHz);
-   RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
+   RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
break;
case DDR_100_MHZ:
psDDRSetting = asT3_DDRSetting100MHz;
RegCount = ARRAY_SIZE(asT3_DDRSetting100MHz);
-   RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
+   RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
break;
case DDR_133_MHZ:
psDDRSetting = asT3_DDRSetting133MHz;
RegCount = ARRAY_SIZE(asT3_DDRSetting133MHz);
-   RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
-   psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
+   RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
+   psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
break;
default:
return -EINVA

Re: [PATCH] staging: dwc2: don't issue traffic to LS devices in FS mode

2013-12-06 Thread Stephen Warren
On 12/06/2013 03:01 PM, Paul Zimmerman wrote:
> From: Nick Hudson 
> 
> I fell over the problem reported in
> https://github.com/raspberrypi/linux/pull/390:
> 
> "Issuing low-speed packets when the root port is in full-speed mode
>  causes the root port to stop responding. Explicitly fail when
>  enqueuing URBs to a LS endpoint on a FS bus."
> 
> with my dwc2 testing in NetBSD, so I adapted the change to dwc2.

Tested-by: Stephen Warren 

The built-in USB Ethernet on my model B still works fine with this
change. A USB keyboard/mouse combo isn't reliable (it keeps dropping
out, and I need to unplug/replug to get it working again), but it never
was before. I'm also not sure if that's because of power issues or not
(I'm not using powered hub on this system).
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/9] Staging: bcm: DDRInit: replaced C99 comments.

2013-12-06 Thread Gary Rookard
This is the fifth patch of a series.

Signed-off-by: Gary Alan Rookard 
---
On branch staging-next
 drivers/staging/bcm/DDRInit.c | 270 +-
 1 file changed, 135 insertions(+), 135 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index cb4dd53..1a08b17 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -5,15 +5,15 @@
 #define DDR_DUMP_INTERNAL_DEVICE_MEMORY 0xBFC02B00
 #define MIPS_CLOCK_REG 0x0f000820
 
-//DDR INIT-133Mhz
-#define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12  //index for 0x0F007000
-static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = {//  # DPLL Clock 
Setting
+/* DDR INIT-133Mhz */
+#define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12  /* index for 0x0F00700 */0
+static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = { /* # DPLL Clock 
Setting */
{0x0F000800, 0x7212},
{0x0f000820, 0x07F13FFF},
{0x0f000810, 0x0F95},
{0x0f000860, 0x},
{0x0f000880, 0x03DD},
-// Changed source for X-bar and MIPS 
clock to APLL
+/* Changed source for X-bar and MIPS 
clock to APLL */
{0x0f000840, 0x0FFF1B00},
{0x0f000870, 0x0002},
{0x0F00a044, 0x1fff},
@@ -21,7 +21,7 @@ static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = {//   
   # DPLL Clock Se
{0x0F00a084, 0x1Cff},
{0x0F00a080, 0x1C00},
{0x0F00a04C, 0x000C},
-//Memcontroller Default values
+/* Memcontroller Default values */
{0x0F007000, 0x00010001},
{0x0F007004, 0x01010100},
{0x0F007008, 0x0101},
@@ -29,17 +29,17 @@ static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = {// 
 # DPLL Clock Se
{0x0F007010, 0x0100},
{0x0F007014, 0x01000100},
{0x0F007018, 0x0100},
-   {0x0F00701c, 0x01020001},// POP - 0x00020001 Normal 0x01020001
-   {0x0F007020, 0x04030107}, //Normal - 0x04030107 POP - 0x05030107
+   {0x0F00701c, 0x01020001},/*  POP - 0x00020001 Normal 0x01020001 */
+   {0x0F007020, 0x04030107}, /* Normal - 0x04030107 POP - 0x05030107 */
{0x0F007024, 0x0207},
{0x0F007028, 0x02020202},
-   {0x0F00702c, 0x0206060a},//ROB- 0x0205050a,//0x0206060a
+   {0x0F00702c, 0x0206060a},/* ROB- 0x0205050a,0x0206060a */
{0x0F007030, 0x0500},
{0x0F007034, 0x0003};
-   {0x0F007038, 0x110a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200
-   {0x0F00703C, 0x02101010},//ROB - 0x02101010,//0x02101018},
-   {0x0F007040, 0x45751200},//ROB - 0x45751200,//0x450f1200},
-   {0x0F007044, 0x110a0d00},//ROB - 0x110a0d00//0x111f0d00
+   {0x0F007038, 0x110a0200},/* ROB - 0x110a0200,0x180a0200,0x1f0a0200 */
+   {0x0F00703C, 0x02101010},/* ROB - 0x02101010,0x02101018}, */
+   {0x0F007040, 0x45751200},/* ROB - 0x45751200,0x450f1200}, */
+   {0x0F007044, 0x110a0d00},/*ROB - 0x110a0d00.0x111f0d00 */
{0x0F007048, 0x081b0306},
{0x0F00704c, 0x},
{0x0F007050, 0x001c},
@@ -56,16 +56,16 @@ static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = {// 
 # DPLL Clock Se
{0x0F00707C, 0x},
{0x0F007080, 0x},
{0x0F007084, 0x},
-//# Enable BW improvement within 
memory controller
+/* # Enable BW improvement within 
memory controller */
{0x0F007094, 0x0104},
-//# Enable 2 ports within X-bar
+/* # Enable 2 ports within X-bar */
{0x0F00A000, 0x0016},
-//# Enable start bit within memory 
controller
+/* # Enable start bit within memory 
controller */
{0x0F007018, 0x0101}
 };
-//80Mhz
-#define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10  //index for 0x0F007000
-static struct bcm_ddr_setting asT3_DDRSetting80MHz[] = {//   # DPLL Clock 
Setting
+/* 80Mhz */
+#define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10  /* index for 0x0F007000 */
+static struct bcm_ddr_setting asT3_DDRSetting80MHz[] = { /*  # DPLL Clock 
Setting */
{0x0f000810, 0x0F95},
{0x0f000820, 0x07f1},
{0x0f000860, 0x},
@@ -76,7 +76,7 @@ static struct bcm_ddr_setting asT3_DDRSetting80MHz[] = {//   
# DPLL Clock Settin
{0x0F00a080, 0x1C00},
{0x0F00a000, 0x0016},
{0x0F00a04C, 0x000C},
-//Memcontroller Default values
+/* Memcontroller Default values */
{0x0F007000, 0x00010001},
{0x0F007004, 0x0100},
{0x0F007008, 0x0101},
@@ -112,19 +112,19 

[PATCH] staging: rtl8192u: fix some type confusion

2013-12-06 Thread Ilia Mirkin
The first 8 bytes of skb->cb are used to store a struct net_device *.
Adjust the memcpy's src/dst types to reflect that.

Signed-off-by: Ilia Mirkin 
---

Noticed this with spatch looking for sizes in memcpy's inconsistent with the
arguments.

 drivers/staging/rtl8192u/r8192U_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index c2bcbe2..36b3bd0 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1038,7 +1038,7 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct 
net_device *dev, int rat
 
spin_lock_irqsave(&priv->tx_lock, flags);
 
-   memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev));
+   memcpy((struct net_device **)(skb->cb), &dev, sizeof(dev));
tcb_desc->bTxEnableFwCalcDur = 1;
skb_push(skb, priv->ieee80211->tx_headroom);
ret = rtl8192_tx(dev, skb);
@@ -1064,7 +1064,7 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb, struct 
net_device *dev)
 
spin_lock_irqsave(&priv->tx_lock, flags);
 
-   memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev));
+   memcpy((struct net_device **)(skb->cb), &dev, sizeof(dev));
if (queue_index == TXCMD_QUEUE) {
skb_push(skb, USB_HWDESC_HEADER_LEN);
rtl819xU_tx_cmd(dev, skb);
@@ -1280,7 +1280,7 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
u8  queue_index = tcb_desc->queue_index;
 
-   memcpy(&dev, (struct net_device *)(skb->cb), sizeof(struct net_device 
*));
+   memcpy(&dev, (struct net_device **)(skb->cb), sizeof(struct net_device 
*));
priv = ieee80211_priv(dev);
 
if (tcb_desc->queue_index != TXCMD_QUEUE) {
-- 
1.8.3.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8192u: fix some type confusion

2013-12-06 Thread Dan Carpenter
On Fri, Dec 06, 2013 at 11:59:26PM -0500, Ilia Mirkin wrote:
> The first 8 bytes of skb->cb are used to store a struct net_device *.
> Adjust the memcpy's src/dst types to reflect that.
> 
> Signed-off-by: Ilia Mirkin 

This isn't right.  The correct fix is just to remove all the casting.

memcpy(skb->cb, &dev, sizeof(dev));

regards,
dan carpenter


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/7 RESEND] staging: et131x: reduce split lines in et131x_config_rx_dma_regs

2013-12-06 Thread Dan Carpenter
On Sat, Dec 07, 2013 at 09:19:04AM +0800, ZHAO Gang wrote:
> Signed-off-by: ZHAO Gang 
> ---
>  drivers/staging/et131x/et131x.c | 25 +++--
>  1 file changed, 11 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
> index e3a71d3..0372f23 100644
> --- a/drivers/staging/et131x/et131x.c
> +++ b/drivers/staging/et131x/et131x.c
> @@ -1822,6 +1822,8 @@ static void et131x_config_rx_dma_regs(struct 
> et131x_adapter *adapter)
>   u32 __iomem *base_hi;
>   u32 __iomem *base_lo;
>  
> + struct fbr_lookup *fbr = rx_local->fbr[id];
> +

Gar no.  I'm sorry.  Please keep all the declarations in one block...

I was fine with the previous version honestly, sorry to make you redo
these over and over.

Don't put RESEND in the subject unless you are resending them unchanged
because the maintainers ignored them the first time.  Put a v2, or v3
there instead.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/10] Staging: bcm: DDRInit: tidy up comments.

2013-12-06 Thread Gary Rookard
This is the tenth patch of a series.

Signed-off-by:Gary Alan Rookard 
---
On branch staging-next
 drivers/staging/bcm/DDRInit.c | 231 +-
 1 file changed, 116 insertions(+), 115 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index 1b73819..96afa15 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -7,37 +7,37 @@
 
 /* DDR INIT-133Mhz */
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12  /* index for 0x0F007000 */
-static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = { /* # DPLL Clock 
Setting */
+static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = {  /* # DPLL Clock 
Setting */
{0x0F000800, 0x7212},
{0x0f000820, 0x07F13FFF},
{0x0f000810, 0x0F95},
{0x0f000860, 0x},
{0x0f000880, 0x03DD},
-   {0x0f000840, 0x0FFF1B00},   /* Changed source for X-bar and MIPS 
clock to APLL */
+   {0x0f000840, 0x0FFF1B00},  /* Changed source for X-bar and MIPS clock 
to APLL */
{0x0f000870, 0x0002},
{0x0F00a044, 0x1fff},
{0x0F00a040, 0x1f00},
{0x0F00a084, 0x1Cff},
{0x0F00a080, 0x1C00},
{0x0F00a04C, 0x000C},
-   {0x0F007000, 0x00010001},   /* Memcontroller Default values */
+   {0x0F007000, 0x00010001},  /* Memcontroller Default values */
{0x0F007004, 0x01010100},
{0x0F007008, 0x0101},
{0x0F00700c, 0x},
{0x0F007010, 0x0100},
{0x0F007014, 0x01000100},
{0x0F007018, 0x0100},
-   {0x0F00701c, 0x01020001},/*  POP - 0x00020001 Normal 0x01020001 */
-   {0x0F007020, 0x04030107}, /* Normal - 0x04030107 POP - 0x05030107 */
+   {0x0F00701c, 0x01020001},  /*  POP - 0x00020001 Normal 0x01020001 */
+   {0x0F007020, 0x04030107},  /* Normal - 0x04030107 POP - 0x05030107 */
{0x0F007024, 0x0207},
{0x0F007028, 0x02020202},
-   {0x0F00702c, 0x0206060a},/* ROB- 0x0205050a,0x0206060a */
+   {0x0F00702c, 0x0206060a},  /* ROB- 0x0205050a,0x0206060a */
{0x0F007030, 0x0500},
{0x0F007034, 0x0003};
-   {0x0F007038, 0x110a0200},/* ROB - 0x110a0200,0x180a0200,0x1f0a0200 */
-   {0x0F00703C, 0x02101010},/* ROB - 0x02101010,0x02101018}, */
-   {0x0F007040, 0x45751200},/* ROB - 0x45751200,0x450f1200}, */
-   {0x0F007044, 0x110a0d00},/*ROB - 0x110a0d00.0x111f0d00 */
+   {0x0F007038, 0x110a0200},  /* ROB - 0x110a0200,0x180a0200,0x1f0a0200 */
+   {0x0F00703C, 0x02101010},  /* ROB - 0x02101010,0x02101018}, */
+   {0x0F007040, 0x45751200},  /* ROB - 0x45751200,0x450f1200}, */
+   {0x0F007044, 0x110a0d00},  /*ROB - 0x110a0d00.0x111f0d00 */
{0x0F007048, 0x081b0306},
{0x0F00704c, 0x},
{0x0F007050, 0x001c},
@@ -54,13 +54,13 @@ static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = {   
  /* # DPLL Clock Se
{0x0F00707C, 0x},
{0x0F007080, 0x},
{0x0F007084, 0x},
-   {0x0F007094, 0x0104},   /* # Enable BW improvement within 
memory controller */
-   {0x0F00A000, 0x0016},   /* # Enable 2 ports within X-bar */
-   {0x0F007018, 0x0101}/* # Enable start bit within memory 
controller */
+   {0x0F007094, 0x0104},  /* # Enable BW improvement within memory 
controller */
+   {0x0F00A000, 0x0016},  /* # Enable 2 ports within X-bar */
+   {0x0F007018, 0x0101}   /* # Enable start bit within memory 
controller */
 };
 /* 80Mhz */
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10  /* index for 0x0F007000 */
-static struct bcm_ddr_setting asT3_DDRSetting80MHz[] = { /*  # DPLL Clock 
Setting */
+static struct bcm_ddr_setting asT3_DDRSetting80MHz[] = {  /*  # DPLL Clock 
Setting */
{0x0f000810, 0x0F95},
{0x0f000820, 0x07f1},
{0x0f000860, 0x},
@@ -106,18 +106,18 @@ static struct bcm_ddr_setting asT3_DDRSetting80MHz[] = { 
/*  # DPLL Clock Settin
{0x0F007080, 0x},
{0x0F007084, 0x},
{0x0F007094, 0x0104},
-   {0x0F007018, 0x0101}/* # Enable start bit within memory 
controller */
+   {0x0F007018, 0x0101}   /* # Enable start bit within memory 
controller */
 };
 /* 100Mhz */
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 13  /* index for 0x0F007000 */
-static struct bcm_ddr_setting asT3_DDRSetting100MHz[] = {/*  # DPLL Clock 
Setting */
+static struct bcm_ddr_setting asT3_DDRSetting100MHz[] = {  /* # DPLL Clock 
Setting */
{0x0F000800, 0x7008},
{0x0f000810, 0x0F95},
{0x0f000820, 0x07F13E3F},
{0x0f000860, 0x},
{0x0f000880, 0x03DD},
-   {0x0f000840, 0x0FFF1B00}, /* Changed source for X-bar and MIPS clock to 
APLL */
-   /* 0x0f000840,0x0FFF1800, */
+   {0x0f000840, 0x0FFF1B00},  /* Changed source for X-bar and MIPS clock 
to APLL */
+

[PATCH 03/10] Staging: bcm: DDRInit: added space after commas.

2013-12-06 Thread Gary Rookard
This is the third patch of a series.

Signed-off-by: Gary Alan Rookard 

---
On branch staging-next
 drivers/staging/bcm/DDRInit.c | 1332 -
 1 file changed, 666 insertions(+), 666 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index e014759..ed4dfe9 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -8,526 +8,526 @@
 //DDR INIT-133Mhz
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12  //index for 0x0F007000
 static struct bcm_ddr_setting asT3_DDRSetting133MHz[]= {//  # DPLL Clock 
Setting
-   {0x0F000800,0x7212},
-   {0x0f000820,0x07F13FFF},
-   {0x0f000810,0x0F95},
-   {0x0f000860,0x},
-   {0x0f000880,0x03DD},
+   {0x0F000800, 0x7212},
+   {0x0f000820, 0x07F13FFF},
+   {0x0f000810, 0x0F95},
+   {0x0f000860, 0x},
+   {0x0f000880, 0x03DD},
 // Changed source for X-bar and MIPS 
clock to APLL
-   {0x0f000840,0x0FFF1B00},
-   {0x0f000870,0x0002},
-   {0x0F00a044,0x1fff},
-   {0x0F00a040,0x1f00},
-   {0x0F00a084,0x1Cff},
-   {0x0F00a080,0x1C00},
-   {0x0F00a04C,0x000C},
+   {0x0f000840, 0x0FFF1B00},
+   {0x0f000870, 0x0002},
+   {0x0F00a044, 0x1fff},
+   {0x0F00a040, 0x1f00},
+   {0x0F00a084, 0x1Cff},
+   {0x0F00a080, 0x1C00},
+   {0x0F00a04C, 0x000C},
 //Memcontroller Default values
-   {0x0F007000,0x00010001},
-   {0x0F007004,0x01010100},
-   {0x0F007008,0x0101},
-   {0x0F00700c,0x},
-   {0x0F007010,0x0100},
-   {0x0F007014,0x01000100},
-   {0x0F007018,0x0100},
-   {0x0F00701c,0x01020001},// POP - 0x00020001 Normal 0x01020001
-   {0x0F007020,0x04030107}, //Normal - 0x04030107 POP - 0x05030107
-   {0x0F007024,0x0207},
-   {0x0F007028,0x02020202},
-   {0x0F00702c,0x0206060a},//ROB- 0x0205050a,//0x0206060a
-   {0x0F007030,0x0500},
-   {0x0F007034,0x0003};
-   {0x0F007038,0x110a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200
-   {0x0F00703C,0x02101010},//ROB - 0x02101010,//0x02101018},
-   {0x0F007040,0x45751200},//ROB - 0x45751200,//0x450f1200},
-   {0x0F007044,0x110a0d00},//ROB - 0x110a0d00//0x111f0d00
-   {0x0F007048,0x081b0306},
-   {0x0F00704c,0x},
-   {0x0F007050,0x001c},
-   {0x0F007054,0x},
-   {0x0F007058,0x},
-   {0x0F00705c,0x},
-   {0x0F007060,0x0010246c},
-   {0x0F007064,0x0010},
-   {0x0F007068,0x},
-   {0x0F00706c,0x0001},
-   {0x0F007070,0x7000},
-   {0x0F007074,0x},
-   {0x0F007078,0x},
-   {0x0F00707C,0x},
-   {0x0F007080,0x},
-   {0x0F007084,0x},
+   {0x0F007000, 0x00010001},
+   {0x0F007004, 0x01010100},
+   {0x0F007008, 0x0101},
+   {0x0F00700c, 0x},
+   {0x0F007010, 0x0100},
+   {0x0F007014, 0x01000100},
+   {0x0F007018, 0x0100},
+   {0x0F00701c, 0x01020001},// POP - 0x00020001 Normal 0x01020001
+   {0x0F007020, 0x04030107}, //Normal - 0x04030107 POP - 0x05030107
+   {0x0F007024, 0x0207},
+   {0x0F007028, 0x02020202},
+   {0x0F00702c, 0x0206060a},//ROB- 0x0205050a,//0x0206060a
+   {0x0F007030, 0x0500},
+   {0x0F007034, 0x0003};
+   {0x0F007038, 0x110a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200
+   {0x0F00703C, 0x02101010},//ROB - 0x02101010,//0x02101018},
+   {0x0F007040, 0x45751200},//ROB - 0x45751200,//0x450f1200},
+   {0x0F007044, 0x110a0d00},//ROB - 0x110a0d00//0x111f0d00
+   {0x0F007048, 0x081b0306},
+   {0x0F00704c, 0x},
+   {0x0F007050, 0x001c},
+   {0x0F007054, 0x},
+   {0x0F007058, 0x},
+   {0x0F00705c, 0x},
+   {0x0F007060, 0x0010246c},
+   {0x0F007064, 0x0010},
+   {0x0F007068, 0x},
+   {0x0F00706c, 0x0001},
+   {0x0F007070, 0x7000},
+   {0x0F007074, 0x},
+   {0x0F007078, 0x},
+   {0x0F00707C, 0x},
+   {0x0F007080, 0x},
+   {0x0F007084, 0x},
 //# Enable BW improvement within 
memory controller
-   {0x0F007094,0x0104},
+   {0x0F007094, 0x0104},
 //# Enable 2 ports within X-bar
-   {0x0F00A000,0x0016},
+   {0x0F00A000, 0x0016},
 //# Enable start bit within memory 
controller
-   {0x0F007018,0x0101}
+   {0x0F007018, 0x0101}
 };
 //80Mhz
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10  //index for 0x0F007000
 static struct bcm_ddr_setting asT3_DDRSetting80MHz[]= {//   # DPLL Cloc

Re: [PATCH 4/7 RESEND] staging: et131x: reduce split lines in nic_return_rfd

2013-12-06 Thread Dan Carpenter
On Sat, Dec 07, 2013 at 09:39:07AM +0800, ZHAO Gang wrote:
> Signed-off-by: ZHAO Gang 
> ---
>  drivers/staging/et131x/et131x.c | 23 ---
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
> index 881ae4f..90ef45b 100644
> --- a/drivers/staging/et131x/et131x.c
> +++ b/drivers/staging/et131x/et131x.c
> @@ -2495,16 +2495,19 @@ static void et131x_set_rx_dma_timer(struct 
> et131x_adapter *adapter)
>   */
>  static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd)
>  {
> + unsigned long flags;
> +
>   struct rx_ring *rx_local = &adapter->rx_ring;
>   struct rxdma_regs __iomem *rx_dma = &adapter->regs->rxdma;
>   u16 buff_index = rfd->bufferindex;
>   u8 ring_index = rfd->ringindex;
> - unsigned long flags;
> + struct fbr_lookup *fbr = rx_local->fbr[ring_index];

No.  Don't do this.  Even though the declarations have initializers,
they all go together.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel