Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16

2014-07-10 Thread h...@infradead.org
On Wed, Jul 09, 2014 at 10:27:24PM +, James Bottomley wrote:
> If we fix it at source, why would there be any need to filter?  That's
> the reason the no_write_same flag was introduced.  If we can find and
> fix the bug, it can go back into the stable trees as a bug fix, hence
> nothing should ever emit write_same(10 or 16) and additional driver code
> is redundant (and counter productive, since if this ever breaks again
> you're our best canary).
> 
> This looks like it might be the problem but Martin should confirm (I
> think the problem comes to us from the RC16 code which unconditionally
> sets WS16).

I think the problem is a differnet one.  If we have the logical
provisioning EVPD it configures what method to use, but if we don't have
one we simply check for a max unmap blocks field, and if that's not
present use WRITE SAME.

The patch checks the no_write_same flag before doing that, for which
we also have to do the write_same setup before the discard setup
in sd_revalidate_disk.

Ky: does hyperv support UNMAP?  If so any idea why it doesn't set
the maximum unmap block count field in the EVPD?

If we want to enable UNMAP in this case I'd prefer a blacklist entry
than trying UNMAP despite the device not advertising it.

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index ba756b1..fbccfd2 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2614,9 +2614,10 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)
 
if (sdkp->max_unmap_blocks)
sd_config_discard(sdkp, SD_LBP_UNMAP);
-   else
+   else if (!sdkp->device->no_write_same)
sd_config_discard(sdkp, SD_LBP_WS16);
-
+   else
+   sd_config_discard(sdkp, SD_LBP_DISABLE);
} else {/* LBP VPD page tells us what to use */
 
if (sdkp->lbpu && sdkp->max_unmap_blocks)
@@ -2766,6 +2767,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
 */
if (sdkp->media_present) {
sd_read_capacity(sdkp, buffer);
+   sd_read_write_same(sdkp, buffer);
 
if (sd_try_extended_inquiry(sdp)) {
sd_read_block_provisioning(sdkp);
@@ -2776,7 +2778,6 @@ static int sd_revalidate_disk(struct gendisk *disk)
sd_read_write_protect_flag(sdkp, buffer);
sd_read_cache_type(sdkp, buffer);
sd_read_app_tag_own(sdkp, buffer);
-   sd_read_write_same(sdkp, buffer);
}
 
sdkp->first_scan = 0;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2

2014-07-10 Thread Sitsofe Wheeler
On Mon, Jul 07, 2014 at 07:13:41PM +0100, Sitsofe Wheeler wrote:
> On Mon, Jul 07, 2014 at 04:54:20PM +, Haiyang Zhang wrote:
> > 
> > > -Original Message-
> > > From: Sitsofe Wheeler [mailto:sits...@gmail.com]
> > > Sent: Sunday, July 6, 2014 4:18 PM
> > > To: Haiyang Zhang
> > > Cc: KY Srinivasan; David S. Miller; de...@linuxdriverproject.org; linux-
> > > ker...@vger.kernel.org; net...@vger.kernel.org
> > > Subject: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in
> > > 3.14+ on Hyper-V 2012 R2
> > > 
> > > With the 3.14 kernel Hyper-V no longer reliably enables its
> > > networking devices in time on cloud images leading to network
> > > devices permanently remaining offline.
> > > 
> 
> > > the system will usually stop rebooting before 20 passes but the most
> > > extreme cases were always less than 100. With a pre
> > > b679ef73edc251f6d200a7dd2396e9fef9e36fc3 kernel it did over 390
> > > passes before I manually stopped it.
> > > 
> > > Originally filed on https://bugzilla.redhat.com/show_bug.cgi?id=1095387
> > > and then on https://bugzilla.kernel.org/show_bug.cgi?id=78771 but without
> > > reply...
> > > 
> > > Might also be related to
> > > http://thread.gmane.org/gmane.linux.kernel/1711873/focus=1733398
> > > (Regression in hyperv network driver in 3.14).
> > 
> > What's the memory size assigned to the Linux guest? And, have you seen
> > any related messages in the dmesg log after this issue?
> 
> (Feel free to trim my emails when replying - it makes it easier to see
> your reply :-)
> 
> I've had as little as 256 MBytes and as much as 4 GBytes (non-dynamic)
> and still seen the issue.
> 
> See https://bugzilla.kernel.org/attachment.cgi?id=142201 for a recent
> dmesg (an older dmesg snippet can be seen on the Red Hat bugzilla).

Oops that should have been
https://bugzilla.kernel.org/attachment.cgi?id=142351 (either way it's
information linked off
https://bugzilla.kernel.org/show_bug.cgi?id=78771 ).

-- 
Sitsofe | http://sucs.org/~sits/
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/4] staging: comedi: addi_apci_1564: fix s->maxdata assignment in do subdevice init.

2014-07-10 Thread Chase Southwood
s->maxdata for the do subdevice should be 1, however currently it is
being set to 0x.  Fix this.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
This patch is at the end because I'm somewhat uncertain of its
correctness.  Every other addi_apci_* driver with a digital output
subdevice sets s->maxdata to 1 so I'd be surprised if just this board
differed, but I'm not familiar enough with the hardware to verify that
myself.  I'd appreciate a verification that this is a correct change.
Thanks!

 drivers/staging/comedi/drivers/addi_apci_1564.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index f91aedd..1e25342 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -391,7 +391,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITEABLE;
s->n_chan = 32;
-   s->maxdata = 0x;
+   s->maxdata = 1;
s->range_table = &range_digital;
s->insn_config = apci1564_do_config;
s->insn_bits = apci1564_do_insn_bits;
-- 
2.0.1

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


[PATCH 3/4] staging: comedi: addi_apci_1564: remove null check of devpriv in apci1564_detach()

2014-07-10 Thread Chase Southwood
There is no need to test whether devpriv is null in this function.  The
check looks left over and we can just remove it.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index e3dcab7..f91aedd 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -433,14 +433,10 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 
 static void apci1564_detach(struct comedi_device *dev)
 {
-   struct apci1564_private *devpriv = dev->private;
-
-   if (devpriv) {
-   if (dev->iobase)
-   apci1564_reset(dev);
-   if (dev->irq)
-   free_irq(dev->irq, dev);
-   }
+   if (dev->iobase)
+   apci1564_reset(dev);
+   if (dev->irq)
+   free_irq(dev->irq, dev);
comedi_pci_disable(dev);
 }
 
-- 
2.0.1

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


[PATCH 1/4] staging: comedi: addi_apci_1564: remove len_chanlist from di and do subdevices

2014-07-10 Thread Chase Southwood
This value is only needed for subdevices that support async commands.
The comedi core will default the value to 1 when it is not initialized.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 5924421..675054f 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -385,7 +385,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->subdev_flags = SDF_READABLE;
s->n_chan = 32;
s->maxdata = 1;
-   s->len_chanlist = 32;
s->range_table = &range_digital;
s->insn_bits = apci1564_di_insn_bits;
 
@@ -395,7 +394,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->subdev_flags = SDF_WRITEABLE;
s->n_chan = 32;
s->maxdata = 0x;
-   s->len_chanlist = 32;
s->range_table = &range_digital;
s->insn_config = apci1564_do_config;
s->insn_bits = apci1564_do_insn_bits;
-- 
2.0.1

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


[PATCH 2/4] staging: comedi: addi_apci_1564: remove unnecessary dev->board_name initialization

2014-07-10 Thread Chase Southwood
The dev->board_name is now initialized by the comedi core before calling
the(*attach) or (*auto_attach) function in a driver. As long as the driver
does no additional probing, it's no longer necessary initialize the board_name.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 675054f..e3dcab7 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -353,8 +353,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
struct comedi_subdevice *s;
int ret;
 
-   dev->board_name = dev->driver->driver_name;
-
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
if (!devpriv)
return -ENOMEM;
-- 
2.0.1

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


[PATCH 0/4] staging: comedi: addi_apci_1564: small fixes in apci1564_auto_attach() and apci1564_detach()

2014-07-10 Thread Chase Southwood
This is a small patchset containing a handful of fixes to the ADDI-DATA
APCI1564 driver that I would like to get out of the way before I forget
to take care of them.  From here, I will move to start fixing the
digital input/timer/counters/watchdog functionality of the board.

Chase Southwood (4):
  staging: comedi: addi_apci_1564: remove len_chanlist from di and do
subdevices
  staging: comedi: addi_apci_1564: remove unnecessary dev->board_name
initialization
  staging: comedi: addi_apci_1564: remove null check of devpriv in
apci1564_detach()
  staging: comedi: addi_apci_1564: fix s->maxdata assignment in do
subdevice init.

 drivers/staging/comedi/drivers/addi_apci_1564.c | 18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

-- 
2.0.1

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


Re: [PATCH] [media] staging/solo6x10: SOLO6X10 should select BITREVERSE

2014-07-10 Thread Ismael Luceno
On Sun,  6 Jul 2014 10:58:41 +0200
Geert Uytterhoeven  wrote:
> If CONFIG_SOLO6X10=y, but CONFIG_BITREVERSE=m:
> 
> drivers/built-in.o: In function `solo_osd_print':
> (.text+0x1c7a1f): undefined reference to `byte_rev_table'
> make: *** [vmlinux] Error 1
> 
> Reported-by: kbuild test robot 
> Signed-off-by: Geert Uytterhoeven 
> ---
>  drivers/staging/media/solo6x10/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/media/solo6x10/Kconfig
> b/drivers/staging/media/solo6x10/Kconfig index
> 6a1906fa1117..1ce2819efcb4 100644 ---
> a/drivers/staging/media/solo6x10/Kconfig +++
> b/drivers/staging/media/solo6x10/Kconfig @@ -1,6 +1,7 @@
>  config SOLO6X10
>   tristate "Bluecherry / Softlogic 6x10 capture cards
> (MPEG-4/H.264)" depends on PCI && VIDEO_DEV && SND && I2C
> + select BITREVERSE
>   select FONT_SUPPORT
>   select FONT_8x16
>   select VIDEOBUF2_DMA_SG

Signed-off-by: Ismael Luceno 


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


[PATCH] staging: gdm724x: fix leak at failure path in init_usb()

2014-07-10 Thread Alexey Khoroshilov
If an allocation in init_usb() failed, it returns without
deallocation of already allocated resources.

The patch fix it and replaces GFP_ATOMIC by GFP_KERNEL in
alloc_tx_sdu_struct() and alloc_rx_struct() as long as
they are called from probe only.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov 
---
 drivers/staging/gdm724x/gdm_usb.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_usb.c 
b/drivers/staging/gdm724x/gdm_usb.c
index ee6e40facca7..ea89d530ff3f 100644
--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -125,11 +125,11 @@ static struct usb_tx_sdu *alloc_tx_sdu_struct(void)
 {
struct usb_tx_sdu *t_sdu;
 
-   t_sdu = kzalloc(sizeof(struct usb_tx_sdu), GFP_ATOMIC);
+   t_sdu = kzalloc(sizeof(struct usb_tx_sdu), GFP_KERNEL);
if (!t_sdu)
return NULL;
 
-   t_sdu->buf = kmalloc(SDU_BUF_SIZE, GFP_ATOMIC);
+   t_sdu->buf = kmalloc(SDU_BUF_SIZE, GFP_KERNEL);
if (!t_sdu->buf) {
kfree(t_sdu);
return NULL;
@@ -183,14 +183,14 @@ static struct usb_rx *alloc_rx_struct(void)
struct usb_rx *r = NULL;
int ret = 0;
 
-   r = kmalloc(sizeof(struct usb_rx), GFP_ATOMIC);
+   r = kmalloc(sizeof(struct usb_rx), GFP_KERNEL);
if (!r) {
ret = -ENOMEM;
goto out;
}
 
-   r->urb = usb_alloc_urb(0, GFP_ATOMIC);
-   r->buf = kmalloc(RX_BUF_SIZE, GFP_ATOMIC);
+   r->urb = usb_alloc_urb(0, GFP_KERNEL);
+   r->buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL);
if (!r->urb || !r->buf) {
ret = -ENOMEM;
goto out;
@@ -366,6 +366,7 @@ static int init_usb(struct lte_udev *udev)
INIT_DELAYED_WORK(&udev->work_rx, do_rx);
return 0;
 fail:
+   release_usb(udev);
return ret;
 }
 
-- 
1.9.1

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


RE: [PATCH 6/8] Drivers: scsi: storvsc: Implement an abort handler

2014-07-10 Thread KY Srinivasan


> -Original Message-
> From: Christoph Hellwig [mailto:h...@infradead.org]
> Sent: Thursday, July 10, 2014 3:13 AM
> To: KY Srinivasan
> Cc: Christoph Hellwig; linux-ker...@vger.kernel.org;
> de...@linuxdriverproject.org; oher...@suse.com;
> jbottom...@parallels.com; jasow...@redhat.com; a...@canonical.com;
> linux-s...@vger.kernel.org
> Subject: Re: [PATCH 6/8] Drivers: scsi: storvsc: Implement an abort handler
> 
> 
> Note that you could increase the timeout and/or implement an
> eh_timed_out handler that just returns BLK_EH_RESET_TIMER, but if the
> completion takes too long the expectation is that a command will eventually
> finish instead of beeing delayed by an unmound amount.

I like this idea; I will implement a eh_timed_out_handler.

K. Y

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


RE: [PATCH 7/8] drivers: scsi: storvsc: Set srb_flags in all cases

2014-07-10 Thread KY Srinivasan


> -Original Message-
> From: Christoph Hellwig [mailto:h...@infradead.org]
> Sent: Thursday, July 10, 2014 3:17 AM
> To: KY Srinivasan
> Cc: Christoph Hellwig; linux-ker...@vger.kernel.org;
> de...@linuxdriverproject.org; oher...@suse.com;
> jbottom...@parallels.com; jasow...@redhat.com; a...@canonical.com;
> linux-s...@vger.kernel.org; sta...@vger.kernel.org
> Subject: Re: [PATCH 7/8] drivers: scsi: storvsc: Set srb_flags in all cases
> 
> On Wed, Jul 09, 2014 at 06:40:09PM +, KY Srinivasan wrote:
> > > On Tue, Jul 08, 2014 at 05:46:51PM -0700, K. Y. Srinivasan wrote:
> > > > Correctly set SRB flags for all valid I/O directions. Some IHV
> > > > drivers on the Windows host require this.
> > >
> > > What are IHV drivers?
> >
> > If the target is a SAN device, the host simply passes the request over to 
> > the
> native driver stack on the host. Some specific hardware (IHV - independent
> hadware vendor) drivers on Windows require that SRB flags be correctly set
> in all cases.
> >
> 
> I'm fine with putting this in, but treating I/O request from guests as 
> trusted in
> a hypervisor doesn't seem like a good idea in general..

The host does  validate the guest request before forwarding the request to the 
appropriate target.

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


Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16

2014-07-10 Thread James Bottomley
On Thu, 2014-07-10 at 21:02 +, KY Srinivasan wrote:
> 
> > -Original Message-
> > From: James Bottomley [mailto:jbottom...@parallels.com]
> > Sent: Wednesday, July 9, 2014 3:27 PM
> > To: KY Srinivasan
> > Cc: linux-ker...@vger.kernel.org; m...@mkp.net; h...@infradead.org;
> > de...@linuxdriverproject.org; a...@canonical.com; sta...@vger.kernel.org;
> > linux-s...@vger.kernel.org; oher...@suse.com; jasow...@redhat.com
> > Subject: Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16
> > 
> > On Wed, 2014-07-09 at 21:14 +, KY Srinivasan wrote:
> > >
> > > > -Original Message-
> > > > From: James Bottomley [mailto:jbottom...@parallels.com]
> > > > Sent: Wednesday, July 9, 2014 12:57 PM
> > > > To: KY Srinivasan
> > > > Cc: linux-ker...@vger.kernel.org; h...@infradead.org;
> > > > de...@linuxdriverproject.org; a...@canonical.com;
> > > > sta...@vger.kernel.org; linux-s...@vger.kernel.org;
> > > > oher...@suse.com; jasow...@redhat.com
> > > > Subject: Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter
> > > > WRITE_SAME_16
> > > >
> > > > On Wed, 2014-07-09 at 19:52 +, KY Srinivasan wrote:
> > > > >
> > > > > > -Original Message-
> > > > > > From: Christoph Hellwig [mailto:h...@infradead.org]
> > > > > > Sent: Wednesday, July 9, 2014 1:43 AM
> > > > > > To: KY Srinivasan
> > > > > > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org;
> > > > > > oher...@suse.com; jbottom...@parallels.com;
> > jasow...@redhat.com;
> > > > > > a...@canonical.com; linux-s...@vger.kernel.org;
> > > > > > sta...@vger.kernel.org
> > > > > > Subject: Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter
> > > > > > WRITE_SAME_16
> > > > > >
> > > > > > On Tue, Jul 08, 2014 at 05:46:48PM -0700, K. Y. Srinivasan wrote:
> > > > > > > Host does not handle WRITE_SAME_16; filter this command out.
> > > > > > > This patch is required to handle large devices (greater than 2 TB
> > disks).
> > > > > >
> > > > > > Storvsc already sets the no_write_same flag, where is the
> > > > > > command coming from?
> > > > >
> > > > > In spite of this flag,  I see WRITE_SAME_16 being issued when I
> > > > > format a device bigger than 2 TB; I tried both xfs and ext4.
> > > > > Windows hosts currently do not handle unsupported commands
> > > > > correctly - The information returned is not sufficient to effect 
> > > > > recovery
> > in the Linux guest.
> > > > While this may be addressed in future hosts, this patch fixes the 
> > > > problem.
> > > >
> > > > What Christoph means is that this looks like a bug somewhere in SCSI
> > itself.
> > > > That means we need to find it and kill it, not add workarounds to
> > > > every driver that sets no_write_same ...
> > >
> > > James,
> > >
> > > I will try to isolate this issue in the SCSI stack. If it is ok with
> > > you guys, I would still want to filter WRITE_SAME_16 (as we currently
> > > do WRITE_SAME) in our driver since this would address the problem for a
> > large number of customers on our platform.
> > 
> > If we fix it at source, why would there be any need to filter?  That's the
> > reason the no_write_same flag was introduced.  If we can find and fix the
> > bug, it can go back into the stable trees as a bug fix, hence nothing should
> > ever emit write_same(10 or 16) and additional driver code is redundant (and
> > counter productive, since if this ever breaks again you're our best canary).
> > 
> > This looks like it might be the problem but Martin should confirm (I think 
> > the
> > problem comes to us from the RC16 code which unconditionally sets WS16).
> > 
> > James
> 
> James,
> 
> This patch works for me; are you planning on committing this patch.

OK, if we go with this we can add your tested by.

It's not going in until Martin takes a look because there may be a
better way of doing this.

James

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


Re: [PATCH v4 4/4] staging: rtl8192u: Fixed too long line

2014-07-10 Thread Greg KH
On Thu, Jul 10, 2014 at 05:54:57PM +0530, sanjeev sharma wrote:
> From: sanjeev sharma 
> 
> This patch will fix too long lines warning
> reported by checkpatch.pl.
> 
> Signed-off-by: Sanjeev Sharma 
> ---
>  drivers/staging/rtl8192u/r819xU_phy.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r819xU_phy.c 
> b/drivers/staging/rtl8192u/r819xU_phy.c
> index 3155616..b2d81e9 100644
> --- a/drivers/staging/rtl8192u/r819xU_phy.c
> +++ b/drivers/staging/rtl8192u/r819xU_phy.c
> @@ -1236,7 +1236,8 @@ static u8 rtl8192_phy_SetSwChnlCmdArray(SwChnlCmd 
> *CmdTable, u32 CmdTableIdx,
>   return false;
>   }
>   if (CmdTableIdx >= CmdTableSz) {
> - RT_TRACE(COMP_ERR, "%s(): Access invalid index, please check 
> size of the table, CmdTableIdx:%d, CmdTableSz:%d\n",
> + RT_TRACE(COMP_ERR,
> +  "%s():invalid index,CmdTableIdx:%d, CmdTableSz:%d\n",

Why did you change the string?  That's not ok, you can ignore this
warning, it's a string that you can not break up, or change.

thanks,

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


Re: [PATCH v4 2/4] staging: rtl8192u: Removed unnecessary whitespace & tab warning

2014-07-10 Thread Greg KH
On Thu, Jul 10, 2014 at 05:54:55PM +0530, sanjeev sharma wrote:
> From: sanjeev sharma 
> 
> This patch will remove whitespace and tabs reported by
> checkpatch.pl script.
> 
> Signed-off-by: Sanjeev Sharma 
> ---
>  drivers/staging/rtl8192u/r819xU_phy.c | 23 ---
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r819xU_phy.c 
> b/drivers/staging/rtl8192u/r819xU_phy.c
> index 0bcdd4e..0fcb673 100644
> --- a/drivers/staging/rtl8192u/r819xU_phy.c
> +++ b/drivers/staging/rtl8192u/r819xU_phy.c
> @@ -106,10 +106,10 @@ void rtl8192_setBBreg(struct net_device *dev, u32 
> reg_addr, u32 bitmask,
>  
> /**
>   * function:  This function reads specific bits from BB register
>   * input: net_device *dev
> - *u32reg_addr   //target addr to be readback
> - *u32bitmask//taget bit pos to be readback
> - * output:none
> - * return:u32data   //the readback register value
> + * u32   reg_addr   //target addr to be readback
> + * u32   bitmask//taget bit pos to be readback
> + * output:   none
> + * return:   u32 data   //the readback register value
>   * notice:
>   
> **/
>  u32 rtl8192_QueryBBReg(struct net_device *dev, u32 reg_addr, u32 bitmask)

That doesn't look like you cleaned it up well, it now looks worse.
Please keep the proper indentation of the variables.  It's not the
"proper" kernel coding style, but don't make code worse, like you did
here :(

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


RE: [PATCH V2 2/8] Drivers: scsi: storvsc: Set cmd_per_lun to reflect value supported by the Host

2014-07-10 Thread KY Srinivasan


> -Original Message-
> From: Christoph Hellwig [mailto:h...@infradead.org]
> Sent: Thursday, July 10, 2014 3:25 AM
> To: KY Srinivasan
> Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org;
> oher...@suse.com; jbottom...@parallels.com; h...@infradead.org;
> jasow...@redhat.com; a...@canonical.com; linux-s...@vger.kernel.org;
> sta...@vger.kernel.org
> Subject: Re: [PATCH V2 2/8] Drivers: scsi: storvsc: Set cmd_per_lun to reflect
> value supported by the Host
> 
> > -   .cmd_per_lun =  1,
> > +   .cmd_per_lun =  255,
> > .can_queue =
>   STORVSC_MAX_IO_REQUESTS*STORVSC_MAX_TARGETS,
> 
> slave_configure immediately adjusts this down to
> STORVSC_MAX_IO_REQUESTS (250), any reson to start out with the magic
> 255 here?

The number 255 (set for cmd_per_lun) is what the host can support (I recently 
discovered this in an MSDN document). STORVSC_MAX_IO_REQUESTS is an 
implementation limitation in this driver.

Regards,

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


Re: [PATCH v2 59/60] staging: ced1401: ced_ioc.c fix checkpatch warnings

2014-07-10 Thread Greg KH
On Thu, Jul 10, 2014 at 11:04:15AM +0200, Luca Ellero wrote:
> Signed-off-by: Luca Ellero 
> ---
>  drivers/staging/ced1401/ced_ioc.c |  212 
> +++--
>  1 file changed, 131 insertions(+), 81 deletions(-)

That's a lot of changes all in one patch.  Please take these last 4
patches and rework them to be more specific, and to only do one thing
per patch (logical thing, like fixing comments in a file, etc.)  I've
applied all of the other ones in the series, so this should give you an
easier base to work off of.

thanks,

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


Re: [PATCH v2 58/60] staging: ced1401: usb1401.h fix checkpatch errors

2014-07-10 Thread Greg KH
On Thu, Jul 10, 2014 at 11:04:14AM +0200, Luca Ellero wrote:
> Signed-off-by: Luca Ellero 

Again, which one?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 57/60] staging: ced1401: usb1401.c fix checkpatch errors

2014-07-10 Thread Greg KH
On Thu, Jul 10, 2014 at 11:04:13AM +0200, Luca Ellero wrote:
> Signed-off-by: Luca Ellero 

Which checkpatch warnings?

Please be specific.

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


Re: [PATCH] staging: unisys: added virtpci info entry

2014-07-10 Thread Greg KH
On Thu, Jul 10, 2014 at 02:45:12PM -0400, Erik Arfvidson wrote:
> This patch adds the virtpci debugfs directory and the info entry
> inside of it.
> 
> Signed-off-by: Erik Arfvidson 
> ---
>  drivers/staging/unisys/virtpci/virtpci.c | 123 
> ++-
>  1 file changed, 119 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/unisys/virtpci/virtpci.c 
> b/drivers/staging/unisys/virtpci/virtpci.c
> index 7d840b0..722bc1b 100644
> --- a/drivers/staging/unisys/virtpci/virtpci.c
> +++ b/drivers/staging/unisys/virtpci/virtpci.c
> @@ -36,6 +36,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include "version.h"
>  #include "guestlinuxdebug.h"
>  #include "timskmodutils.h"
> @@ -100,6 +101,12 @@ static int virtpci_device_resume(struct device *dev);
>  static int virtpci_device_probe(struct device *dev);
>  static int virtpci_device_remove(struct device *dev);
>  
> +static ssize_t info_debugfs_read(struct file *file, char __user *buf,
> +   size_t len, loff_t *offset);
> +
> +static const struct file_operations debugfs_info_fops = {
> + .read = info_debugfs_read,
> +};
>  
>  /*/
>  /* Globals   */
> @@ -139,7 +146,19 @@ static DEFINE_RWLOCK(VpcidevListLock);
>  
>  /* filled in with info about this driver, wrt it servicing client busses */
>  static ULTRA_VBUS_DEVICEINFO Bus_DriverInfo;
> -
> +/*/
> +/* DebugFS entries   */
> +/*/
> +/* dentry is used to create the debugfs entry directory
> + * for virtpci
> + */
> +static struct dentry *virtpci_debugfs_dir;
> +static struct dentry *info_debugfs_entry;
> +/* info_debugfs_entry is used to tell virtpci to display current info
> + * kept in the driver
> + */
> +#define DIR_DEBUGFS_ENTRY "virtpci"
> +#define INFO_DEBUGFS_ENTRY_FN "info"
>  
>  struct virtpci_busdev {
>   struct device virtpci_bus_device;
> @@ -588,7 +607,8 @@ static void delete_all(void)
>  /* deletes all vnics or vhbas
>   * returns 0 failure, 1 success,
>   */
> -static int delete_all_virt(VIRTPCI_DEV_TYPE devtype, struct 
> del_vbus_guestpart *delparams)
> +static int delete_all_virt(VIRTPCI_DEV_TYPE devtype,
> + struct del_vbus_guestpart *delparams)
>  {
>   int i;
>   unsigned char busid[BUS_ID_SIZE];
> @@ -1375,6 +1395,97 @@ void virtpci_unregister_driver(struct virtpci_driver 
> *drv)
>   DBGINF("Leaving\n");
>  }
>  EXPORT_SYMBOL_GPL(virtpci_unregister_driver);
> +/*/
> +/* debugfs filesystem functions  
> */
> +/*/
> +struct print_vbus_info {
> + int *length;
> + char *buf;
> +};
> +
> +static int print_vbus(struct device *vbus, void *data)
> +{
> + struct print_vbus_info *p = (struct print_vbus_info *)data;
> +
> + *p->length += sprintf(p->buf + *p->length, "bus_id:%s\n",
> +   dev_name(vbus));
> + return 0;   /* no error */

Of course 0 is "no error", that's by definition how Linux kernel
functions work.  No need to add that comment, especially to the right of
the line (which is not kernel coding style at all.)

> +}
> +
> +static ssize_t info_debugfs_read(struct file *file, char __user *buf,
> +   size_t len, loff_t *offset)
> +{
> + int str_pos = 0;
> + struct virtpci_dev *tmpvpcidev;
> + unsigned long flags;
> + struct print_vbus_info printparam;
> + char *vbuf;
> + loff_t pos = *offset;
> +
> + if (pos < 0)
> + return -EINVAL;
> +
> + if (pos > 0 || !len)
> + return 0;

So no moving about the file?  Why not?  Why not just use
simple_read_from_buffer() with the string you generate here?  That
handles all the nasty offset mess for you automatically.

> +
> + vbuf = kzalloc(len, GFP_KERNEL);
> + if (!vbuf)
> + return -ENOMEM;
> +
> +

2 blank lines?

Yes, I'm being picky, but this is new code.

> + str_pos += snprintf(vbuf + str_pos, len - str_pos,
> + "\n Virtual PCI Bus devices\n");

You start the buffer with an empty line?

> + printparam.length = &str_pos;
> + printparam.buf = vbuf;
> + if (bus_for_each_dev(&virtpci_bus_type, NULL,
> +  (void *) &printparam, print_vbus))
> + LOGERR("Failed to find bus\n");
> +
> + str_pos += snprintf(vbuf + str_pos, len - str_pos,
> + "\n Virtual PCI devices\n");
> + read_lock_irqsave(&VpcidevListLock, flags);
> + tmpvpcidev = VpcidevListHead;
> + while (tmpvpcidev) {
> + if (tmpvpcidev->devtype == VIRTHBA_TYPE) {
> + str_pos += snprintf(vbuf + str_pos, len - str_pos,
> + 

Re: [PATCH] staging: unisys: added virtpci info entry

2014-07-10 Thread Dan Carpenter
On Thu, Jul 10, 2014 at 02:45:12PM -0400, Erik Arfvidson wrote:
> + str_pos += snprintf(vbuf + str_pos, len - str_pos, "\n");
> + if (copy_to_user(buf, vbuf, str_pos)) {

The length checking here still isn't correct.  snprintf() returns the
number of bytes which would have been printed if there were space
available, so "str_pos" could be larger than "len".  So we have fixed
the problem of corruption kernel memory but it still corrupts user
memory.

I think it all works correctly if you use scnprintf() instead of
snprintf() but think it through because I'm not positive.

> + kfree(vbuf);
> + return -EFAULT;
> + }
> +

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


RE: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16

2014-07-10 Thread KY Srinivasan


> -Original Message-
> From: James Bottomley [mailto:jbottom...@parallels.com]
> Sent: Wednesday, July 9, 2014 3:27 PM
> To: KY Srinivasan
> Cc: linux-ker...@vger.kernel.org; m...@mkp.net; h...@infradead.org;
> de...@linuxdriverproject.org; a...@canonical.com; sta...@vger.kernel.org;
> linux-s...@vger.kernel.org; oher...@suse.com; jasow...@redhat.com
> Subject: Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16
> 
> On Wed, 2014-07-09 at 21:14 +, KY Srinivasan wrote:
> >
> > > -Original Message-
> > > From: James Bottomley [mailto:jbottom...@parallels.com]
> > > Sent: Wednesday, July 9, 2014 12:57 PM
> > > To: KY Srinivasan
> > > Cc: linux-ker...@vger.kernel.org; h...@infradead.org;
> > > de...@linuxdriverproject.org; a...@canonical.com;
> > > sta...@vger.kernel.org; linux-s...@vger.kernel.org;
> > > oher...@suse.com; jasow...@redhat.com
> > > Subject: Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter
> > > WRITE_SAME_16
> > >
> > > On Wed, 2014-07-09 at 19:52 +, KY Srinivasan wrote:
> > > >
> > > > > -Original Message-
> > > > > From: Christoph Hellwig [mailto:h...@infradead.org]
> > > > > Sent: Wednesday, July 9, 2014 1:43 AM
> > > > > To: KY Srinivasan
> > > > > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org;
> > > > > oher...@suse.com; jbottom...@parallels.com;
> jasow...@redhat.com;
> > > > > a...@canonical.com; linux-s...@vger.kernel.org;
> > > > > sta...@vger.kernel.org
> > > > > Subject: Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter
> > > > > WRITE_SAME_16
> > > > >
> > > > > On Tue, Jul 08, 2014 at 05:46:48PM -0700, K. Y. Srinivasan wrote:
> > > > > > Host does not handle WRITE_SAME_16; filter this command out.
> > > > > > This patch is required to handle large devices (greater than 2 TB
> disks).
> > > > >
> > > > > Storvsc already sets the no_write_same flag, where is the
> > > > > command coming from?
> > > >
> > > > In spite of this flag,  I see WRITE_SAME_16 being issued when I
> > > > format a device bigger than 2 TB; I tried both xfs and ext4.
> > > > Windows hosts currently do not handle unsupported commands
> > > > correctly - The information returned is not sufficient to effect 
> > > > recovery
> in the Linux guest.
> > > While this may be addressed in future hosts, this patch fixes the problem.
> > >
> > > What Christoph means is that this looks like a bug somewhere in SCSI
> itself.
> > > That means we need to find it and kill it, not add workarounds to
> > > every driver that sets no_write_same ...
> >
> > James,
> >
> > I will try to isolate this issue in the SCSI stack. If it is ok with
> > you guys, I would still want to filter WRITE_SAME_16 (as we currently
> > do WRITE_SAME) in our driver since this would address the problem for a
> large number of customers on our platform.
> 
> If we fix it at source, why would there be any need to filter?  That's the
> reason the no_write_same flag was introduced.  If we can find and fix the
> bug, it can go back into the stable trees as a bug fix, hence nothing should
> ever emit write_same(10 or 16) and additional driver code is redundant (and
> counter productive, since if this ever breaks again you're our best canary).
> 
> This looks like it might be the problem but Martin should confirm (I think the
> problem comes to us from the RC16 code which unconditionally sets WS16).
> 
> James

James,

This patch works for me; are you planning on committing this patch.

Regards,

K. Y
> 
> ---
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 6825eda..8353a4c
> 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -634,6 +634,23 @@ static void sd_config_discard(struct scsi_disk *sdkp,
> unsigned int mode)
>   max(sdkp->physical_block_size,
>   sdkp->unmap_granularity * logical_block_size);
> 
> + if (sdkp->device->host->no_write_same) {
> + switch(mode) {
> +
> + case SD_LBP_WS16:
> + case SD_LBP_WS10:
> + case SD_LBP_ZERO:
> + /*
> +  * filter out all the WRITE SAME modes and map them
> +  * directly to UNMAP
> +  */
> + mode = SD_LBP_UNMAP;
> + /* fall through */
> + default:
> + /* everything else is OK */
> + break;
> + }
> + }
>   sdkp->provisioning_mode = mode;
> 
>   switch (mode) {

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


Re: [PATCH] staging: r8821ae: avoid leaking format string

2014-07-10 Thread Greg Kroah-Hartman
On Thu, Jul 10, 2014 at 01:16:11PM -0700, Kees Cook wrote:
> This make sure a format string cannot leak into the work queue name nor
> the printk buffer.
> 
> Signed-off-by: Kees Cook 
> ---
> This is the third time this set of macros has entered the kernel:
> 
> drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.h
> drivers/staging/rtl8192ee/btcoexist/halbtcoutsrc.h
> drivers/staging/rtl8821ae/btcoexist/halbtcoutsrc.h
> 
> Can we extract these macros to some common place and keep them from returning?

I wish.  These are all from the same company.  Each new version of their
hardware consists of a whole dump of a wireless stack.  People are
working on addressing this issue, by writing "real" drivers for the
hardware, and working with the company to not keep doing this.  But odds
are, I'll get a new driver for the next chip from them that does the
same thing :(

thanks for the patch, I'll queue it up.

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


[PATCH] staging: r8821ae: avoid leaking format string

2014-07-10 Thread Kees Cook
This make sure a format string cannot leak into the work queue name nor
the printk buffer.

Signed-off-by: Kees Cook 
---
This is the third time this set of macros has entered the kernel:

drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.h
drivers/staging/rtl8192ee/btcoexist/halbtcoutsrc.h
drivers/staging/rtl8821ae/btcoexist/halbtcoutsrc.h

Can we extract these macros to some common place and keep them from returning?
---
 drivers/staging/rtl8821ae/btcoexist/halbtcoutsrc.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtcoutsrc.h 
b/drivers/staging/rtl8821ae/btcoexist/halbtcoutsrc.h
index 787798e76217..fd233cc85a5b 100644
--- a/drivers/staging/rtl8821ae/btcoexist/halbtcoutsrc.h
+++ b/drivers/staging/rtl8821ae/btcoexist/halbtcoutsrc.h
@@ -88,7 +88,7 @@ extern u32 btc_dbg_type[];
 
 
 #defineCL_SPRINTF  snprintf
-#defineCL_PRINTF   printk
+#defineCL_PRINTF(buf)  printk("%s", buf)
 
 #defineBTC_PRINT(dbgtype, dbgflag, printstr, ...)  \
do {\
-- 
1.7.9.5


-- 
Kees Cook
Chrome OS Security
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: unisys: added virtpci info entry

2014-07-10 Thread Erik Arfvidson
This patch adds the virtpci debugfs directory and the info entry
inside of it.

Signed-off-by: Erik Arfvidson 
---
 drivers/staging/unisys/virtpci/virtpci.c | 123 ++-
 1 file changed, 119 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/virtpci/virtpci.c 
b/drivers/staging/unisys/virtpci/virtpci.c
index 7d840b0..722bc1b 100644
--- a/drivers/staging/unisys/virtpci/virtpci.c
+++ b/drivers/staging/unisys/virtpci/virtpci.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "version.h"
 #include "guestlinuxdebug.h"
 #include "timskmodutils.h"
@@ -100,6 +101,12 @@ static int virtpci_device_resume(struct device *dev);
 static int virtpci_device_probe(struct device *dev);
 static int virtpci_device_remove(struct device *dev);
 
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+ size_t len, loff_t *offset);
+
+static const struct file_operations debugfs_info_fops = {
+   .read = info_debugfs_read,
+};
 
 /*/
 /* Globals   */
@@ -139,7 +146,19 @@ static DEFINE_RWLOCK(VpcidevListLock);
 
 /* filled in with info about this driver, wrt it servicing client busses */
 static ULTRA_VBUS_DEVICEINFO Bus_DriverInfo;
-
+/*/
+/* DebugFS entries   */
+/*/
+/* dentry is used to create the debugfs entry directory
+ * for virtpci
+ */
+static struct dentry *virtpci_debugfs_dir;
+static struct dentry *info_debugfs_entry;
+/* info_debugfs_entry is used to tell virtpci to display current info
+ * kept in the driver
+ */
+#define DIR_DEBUGFS_ENTRY "virtpci"
+#define INFO_DEBUGFS_ENTRY_FN "info"
 
 struct virtpci_busdev {
struct device virtpci_bus_device;
@@ -588,7 +607,8 @@ static void delete_all(void)
 /* deletes all vnics or vhbas
  * returns 0 failure, 1 success,
  */
-static int delete_all_virt(VIRTPCI_DEV_TYPE devtype, struct del_vbus_guestpart 
*delparams)
+static int delete_all_virt(VIRTPCI_DEV_TYPE devtype,
+   struct del_vbus_guestpart *delparams)
 {
int i;
unsigned char busid[BUS_ID_SIZE];
@@ -1375,6 +1395,97 @@ void virtpci_unregister_driver(struct virtpci_driver 
*drv)
DBGINF("Leaving\n");
 }
 EXPORT_SYMBOL_GPL(virtpci_unregister_driver);
+/*/
+/* debugfs filesystem functions
*/
+/*/
+struct print_vbus_info {
+   int *length;
+   char *buf;
+};
+
+static int print_vbus(struct device *vbus, void *data)
+{
+   struct print_vbus_info *p = (struct print_vbus_info *)data;
+
+   *p->length += sprintf(p->buf + *p->length, "bus_id:%s\n",
+ dev_name(vbus));
+   return 0;   /* no error */
+}
+
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+ size_t len, loff_t *offset)
+{
+   int str_pos = 0;
+   struct virtpci_dev *tmpvpcidev;
+   unsigned long flags;
+   struct print_vbus_info printparam;
+   char *vbuf;
+   loff_t pos = *offset;
+
+   if (pos < 0)
+   return -EINVAL;
+
+   if (pos > 0 || !len)
+   return 0;
+
+   vbuf = kzalloc(len, GFP_KERNEL);
+   if (!vbuf)
+   return -ENOMEM;
+
+
+   str_pos += snprintf(vbuf + str_pos, len - str_pos,
+   "\n Virtual PCI Bus devices\n");
+   printparam.length = &str_pos;
+   printparam.buf = vbuf;
+   if (bus_for_each_dev(&virtpci_bus_type, NULL,
+(void *) &printparam, print_vbus))
+   LOGERR("Failed to find bus\n");
+
+   str_pos += snprintf(vbuf + str_pos, len - str_pos,
+   "\n Virtual PCI devices\n");
+   read_lock_irqsave(&VpcidevListLock, flags);
+   tmpvpcidev = VpcidevListHead;
+   while (tmpvpcidev) {
+   if (tmpvpcidev->devtype == VIRTHBA_TYPE) {
+   str_pos += snprintf(vbuf + str_pos, len - str_pos,
+   "[%d:%d] VHba:%08x:%08x 
max-config:%d-%d-%d-%d",
+   tmpvpcidev->busNo, tmpvpcidev->deviceNo,
+   tmpvpcidev->scsi.wwnn.wwnn1,
+   tmpvpcidev->scsi.wwnn.wwnn2,
+   tmpvpcidev->scsi.max.max_channel,
+   tmpvpcidev->scsi.max.max_id,
+   tmpvpcidev->scsi.max.max_lun,
+   tmpvpcidev->scsi.max.cmd_per_lun);
+   } else {
+   str_pos += snprintf(vbuf + str_pos, len - str_pos,
+   "[%d:%d] 
VNic:%02x:

Re: Anybody working on tidspbridge?

2014-07-10 Thread Greg KH
On Thu, Jul 10, 2014 at 08:54:18AM +0300, Ivaylo Dimitrov wrote:
> 
> 
> On  9.07.2014 10:07, Tony Lindgren wrote:
> >* Suman Anna  [140708 11:40]:
> >>Hi Peter,
> >>
> >>On 07/08/2014 09:36 AM, Greg KH wrote:
> >>>On Tue, Jul 08, 2014 at 03:03:58PM +0200, Peter Meerwald wrote:
> Hello,
> 
> >>Given the total lack of response here, I suggest just deleting the
> >>driver.  No one has ever done the "real work" that is going to be
> >>required to get this code out of staging.  It has had build errors
> >>causing it to not even be usable for some kernel versions with no one
> >>noticing, so I doubt anyone cares about it anymore here.
> >
> >Cc'ing some more people who might be interested. If no one offers to
> >work on the driver in the next couple of days, I'll send a patch to
> >remove it.
> 
> I'm using the driver (with kernel 3.7) and it works reasonably well for
> me; removing it seems a bit harsh.
> >>>
> >>>Using it is different from being able to maintain the code and move it
> >>>out of the staging tree.  Also, 3.7 is really old and obsolete, not much
> >>>we can do with that kernel version :)
> >>>
> >>>Are you able to work on the code and do the effort needed to get it out
> >>>of the staging tree?  If so, great, if not, we are going to have to
> >>>delete it, sorry.
> >>
> >>I agree with Greg here. In fact, the current TODO does not do enough
> >>justice to the amount of work required to make it even work on the
> >>latest kernel. Most of the TIers who worked on this driver have moved on
> >>as Kristina would have figured with her bounced emails. So I do suggest
> >>that this driver be deleted from the kernel tree. If there are enough
> >>number of folks using it (not sure how many are out there), it can be
> >>worked on out-of-tree and brought back in a cleaner fashion rather than
> >>keeping a broken stale driver in the kernel.
> >
> >I agree, not much has improved with this driver since it got added into
> >staging except just compile fixes.
> >
> >Regards,
> >
> >Tony
> 
> Well, recently I've sent a couple of patches which implement stuff from TODO
> [1]. However, with the migration to DT, my focus now is to have a
> kernel/userspace that boots at all and this leaves no free cycles for DSP.
> Maybe tidspbridge can be left in staging until DT migration is finished,
> that way me (and maybe other people) will have the time needed to try to
> implement what remains in TODO. Also, keep in mind there will (hopefully) be
> another omap3 end-user device released by the end of the year (Neo900),
> which most probably will gain more developers interested in fixing the DSP
> driver.

I'm really tired of people saying, "maybe sometime in the future we will
work on this" for this driver.  It's not the first time I've heard it,
and it has _never_ come true.  Honestly, I really don't believe it will
ever happen, given that TI doesn't care about this code at all.

If in the future, someone does want to work on this, a simple revert of
the patch that removes the driver will be all that is needed.  Let's do
that instead of hoping that sometime, someone, somewhere, will do this
work.

thanks,

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


Re: Anybody working on tidspbridge?

2014-07-10 Thread Jason Kridner
On Thu, Jul 10, 2014 at 12:11 PM, Greg KH  wrote:
>
> On Thu, Jul 10, 2014 at 08:54:18AM +0300, Ivaylo Dimitrov wrote:
> >
> >
> > On  9.07.2014 10:07, Tony Lindgren wrote:
> > >* Suman Anna  [140708 11:40]:
> > >>Hi Peter,
> > >>
> > >>On 07/08/2014 09:36 AM, Greg KH wrote:
> > >>>On Tue, Jul 08, 2014 at 03:03:58PM +0200, Peter Meerwald wrote:
> > Hello,
> > 
> > >>Given the total lack of response here, I suggest just deleting the
> > >>driver.  No one has ever done the "real work" that is going to be
> > >>required to get this code out of staging.  It has had build errors
> > >>causing it to not even be usable for some kernel versions with no one
> > >>noticing, so I doubt anyone cares about it anymore here.
> > >
> > >Cc'ing some more people who might be interested. If no one offers to
> > >work on the driver in the next couple of days, I'll send a patch to
> > >remove it.
> > 
> > I'm using the driver (with kernel 3.7) and it works reasonably well for
> > me; removing it seems a bit harsh.
> > >>>
> > >>>Using it is different from being able to maintain the code and move it
> > >>>out of the staging tree.  Also, 3.7 is really old and obsolete, not much
> > >>>we can do with that kernel version :)
> > >>>
> > >>>Are you able to work on the code and do the effort needed to get it out
> > >>>of the staging tree?  If so, great, if not, we are going to have to
> > >>>delete it, sorry.
> > >>
> > >>I agree with Greg here. In fact, the current TODO does not do enough
> > >>justice to the amount of work required to make it even work on the
> > >>latest kernel. Most of the TIers who worked on this driver have moved on
> > >>as Kristina would have figured with her bounced emails. So I do suggest
> > >>that this driver be deleted from the kernel tree. If there are enough
> > >>number of folks using it (not sure how many are out there), it can be
> > >>worked on out-of-tree and brought back in a cleaner fashion rather than
> > >>keeping a broken stale driver in the kernel.
> > >
> > >I agree, not much has improved with this driver since it got added into
> > >staging except just compile fixes.
> > >
> > >Regards,
> > >
> > >Tony
> >
> > Well, recently I've sent a couple of patches which implement stuff from TODO
> > [1]. However, with the migration to DT, my focus now is to have a
> > kernel/userspace that boots at all and this leaves no free cycles for DSP.
> > Maybe tidspbridge can be left in staging until DT migration is finished,
> > that way me (and maybe other people) will have the time needed to try to
> > implement what remains in TODO. Also, keep in mind there will (hopefully) be
> > another omap3 end-user device released by the end of the year (Neo900),
> > which most probably will gain more developers interested in fixing the DSP
> > driver.
>
> I'm really tired of people saying, "maybe sometime in the future we will
> work on this" for this driver.  It's not the first time I've heard it,
> and it has _never_ come true.  Honestly, I really don't believe it will
> ever happen, given that TI doesn't care about this code at all.
>
> If in the future, someone does want to work on this, a simple revert of
> the patch that removes the driver will be all that is needed.  Let's do
> that instead of hoping that sometime, someone, somewhere, will do this
> work.

Makes sense to me. FYI, it will come back again on newer TI ARM+DSP
devices. Those aren't going away, but I'm also not aware of anyone
imminently pushing patches.

>
> thanks,
>
> greg k-h
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] staging: unisys: added virtpci info entry

2014-07-10 Thread Greg KH
On Thu, Jul 10, 2014 at 10:34:14AM -0400, Erik Arfvidson wrote:
> This patch adds the virtpci debugfs directory and the info entry
> inside of it.
> 
> Signed-off-by: Erik Arfvidson 
> Signed-off-by: Benjamin Romer 

2/2?  Where is patch 1/2?

Please resend this correctly, and properly version your patches (this is
what, version 10 or something?).

Your subsystem maintainer has a short-term memory of a gnat, you need to
be explicit otherwise I'll ignore it...

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


[PATCH 2/2] staging: unisys: added virtpci info entry

2014-07-10 Thread Erik Arfvidson
This patch adds the virtpci debugfs directory and the info entry
inside of it.

Signed-off-by: Erik Arfvidson 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virtpci/virtpci.c | 123 ++-
 1 file changed, 119 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/virtpci/virtpci.c 
b/drivers/staging/unisys/virtpci/virtpci.c
index 7d840b0..722bc1b 100644
--- a/drivers/staging/unisys/virtpci/virtpci.c
+++ b/drivers/staging/unisys/virtpci/virtpci.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "version.h"
 #include "guestlinuxdebug.h"
 #include "timskmodutils.h"
@@ -100,6 +101,12 @@ static int virtpci_device_resume(struct device *dev);
 static int virtpci_device_probe(struct device *dev);
 static int virtpci_device_remove(struct device *dev);
 
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+ size_t len, loff_t *offset);
+
+static const struct file_operations debugfs_info_fops = {
+   .read = info_debugfs_read,
+};
 
 /*/
 /* Globals   */
@@ -139,7 +146,19 @@ static DEFINE_RWLOCK(VpcidevListLock);
 
 /* filled in with info about this driver, wrt it servicing client busses */
 static ULTRA_VBUS_DEVICEINFO Bus_DriverInfo;
-
+/*/
+/* DebugFS entries   */
+/*/
+/* dentry is used to create the debugfs entry directory
+ * for virtpci
+ */
+static struct dentry *virtpci_debugfs_dir;
+static struct dentry *info_debugfs_entry;
+/* info_debugfs_entry is used to tell virtpci to display current info
+ * kept in the driver
+ */
+#define DIR_DEBUGFS_ENTRY "virtpci"
+#define INFO_DEBUGFS_ENTRY_FN "info"
 
 struct virtpci_busdev {
struct device virtpci_bus_device;
@@ -588,7 +607,8 @@ static void delete_all(void)
 /* deletes all vnics or vhbas
  * returns 0 failure, 1 success,
  */
-static int delete_all_virt(VIRTPCI_DEV_TYPE devtype, struct del_vbus_guestpart 
*delparams)
+static int delete_all_virt(VIRTPCI_DEV_TYPE devtype,
+   struct del_vbus_guestpart *delparams)
 {
int i;
unsigned char busid[BUS_ID_SIZE];
@@ -1375,6 +1395,97 @@ void virtpci_unregister_driver(struct virtpci_driver 
*drv)
DBGINF("Leaving\n");
 }
 EXPORT_SYMBOL_GPL(virtpci_unregister_driver);
+/*/
+/* debugfs filesystem functions
*/
+/*/
+struct print_vbus_info {
+   int *length;
+   char *buf;
+};
+
+static int print_vbus(struct device *vbus, void *data)
+{
+   struct print_vbus_info *p = (struct print_vbus_info *)data;
+
+   *p->length += sprintf(p->buf + *p->length, "bus_id:%s\n",
+ dev_name(vbus));
+   return 0;   /* no error */
+}
+
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+ size_t len, loff_t *offset)
+{
+   int str_pos = 0;
+   struct virtpci_dev *tmpvpcidev;
+   unsigned long flags;
+   struct print_vbus_info printparam;
+   char *vbuf;
+   loff_t pos = *offset;
+
+   if (pos < 0)
+   return -EINVAL;
+
+   if (pos > 0 || !len)
+   return 0;
+
+   vbuf = kzalloc(len, GFP_KERNEL);
+   if (!vbuf)
+   return -ENOMEM;
+
+
+   str_pos += snprintf(vbuf + str_pos, len - str_pos,
+   "\n Virtual PCI Bus devices\n");
+   printparam.length = &str_pos;
+   printparam.buf = vbuf;
+   if (bus_for_each_dev(&virtpci_bus_type, NULL,
+(void *) &printparam, print_vbus))
+   LOGERR("Failed to find bus\n");
+
+   str_pos += snprintf(vbuf + str_pos, len - str_pos,
+   "\n Virtual PCI devices\n");
+   read_lock_irqsave(&VpcidevListLock, flags);
+   tmpvpcidev = VpcidevListHead;
+   while (tmpvpcidev) {
+   if (tmpvpcidev->devtype == VIRTHBA_TYPE) {
+   str_pos += snprintf(vbuf + str_pos, len - str_pos,
+   "[%d:%d] VHba:%08x:%08x 
max-config:%d-%d-%d-%d",
+   tmpvpcidev->busNo, tmpvpcidev->deviceNo,
+   tmpvpcidev->scsi.wwnn.wwnn1,
+   tmpvpcidev->scsi.wwnn.wwnn2,
+   tmpvpcidev->scsi.max.max_channel,
+   tmpvpcidev->scsi.max.max_id,
+   tmpvpcidev->scsi.max.max_lun,
+   tmpvpcidev->scsi.max.cmd_per_lun);
+   } else {
+   str_pos += snprintf(vbuf + str_pos, len - str_pos,
+

RE: [PATCH v3 1/4] staging: rtl8192u: Remove useless return statements.

2014-07-10 Thread Sharma, Sanjeev
Thanks Greg for review.

Change has been just pushed now with version 4.

Regards
Sanjeev Sharma

-Original Message-
From: Greg KH [mailto:gre...@linuxfoundation.org] 
Sent: Thursday, July 10, 2014 12:55 AM
To: sanjeev sharma
Cc: de...@driverdev.osuosl.org; peter.se...@gmail.com; 
linux-ker...@vger.kernel.org; rmf...@gmail.com; teobal...@gmail.com; Sharma, 
Sanjeev
Subject: Re: [PATCH v3 1/4] staging: rtl8192u: Remove useless return statements.

On Wed, Jul 09, 2014 at 05:49:39PM +0530, sanjeev sharma wrote:
> From: sanjeev sharma 

No "S" characters?

And your 0/4 Subject: was really odd, please fix up and resend all of these.

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


RE: [PATCH v3 4/4] staging: rtl8192u: Fixed too long lines

2014-07-10 Thread Sharma, Sanjeev
Hi Joe,

I have incorporated your review comment  in version v4.

Regards
Sanjeev Sharma 

-Original Message-
From: Joe Perches [mailto:j...@perches.com] 
Sent: Wednesday, July 09, 2014 6:27 PM
To: sanjeev sharma
Cc: gre...@linuxfoundation.org; rmf...@gmail.com; peter.se...@gmail.com; 
teobal...@gmail.com; de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org; 
Sharma, Sanjeev
Subject: Re: [PATCH v3 4/4] staging: rtl8192u: Fixed too long lines

On Wed, 2014-07-09 at 17:49 +0530, sanjeev sharma wrote:
> This patch will fix too long lines warning reported by checkpatch.pl.

Hi Sanjeev.

> diff --git a/drivers/staging/rtl8192u/r819xU_phy.c 
> b/drivers/staging/rtl8192u/r819xU_phy.c
[]
> @@ -1786,7 +1788,9 @@ void InitialGainOperateWorkItemCallBack(struct 
> work_struct *work)
>   RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xa0a is %x\n",
>priv->initgain_backup.cca);
>  
> - rtl8192_phy_setTxPower(dev, 
> priv->ieee80211->current_network.channel);
> + rtl8192_phy_setTxPower(dev,
> + priv->ieee80211->current_network.channel
> +);

This one is a little off

+   rtl8192_phy_setTxPower(dev,
+   priv->ieee80211->current_network.channel
+  );

Please align multiline statements to the appropriate open parenthesis using a 
mix of initial leading tabs followed by the minimal number of spaces required 
to put the first non-whitespace char at the column immediately after the 
preceding open paren.

Here it's 4 tabs, 7 spaces, not 5 tabs:

+   rtl8192_phy_setTxPower(dev,
+  
priv->ieee80211->current_network.channel);

And please don't use a line that's just a close parenthesis and semicolon.

I think it's better to ignore the 80 column limit for these and place them at 
the end of the preceding line.


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


[PATCH v4 2/4] staging: rtl8192u: Removed unnecessary whitespace & tab warning

2014-07-10 Thread sanjeev sharma
From: sanjeev sharma 

This patch will remove whitespace and tabs reported by
checkpatch.pl script.

Signed-off-by: Sanjeev Sharma 
---
 drivers/staging/rtl8192u/r819xU_phy.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/r819xU_phy.c 
b/drivers/staging/rtl8192u/r819xU_phy.c
index 0bcdd4e..0fcb673 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.c
+++ b/drivers/staging/rtl8192u/r819xU_phy.c
@@ -106,10 +106,10 @@ void rtl8192_setBBreg(struct net_device *dev, u32 
reg_addr, u32 bitmask,
 /**
  * function:  This function reads specific bits from BB register
  * input: net_device   *dev
- *u32  reg_addr   //target addr to be readback
- *u32  bitmask//taget bit pos to be readback
- * output:none
- * return:u32  data   //the readback register value
+ * u32 reg_addr   //target addr to be readback
+ * u32 bitmask//taget bit pos to be readback
+ * output: none
+ * return: u32 data   //the readback register value
  * notice:
  
**/
 u32 rtl8192_QueryBBReg(struct net_device *dev, u32 reg_addr, u32 bitmask)
@@ -478,9 +478,9 @@ static void phy_FwRFSerialWrite(struct net_device *dev,
 /**
  * function:  This function reads BB parameters from header file we generate,
  *and do register read/write
- * input: net_device   *dev
- * output:none
- * return:none
+ * input:  net_device  *dev
+ * output: none
+ * return: none
  * notice:BB parameters may change all the time, so please make
  *sure it has been synced with the newest.
  */
@@ -900,7 +900,7 @@ void rtl8192_phy_getTxPower(struct net_device *dev)
read_nic_byte(dev, rOFDM0_RxDetector3, &priv->framesync);
read_nic_byte(dev, rOFDM0_RxDetector2, &tmp);
priv->framesyncC34 = tmp;
-   RT_TRACE(COMP_INIT, "Default framesync (0x%x) = 0x%x \n",
+   RT_TRACE(COMP_INIT, "Default framesync (0x%x) = 0x%x\n",
rOFDM0_RxDetector3, priv->framesync);
 
/* Read SIFS (save the value read fome MACPHY_REG.txt) */
@@ -1463,6 +1463,7 @@ void rtl8192_SwChnl_WorkItem(struct net_device *dev)
 u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel)
 {
struct r8192_priv *priv = ieee80211_priv(dev);
+
RT_TRACE(COMP_CH, "%s(), SwChnlInProgress: %d\n", __func__,
 priv->SwChnlInProgress);
if (!priv->up)
@@ -1745,13 +1746,13 @@ void InitialGainOperateWorkItemCallBack(struct 
work_struct *work)
RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xa0a is %x\n",
 priv->initgain_backup.cca);
 
-   RT_TRACE(COMP_SCAN, "Write scan initial gain = 0x%x \n",
+   RT_TRACE(COMP_SCAN, "Write scan initial gain = 0x%x\n",
 initial_gain);
write_nic_byte(dev, rOFDM0_XAAGCCore1, initial_gain);
write_nic_byte(dev, rOFDM0_XBAGCCore1, initial_gain);
write_nic_byte(dev, rOFDM0_XCAGCCore1, initial_gain);
write_nic_byte(dev, rOFDM0_XDAGCCore1, initial_gain);
-   RT_TRACE(COMP_SCAN, "Write scan 0xa0a = 0x%x \n",
+   RT_TRACE(COMP_SCAN, "Write scan 0xa0a = 0x%x\n",
 POWER_DETECTION_TH);
write_nic_byte(dev, 0xa0a, POWER_DETECTION_TH);
break;
@@ -1792,7 +1793,7 @@ void InitialGainOperateWorkItemCallBack(struct 
work_struct *work)
rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1);
break;
default:
-   RT_TRACE(COMP_SCAN, "Unknown IG Operation. \n");
+   RT_TRACE(COMP_SCAN, "Unknown IG Operation.\n");
break;
}
 }
-- 
1.7.11.7

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


[PATCH v4 4/4] staging: rtl8192u: Fixed too long line

2014-07-10 Thread sanjeev sharma
From: sanjeev sharma 

This patch will fix too long lines warning
reported by checkpatch.pl.

Signed-off-by: Sanjeev Sharma 
---
 drivers/staging/rtl8192u/r819xU_phy.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192u/r819xU_phy.c 
b/drivers/staging/rtl8192u/r819xU_phy.c
index 3155616..b2d81e9 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.c
+++ b/drivers/staging/rtl8192u/r819xU_phy.c
@@ -1236,7 +1236,8 @@ static u8 rtl8192_phy_SetSwChnlCmdArray(SwChnlCmd 
*CmdTable, u32 CmdTableIdx,
return false;
}
if (CmdTableIdx >= CmdTableSz) {
-   RT_TRACE(COMP_ERR, "%s(): Access invalid index, please check 
size of the table, CmdTableIdx:%d, CmdTableSz:%d\n",
+   RT_TRACE(COMP_ERR,
+"%s():invalid index,CmdTableIdx:%d, CmdTableSz:%d\n",
 __func__, CmdTableIdx, CmdTableSz);
return false;
}
@@ -1697,7 +1698,8 @@ void InitialGain819xUsb(struct net_device *dev,   u8 
Operation)
priv->InitialGainOperateType = Operation;
 
if (priv->up)
-   queue_delayed_work(priv->priv_wq, 
&priv->initialgain_operate_wq, 0);
+   queue_delayed_work(priv->priv_wq,
+  &priv->initialgain_operate_wq, 0);
 }
 
 void InitialGainOperateWorkItemCallBack(struct work_struct *work)
@@ -1786,7 +1788,8 @@ void InitialGainOperateWorkItemCallBack(struct 
work_struct *work)
RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xa0a is %x\n",
 priv->initgain_backup.cca);
 
-   rtl8192_phy_setTxPower(dev, 
priv->ieee80211->current_network.channel);
+   rtl8192_phy_setTxPower(dev,
+   
priv->ieee80211->current_network.channel);
 
if (dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM)
/* FW DIG ON */
-- 
1.7.11.7

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


[PATCH v4 1/4] staging: rtl8192u: Remove useless return statement

2014-07-10 Thread sanjeev sharma
From: sanjeev sharma 

This patch will remove unneeded return statements in
code.

Signed-off-by: Sanjeev Sharma 
---
 drivers/staging/rtl8192u/r819xU_phy.c | 13 -
 1 file changed, 13 deletions(-)

diff --git a/drivers/staging/rtl8192u/r819xU_phy.c 
b/drivers/staging/rtl8192u/r819xU_phy.c
index 02554c9..0bcdd4e 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.c
+++ b/drivers/staging/rtl8192u/r819xU_phy.c
@@ -101,7 +101,6 @@ void rtl8192_setBBreg(struct net_device *dev, u32 reg_addr, 
u32 bitmask,
} else {
write_nic_dword(dev, reg_addr, data);
}
-   return;
 }
 
 /**
@@ -281,7 +280,6 @@ static void rtl8192_phy_RFSerialWrite(struct net_device 
*dev,
 priv->RfReg0Value[eRFPath] << 16);
}
}
-   return;
 }
 
 /**
@@ -332,7 +330,6 @@ void rtl8192_phy_SetRFReg(struct net_device *dev, 
RF90_RADIO_PATH_E eRFPath,
rtl8192_phy_RFSerialWrite(dev, eRFPath, reg_addr, data);
}
}
-   return;
 }
 
 /**
@@ -513,7 +510,6 @@ void rtl8192_phy_configmac(struct net_device *dev)
rtl8192_setBBreg(dev, pdwArray[i], pdwArray[i+1],
 pdwArray[i+2]);
}
-   return;
 }
 
 /**
@@ -559,7 +555,6 @@ void rtl8192_phyConfigBB(struct net_device *dev, u8 
ConfigType)
 rtl819XAGCTAB_Array[i+1]);
}
}
-   return;
 }
 
 /**
@@ -846,7 +841,6 @@ static void rtl8192_BB_Config_ParaFile(struct net_device 
*dev)
priv->bCckHighPower = (u8)rtl8192_QueryBBReg(dev,
 rFPGA0_XA_HSSIParameter2,
 0x200);
-   return;
 }
 
 /**
@@ -864,7 +858,6 @@ void rtl8192_BBConfig(struct net_device *dev)
 * implemented, so use file first.
 * FIXME: should implement it for hardcode? */
rtl8192_BB_Config_ParaFile(dev);
-   return;
 }
 
 
@@ -912,8 +905,6 @@ void rtl8192_phy_getTxPower(struct net_device *dev)
 
/* Read SIFS (save the value read fome MACPHY_REG.txt) */
read_nic_word(dev, SIFS, &priv->SifsTime);
-
-   return;
 }
 
 /**
@@ -942,7 +933,6 @@ void rtl8192_phy_setTxPower(struct net_device *dev, u8 
channel)
 __func__);
break;
}
-   return;
 }
 
 /**
@@ -963,7 +953,6 @@ void rtl8192_phy_RFConfig(struct net_device *dev)
RT_TRACE(COMP_ERR, "error chip id\n");
break;
}
-   return;
 }
 
 /**
@@ -974,7 +963,6 @@ void rtl8192_phy_RFConfig(struct net_device *dev)
  
**/
 void rtl8192_phy_updateInitGain(struct net_device *dev)
 {
-   return;
 }
 
 /**
@@ -1094,7 +1082,6 @@ static void rtl8192_SetTxPowerLevel(struct net_device 
*dev, u8 channel)
RT_TRACE(COMP_ERR, "unknown rf chip ID in %s()\n", __func__);
break;
}
-   return;
 }
 
 /**
-- 
1.7.11.7

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


[PATCH v4 3/4] staging: rtl8192u: Fixed switch and case indentation error

2014-07-10 Thread sanjeev sharma
From: sanjeev sharma 

This patch will fix switch and case indentation Error
reported by checkpatch script.

Signed-off-by: Sanjeev Sharma 
---
 drivers/staging/rtl8192u/r819xU_phy.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192u/r819xU_phy.c 
b/drivers/staging/rtl8192u/r819xU_phy.c
index 0fcb673..3155616 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.c
+++ b/drivers/staging/rtl8192u/r819xU_phy.c
@@ -946,12 +946,12 @@ void rtl8192_phy_RFConfig(struct net_device *dev)
struct r8192_priv *priv = ieee80211_priv(dev);
 
switch (priv->rf_chip) {
-   case RF_8256:
-   PHY_RF8256_Config(dev);
-   break;
-   default:
-   RT_TRACE(COMP_ERR, "error chip id\n");
-   break;
+   case RF_8256:
+   PHY_RF8256_Config(dev);
+   break;
+   default:
+   RT_TRACE(COMP_ERR, "error chip id\n");
+   break;
}
 }
 
-- 
1.7.11.7

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


[PATCH v4 0/4] staging: rtl8192u: checkpatch fixes

2014-07-10 Thread sanjeev sharma
From: sanjeev sharma 

This version of patch incorporated Joe & Greg KH review comment.

sanjeev sharma (4):
  staging: rtl8192u: Remove useless return statement
  staging: rtl8192u: Removed unnecessary whitespace & tab warning
  staging: rtl8192u: Fixed switch and case indentation error
  staging: rtl8192u: Fixed too long line

 drivers/staging/rtl8192u/r819xU_phy.c | 57 +++
 1 file changed, 24 insertions(+), 33 deletions(-)

-- 
1.7.11.7

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


[PATCH 0/2] staging: comedi: remove MODULE_VERSION()

2014-07-10 Thread Ian Abbott
A couple of comedi drivers use MODULE_VERSION(), which is inappropriate
for in-kernel drivers.

1) staging: comedi: vmk80xx: remove MODULE_VERSION() from in-kernel module
2) staging: comedi: ni_daq_700: remove MODULE_VERSION() and commentary

 drivers/staging/comedi/drivers/ni_daq_700.c | 7 ---
 drivers/staging/comedi/drivers/vmk80xx.c| 1 -
 2 files changed, 8 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: comedi: vmk80xx: remove MODULE_VERSION() from in-kernel module

2014-07-10 Thread Ian Abbott
Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/vmk80xx.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/vmk80xx.c 
b/drivers/staging/comedi/drivers/vmk80xx.c
index 0adf3cf..831c3b7 100644
--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -959,5 +959,4 @@ module_comedi_usb_driver(vmk80xx_driver, 
vmk80xx_usb_driver);
 MODULE_AUTHOR("Manuel Gebele ");
 MODULE_DESCRIPTION("Velleman USB Board Low-Level Driver");
 MODULE_SUPPORTED_DEVICE("K8055/K8061 aka VM110/VM140");
-MODULE_VERSION("0.8.01");
 MODULE_LICENSE("GPL");
-- 
2.0.0

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


[PATCH 2/2] staging: comedi: ni_daq_700: remove MODULE_VERSION() and commentary

2014-07-10 Thread Ian Abbott
We don't module version numbers for in-kernel drivers.  The kernel
version number is sufficient information.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/ni_daq_700.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c 
b/drivers/staging/comedi/drivers/ni_daq_700.c
index 3d841d4..5e472cb 100644
--- a/drivers/staging/comedi/drivers/ni_daq_700.c
+++ b/drivers/staging/comedi/drivers/ni_daq_700.c
@@ -43,12 +43,6 @@
  *
  * IRQ is assigned but not used.
  *
- * Version 0.1 Original DIO only driver
- * Version 0.2 DIO and basic AI analog input support on 16 se channels
- * Version 0.3 Add SE or DIFF mode and range switching +-10,+-5,+-2.5
- * Clear the FIFO of data before the conversion to handle card
- * mode switching glitches.
- *
  * Manuals:Register level: http://www.ni.com/pdf/manuals/340698.pdf
  * User Manual:http://www.ni.com/pdf/manuals/320676d.pdf
  */
@@ -295,5 +289,4 @@ module_comedi_pcmcia_driver(daq700_driver, 
daq700_cs_driver);
 MODULE_AUTHOR("Fred Brooks ");
 MODULE_DESCRIPTION(
"Comedi driver for National Instruments PCMCIA DAQCard-700 DIO/AI");
-MODULE_VERSION("0.3.00");
 MODULE_LICENSE("GPL");
-- 
2.0.0

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


[PATCH] Staging: panel: fixed frivilous else statement warning

2014-07-10 Thread Vincent Heuken
Fixed one instance of the following checkpatch.pl warning in
panel.c:
WARNING: else is not generally useful after a break or return

Signed-off-by: Vincent Heuken 
---
 drivers/staging/panel/panel.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 4e92293..6d1a320 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -1800,11 +1800,12 @@ static inline int input_state_high(struct logical_input 
*input)
input->high_timer++;
}
return 1;
-   } else {
-   /* else signal falling down. Let's fall through. */
-   input->state = INPUT_ST_FALLING;
-   input->fall_timer = 0;
}
+
+   /* else signal falling down. Let's fall through. */
+   input->state = INPUT_ST_FALLING;
+   input->fall_timer = 0;
+
return 0;
 }
 
-- 
2.0.1

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


Re: [PATCH 6/8] Drivers: scsi: storvsc: Implement an abort handler

2014-07-10 Thread Richard Weinberger
On Wed, Jul 9, 2014 at 8:51 PM, KY Srinivasan  wrote:
>
>
>> -Original Message-
>> From: Christoph Hellwig [mailto:h...@infradead.org]
>> Sent: Wednesday, July 9, 2014 1:44 AM
>> To: KY Srinivasan
>> Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org;
>> oher...@suse.com; jbottom...@parallels.com; jasow...@redhat.com;
>> a...@canonical.com; linux-s...@vger.kernel.org
>> Subject: Re: [PATCH 6/8] Drivers: scsi: storvsc: Implement an abort handler
>>
>> On Tue, Jul 08, 2014 at 05:46:50PM -0700, K. Y. Srinivasan wrote:
>> > Implement a simple abort handler. The host does not support "Abort";
>> > just ensure that all inflight I/Os have been accounted for.
>>
>> The abort handler should abort a single command, not wait for all of them.
>> What issue do you see that this tries to address?
>
> On Azure, we sometimes have unbounded I/O latencies and some distributions 
> (such as SLES12) based on recent kernels are invoking
> the "Abort Handler". Unfortunately, our scsi emulation on the host does not 
> support aborting a command.
> The issue I have seen is that the upper level scsi code attempts error 
> recovery when the command times out and finally frees up the command.
> The host subsequently responds to the command that has timed out and since 
> the memory has been freed up, we end up touching freed memory
> in this driver. Since the host is also doing error recovery, by just delaying 
> the error handler in the guest until we can account for all the in-flight 
> commands,
> we can get around the problem.

I see strange issues in Azure and maybe they are related to this.
Some Linux machines crash in a way that no disk IO is possible (thus,
no SSH for me) but they still respond to
ping. It happens rather seldom (every few weeks).

Do you see similar symptoms?

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


Re: [PATCH V2 2/8] Drivers: scsi: storvsc: Set cmd_per_lun to reflect value supported by the Host

2014-07-10 Thread Christoph Hellwig
> - .cmd_per_lun =  1,
> + .cmd_per_lun =  255,
>   .can_queue =STORVSC_MAX_IO_REQUESTS*STORVSC_MAX_TARGETS,

slave_configure immediately adjusts this down to STORVSC_MAX_IO_REQUESTS
(250), any reson to start out with the magic 255 here?

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


Re: [PATCH 7/8] drivers: scsi: storvsc: Set srb_flags in all cases

2014-07-10 Thread Christoph Hellwig
>   default:
>   vm_srb->data_in = UNKNOWN_TYPE;
> - vm_srb->win8_extension.srb_flags = 0;
> + vm_srb->win8_extension.srb_flags |= (SRB_FLAGS_DATA_IN |
> +  SRB_FLAGS_DATA_OUT);

This would usually be a command that doesn't transfer data (e.g.
TEST_UNIT_READY or SYNCHRONIZE_CACHE), do you really want to set the in
and out flags here?

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


Re: [PATCH 7/8] drivers: scsi: storvsc: Set srb_flags in all cases

2014-07-10 Thread Christoph Hellwig
On Wed, Jul 09, 2014 at 06:40:09PM +, KY Srinivasan wrote:
> > On Tue, Jul 08, 2014 at 05:46:51PM -0700, K. Y. Srinivasan wrote:
> > > Correctly set SRB flags for all valid I/O directions. Some IHV drivers
> > > on the Windows host require this.
> > 
> > What are IHV drivers?
> 
> If the target is a SAN device, the host simply passes the request over to the 
> native driver stack on the host. Some specific hardware (IHV - independent 
> hadware vendor) drivers on Windows require that SRB flags be correctly set in 
> all cases.
> 

I'm fine with putting this in, but treating I/O request from guests as
trusted in a hypervisor doesn't seem like a good idea in general..

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


Re: [PATCH 6/8] Drivers: scsi: storvsc: Implement an abort handler

2014-07-10 Thread Christoph Hellwig
On Wed, Jul 09, 2014 at 06:51:38PM +, KY Srinivasan wrote:
> On Azure, we sometimes have unbounded I/O latencies and some distributions
> (such as SLES12) based on recent kernels are invoking the "Abort Handler".

Any kernel will invoke the abort handler if present, and then escalate
to the various resets.

> Unfortunately, our scsi emulation on the host does not support aborting 
> a command. The issue I have seen is that the upper level scsi code attempts
> error recovery when the command times out and finally frees up the command.
> The host subsequently responds to the command that has timed out and since
> the memory has been freed up, we end up touching freed memory in this
> driver. Since the host is also doing error recovery, by just delaying the
> error handler in the guest until we can account for all the in-flight 
> commands, we can get around the problem.

The storvsc driver does implement an bus reset error handler, and
after that completes successfully the midlayer frees the commands,
and the driver has to deal with this and not call scsi_done after
the reset finished (normally you'd expect the hardware to not complete
requests after an reset).

Note that you could increase the timeout and/or implement an
eh_timed_out handler that just returns BLK_EH_RESET_TIMER, but if the
completion takes too long the expectation is that a command will
eventually finish instead of beeing delayed by an unmound amount.

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


Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16

2014-07-10 Thread h...@infradead.org
On Wed, Jul 09, 2014 at 10:36:26PM +, KY Srinivasan wrote:
> Ok; I am concerned about older kernels that do not have no_write_same flag.
> I suppose I can work directly with these Distros and give them a choice: 
> either implement
> the no_write_same flag or filter the command in our driver. I will not 
> include this patch when

Exactly.  In general they should be interested in the flag as various
raid controllers react badly to it as well.

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


[PATCH v2 60/60] staging: ced1401: usb1401.c fix checkpatch warnings

2014-07-10 Thread Luca Ellero
Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |  263 +++--
 1 file changed, 167 insertions(+), 96 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index a3d1ed6..f362859 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -1,11 +1,12 @@
-/***
- CED1401 usb driver. This basic loading is based on the usb-skeleton.c code 
that is:
+/***
+ CED1401 usb driver. This basic loading is based on the usb-skeleton.c code
+ that is:
  Copyright (C) 2001-2004 Greg Kroah-Hartman (g...@kroah.com)
  Copyright (C) 2012 Alois Schloegl 
  There is not a great deal of the skeleton left.
 
- All the remainder dealing specifically with the CED1401 is based on drivers 
written
- by CED for other systems (mainly Windows) and is:
+ All the remainder dealing specifically with the CED1401 is based on drivers
+ written by CED for other systems (mainly Windows) and is:
  Copyright (C) 2010 Cambridge Electronic Design Ltd
  Author Greg P Smith (g...@ced.co.uk)
 
@@ -125,8 +126,9 @@ static void ced_delete(struct kref *kref)
 {
struct ced_data *ced = to_ced_data(kref);
 
-   /*  Free up the output buffer, then free the output urb. Note that the 
interface member */
-   /*  of ced will probably be NULL, so cannot be used to get to dev. */
+   /* Free up the output buffer, then free the output urb. Note that  */
+   /* the interface member of ced will probably be NULL, so cannot be */
+   /* used to get to dev. */
usb_free_coherent(ced->udev, OUTBUF_SZ, ced->coher_char_out,
  ced->urb_char_out->transfer_dma);
usb_free_urb(ced->urb_char_out);
@@ -183,7 +185,7 @@ static int ced_open(struct inode *inode, struct file *file)
kref_put(&ced->kref, ced_delete);
goto exit;
}
-   } else {/* uncomment this block if you want exclusive 
open */
+   } else {/* uncomment this block if you want exclusive open */
dev_err(&interface->dev, "%s: fail: already open\n", __func__);
retval = -EBUSY;
ced->open_count--;
@@ -204,6 +206,7 @@ exit:
 static int ced_release(struct inode *inode, struct file *file)
 {
struct ced_data *ced = file->private_data;
+
if (ced == NULL)
return -ENODEV;
 
@@ -213,7 +216,8 @@ static int ced_release(struct inode *inode, struct file 
*file)
usb_autopm_put_interface(ced->interface);
mutex_unlock(&ced->io_mutex);
 
-   kref_put(&ced->kref, ced_delete);   /*  decrement the count on our 
device */
+   /* decrement the count on our device */
+   kref_put(&ced->kref, ced_delete);
return 0;
 }
 
@@ -221,6 +225,7 @@ static int ced_flush(struct file *file, fl_owner_t id)
 {
int res;
struct ced_data *ced = file->private_data;
+
if (ced == NULL)
return -ENODEV;
 
@@ -294,21 +299,27 @@ static void ced_writechar_callback(struct urb *urb)
spin_lock(&ced->char_out_lock); /*  already at irq level */
ced->num_output -= got; /*  Now adjust the char send buffer */
ced->out_buff_get += got;   /*  to match what we did */
-   if (ced->out_buff_get >= OUTBUF_SZ) /*  Can't do this any 
earlier as data could be overwritten */
+
+   /* Can't do this any earlier as data could be overwritten */
+   if (ced->out_buff_get >= OUTBUF_SZ)
ced->out_buff_get = 0;
 
if (ced->num_output > 0) {  /*  if more to be done... */
int pipe = 0;   /*  The pipe number to use */
int ret;
char *pDat = &ced->output_buffer[ced->out_buff_get];
-   unsigned int dwCount = ced->num_output; /*  maximum to 
send */
-   if ((ced->out_buff_get + dwCount) > OUTBUF_SZ)  /*  
does it cross buffer end? */
+   /* maximum to send */
+   unsigned int dwCount = ced->num_output;
+
+   /* does it cross buffer end? */
+   if ((ced->out_buff_get + dwCount) > OUTBUF_SZ)
dwCount = OUTBUF_SZ - ced->out_buff_get;
 
/* we are done with stuff that changes */
spin_unlock(&ced->char_out_lock);
 
-   memcpy(ced->coher_char_out, pDat, dwCount); /*  
copy output data to the buffer */
+   /* copy output data to the buffer */
+   memcpy(ced->coher_char_out, pDat, dwCount);
  

[PATCH v2 55/60] staging: ced1401: fix ced_get_circ_block()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_get_circ_block()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   34 +-
 drivers/staging/ced1401/usb1401.h |2 +-
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index efc1db9..73ec4bc 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -1406,49 +1406,49 @@ int ced_set_circular(struct ced_data *ced,
 **
 ** Return the next available block of circularly-transferred data.
 /
-int ced_get_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB)
+int ced_get_circ_block(struct ced_data *ced, TCIRCBLOCK __user *ucb)
 {
-   int iReturn = U14ERR_NOERROR;
-   unsigned int nArea;
+   int ret = U14ERR_NOERROR;
+   unsigned int area;
TCIRCBLOCK cb;
 
dev_dbg(&ced->interface->dev, "%s\n", __func__);
 
-   if (copy_from_user(&cb, pCB, sizeof(cb)))
+   if (copy_from_user(&cb, ucb, sizeof(cb)))
return -EFAULT;
 
mutex_lock(&ced->io_mutex);
 
-   nArea = cb.nArea;   /*  Retrieve parameters first */
+   area = cb.nArea;/*  Retrieve parameters first */
cb.dwOffset = 0;/*  set default result (nothing) */
cb.dwSize = 0;
 
-   if (nArea < MAX_TRANSAREAS) {   /*  The area number must be OK */
+   if (area < MAX_TRANSAREAS) {/*  The area number must be OK */
/* Pointer to relevant info */
-   struct transarea *pArea = &ced->trans_def[nArea];
+   struct transarea *ta = &ced->trans_def[area];
spin_lock_irq(&ced->staged_lock);   /*  Lock others out */
 
-   if ((pArea->used) && (pArea->circular) &&   /*  Must be 
circular area */
-   (pArea->circ_to_host)) {/*  For now at least must be to 
host */
-   if (pArea->blocks[0].size > 0) {/*  Got 
anything? */
-   cb.dwOffset = pArea->blocks[0].offset;
-   cb.dwSize = pArea->blocks[0].size;
+   if ((ta->used) && (ta->circular) && /* Must be circular area */
+   (ta->circ_to_host)) { /* For now at least must be to host */
+   if (ta->blocks[0].size > 0) {   /*  Got anything? */
+   cb.dwOffset = ta->blocks[0].offset;
+   cb.dwSize = ta->blocks[0].size;
dev_dbg(&ced->interface->dev,
"%s: return block 0: %d bytes at %d\n",
__func__, cb.dwSize, cb.dwOffset);
}
} else
-   iReturn = U14ERR_NOTSET;
+   ret = U14ERR_NOTSET;
 
spin_unlock_irq(&ced->staged_lock);
} else
-   iReturn = U14ERR_BADAREA;
+   ret = U14ERR_BADAREA;
 
-   if (copy_to_user(pCB, &cb, sizeof(cb)))
-   iReturn = -EFAULT;
+   if (copy_to_user(ucb, &cb, sizeof(cb)))
+   ret = -EFAULT;
 
mutex_unlock(&ced->io_mutex);
-   return iReturn;
+   return ret;
 }
 
 /
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index a0d19aa..2dd4d92 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -253,7 +253,7 @@ extern int ced_dbg_get_data(struct ced_data *ced, TDBGBLOCK 
__user *udb);
 extern int ced_dbg_stop_loop(struct ced_data *ced);
 extern int ced_set_circular(struct ced_data *ced,
struct transfer_area_desc __user *utd);
-extern int ced_get_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB);
+extern int ced_get_circ_block(struct ced_data *ced, TCIRCBLOCK __user *ucb);
 extern int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB);
 extern int ced_wait_event(struct ced_data *ced, int area, int time_out);
 extern int ced_test_event(struct ced_data *ced, int area);
-- 
1.7.10.4

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


[PATCH v2 52/60] staging: ced1401: fix ced_dbg_get_data()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_dbg_get_data()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   19 ++-
 drivers/staging/ced1401/usb1401.h |2 +-
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 8c7bfe25..682da27 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -1318,31 +1318,32 @@ int ced_dbg_ramp_addr(struct ced_data *ced, TDBGBLOCK 
__user *udb)
 **
 ** Retrieve the data resulting from the last debug Peek operation
 /
-int ced_dbg_get_data(struct ced_data *ced, TDBGBLOCK __user *pDB)
+int ced_dbg_get_data(struct ced_data *ced, TDBGBLOCK __user *udb)
 {
-   int iReturn;
+   int ret;
TDBGBLOCK db;
+
memset(&db, 0, sizeof(db)); /*  fill returned block with 0s */
 
mutex_lock(&ced->io_mutex);
dev_dbg(&ced->interface->dev, "%s\n", __func__);
 
/*  Read back the last peeked value from the 1401. */
-   iReturn = usb_control_msg(ced->udev, usb_rcvctrlpipe(ced->udev, 0),
+   ret = usb_control_msg(ced->udev, usb_rcvctrlpipe(ced->udev, 0),
  DB_DATA, (D_TO_H | VENDOR | DEVREQ), 0, 0,
  &db.iData, sizeof(db.iData), HZ);
-   if (iReturn == sizeof(db.iData)) {
-   if (copy_to_user(pDB, &db, sizeof(db)))
-   iReturn = -EFAULT;
+   if (ret == sizeof(db.iData)) {
+   if (copy_to_user(udb, &db, sizeof(db)))
+   ret = -EFAULT;
else
-   iReturn = U14ERR_NOERROR;
+   ret = U14ERR_NOERROR;
} else
dev_err(&ced->interface->dev, "%s: failed, code %d\n",
-   __func__, iReturn);
+   __func__, ret);
 
mutex_unlock(&ced->io_mutex);
 
-   return iReturn;
+   return ret;
 }
 
 /
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index 77d8614..c04f385 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -249,7 +249,7 @@ extern int ced_dbg_peek(struct ced_data *ced, TDBGBLOCK 
__user *udb);
 extern int ced_dbg_poke(struct ced_data *ced, TDBGBLOCK __user *udb);
 extern int ced_dbg_ramp_data(struct ced_data *ced, TDBGBLOCK __user *udb);
 extern int ced_dbg_ramp_addr(struct ced_data *ced, TDBGBLOCK __user *udb);
-extern int ced_dbg_get_data(struct ced_data *ced, TDBGBLOCK __user *pDB);
+extern int ced_dbg_get_data(struct ced_data *ced, TDBGBLOCK __user *udb);
 extern int ced_dbg_stop_loop(struct ced_data *ced);
 extern int ced_set_circular(struct ced_data *ced, struct transfer_area_desc 
__user *pTD);
 extern int ced_get_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB);
-- 
1.7.10.4

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


[PATCH v2 57/60] staging: ced1401: usb1401.c fix checkpatch errors

2014-07-10 Thread Luca Ellero
Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index 26e5f1b..a3d1ed6 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -610,9 +610,9 @@ static void staged_callback(struct urb *urb)
ta->blocks[1].offset);
}
} else { /* If block 1 is not used, we try to add */
-/*to block 0 */
+/*to block 0 */
 
-   /* Got stored block 0 information? */
+   /* Got stored block 0 information? */
if (ta->blocks[0].size > 0) {
/*  Must append onto the */
/*existing block 0   */
@@ -738,7 +738,7 @@ static void staged_callback(struct urb *urb)
/* This feels wrong as we should ask which spin lock protects*/
/* dma_flag. */
restart_char_input = !cancel && (ced->dma_flag == MODE_CHAR) &&
-   !ced->xfer_waiting;
+!ced->xfer_waiting;
 
spin_unlock(&ced->staged_lock); /*  Finally release the lock again */
 
@@ -803,7 +803,7 @@ static int ced_stage_chunk(struct ced_data *ced)
ced->pipe_error[pipe] = 1; /* Flag an error to be */
   /* handled later   */
dev_err(&ced->interface->dev,
-   "%s: submit urb failed, code %d\n",
+   "%s: submit urb failed, code %d\n",
__func__, retval);
} else
/* Set the flag for staged URB pending */
-- 
1.7.10.4

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


[PATCH v2 58/60] staging: ced1401: usb1401.h fix checkpatch errors

2014-07-10 Thread Luca Ellero
Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index 8e800c3..da4d90c 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -213,7 +213,7 @@ struct ced_data {
 
 /*  Definitions of routimes used between compilation object files */
 /*  in usb1401.c */
-extern int ced_allowi(struct ced_data * ced);
+extern int ced_allowi(struct ced_data *ced);
 extern int ced_send_chars(struct ced_data *ced);
 extern void ced_draw_down(struct ced_data *ced);
 extern int ced_read_write_mem(struct ced_data *ced, bool read,
-- 
1.7.10.4

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


[PATCH v2 38/60] staging: ced1401: fix ced_set_transfer()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_set_transfer()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   19 +++
 drivers/staging/ced1401/usb1401.h |3 ++-
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 4609cb4..bba034c 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -775,26 +775,29 @@ error:
 ** unset it. Unsetting will fail if the area is booked, and a transfer to that
 ** area is in progress. Otherwise, we will release the area and re-assign it.
 /
-int ced_set_transfer(struct ced_data *ced, struct transfer_area_desc __user 
*pTD)
+int ced_set_transfer(struct ced_data *ced,
+struct transfer_area_desc __user *utd)
 {
-   int iReturn;
+   int ret;
struct transfer_area_desc td;
 
-   if (copy_from_user(&td, pTD, sizeof(td)))
+   if (copy_from_user(&td, utd, sizeof(td)))
return -EFAULT;
 
mutex_lock(&ced->io_mutex);
dev_dbg(&ced->interface->dev, "%s: area:%d, size:%08x\n",
__func__, td.wAreaNum, td.dwLength);
-   /*  The strange cast is done so that we don't get warnings in 32-bit 
linux about the size of the */
-   /*  pointer. The pointer is always passed as a 64-bit object so that we 
don't have problems using */
-   /*  a 32-bit program on a 64-bit system. unsigned long is 64-bits on a 
64-bit system. */
-   iReturn =
+   /* The strange cast is done so that we don't get warnings in 32-bit  */
+   /* linux about the size of the pointer. The pointer is always passed */
+   /* as a 64-bit object so that we don't have problems using a 32-bit  */
+   /* program on a 64-bit system. unsigned long is 64-bits on a 64-bit  */
+   /* system.   */
+   ret =
ced_set_area(ced, td.wAreaNum,
(char __user *)((unsigned long)td.lpvBuff), td.dwLength,
false, false);
mutex_unlock(&ced->io_mutex);
-   return iReturn;
+   return ret;
 }
 
 /
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index a5fc387..c8cb2c5 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -229,7 +229,8 @@ extern int ced_read_write_cancel(struct ced_data *ced);
 extern int ced_reset(struct ced_data *ced);
 extern int ced_get_char(struct ced_data *ced);
 extern int ced_get_string(struct ced_data *ced, char __user *user, int n);
-extern int ced_set_transfer(struct ced_data *ced, struct transfer_area_desc 
__user *pTD);
+extern int ced_set_transfer(struct ced_data *ced,
+   struct transfer_area_desc __user *utd);
 extern int ced_unset_transfer(struct ced_data *ced, int nArea);
 extern int ced_set_event(struct ced_data *ced, struct transfer_event __user 
*pTE);
 extern int ced_stat_1401(struct ced_data *ced);
-- 
1.7.10.4

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


[PATCH v2 51/60] staging: ced1401: fix ced_dbg_ramp_data/addr()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_dbg_ramp_data() and
ced_dbg_ramp_addr()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   56 ++---
 drivers/staging/ced1401/usb1401.h |4 +--
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index adab1de..8c7bfe25 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -1256,31 +1256,31 @@ int ced_dbg_poke(struct ced_data *ced, TDBGBLOCK __user 
*udb)
 ** Execute the diagnostic ramp data operation. Parameters are in the CSBLOCK 
struct
 ** in order address, default, enable mask, size and repeats.
 /
-int ced_dbg_ramp_data(struct ced_data *ced, TDBGBLOCK __user *pDB)
+int ced_dbg_ramp_data(struct ced_data *ced, TDBGBLOCK __user *udb)
 {
-   int iReturn;
+   int ret;
TDBGBLOCK db;
 
-   if (copy_from_user(&db, pDB, sizeof(db)))
+   if (copy_from_user(&db, udb, sizeof(db)))
return -EFAULT;
 
mutex_lock(&ced->io_mutex);
dev_dbg(&ced->interface->dev, "%s: @ %08x\n", __func__, db.iAddr);
 
-   iReturn = ced_dbg_cmd(ced, DB_SETADD, db.iAddr);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_SETDEF, db.iDefault);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_SETMASK, db.iMask);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_WIDTH, db.iWidth);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_REPEATS, db.iRepeats);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_RAMPD, 0);
+   ret = ced_dbg_cmd(ced, DB_SETADD, db.iAddr);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_SETDEF, db.iDefault);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_SETMASK, db.iMask);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_WIDTH, db.iWidth);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_REPEATS, db.iRepeats);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_RAMPD, 0);
mutex_unlock(&ced->io_mutex);
 
-   return iReturn;
+   return ret;
 }
 
 /
@@ -1288,29 +1288,29 @@ int ced_dbg_ramp_data(struct ced_data *ced, TDBGBLOCK 
__user *pDB)
 **
 ** Execute the diagnostic ramp address operation
 /
-int ced_dbg_ramp_addr(struct ced_data *ced, TDBGBLOCK __user *pDB)
+int ced_dbg_ramp_addr(struct ced_data *ced, TDBGBLOCK __user *udb)
 {
-   int iReturn;
+   int ret;
TDBGBLOCK db;
 
-   if (copy_from_user(&db, pDB, sizeof(db)))
+   if (copy_from_user(&db, udb, sizeof(db)))
return -EFAULT;
 
mutex_lock(&ced->io_mutex);
dev_dbg(&ced->interface->dev, "%s\n", __func__);
 
-   iReturn = ced_dbg_cmd(ced, DB_SETDEF, db.iDefault);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_SETMASK, db.iMask);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_WIDTH, db.iWidth);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_REPEATS, db.iRepeats);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_RAMPA, 0);
+   ret = ced_dbg_cmd(ced, DB_SETDEF, db.iDefault);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_SETMASK, db.iMask);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_WIDTH, db.iWidth);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_REPEATS, db.iRepeats);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_RAMPA, 0);
mutex_unlock(&ced->io_mutex);
 
-   return iReturn;
+   return ret;
 }
 
 /
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index 2e3a1c6..77d8614 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -247,8 +247,8 @@ extern int ced_type_of_1401(struct ced_data *ced);
 extern int ced_transfer_flags(struct ced_data *ced);
 extern int ced_dbg_peek(struct ced_data *ced, TDBGBLOCK __user *udb);
 extern int ced_dbg_poke(struct ced_data *ced, TDBGBLOCK __user *udb);
-extern int ced_dbg_ramp_data(struct ced_data *ced, TDBGBLOCK __user *pDB);
-extern int ced_dbg_ramp_addr(struct ced_data *ced, TDBGBLOCK __user *pDB);
+extern int ced_dbg_ramp_data(struct ced_data *ced, TDBGBLOCK __user *udb);
+extern int ced_dbg_ramp_addr(struc

[PATCH v2 48/60] staging: ced1401: fix ced_transfer_flags()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_transfer_flags()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 9ac275c..0778cf0 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -1157,15 +1157,17 @@ int ced_type_of_1401(struct ced_data *ced)
 /
 int ced_transfer_flags(struct ced_data *ced)
 {
-   int iReturn = U14TF_MULTIA | U14TF_DIAG |   /*  we always have 
multiple DMA area */
-   U14TF_NOTIFY | U14TF_CIRCTH;/*  diagnostics, notify and 
circular */
+/* we always have multiple DMA area diagnostics, notify and circular */
+   int ret = U14TF_MULTIA | U14TF_DIAG |
+   U14TF_NOTIFY | U14TF_CIRCTH;
+
dev_dbg(&ced->interface->dev, "%s\n", __func__);
mutex_lock(&ced->io_mutex);
if (ced->is_usb2)   /*  Set flag for USB2 if appropriate */
-   iReturn |= U14TF_USB2;
+   ret |= U14TF_USB2;
mutex_unlock(&ced->io_mutex);
 
-   return iReturn;
+   return ret;
 }
 
 /***
-- 
1.7.10.4

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


[PATCH v2 40/60] staging: ced1401: fix ced_set_event()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_set_event()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   33 -
 drivers/staging/ced1401/usb1401.h |3 ++-
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index f632d2f..f00aff6 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -821,33 +821,40 @@ int ced_unset_transfer(struct ced_data *ced, int area)
 ** pretend that whatever the user asked for was achieved, so we return 1 if
 ** try to create one, and 0 if they ask to remove (assuming all else was OK).
 /
-int ced_set_event(struct ced_data *ced, struct transfer_event __user *pTE)
+int ced_set_event(struct ced_data *ced, struct transfer_event __user *ute)
 {
-   int iReturn = U14ERR_NOERROR;
+   int ret = U14ERR_NOERROR;
struct transfer_event te;
 
/*  get a local copy of the data */
-   if (copy_from_user(&te, pTE, sizeof(te)))
+   if (copy_from_user(&te, ute, sizeof(te)))
return -EFAULT;
 
if (te.wAreaNum >= MAX_TRANSAREAS)  /*  the area must exist */
return U14ERR_BADAREA;
else {
-   struct transarea *pTA = &ced->trans_def[te.wAreaNum];
-   mutex_lock(&ced->io_mutex); /*  make sure we have no 
competitor */
+   struct transarea *ta = &ced->trans_def[te.wAreaNum];
+
+   /* make sure we have no competitor */
+   mutex_lock(&ced->io_mutex);
spin_lock_irq(&ced->staged_lock);
-   if (pTA->used) {/*  area must be in use */
-   pTA->event_st = te.dwStart; /*  set area regions */
-   pTA->event_sz = te.dwLength;/*  set size (0 cancels 
it) */
-   pTA->event_to_host = te.wFlags & 1; /*  set the 
direction */
-   pTA->wake_up = 0;   /*  zero the wake up count */
+
+   if (ta->used) { /* area must be in use */
+   ta->event_st = te.dwStart; /*  set area regions */
+
+/* set size (0 cancels it) */
+   ta->event_sz = te.dwLength;
+
+/*  set the direction */
+   ta->event_to_host = te.wFlags & 1;
+   ta->wake_up = 0;/*  zero the wake up count */
} else
-   iReturn = U14ERR_NOTSET;
+   ret = U14ERR_NOTSET;
spin_unlock_irq(&ced->staged_lock);
mutex_unlock(&ced->io_mutex);
}
-   return iReturn ==
-   U14ERR_NOERROR ? (te.iSetEvent ? 1 : U14ERR_NOERROR) : iReturn;
+   return ret ==
+   U14ERR_NOERROR ? (te.iSetEvent ? 1 : U14ERR_NOERROR) : ret;
 }
 
 /
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index 2e88db8..d18755b 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -232,7 +232,8 @@ extern int ced_get_string(struct ced_data *ced, char __user 
*user, int n);
 extern int ced_set_transfer(struct ced_data *ced,
struct transfer_area_desc __user *utd);
 extern int ced_unset_transfer(struct ced_data *ced, int area);
-extern int ced_set_event(struct ced_data *ced, struct transfer_event __user 
*pTE);
+extern int ced_set_event(struct ced_data *ced,
+struct transfer_event __user *ute);
 extern int ced_stat_1401(struct ced_data *ced);
 extern int ced_line_count(struct ced_data *ced);
 extern int ced_get_out_buf_space(struct ced_data *ced);
-- 
1.7.10.4

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


[PATCH v2 47/60] staging: ced1401: fix ced_type_of_1401()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_type_of_1401()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 7e598e2..9ac275c 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -1123,30 +1123,31 @@ int ced_check_self_test(struct ced_data *ced, 
TGET_SELFTEST __user *ugst)
 /
 int ced_type_of_1401(struct ced_data *ced)
 {
-   int iReturn = TYPEUNKNOWN;
+   int ret = TYPEUNKNOWN;
+
mutex_lock(&ced->io_mutex);
dev_dbg(&ced->interface->dev, "%s\n", __func__);
 
switch (ced->type) {
case TYPE1401:
-   iReturn = U14ERR_STD;
+   ret = U14ERR_STD;
break;  /*  Handle these types directly */
case TYPEPLUS:
-   iReturn = U14ERR_PLUS;
+   ret = U14ERR_PLUS;
break;
case TYPEU1401:
-   iReturn = U14ERR_U1401;
+   ret = U14ERR_U1401;
break;
default:
if ((ced->type >= TYPEPOWER) && (ced->type <= 25))
-   iReturn = ced->type + 4;/*  We can calculate 
types */
+   ret = ced->type + 4;/*  We can calculate types */
else/*   for up-coming 1401 designs */
-   iReturn = TYPEUNKNOWN;  /*  Don't know or not there */
+   ret = TYPEUNKNOWN;  /*  Don't know or not there */
}
-   dev_dbg(&ced->interface->dev, "%s %d\n", __func__, iReturn);
+   dev_dbg(&ced->interface->dev, "%s %d\n", __func__, ret);
mutex_unlock(&ced->io_mutex);
 
-   return iReturn;
+   return ret;
 }
 
 /
-- 
1.7.10.4

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


[PATCH v2 44/60] staging: ced1401: fix ced_state_of_1401()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_state_of_1401()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 80bc213..b37cf26 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -997,16 +997,16 @@ int ced_kill_io(struct ced_data *ced)
 */
 int ced_state_of_1401(struct ced_data *ced)
 {
-   int iReturn;
+   int ret;
mutex_lock(&ced->io_mutex);
 
-   ced_quick_check(ced, false, false); /*  get state up to date, no 
reset */
-   iReturn = ced->current_state;
+   ced_quick_check(ced, false, false); /* get state up to date, no reset */
+   ret = ced->current_state;
 
mutex_unlock(&ced->io_mutex);
-   dev_dbg(&ced->interface->dev, "%s: %d\n", __func__, iReturn);
+   dev_dbg(&ced->interface->dev, "%s: %d\n", __func__, ret);
 
-   return iReturn;
+   return ret;
 }
 
 /
-- 
1.7.10.4

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


[PATCH v2 54/60] staging: ced1401: fix ced_set_circular()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_set_circular()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   25 ++---
 drivers/staging/ced1401/usb1401.h |3 ++-
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 3da24a6..efc1db9 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -1373,29 +1373,32 @@ int ced_dbg_stop_loop(struct ced_data *ced)
 ** booked and a transfer to that area is in progress. Otherwise, we will
 ** release the area and re-assign it.
 /
-int ced_set_circular(struct ced_data *ced, struct transfer_area_desc __user 
*pTD)
+int ced_set_circular(struct ced_data *ced,
+struct transfer_area_desc __user *utd)
 {
-   int iReturn;
-   bool bToHost;
+   int ret;
+   bool to_host;
struct transfer_area_desc td;
 
-   if (copy_from_user(&td, pTD, sizeof(td)))
+   if (copy_from_user(&td, utd, sizeof(td)))
return -EFAULT;
 
mutex_lock(&ced->io_mutex);
dev_dbg(&ced->interface->dev, "%s: area:%d, size:%08x\n",
__func__, td.wAreaNum, td.dwLength);
-   bToHost = td.eSize != 0;/*  this is used as the tohost flag */
+   to_host = td.eSize != 0;/*  this is used as the tohost flag */
 
-   /*  The strange cast is done so that we don't get warnings in 32-bit 
linux about the size of the */
-   /*  pointer. The pointer is always passed as a 64-bit object so that we 
don't have problems using */
-   /*  a 32-bit program on a 64-bit system. unsigned long is 64-bits on a 
64-bit system. */
-   iReturn =
+   /* The strange cast is done so that we don't get warnings in 32-bit  */
+   /* linux about the size of the pointer. The pointer is always passed */
+   /* as a 64-bit object so that we don't have problems using a 32-bit  */
+   /* program on a 64-bit system. unsigned long is 64-bits on a 64-bit  */
+   /* system.   */
+   ret =
ced_set_area(ced, td.wAreaNum,
(char __user *)((unsigned long)td.lpvBuff), td.dwLength,
-   true, bToHost);
+   true, to_host);
mutex_unlock(&ced->io_mutex);
-   return iReturn;
+   return ret;
 }
 
 /
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index c04f385..a0d19aa 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -251,7 +251,8 @@ extern int ced_dbg_ramp_data(struct ced_data *ced, 
TDBGBLOCK __user *udb);
 extern int ced_dbg_ramp_addr(struct ced_data *ced, TDBGBLOCK __user *udb);
 extern int ced_dbg_get_data(struct ced_data *ced, TDBGBLOCK __user *udb);
 extern int ced_dbg_stop_loop(struct ced_data *ced);
-extern int ced_set_circular(struct ced_data *ced, struct transfer_area_desc 
__user *pTD);
+extern int ced_set_circular(struct ced_data *ced,
+   struct transfer_area_desc __user *utd);
 extern int ced_get_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB);
 extern int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB);
 extern int ced_wait_event(struct ced_data *ced, int area, int time_out);
-- 
1.7.10.4

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


[PATCH v2 50/60] staging: ced1401: fix ced_dbg_peek/poke()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_dbg_peek() and
ced_dbg_poke()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   44 ++---
 drivers/staging/ced1401/usb1401.h |4 ++--
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 46cc293..adab1de 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -1198,27 +1198,27 @@ static int ced_dbg_cmd(struct ced_data *ced, unsigned 
char cmd,
 **
 ** Execute the diagnostic peek operation. Uses address, width and repeats.
 /
-int ced_dbg_peek(struct ced_data *ced, TDBGBLOCK __user *pDB)
+int ced_dbg_peek(struct ced_data *ced, TDBGBLOCK __user *udb)
 {
-   int iReturn;
+   int ret;
TDBGBLOCK db;
 
-   if (copy_from_user(&db, pDB, sizeof(db)))
+   if (copy_from_user(&db, udb, sizeof(db)))
return -EFAULT;
 
mutex_lock(&ced->io_mutex);
dev_dbg(&ced->interface->dev, "%s: @ %08x\n", __func__, db.iAddr);
 
-   iReturn = ced_dbg_cmd(ced, DB_SETADD, db.iAddr);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_WIDTH, db.iWidth);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_REPEATS, db.iRepeats);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_PEEK, 0);
+   ret = ced_dbg_cmd(ced, DB_SETADD, db.iAddr);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_WIDTH, db.iWidth);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_REPEATS, db.iRepeats);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_PEEK, 0);
mutex_unlock(&ced->io_mutex);
 
-   return iReturn;
+   return ret;
 }
 
 /
@@ -1227,27 +1227,27 @@ int ced_dbg_peek(struct ced_data *ced, TDBGBLOCK __user 
*pDB)
 ** Execute the diagnostic poke operation. Parameters are in the CSBLOCK struct
 ** in order address, size, repeats and value to poke.
 /
-int ced_dbg_poke(struct ced_data *ced, TDBGBLOCK __user *pDB)
+int ced_dbg_poke(struct ced_data *ced, TDBGBLOCK __user *udb)
 {
-   int iReturn;
+   int ret;
TDBGBLOCK db;
 
-   if (copy_from_user(&db, pDB, sizeof(db)))
+   if (copy_from_user(&db, udb, sizeof(db)))
return -EFAULT;
 
mutex_lock(&ced->io_mutex);
dev_dbg(&ced->interface->dev, "%s: @ %08x\n", __func__, db.iAddr);
 
-   iReturn = ced_dbg_cmd(ced, DB_SETADD, db.iAddr);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_WIDTH, db.iWidth);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_REPEATS, db.iRepeats);
-   if (iReturn == U14ERR_NOERROR)
-   iReturn = ced_dbg_cmd(ced, DB_POKE, db.iData);
+   ret = ced_dbg_cmd(ced, DB_SETADD, db.iAddr);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_WIDTH, db.iWidth);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_REPEATS, db.iRepeats);
+   if (ret == U14ERR_NOERROR)
+   ret = ced_dbg_cmd(ced, DB_POKE, db.iData);
mutex_unlock(&ced->io_mutex);
 
-   return iReturn;
+   return ret;
 }
 
 /
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index e1f1c54..2e3a1c6 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -245,8 +245,8 @@ extern int ced_check_self_test(struct ced_data *ced,
   TGET_SELFTEST __user *ugst);
 extern int ced_type_of_1401(struct ced_data *ced);
 extern int ced_transfer_flags(struct ced_data *ced);
-extern int ced_dbg_peek(struct ced_data *ced, TDBGBLOCK __user *pDB);
-extern int ced_dbg_poke(struct ced_data *ced, TDBGBLOCK __user *pDB);
+extern int ced_dbg_peek(struct ced_data *ced, TDBGBLOCK __user *udb);
+extern int ced_dbg_poke(struct ced_data *ced, TDBGBLOCK __user *udb);
 extern int ced_dbg_ramp_data(struct ced_data *ced, TDBGBLOCK __user *pDB);
 extern int ced_dbg_ramp_addr(struct ced_data *ced, TDBGBLOCK __user *pDB);
 extern int ced_dbg_get_data(struct ced_data *ced, TDBGBLOCK __user *pDB);
-- 
1.7.10.4

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


[PATCH v2 45/60] staging: ced1401: fix ced_start_self_test()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_start_self_test()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index b37cf26..44b4c6e 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -1017,7 +1017,7 @@ int ced_state_of_1401(struct ced_data *ced)
 */
 int ced_start_self_test(struct ced_data *ced)
 {
-   int nGot;
+   int got;
mutex_lock(&ced->io_mutex);
dev_dbg(&ced->interface->dev, "%s\n", __func__);
 
@@ -1028,15 +1028,16 @@ int ced_start_self_test(struct ced_data *ced)
/* ced_read_write_cancel(pDeviceObject); */
ced->dma_flag = MODE_CHAR;  /* Clear DMA mode flags here */
 
-   nGot = usb_control_msg(ced->udev, usb_rcvctrlpipe(ced->udev, 0),
+   got = usb_control_msg(ced->udev, usb_rcvctrlpipe(ced->udev, 0),
   DB_SELFTEST, (H_TO_D | VENDOR | DEVREQ),
   0, 0, NULL, 0, HZ); /* allow 1 second timeout */
-   ced->self_test_time = jiffies + HZ * 30;/*  30 seconds into the 
future */
+   ced->self_test_time = jiffies + HZ * 30;   /* 30 seconds into the*/
+  /* future */
 
mutex_unlock(&ced->io_mutex);
-   if (nGot < 0)
-   dev_err(&ced->interface->dev, "%s: err=%d\n", __func__, nGot);
-   return nGot < 0 ? U14ERR_FAIL : U14ERR_NOERROR;
+   if (got < 0)
+   dev_err(&ced->interface->dev, "%s: err=%d\n", __func__, got);
+   return got < 0 ? U14ERR_FAIL : U14ERR_NOERROR;
 }
 
 /
-- 
1.7.10.4

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


[PATCH v2 56/60] staging: ced1401: fix ced_free_circ_block()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_free_circ_block()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |  103 -
 drivers/staging/ced1401/usb1401.h |2 +-
 2 files changed, 58 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 73ec4bc..fb4e8a3 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -1456,79 +1456,90 @@ int ced_get_circ_block(struct ced_data *ced, TCIRCBLOCK 
__user *ucb)
 **
 ** Frees a block of circularly-transferred data and returns the next one.
 /
-int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB)
+int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *ucb)
 {
-   int iReturn = U14ERR_NOERROR;
-   unsigned int nArea, uStart, uSize;
+   int ret = U14ERR_NOERROR;
+   unsigned int area, start, size;
TCIRCBLOCK cb;
 
dev_dbg(&ced->interface->dev, "%s\n", __func__);
 
-   if (copy_from_user(&cb, pCB, sizeof(cb)))
+   if (copy_from_user(&cb, ucb, sizeof(cb)))
return -EFAULT;
 
mutex_lock(&ced->io_mutex);
 
-   nArea = cb.nArea;   /*  Retrieve parameters first */
-   uStart = cb.dwOffset;
-   uSize = cb.dwSize;
+   area = cb.nArea;/*  Retrieve parameters first */
+   start = cb.dwOffset;
+   size = cb.dwSize;
cb.dwOffset = 0;/*  then set default result (nothing) */
cb.dwSize = 0;
 
-   if (nArea < MAX_TRANSAREAS) {   /*  The area number must be OK */
+   if (area < MAX_TRANSAREAS) {/*  The area number must be OK */
/* Pointer to relevant info */
-   struct transarea *pArea = &ced->trans_def[nArea];
+   struct transarea *ta = &ced->trans_def[area];
+
spin_lock_irq(&ced->staged_lock);   /*  Lock others out */
 
-   if ((pArea->used) && (pArea->circular) &&   /*  Must be 
circular area */
-   (pArea->circ_to_host)) {/*  For now at least must be to 
host */
-   bool bWaiting = false;
-
-   if ((pArea->blocks[0].size >= uSize) && /*  Got 
anything? */
-   (pArea->blocks[0].offset == uStart)) {  /*  
Must be legal data */
-   pArea->blocks[0].size -= uSize;
-   pArea->blocks[0].offset += uSize;
-   if (pArea->blocks[0].size == 0) {   /*  
Have we emptied this block? */
-   if (pArea->blocks[1].size) {/*  Is 
there a second block? */
-   pArea->blocks[0] = 
pArea->blocks[1];/*  Copy down block 2 data */
-   pArea->blocks[1].size = 0;  
/*  and mark the second block as unused */
-   pArea->blocks[1].offset = 0;
+   if ((ta->used) && (ta->circular) && /*  Must be circular area */
+   (ta->circ_to_host)) { /* For now at least must be to host */
+   bool waiting = false;
+
+   if ((ta->blocks[0].size >= size) && /* Got anything? */
+   (ta->blocks[0].offset == start)) { /* Must be legal 
data */
+   ta->blocks[0].size -= size;
+   ta->blocks[0].offset += size;
+
+/* Have we emptied this block? */
+   if (ta->blocks[0].size == 0) {
+   /* Is there a second block? */
+   if (ta->blocks[1].size) {
+   /* Copy down block 2 data */
+   ta->blocks[0] = ta->blocks[1];
+   /* and mark the second */
+   /* block as unused */
+   ta->blocks[1].size = 0;
+   ta->blocks[1].offset = 0;
} else
-   pArea->blocks[0].offset = 0;
+   ta->blocks[0].offset = 0;
}
 
dev_dbg(&ced->interface->dev,
-   "%s: free %d bytes at %d, return %d 
bytes at %d, wait=%d\n",
-   __func__, uSize, uStart,
-   pArea->blocks[0].size,
-   pArea->blocks[0].offset,
+   "%s: free %d bytes at %d, "
+   

[PATCH v2 39/60] staging: ced1401: fix ced_unset_transfer()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_unset_transfer()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   10 +-
 drivers/staging/ced1401/usb1401.h |2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index bba034c..f632d2f 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -801,16 +801,16 @@ int ced_set_transfer(struct ced_data *ced,
 }
 
 /
-** UnSetTransfer
+** ced_unset_transfer
 ** Erases a transfer area record
 /
-int ced_unset_transfer(struct ced_data *ced, int nArea)
+int ced_unset_transfer(struct ced_data *ced, int area)
 {
-   int iReturn;
+   int ret;
mutex_lock(&ced->io_mutex);
-   iReturn = ced_clear_area(ced, nArea);
+   ret = ced_clear_area(ced, area);
mutex_unlock(&ced->io_mutex);
-   return iReturn;
+   return ret;
 }
 
 /
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index c8cb2c5..2e88db8 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -231,7 +231,7 @@ extern int ced_get_char(struct ced_data *ced);
 extern int ced_get_string(struct ced_data *ced, char __user *user, int n);
 extern int ced_set_transfer(struct ced_data *ced,
struct transfer_area_desc __user *utd);
-extern int ced_unset_transfer(struct ced_data *ced, int nArea);
+extern int ced_unset_transfer(struct ced_data *ced, int area);
 extern int ced_set_event(struct ced_data *ced, struct transfer_event __user 
*pTE);
 extern int ced_stat_1401(struct ced_data *ced);
 extern int ced_line_count(struct ced_data *ced);
-- 
1.7.10.4

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


[PATCH v2 59/60] staging: ced1401: ced_ioc.c fix checkpatch warnings

2014-07-10 Thread Luca Ellero
Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |  212 +++--
 1 file changed, 131 insertions(+), 81 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index fb4e8a3..717b4ce 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -63,8 +63,11 @@ static void ced_flush_in_buff(struct ced_data *ced)
 {
dev_dbg(&ced->interface->dev, "%s: current_state=%d\n",
__func__, ced->current_state);
-   if (ced->current_state == U14ERR_TIME)  /* Do nothing if hardware in 
trouble */
+
+   /* Do nothing if hardware in trouble */
+   if (ced->current_state == U14ERR_TIME)
return;
+
/* Kill off any pending I/O */
/* CharRead_Cancel(pDevObject);  */
spin_lock_irq(&ced->char_in_lock);
@@ -84,9 +87,11 @@ static int ced_put_chars(struct ced_data *ced, const char 
*ch,
unsigned int count)
 {
int ret;
+
spin_lock_irq(&ced->char_out_lock); /*  get the output spin lock */
if ((OUTBUF_SZ - ced->num_output) >= count) {
unsigned int u;
+
for (u = 0; u < count; u++) {
ced->output_buffer[ced->out_buff_put++] = ch[u];
if (ced->out_buff_put >= OUTBUF_SZ)
@@ -94,7 +99,9 @@ static int ced_put_chars(struct ced_data *ced, const char *ch,
}
ced->num_output += count;
spin_unlock_irq(&ced->char_out_lock);
-   ret = ced_send_chars(ced);  /*  ...give a chance to 
transmit data */
+
+   /* ...give a chance to transmit data */
+   ret = ced_send_chars(ced);
} else {
ret = U14ERR_NOOUT; /*  no room at the out (ha-ha) */
spin_unlock_irq(&ced->char_out_lock);
@@ -140,6 +147,7 @@ int ced_send_string(struct ced_data *ced, const char __user 
*data,
 int ced_send_char(struct ced_data *ced, char c)
 {
int ret;
+
mutex_lock(&ced->io_mutex); /*  Protect disconnect from new i/o */
ret = ced_put_chars(ced, &c, 1);
dev_dbg(&ced->interface->dev, "ced_send_char >%c< (0x%02x)\n", c, c);
@@ -177,6 +185,7 @@ int ced_send_char(struct ced_data *ced, char c)
 int ced_get_state(struct ced_data *ced, __u32 *state, __u32 *error)
 {
int got;
+
dev_dbg(&ced->interface->dev, "%s: entry\n", __func__);
 
*state = 0x;/*  Start off with invalid state */
@@ -192,6 +201,7 @@ int ced_get_state(struct ced_data *ced, __u32 *state, __u32 
*error)
*error = 0;
} else {
int device;
+
dev_dbg(&ced->interface->dev,
"%s: Success, state: 0x%x, 0x%x\n",
__func__, ced->stat_buf[0], ced->stat_buf[1]);
@@ -233,23 +243,32 @@ int ced_read_write_cancel(struct ced_data *ced)
int ntStatus = STATUS_SUCCESS;
bool bResult = false;
unsigned int i;
-   /*  We can fill this in when we know how we will implement the staged 
transfer stuff */
+
+   /* We can fill this in when we know how we  */
+   /* will implement the staged transfer stuff */
spin_lock_irq(&ced->staged_lock);
 
-   if (ced->staged_urb_pending) {  /*  anything to be cancelled? May need 
more... */
+   /* anything to be cancelled? May need more... */
+   if (ced->staged_urb_pending) {
dev_info(&ced->interface - dev,
 "ced_read_write_cancel about to cancel Urb\n");
/* Clear the staging done flag */
/* KeClearEvent(&ced->StagingDoneEvent); */
USB_ASSERT(ced->pStagedIrp != NULL);
 
-   /*  Release the spinlock first otherwise the completion routine 
may hang */
-   /*   on the spinlock while this function hands waiting for the 
event. */
+   /* Release the spinlock first otherwise the completion  */
+   /* routine may hang on the spinlock while this function */
+   /* hands waiting for the event. */
spin_unlock_irq(&ced->staged_lock);
-   bResult = IoCancelIrp(ced->pStagedIrp); /*  Actually do the 
cancel */
+
+   /* Actually do the cancel */
+   bResult = IoCancelIrp(ced->pStagedIrp);
+
if (bResult) {
LARGE_INTEGER timeout;
-   timeout.QuadPart = -1000;   /*  Use a timeout of 1 
second */
+
+   /* Use a timeout of 1 second */
+   timeout.QuadPart = -1000;
dev_info(&ced->interface - dev,
 "%s: about to wait till done\n", __func__);
ntStatus =
@@ -261,9 +280,11 @@ int ced_read_write_cancel(struct ced_data *ced)
 "%s: can

[PATCH v2 53/60] staging: ced1401: fix ced_dbg_stop_loop()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_dbg_stop_loop()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 682da27..3da24a6 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -1354,15 +1354,15 @@ int ced_dbg_get_data(struct ced_data *ced, TDBGBLOCK 
__user *udb)
 /
 int ced_dbg_stop_loop(struct ced_data *ced)
 {
-   int iReturn;
+   int ret;
unsigned int uState, uErr;
 
mutex_lock(&ced->io_mutex);
dev_dbg(&ced->interface->dev, "%s\n", __func__);
-   iReturn = ced_get_state(ced, &uState, &uErr);
+   ret = ced_get_state(ced, &uState, &uErr);
mutex_unlock(&ced->io_mutex);
 
-   return iReturn;
+   return ret;
 }
 
 /
-- 
1.7.10.4

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


[PATCH v2 43/60] staging: ced1401: fix ced_get_transfer()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_get_transfer()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   18 ++
 drivers/staging/ced1401/usb1401.h |2 +-
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 47ef5dd..80bc213 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -939,17 +939,18 @@ int ced_test_event(struct ced_data *ced, int area)
 ** ced_get_transferInfo
 ** Puts the current state of the 1401 in a TGET_TX_BLOCK.
 */
-int ced_get_transfer(struct ced_data *ced, TGET_TX_BLOCK __user *pTX)
+int ced_get_transfer(struct ced_data *ced, TGET_TX_BLOCK __user *utx)
 {
-   int iReturn = U14ERR_NOERROR;
+   int ret = U14ERR_NOERROR;
unsigned int dwIdent;
 
mutex_lock(&ced->io_mutex);
dwIdent = ced->staged_id;   /*  area ident for last xfer */
if (dwIdent >= MAX_TRANSAREAS)
-   iReturn = U14ERR_BADAREA;
+   ret = U14ERR_BADAREA;
else {
-   /*  Return the best information we have - we don't have 
physical addresses */
+   /* Return the best information we have - we */
+   /* don't have physical addresses*/
TGET_TX_BLOCK *tx;
 
tx = kzalloc(sizeof(*tx), GFP_KERNEL);
@@ -959,18 +960,19 @@ int ced_get_transfer(struct ced_data *ced, TGET_TX_BLOCK 
__user *pTX)
}
tx->size = ced->trans_def[dwIdent].length;
tx->linear = (long long)((long)ced->trans_def[dwIdent].buff);
-   tx->avail = GET_TX_MAXENTRIES;  /*  how many blocks we could 
return */
+   /* how many blocks we could return */
+   tx->avail = GET_TX_MAXENTRIES;
tx->used = 1;   /*  number we actually return */
tx->entries[0].physical =
(long long)(tx->linear + ced->staged_offset);
tx->entries[0].size = tx->size;
 
-   if (copy_to_user(pTX, tx, sizeof(*tx)))
-   iReturn = -EFAULT;
+   if (copy_to_user(utx, tx, sizeof(*tx)))
+   ret = -EFAULT;
kfree(tx);
}
mutex_unlock(&ced->io_mutex);
-   return iReturn;
+   return ret;
 }
 
 /
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index 30dbe5b..c5a4118 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -237,7 +237,7 @@ extern int ced_set_event(struct ced_data *ced,
 extern int ced_stat_1401(struct ced_data *ced);
 extern int ced_line_count(struct ced_data *ced);
 extern int ced_get_out_buf_space(struct ced_data *ced);
-extern int ced_get_transfer(struct ced_data *ced, TGET_TX_BLOCK __user *pGTB);
+extern int ced_get_transfer(struct ced_data *ced, TGET_TX_BLOCK __user *utx);
 extern int ced_kill_io(struct ced_data *ced);
 extern int ced_state_of_1401(struct ced_data *ced);
 extern int ced_start_self_test(struct ced_data *ced);
-- 
1.7.10.4

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


[PATCH v2 42/60] staging: ced1401: fix ced_test_event()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_test_event()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   20 +++-
 drivers/staging/ced1401/usb1401.h |2 +-
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 707f8fa..47ef5dd 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -916,21 +916,23 @@ int ced_wait_event(struct ced_data *ced, int area, int 
time_out)
 ** number of times a block completed since the last call, or 0 if none or a
 ** negative error.
 /
-int ced_test_event(struct ced_data *ced, int nArea)
+int ced_test_event(struct ced_data *ced, int area)
 {
-   int iReturn;
-   if ((unsigned)nArea >= MAX_TRANSAREAS)
-   iReturn = U14ERR_BADAREA;
+   int ret;
+   if ((unsigned)area >= MAX_TRANSAREAS)
+   ret = U14ERR_BADAREA;
else {
-   struct transarea *pTA = &ced->trans_def[nArea];
-   mutex_lock(&ced->io_mutex); /*  make sure we have no 
competitor */
+   struct transarea *ta = &ced->trans_def[area];
+
+/* make sure we have no competitor */
+   mutex_lock(&ced->io_mutex);
spin_lock_irq(&ced->staged_lock);
-   iReturn = pTA->wake_up; /*  get wakeup count since last call */
-   pTA->wake_up = 0;   /*  clear the count */
+   ret = ta->wake_up;  /*  get wakeup count since last call */
+   ta->wake_up = 0;/*  clear the count */
spin_unlock_irq(&ced->staged_lock);
mutex_unlock(&ced->io_mutex);
}
-   return iReturn;
+   return ret;
 }
 
 /
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index ac4062b..30dbe5b 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -253,6 +253,6 @@ extern int ced_dbg_stop_loop(struct ced_data *ced);
 extern int ced_set_circular(struct ced_data *ced, struct transfer_area_desc 
__user *pTD);
 extern int ced_get_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB);
 extern int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB);
-extern int ced_test_event(struct ced_data *ced, int nArea);
 extern int ced_wait_event(struct ced_data *ced, int area, int time_out);
+extern int ced_test_event(struct ced_data *ced, int area);
 #endif
-- 
1.7.10.4

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


[PATCH v2 46/60] staging: ced1401: fix ced_check_self_test()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_check_self_test()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   40 +++--
 drivers/staging/ced1401/usb1401.h |3 ++-
 2 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 44b4c6e..7e598e2 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -1045,31 +1045,31 @@ int ced_start_self_test(struct ced_data *ced)
 **
 ** Check progress of a self-test cycle
 /
-int ced_check_self_test(struct ced_data *ced, TGET_SELFTEST __user *pGST)
+int ced_check_self_test(struct ced_data *ced, TGET_SELFTEST __user *ugst)
 {
unsigned int state, error;
-   int iReturn;
+   int ret;
TGET_SELFTEST gst;  /*  local work space */
memset(&gst, 0, sizeof(gst));   /*  clear out the space (sets code 0) */
 
mutex_lock(&ced->io_mutex);
 
dev_dbg(&ced->interface->dev, "%s\n", __func__);
-   iReturn = ced_get_state(ced, &state, &error);
-   if (iReturn == U14ERR_NOERROR)  /*  Only accept zero if it happens 
twice */
-   iReturn = ced_get_state(ced, &state, &error);
+   ret = ced_get_state(ced, &state, &error);
+   if (ret == U14ERR_NOERROR) /* Only accept zero if it happens twice */
+   ret = ced_get_state(ced, &state, &error);
 
-   if (iReturn != U14ERR_NOERROR) {/*  Self-test can cause comms 
errors */
+   if (ret != U14ERR_NOERROR) {/*  Self-test can cause comms errors */
/*  so we assume still testing */
dev_err(&ced->interface->dev,
"%s: ced_get_state=%d, assuming still testing\n",
-   __func__, iReturn);
+   __func__, ret);
state = 0x80;   /*  Force still-testing, no error */
error = 0;
-   iReturn = U14ERR_NOERROR;
+   ret = U14ERR_NOERROR;
}
 
-   if ((state == -1) && (error == -1)) {   /*  If ced_get_state had 
problems */
+   if ((state == -1) && (error == -1)) {/* If ced_get_state had problems */
dev_err(&ced->interface->dev,
"%s: ced_get_state failed, assuming still testing\n",
__func__);
@@ -1079,14 +1079,15 @@ int ced_check_self_test(struct ced_data *ced, 
TGET_SELFTEST __user *pGST)
 
if ((state & 0xFF) == 0x80) {   /*  If we are still in self-test */
if (state & 0x00FF) { /*  Have we got an error? */
-   gst.code = (state & 0x00FF) >> 16;  /*  read the 
error code */
-   gst.x = error & 0x; /*  Error data X */
-   gst.y = (error & 0x) >> 16; /*  and data Y 
*/
+   /* read the error code */
+   gst.code = (state & 0x00FF) >> 16;
+   gst.x = error & 0x; /* Error data X */
+   gst.y = (error & 0x) >> 16; /* and data Y   */
dev_dbg(&ced->interface->dev,
"Self-test error code %d\n", gst.code);
} else {/*  No error, check for timeout */
-   unsigned long ulNow = jiffies;  /*  get current time */
-   if (time_after(ulNow, ced->self_test_time)) {
+   unsigned long now = jiffies;/*  get current time */
+   if (time_after(now, ced->self_test_time)) {
gst.code = -2;  /*  Flag the timeout */
dev_dbg(&ced->interface->dev,
"Self-test timed-out\n");
@@ -1099,19 +1100,20 @@ int ced_check_self_test(struct ced_data *ced, 
TGET_SELFTEST __user *pGST)
dev_dbg(&ced->interface->dev, "Self-test done\n");
}
 
-   if (gst.code < 0) { /*  If we have a problem or finished */
-   /*  If using the 2890 we should reset properly 
*/
+   if (gst.code < 0) { /* If we have a problem or finished */
+   /* If using the 2890 we should reset properly */
if ((ced->n_pipes == 4) && (ced->type <= TYPEPOWER))
ced_is_1401(ced);   /*  Get 1401 reset and OK */
else
-   ced_quick_check(ced, true, true);   /*  Otherwise 
check without reset unless problems */
+   /* Otherwise check without reset unless problems */
+   ced_quick_check(ced, true, true);
}
mutex_unlock(&ced->io_mutex);
 
-   if (copy_to_user(pGST, &gst, sizeof(gst)))
+   if (copy_to_user(ugst, &gst, sizeof(gst)))

[PATCH v2 37/60] staging: ced1401: fix ced_set_area()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_set_area()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |  109 +++--
 1 file changed, 57 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 9c629e2..4609cb4 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -694,73 +694,78 @@ int ced_clear_area(struct ced_data *ced, int area)
 ** Sets up a transfer area - the functional part. Called by both
 ** ced_set_transfer and ced_set_circular.
 /
-static int ced_set_area(struct ced_data *ced, int nArea, char __user *puBuf,
-  unsigned int dwLength, bool bCircular, bool bCircToHost)
+static int ced_set_area(struct ced_data *ced, int area, char __user *buf,
+  unsigned int length, bool circular, bool circ_to_host)
 {
-   /*  Start by working out the page aligned start of the area and the 
size */
-   /*  of the area in pages, allowing for the start not being aligned and 
the */
-   /*  end needing to be rounded up to a page boundary. */
-   unsigned long ulStart = ((unsigned long)puBuf) & PAGE_MASK;
-   unsigned int ulOffset = ((unsigned long)puBuf) & (PAGE_SIZE - 1);
-   int len = (dwLength + ulOffset + PAGE_SIZE - 1) >> PAGE_SHIFT;
-
-   struct transarea *pTA = &ced->trans_def[nArea]; /*  to save typing */
-   struct page **pPages = NULL;/*  space for page tables */
-   int nPages = 0; /*  and number of pages */
-
-   int iReturn = ced_clear_area(ced, nArea);   /*  see if OK to use 
this area */
-   if ((iReturn != U14ERR_NOTSET) &&   /*  if not area unused and... */
-   (iReturn != U14ERR_NOERROR))/*  ...not all OK, then... */
-   return iReturn; /*  ...we cannot use this area */
-
-   if (!access_ok(VERIFY_WRITE, puBuf, dwLength))  /*  if we cannot access 
the memory... */
+   /* Start by working out the page aligned start of the area and the  */
+   /* size of the area in pages, allowing for the start not being  */
+   /* aligned and the end needing to be rounded up to a page boundary. */
+   unsigned long start = ((unsigned long)buf) & PAGE_MASK;
+   unsigned int offset = ((unsigned long)buf) & (PAGE_SIZE - 1);
+   int len = (length + offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
+
+   struct transarea *ta = &ced->trans_def[area];   /*  to save typing */
+   struct page **pages = NULL; /*  space for page tables */
+   int n_pages = 0;/*  and number of pages */
+
+   int ret = ced_clear_area(ced, area); /*  see if OK to use this area */
+   if ((ret != U14ERR_NOTSET) &&   /*  if not area unused and... */
+   (ret != U14ERR_NOERROR))/*  ...not all OK, then... */
+   return ret; /*  ...we cannot use this area */
+
+   /* if we cannot access the memory... */
+   if (!access_ok(VERIFY_WRITE, buf, length))
return -EFAULT; /*  ...then we are done */
 
-   /*  Now allocate space to hold the page pointer and virtual address 
pointer tables */
-   pPages = kmalloc(len * sizeof(struct page *), GFP_KERNEL);
-   if (!pPages) {
-   iReturn = U14ERR_NOMEMORY;
+   /*  Now allocate space to hold the page pointer and */
+   /* virtual address pointer tables   */
+   pages = kmalloc(len * sizeof(struct page *), GFP_KERNEL);
+   if (!pages) {
+   ret = U14ERR_NOMEMORY;
goto error;
}
dev_dbg(&ced->interface->dev, "%s: %p, length=%06x, circular %d\n",
-   __func__, puBuf, dwLength, bCircular);
-
-   /*  To pin down user pages we must first acquire the mapping semaphore. 
*/
-   nPages = get_user_pages_fast(ulStart, len, 1, pPages);
-   dev_dbg(&ced->interface->dev, "%s: nPages = %d\n", __func__, nPages);
-
-   if (nPages > 0) {   /*  if we succeeded */
-   /*  If you are tempted to use page_address (form LDD3), forget 
it. You MUST use */
-   /*  kmap() or kmap_atomic() to get a virtual address. 
page_address will give you */
-   /*  (null) or at least it does in this context with an x86 
machine. */
+   __func__, buf, length, circular);
+
+   /* To pin down user pages we must first */
+   /* acquire the mapping semaphore.   */
+   n_pages = get_user_pages_fast(start, len, 1, pages);
+   dev_dbg(&ced->interface->dev, "%s: n_pages = %d\n", __func__, n_pages);
+
+   if (n_pages > 0) { /* if we succeeded */
+   /* If you are tempted to use page_address (form LDD3), forget */
+   /* it. You MUST use kmap() or kmap_atomic() to get a virtual  */
+   /* address. page_address will give you (null) or at least it  */
+ 

[PATCH v2 41/60] staging: ced1401: fix ced_wait_event()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_wait_event()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   58 -
 drivers/staging/ced1401/usb1401.h |2 +-
 2 files changed, 33 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index f00aff6..707f8fa 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -863,45 +863,51 @@ int ced_set_event(struct ced_data *ced, struct 
transfer_event __user *ute)
 ** of times that a block met the event condition since we last cleared it or
 ** 0 if timed out, or -ve error (bad area or not set, or signal).
 /
-int ced_wait_event(struct ced_data *ced, int nArea, int msTimeOut)
+int ced_wait_event(struct ced_data *ced, int area, int time_out)
 {
-   int iReturn;
-   if ((unsigned)nArea >= MAX_TRANSAREAS)
+   int ret;
+   if ((unsigned)area >= MAX_TRANSAREAS)
return U14ERR_BADAREA;
else {
-   int iWait;
-   struct transarea *pTA = &ced->trans_def[nArea];
-   msTimeOut = (msTimeOut * HZ + 999) / 1000;  /*  convert 
timeout to jiffies */
+   int wait;
+   struct transarea *ta = &ced->trans_def[area];
 
-   /*  We cannot wait holding the mutex, but we check the flags 
while holding */
-   /*  it. This may well be pointless as another thread could get 
in between */
-   /*  releasing it and the wait call. However, this would have to 
clear the */
-   /*  iWakeUp flag. However, the !pTA-bUsed may help us in this 
case. */
-   mutex_lock(&ced->io_mutex); /*  make sure we have no 
competitor */
-   if (!pTA->used || !pTA->event_sz)   /*  check something to 
wait for... */
+/* convert timeout to jiffies */
+   time_out = (time_out * HZ + 999) / 1000;
+
+   /* We cannot wait holding the mutex, but we check the flags  */
+   /* while holding it. This may well be pointless as another   */
+   /* thread could get in between releasing it and the wait */
+   /* call. However, this would have to clear the wake_up flag. */
+   /* However, the !ta->used may help us in this case.  */
+
+   /* make sure we have no competitor */
+   mutex_lock(&ced->io_mutex);
+   if (!ta->used || !ta->event_sz) /* check something to */
+ /* wait for...*/
return U14ERR_NOTSET;   /*  ...else we do nothing */
mutex_unlock(&ced->io_mutex);
 
-   if (msTimeOut)
-   iWait =
-   wait_event_interruptible_timeout(pTA->event,
-pTA->wake_up
-|| !pTA->used,
-msTimeOut);
+   if (time_out)
+   wait = wait_event_interruptible_timeout(ta->event,
+   ta->wake_up ||
+   !ta->used,
+   time_out);
else
-   iWait =
-   wait_event_interruptible(pTA->event, pTA->wake_up
-|| !pTA->used);
-   if (iWait)
-   iReturn = -ERESTARTSYS; /*  oops - we have had a SIGNAL 
*/
+   wait = wait_event_interruptible(ta->event,
+   ta->wake_up ||
+   !ta->used);
+
+   if (wait)
+   ret = -ERESTARTSYS; /* oops - we have had a SIGNAL */
else
-   iReturn = pTA->wake_up; /*  else the wakeup count */
+   ret = ta->wake_up; /* else the wakeup count */
 
spin_lock_irq(&ced->staged_lock);
-   pTA->wake_up = 0;   /*  clear the flag */
+   ta->wake_up = 0;/*  clear the flag */
spin_unlock_irq(&ced->staged_lock);
}
-   return iReturn;
+   return ret;
 }
 
 /
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index d18755b..ac4062b 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -253,6 +253,6 @@ extern int ced_dbg_stop_loop(struct ced_data *ced);
 extern int ced_set_circular(struct ced_data *ced

[PATCH v2 49/60] staging: ced1401: fix ced_dbg_cmd()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_dbg_cmd()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 0778cf0..46cc293 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -1178,18 +1178,19 @@ int ced_transfer_flags(struct ced_data *ced)
 static int ced_dbg_cmd(struct ced_data *ced, unsigned char cmd,
  unsigned int data)
 {
-   int iReturn;
+   int ret;
+
dev_dbg(&ced->interface->dev, "%s: entry\n", __func__);
-   iReturn = usb_control_msg(ced->udev, usb_sndctrlpipe(ced->udev, 0), cmd,
+   ret = usb_control_msg(ced->udev, usb_sndctrlpipe(ced->udev, 0), cmd,
  (H_TO_D | VENDOR | DEVREQ),
  (unsigned short)data,
  (unsigned short)(data >> 16), NULL, 0, HZ);
/* allow 1 second timeout */
-   if (iReturn < 0)
+   if (ret < 0)
dev_err(&ced->interface->dev, "%s: fail code=%d\n",
-   __func__, iReturn);
+   __func__, ret);
 
-   return iReturn;
+   return ret;
 }
 
 /
-- 
1.7.10.4

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


[PATCH v2 33/60] staging: ced1401: fix ced_stat_1401()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_stat_1401()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 28697c0..414056f 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -533,13 +533,13 @@ int ced_get_string(struct ced_data *ced, char __user 
*user, int n)
 
***/
 int ced_stat_1401(struct ced_data *ced)
 {
-   int iReturn;
+   int ret;
mutex_lock(&ced->io_mutex); /*  Protect disconnect from new i/o */
ced_allowi(ced);/*  make sure we allow pending chars */
ced_send_chars(ced);/*  in both directions */
-   iReturn = ced->num_input;   /*  no lock as single read */
+   ret = ced->num_input;   /*  no lock as single read */
mutex_unlock(&ced->io_mutex);   /*  Protect disconnect from new i/o */
-   return iReturn;
+   return ret;
 }
 
 /
-- 
1.7.10.4

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


[PATCH v2 23/60] staging: ced1401: fix comment

2014-07-10 Thread Luca Ellero
Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 60a671e..1b7ed4f 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -78,7 +78,7 @@ static void ced_flush_in_buff(struct ced_data *ced)
 ** ced_put_chars
 **
 ** Utility routine to copy chars into the output buffer and fire them off.
-** called from user mode, holds charOutLock.
+** called from user mode, holds char_out_lock.
 /
 static int ced_put_chars(struct ced_data *ced, const char *pCh,
unsigned int uCount)
-- 
1.7.10.4

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


[PATCH v2 36/60] staging: ced1401: fix ced_clear_area()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_clear_area()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   90 -
 drivers/staging/ced1401/usb1401.h |2 +-
 2 files changed, 51 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 3f8bf6d..9c629e2 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -607,75 +607,85 @@ int ced_get_out_buf_space(struct ced_data *ced)
 ** Clears up a transfer area. This is always called in the context of a user
 ** request, never from a call-back.
 /
-int ced_clear_area(struct ced_data *ced, int nArea)
+int ced_clear_area(struct ced_data *ced, int area)
 {
-   int iReturn = U14ERR_NOERROR;
+   int ret = U14ERR_NOERROR;
 
-   if ((nArea < 0) || (nArea >= MAX_TRANSAREAS)) {
-   iReturn = U14ERR_BADAREA;
+   if ((area < 0) || (area >= MAX_TRANSAREAS)) {
+   ret = U14ERR_BADAREA;
dev_err(&ced->interface->dev, "%s: Attempt to clear area %d\n",
-   __func__, nArea);
+   __func__, area);
} else {
/* to save typing */
-   struct transarea *pTA = &ced->trans_def[nArea];
-   if (!pTA->used) /*  if not used... */
-   iReturn = U14ERR_NOTSET;/*  ...nothing to be 
done */
+   struct transarea *ta = &ced->trans_def[area];
+   if (!ta->used)  /*  if not used... */
+   ret = U14ERR_NOTSET;/*  ...nothing to be done */
else {
-   /*  We must save the memory we return as we shouldn't 
mess with memory while */
-   /*  holding a spin lock. */
-   struct page **pPages = NULL; /*save page address list*/
-   int nPages = 0; /*  and number of pages */
+   /*  We must save the memory we return as we shouldn't */
+   /* mess with memory while holding a spin lock. */
+   struct page **pages = NULL; /*save page address list*/
+   int n_pages = 0;/*  and number of pages */
int np;
 
dev_dbg(&ced->interface->dev, "%s: area %d\n",
-   __func__, nArea);
+   __func__, area);
spin_lock_irq(&ced->staged_lock);
-   if ((ced->staged_id == nArea)
+   if ((ced->staged_id == area)
&& (ced->dma_flag > MODE_CHAR)) {
-   iReturn = U14ERR_UNLOCKFAIL;/*  cannot 
delete as in use */
+   /* cannot delete as in use */
+   ret = U14ERR_UNLOCKFAIL;
dev_err(&ced->interface->dev,
"%s: call on area %d while active\n",
-   __func__, nArea);
+   __func__, area);
} else {
-   pPages = pTA->pages;/*  save page address 
list */
-   nPages = pTA->n_pages;  /*  and page count */
-   if (pTA->event_sz)  /*  if events flagging 
in use */
-   wake_up_interruptible(&pTA->event); 
/*  release anything that was waiting */
+   pages = ta->pages; /* save page address list */
+   n_pages = ta->n_pages;  /* and page count */
+   if (ta->event_sz)/* if events flagging in use */
+   /* release anything that was waiting */
+   wake_up_interruptible(&ta->event);
 
if (ced->xfer_waiting
-   && (ced->dma_info.ident == nArea))
-   ced->xfer_waiting = false; /* Cannot 
have pending xfer if area cleared */
-
-   /*  Clean out the struct transarea except for 
the wait queue, which is at the end */
-   /*  This sets used to false and event_sz to 0 
to say area not used and no events. */
-   memset(pTA, 0,
+   && (ced->dma_info.ident == area))
+   /* Cannot have pending xfer if */
+   /* area cleared*/
+   ced->xfer_waiting = false;
+
+   /* Clean out the struct transarea except for */
+   /* the wai

[PATCH v2 26/60] staging: ced1401: fix ced_send_char()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_send_char()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 0c96202..c84b83c 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -139,13 +139,13 @@ int ced_send_string(struct ced_data *ced, const char 
__user *data,
 /
 int ced_send_char(struct ced_data *ced, char c)
 {
-   int iReturn;
+   int ret;
mutex_lock(&ced->io_mutex); /*  Protect disconnect from new i/o */
-   iReturn = ced_put_chars(ced, &c, 1);
+   ret = ced_put_chars(ced, &c, 1);
dev_dbg(&ced->interface->dev, "ced_send_char >%c< (0x%02x)\n", c, c);
ced_allowi(ced);/*  Make sure char reads are running */
mutex_unlock(&ced->io_mutex);
-   return iReturn;
+   return ret;
 }
 
 /***
-- 
1.7.10.4

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


[PATCH v2 22/60] staging: ced1401: fix ced_disconnect()

2014-07-10 Thread Luca Ellero
Rename camel case locals in function ced_disconnect()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index c8685c1..26e5f1b 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -1628,8 +1628,8 @@ static void ced_disconnect(struct usb_interface 
*interface)
mutex_lock(&ced->io_mutex); /*  stop more I/O starting while... */
ced_draw_down(ced); /*  ...wait for then kill any io */
for (i = 0; i < MAX_TRANSAREAS; ++i) {
-   int iErr = ced_clear_area(ced, i);  /*  ...release any used 
memory */
-   if (iErr == U14ERR_UNLOCKFAIL)
+   int err = ced_clear_area(ced, i);   /*  ...release any used 
memory */
+   if (err == U14ERR_UNLOCKFAIL)
dev_err(&ced->interface->dev, "%s: Area %d was in 
used\n",
__func__, i);
}
-- 
1.7.10.4

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


[PATCH v2 29/60] staging: ced1401: fix ced_is_1401()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_is_1401()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   48 +
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 528061b..194aa18 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -310,45 +310,51 @@ static int ced_in_self_test(struct ced_data *ced, 
unsigned int *stat)
 /
 static bool ced_is_1401(struct ced_data *ced)
 {
-   int iReturn;
+   int ret;
dev_dbg(&ced->interface->dev, "%s\n", __func__);
 
ced_draw_down(ced); /*  wait for, then kill outstanding Urbs */
ced_flush_in_buff(ced); /*  Clear out input buffer & pipe */
ced_flush_out_buff(ced);/*  Clear output buffer & pipe */
 
-   /*  The next call returns 0 if OK, but has returned 1 in the past, 
meaning that */
-   /*  usb_unlock_device() is needed... now it always is */
-   iReturn = usb_lock_device_for_reset(ced->udev, ced->interface);
-
-   /*  release the io_mutex because if we don't, we will deadlock due to 
system */
-   /*  calls back into the driver. */
-   mutex_unlock(&ced->io_mutex);   /*  locked, so we will not get system 
calls */
-   if (iReturn >= 0) { /*  if we failed */
-   iReturn = usb_reset_device(ced->udev);  /*  try to do the reset 
*/
-   usb_unlock_device(ced->udev);   /*  undo the lock */
+   /* The next call returns 0 if OK, but has returned 1 in the past, */
+   /* meaning that usb_unlock_device() is needed... now it always is */
+   ret = usb_lock_device_for_reset(ced->udev, ced->interface);
+
+   /*  release the io_mutex because if we don't, we will deadlock due to */
+   /* system calls back into the driver. */
+   mutex_unlock(&ced->io_mutex); /* locked, so we will not get */
+ /* system calls   */
+   if (ret >= 0) { /*  if we failed */
+   ret = usb_reset_device(ced->udev); /* try to do the reset */
+   usb_unlock_device(ced->udev);   /* undo the lock */
}
 
mutex_lock(&ced->io_mutex); /*  hold stuff off while we wait */
ced->dma_flag = MODE_CHAR;  /*  Clear DMA mode flag regardless! */
-   if (iReturn == 0) { /*  if all is OK still */
+   if (ret == 0) { /*  if all is OK still */
unsigned int state;
-   iReturn = ced_in_self_test(ced, &state);/*  see if 
likely in self test */
-   if (iReturn > 0) {  /*  do we need to wait for self-test? */
-   unsigned long ulTimeOut = jiffies + 30 * HZ;/*  
when to give up */
-   while ((iReturn > 0) && time_before(jiffies, 
ulTimeOut)) {
+   ret = ced_in_self_test(ced, &state); /* see if likely in */
+/* self test*/
+   if (ret > 0) {  /*  do we need to wait for self-test? */
+   /* when to give up */
+   unsigned long timeout = jiffies + 30 * HZ;
+   while ((ret > 0) && time_before(jiffies, timeout)) {
schedule(); /*  let other stuff run */
-   iReturn = ced_in_self_test(ced, &state);
/*  see if done yet */
+
+   /* see if done yet */
+   ret = ced_in_self_test(ced, &state);
}
}
 
-   if (iReturn == 0)   /*  if all is OK... */
-   iReturn = state == 0;   /*  then success is that the 
state is 0 */
+   if (ret == 0)   /*  if all is OK... */
+   /* then success is that the state is 0 */
+   ret = state == 0;
} else
-   iReturn = 0;/*  we failed */
+   ret = 0;/*  we failed */
ced->force_reset = false;   /*  Clear forced reset flag now */
 
-   return iReturn > 0;
+   return ret > 0;
 }
 
 /
-- 
1.7.10.4

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


[PATCH v2 28/60] staging: ced1401: fix ced_in_self_test()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_in_self_test()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 8c847ff..528061b 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -276,18 +276,18 @@ int ced_read_write_cancel(struct ced_data *ced)
 }
 
 /***
-** ced_in_self_test - utility to check in self test. Return 1 for ST, 0 for 
not or
-** a -ve error code if we failed for some reason.
+** ced_in_self_test - utility to check in self test. Return 1 for ST, 0 for not
+** or a -ve error code if we failed for some reason.
 ***/
-static int ced_in_self_test(struct ced_data *ced, unsigned int *pState)
+static int ced_in_self_test(struct ced_data *ced, unsigned int *stat)
 {
unsigned int state, error;
-   int iReturn = ced_get_state(ced, &state, &error);   /*  see if in 
self-test */
-   if (iReturn == U14ERR_NOERROR)  /*  if all still OK */
-   iReturn = (state == (unsigned int)-1) ||/*  TX problem 
or... */
+   int ret = ced_get_state(ced, &state, &error); /* see if in self-test */
+   if (ret == U14ERR_NOERROR)  /*  if all still OK */
+   ret = (state == (unsigned int)-1) ||/*  TX problem or... */
((state & 0xff) == 0x80);   /*  ...self test */
-   *pState = state;/*  return actual state */
-   return iReturn;
+   *stat = state;  /*  return actual state */
+   return ret;
 }
 
 /***
-- 
1.7.10.4

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


[PATCH v2 24/60] staging: ced1401: fix ced_put_chars()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_put_chars()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 1b7ed4f..81289d7 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -80,26 +80,26 @@ static void ced_flush_in_buff(struct ced_data *ced)
 ** Utility routine to copy chars into the output buffer and fire them off.
 ** called from user mode, holds char_out_lock.
 /
-static int ced_put_chars(struct ced_data *ced, const char *pCh,
-   unsigned int uCount)
+static int ced_put_chars(struct ced_data *ced, const char *ch,
+   unsigned int count)
 {
-   int iReturn;
+   int ret;
spin_lock_irq(&ced->char_out_lock); /*  get the output spin lock */
-   if ((OUTBUF_SZ - ced->num_output) >= uCount) {
+   if ((OUTBUF_SZ - ced->num_output) >= count) {
unsigned int u;
-   for (u = 0; u < uCount; u++) {
-   ced->output_buffer[ced->out_buff_put++] = pCh[u];
+   for (u = 0; u < count; u++) {
+   ced->output_buffer[ced->out_buff_put++] = ch[u];
if (ced->out_buff_put >= OUTBUF_SZ)
ced->out_buff_put = 0;
}
-   ced->num_output += uCount;
+   ced->num_output += count;
spin_unlock_irq(&ced->char_out_lock);
-   iReturn = ced_send_chars(ced);  /*  ...give a chance to 
transmit data */
+   ret = ced_send_chars(ced);  /*  ...give a chance to 
transmit data */
} else {
-   iReturn = U14ERR_NOOUT; /*  no room at the out (ha-ha) */
+   ret = U14ERR_NOOUT; /*  no room at the out (ha-ha) */
spin_unlock_irq(&ced->char_out_lock);
}
-   return iReturn;
+   return ret;
 }
 
 /*
-- 
1.7.10.4

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


[PATCH v2 34/60] staging: ced1401: fix ced_line_count()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_line_count()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 414056f..d7645c4 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -551,7 +551,7 @@ int ced_stat_1401(struct ced_data *ced)
 /
 int ced_line_count(struct ced_data *ced)
 {
-   int iReturn = 0;/*  will be count of line ends */
+   int ret = 0;/*  will be count of line ends */
 
mutex_lock(&ced->io_mutex); /*  Protect disconnect from new i/o */
ced_allowi(ced);/*  Make sure char reads are running */
@@ -559,21 +559,23 @@ int ced_line_count(struct ced_data *ced)
spin_lock_irq(&ced->char_in_lock);  /*  Get protection */
 
if (ced->num_input > 0) {   /*  worth looking? */
-   unsigned int dwIndex = ced->in_buff_get; /* start at first 
available */
-   unsigned int dwEnd = ced->in_buff_put;  /* Position for search 
end */
+   /* start at first available */
+   unsigned int index = ced->in_buff_get;
+   /* Position for search end */
+   unsigned int end = ced->in_buff_put;
do {
-   if (ced->input_buffer[dwIndex++] == CR_CHAR)
-   ++iReturn;  /*  inc count if CR */
+   if (ced->input_buffer[index++] == CR_CHAR)
+   ++ret;  /*  inc count if CR */
 
-   if (dwIndex >= INBUF_SZ)/*  see if we fall off 
buff */
-   dwIndex = 0;
-   } while (dwIndex != dwEnd); /*  go to last available */
+   if (index >= INBUF_SZ) /*  see if we fall off buff */
+   index = 0;
+   } while (index != end); /*  go to last available */
}
 
spin_unlock_irq(&ced->char_in_lock);
-   dev_dbg(&ced->interface->dev, "%s: returned %d\n", __func__, iReturn);
+   dev_dbg(&ced->interface->dev, "%s: returned %d\n", __func__, ret);
mutex_unlock(&ced->io_mutex);   /*  Protect disconnect from new i/o */
-   return iReturn;
+   return ret;
 }
 
 /
-- 
1.7.10.4

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


[PATCH v2 14/60] staging: ced1401: fix ced_read_char()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_read_char()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index 8007085..17d1c60 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -937,20 +937,21 @@ int ced_read_write_mem(struct ced_data *ced, bool read, 
unsigned short ident,
 **  data we return FALSE. Used as part of decoding a DMA request.
 **
 /
-static bool ced_read_char(unsigned char *pChar, char *pBuf, unsigned int 
*pdDone,
-unsigned int dGot)
+static bool ced_read_char(unsigned char *character, char *buf,
+ unsigned int *n_done, unsigned int got)
 {
-   bool bRead = false;
-   unsigned int dDone = *pdDone;
-
-   if (dDone < dGot) { /*  If there is more data */
-   *pChar = (unsigned char)pBuf[dDone];/*  Extract the next 
char */
-   dDone++;/*  Increment the done count */
-   *pdDone = dDone;
-   bRead = true;   /*  and flag success */
+   bool read = false;
+   unsigned int done = *n_done;
+
+   if (done < got) {   /* If there is more data */
+   /* Extract the next char */
+   *character = (unsigned char)buf[done];
+   done++; /* Increment the done count */
+   *n_done = done;
+   read = true;/* and flag success */
}
 
-   return bRead;
+   return read;
 }
 
 #ifdef NOTUSED
-- 
1.7.10.4

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


[PATCH v2 17/60] staging: ced1401: fix ced_read_dma_info()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_read_dma_info()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   90 -
 1 file changed, 48 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index 0078142..f360896 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -1028,66 +1028,71 @@ static bool ced_read_huff(volatile unsigned int *word, 
char *buf,
 ** the transfer request. Returns FALSE if 1401 fails to respond or obselete
 ** code from 1401 or bad parameters.
 **
-** The pBuf char pointer does not include the initial escape character, so
+** The buf char pointer does not include the initial escape character, so
 **  we start handling the data at offset zero.
 **
 */
-static bool ced_read_dma_info(volatile struct dmadesc *pDmaDesc,
+static bool ced_read_dma_info(volatile struct dmadesc *dma_desc,
  struct ced_data *ced,
- char *pBuf, unsigned int dwCount)
+ char *buf, unsigned int count)
 {
-   bool bResult = false;   /*  assume we won't succeed */
-   unsigned char ucData;
-   unsigned int dDone = 0; /*  We haven't parsed anything so far */
+   bool retval = false;/*  assume we won't succeed */
+   unsigned char c;
+   unsigned int n_done = 0;/*  We haven't parsed anything so far */
 
dev_dbg(&ced->interface->dev, "%s\n", __func__);
 
-   if (ced_read_char(&ucData, pBuf, &dDone, dwCount)) {
-   unsigned char ucTransCode = (ucData & 0x0F);/*  get code 
for transfer type */
-   unsigned short wIdent = ((ucData >> 4) & 0x07); /*  and area 
identifier */
+   if (ced_read_char(&c, buf, &n_done, count)) {
+   /* get code for transfer type */
+   unsigned char trans_code = (c & 0x0F);
+   /* and area identifier */
+   unsigned short ident = ((c >> 4) & 0x07);
 
/*  fill in the structure we were given */
-   pDmaDesc->trans_type = ucTransCode; /*  type of transfer */
-   pDmaDesc->ident = wIdent;   /*  area to use */
-   pDmaDesc->size = 0; /*  initialise other bits */
-   pDmaDesc->offset = 0;
+   dma_desc->trans_type = trans_code;  /*  type of transfer */
+   dma_desc->ident = ident;/*  area to use */
+   dma_desc->size = 0; /*  initialise other bits */
+   dma_desc->offset = 0;
 
dev_dbg(&ced->interface->dev, "%s: type: %d ident: %d\n",
-   __func__, pDmaDesc->trans_type, pDmaDesc->ident);
+   __func__, dma_desc->trans_type, dma_desc->ident);
 
-   pDmaDesc->outward = (ucTransCode != TM_EXTTOHOST);  /*  set 
transfer direction */
+   /* set transfer direction */
+   dma_desc->outward = (trans_code != TM_EXTTOHOST);
 
-   switch (ucTransCode) {
-   case TM_EXTTOHOST:  /*  Extended linear transfer modes (the 
only ones!) */
+   switch (trans_code) {
+
+   /* Extended linear transfer modes (the only ones!) */
+   case TM_EXTTOHOST:
case TM_EXTTO1401:
{
-   bResult =
-   ced_read_huff(&(pDmaDesc->offset), pBuf,
-&dDone, dwCount)
-   && ced_read_huff(&(pDmaDesc->size), pBuf,
-   &dDone, dwCount);
-   if (bResult) {
+   retval =
+   ced_read_huff(&(dma_desc->offset), buf,
+&n_done, count)
+   && ced_read_huff(&(dma_desc->size), buf,
+   &n_done, count);
+   if (retval) {
dev_dbg(&ced->interface->dev,
"%s: xfer offset & size %d 
%d\n",
-   __func__, pDmaDesc->offset,
-   pDmaDesc->size);
-
-   if ((wIdent >= MAX_TRANSAREAS) ||   
/*  Illegal area number, or... */
-   (!ced->trans_def[wIdent].used) ||   
/*  area not set up, or... */
-   (pDmaDesc->offset > 
ced->trans_def[wIdent].length) ||   /*  range/size */
-   ((pDmaDesc->offset +
- pDmaDesc->si

[PATCH v2 27/60] staging: ced1401: fix ced_get_state()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_get_state()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   28 
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index c84b83c..8c847ff 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -176,37 +176,41 @@ int ced_send_char(struct ced_data *ced, char c)
 */
 int ced_get_state(struct ced_data *ced, __u32 *state, __u32 *error)
 {
-   int nGot;
+   int got;
dev_dbg(&ced->interface->dev, "%s: entry\n", __func__);
 
*state = 0x;/*  Start off with invalid state */
-   nGot = usb_control_msg(ced->udev, usb_rcvctrlpipe(ced->udev, 0),
+   got = usb_control_msg(ced->udev, usb_rcvctrlpipe(ced->udev, 0),
   GET_STATUS, (D_TO_H | VENDOR | DEVREQ), 0, 0,
   ced->stat_buf, sizeof(ced->stat_buf), HZ);
-   if (nGot != sizeof(ced->stat_buf)) {
+   if (got != sizeof(ced->stat_buf)) {
dev_err(&ced->interface->dev,
-   "%s: FAILED, return code %d\n", __func__, nGot);
-   ced->current_state = U14ERR_TIME;   /*  Indicate that 
things are very wrong indeed */
+   "%s: FAILED, return code %d\n", __func__, got);
+   /* Indicate that things are very wrong indeed */
+   ced->current_state = U14ERR_TIME;
*state = 0; /*  Force status values to a known state */
*error = 0;
} else {
-   int nDevice;
+   int device;
dev_dbg(&ced->interface->dev,
"%s: Success, state: 0x%x, 0x%x\n",
__func__, ced->stat_buf[0], ced->stat_buf[1]);
 
-   *state = ced->stat_buf[0];  /*  Return the state values to 
the calling code */
+   /* Return the state values to the calling code */
+   *state = ced->stat_buf[0];
+
*error = ced->stat_buf[1];
 
-   nDevice = ced->udev->descriptor.bcdDevice >> 8; /*  1401 type 
code value */
-   switch (nDevice) {  /*  so we can clean up current state */
+   /* 1401 type code value */
+   device = ced->udev->descriptor.bcdDevice >> 8;
+   switch (device) {   /*  so we can clean up current state */
case 0:
ced->current_state = U14ERR_U1401;
break;
 
-   default:/*  allow lots of device codes for future 1401s 
*/
-   if ((nDevice >= 1) && (nDevice <= 23))
-   ced->current_state = (short)(nDevice + 6);
+   default: /* allow lots of device codes for future 1401s */
+   if ((device >= 1) && (device <= 23))
+   ced->current_state = (short)(device + 6);
else
ced->current_state = U14ERR_ILL;
break;
-- 
1.7.10.4

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


[PATCH v2 19/60] staging: ced1401: fix ced_readchar_callback()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_readchar_callback()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   63 ++---
 1 file changed, 37 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index f47735f..4f478bd 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -1189,57 +1189,68 @@ static int ced_handle_esc(struct ced_data *ced, char 
*ch,
 /
 ** Callback for the character read complete or error
 /
-static void ced_readchar_callback(struct urb *pUrb)
+static void ced_readchar_callback(struct urb *urb)
 {
-   struct ced_data *ced = pUrb->context;
-   int nGot = pUrb->actual_length; /*  what we transferred */
+   struct ced_data *ced = urb->context;
+   int got = urb->actual_length;   /*  what we transferred */
 
-   if (pUrb->status) { /*  Do we have a problem to handle? */
-   int nPipe = ced->n_pipes == 4 ? 1 : 0;  /*  The pipe number to 
use for error */
-   /*  sync/async unlink faults aren't errors... just saying 
device removed or stopped */
+   if (urb->status) {  /*  Do we have a problem to handle? */
+   /* The pipe number to use for error */
+   int pipe = ced->n_pipes == 4 ? 1 : 0;
+   /* sync/async unlink faults aren't errors... */
+   /* just saying device removed or stopped */
if (!
-   (pUrb->status == -ENOENT || pUrb->status == -ECONNRESET
-|| pUrb->status == -ESHUTDOWN)) {
+   (urb->status == -ENOENT || urb->status == -ECONNRESET
+|| urb->status == -ESHUTDOWN)) {
dev_err(&ced->interface->dev,
"%s: nonzero write bulk status received: %d\n",
-   __func__, pUrb->status);
+   __func__, urb->status);
} else
dev_dbg(&ced->interface->dev,
-   "%s: 0 chars pUrb->status=%d (shutdown?)\n",
-   __func__, pUrb->status);
+   "%s: 0 chars urb->status=%d (shutdown?)\n",
+   __func__, urb->status);
 
spin_lock(&ced->err_lock);
-   ced->errors = pUrb->status;
+   ced->errors = urb->status;
spin_unlock(&ced->err_lock);
-   nGot = 0;   /*   and tidy up again if so */
+   got = 0;/*   and tidy up again if so */
 
spin_lock(&ced->char_in_lock);  /*  already at irq level */
-   ced->pipe_error[nPipe] = 1; /*  Flag an error for later */
+   ced->pipe_error[pipe] = 1;  /*  Flag an error for later */
} else {
-   if ((nGot > 1) && ((ced->coher_char_in[0] & 0x7f) == 0x1b)) {   
/*  Esc sequence? */
-   ced_handle_esc(ced, &ced->coher_char_in[1], nGot - 1);  
/*  handle it */
-   spin_lock(&ced->char_in_lock);  /* already at irq level 
*/
+   /* Esc sequence? */
+   if ((got > 1) && ((ced->coher_char_in[0] & 0x7f) == 0x1b)) {
+   /* handle it */
+   ced_handle_esc(ced, &ced->coher_char_in[1], got - 1);
+
+   /* already at irq level */
+   spin_lock(&ced->char_in_lock);
} else {
-   spin_lock(&ced->char_in_lock); /* already at irq level 
*/
-   if (nGot > 0) {
+   /* already at irq level */
+   spin_lock(&ced->char_in_lock);
+
+   if (got > 0) {
unsigned int i;
-   if (nGot < INBUF_SZ) {
-   ced->coher_char_in[nGot] = 0;   /*  
tidy the string */
+   if (got < INBUF_SZ) {
+   /* tidy the string */
+   ced->coher_char_in[got] = 0;
dev_dbg(&ced->interface->dev,
"%s: got %d chars >%s<\n",
-   __func__, nGot,
+   __func__, got,
ced->coher_char_in);
}
-   /*  We know that whatever we read must fit in 
the input buffer */
-   for (i = 0; i < nGot; i++) {
+   /* We know that whatever we read must fit */
+   

[PATCH v2 16/60] staging: ced1401: fix ced_read_huff()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_read_huff()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   45 -
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index d062d5d..0078142 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -984,35 +984,38 @@ static bool ced_read_word(unsigned short *word, char 
*buf, unsigned int *n_done,
 ** to indicate three byte total.
 **
 */
-static bool ced_read_huff(volatile unsigned int *pDWord, char *pBuf,
-unsigned int *pdDone, unsigned int dGot)
+static bool ced_read_huff(volatile unsigned int *word, char *buf,
+unsigned int *n_done, unsigned int got)
 {
-   unsigned char ucData;   /* for each read to ced_read_char */
-   bool bReturn = true;/* assume we will succeed */
-   unsigned int dwData = 0;/* Accumulator for the data */
-
-   if (ced_read_char(&ucData, pBuf, pdDone, dGot)) {
-   dwData = ucData;/* copy the data */
-   if ((dwData & 0x0080) != 0) {   /* Bit set for more 
data ? */
-   dwData &= 0x007F;   /* Clear the relevant bit */
-   if (ced_read_char(&ucData, pBuf, pdDone, dGot)) {
-   dwData = (dwData << 8) | ucData;
-   if ((dwData & 0x4000) != 0) {   /* 
three byte sequence ? */
-   dwData &= 0x3FFF;   /* Clear the 
relevant bit */
+   unsigned char c;/* for each read to ced_read_char */
+   bool retval = true; /* assume we will succeed */
+   unsigned int data = 0;  /* Accumulator for the data */
+
+   if (ced_read_char(&c, buf, n_done, got)) {
+   data = c;   /* copy the data */
+   if ((data & 0x0080) != 0) { /* Bit set for more data ? */
+   data &= 0x007F; /* Clear the relevant bit */
+   if (ced_read_char(&c, buf, n_done, got)) {
+   data = (data << 8) | c;
+
+   /* three byte sequence ? */
+   if ((data & 0x4000) != 0) {
+   /* Clear the relevant bit */
+   data &= 0x3FFF;
if (ced_read_char
-   (&ucData, pBuf, pdDone, dGot))
-   dwData = (dwData << 8) | ucData;
+   (&c, buf, n_done, got))
+   data = (data << 8) | c;
else
-   bReturn = false;
+   retval = false;
}
} else
-   bReturn = false;/* couldn't read data */
+   retval = false; /* couldn't read data */
}
} else
-   bReturn = false;
+   retval = false;
 
-   *pDWord = dwData;   /* return the data */
-   return bReturn;
+   *word = data;   /* return the data */
+   return retval;
 }
 
 /***
-- 
1.7.10.4

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


[PATCH v2 21/60] staging: ced1401: fix ced_ioctl()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_ioctl()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   66 +
 1 file changed, 38 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index 122d521..c8685c1 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -1332,28 +1332,34 @@ int ced_allowi(struct ced_data *ced)
 ** The ioctl entry point to the driver that is used by us to talk to it.
 ** inodeThe device node (no longer in 3.0.0 kernels)
 ** file The file that is open, which holds our ced pointer
-** ulArgThe argument passed in. Note that long is 64-bits in 64-bit 
system, i.e. it is big
-**  enough for a 64-bit pointer.
+** argThe argument passed in. Note that long is 64-bits in 64-bit system,
+**i.e. it is big enough for a 64-bit pointer.
 */
-static long ced_ioctl(struct file *file, unsigned int cmd, unsigned long ulArg)
+static long ced_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
int err = 0;
struct ced_data *ced = file->private_data;
if (!can_accept_io_requests(ced))   /*  check we still exist */
return -ENODEV;
 
-   /*  Check that access is allowed, where is is needed. Anything that 
would have an indeterminate */
-   /*  size will be checked by the specific command. */
-   if (_IOC_DIR(cmd) & _IOC_READ)  /*  read from point of view of user... 
*/
-   err = !access_ok(VERIFY_WRITE, (void __user *)ulArg, 
_IOC_SIZE(cmd));   /*  is kernel write */
-   else if (_IOC_DIR(cmd) & _IOC_WRITE)/*  and write from point of 
view of user... */
-   err = !access_ok(VERIFY_READ, (void __user *)ulArg, 
_IOC_SIZE(cmd));/*  is kernel read */
+   /* Check that access is allowed, where is is needed. Anything that */
+   /* would have an indeterminate size will be checked by the */
+   /* specific command.   */
+   if (_IOC_DIR(cmd) & _IOC_READ) /* read from point of view of user... */
+   /* is kernel write */
+   err = !access_ok(VERIFY_WRITE,
+(void __user *)arg, _IOC_SIZE(cmd));
+   else if (_IOC_DIR(cmd) & _IOC_WRITE) /* and write from point of */
+/* view of user... */
+   /* is kernel read */
+   err = !access_ok(VERIFY_READ,
+(void __user *)arg, _IOC_SIZE(cmd));
if (err)
return -EFAULT;
 
switch (_IOC_NR(cmd)) {
case _IOC_NR(IOCTL_CED_SENDSTRING(0)):
-   return ced_send_string(ced, (const char __user *)ulArg,
+   return ced_send_string(ced, (const char __user *)arg,
  _IOC_SIZE(cmd));
 
case _IOC_NR(IOCTL_CED_RESET1401):
@@ -1363,7 +1369,7 @@ static long ced_ioctl(struct file *file, unsigned int 
cmd, unsigned long ulArg)
return ced_get_char(ced);
 
case _IOC_NR(IOCTL_CED_SENDCHAR):
-   return ced_send_char(ced, (char)ulArg);
+   return ced_send_char(ced, (char)arg);
 
case _IOC_NR(IOCTL_CED_STAT1401):
return ced_stat_1401(ced);
@@ -1372,16 +1378,18 @@ static long ced_ioctl(struct file *file, unsigned int 
cmd, unsigned long ulArg)
return ced_line_count(ced);
 
case _IOC_NR(IOCTL_CED_GETSTRING(0)):
-   return ced_get_string(ced, (char __user *)ulArg, 
_IOC_SIZE(cmd));
+   return ced_get_string(ced, (char __user *)arg, _IOC_SIZE(cmd));
 
case _IOC_NR(IOCTL_CED_SETTRANSFER):
-   return ced_set_transfer(ced, (struct transfer_area_desc __user 
*) ulArg);
+   return ced_set_transfer(ced,
+   (struct transfer_area_desc __user *) arg);
 
case _IOC_NR(IOCTL_CED_UNSETTRANSFER):
-   return ced_unset_transfer(ced, (int)ulArg);
+   return ced_unset_transfer(ced, (int)arg);
 
case _IOC_NR(IOCTL_CED_SETEVENT):
-   return ced_set_event(ced, (struct transfer_event __user *) 
ulArg);
+   return ced_set_event(ced,
+(struct transfer_event __user *) arg);
 
case _IOC_NR(IOCTL_CED_GETOUTBUFSPACE):
return ced_get_out_buf_space(ced);
@@ -1390,10 +1398,11 @@ static long ced_ioctl(struct file *file, unsigned int 
cmd, unsigned long ulArg)
return -1;
 
case _IOC_NR(IOCTL_CED_GETDRIVERREVISION):
-   return (2 << 24) | (DRIVERMAJREV << 16) | DRIVERMINREV; /*  USB 
| MAJOR | MINOR */
+   /* USB | MAJOR | MINOR */
+   return (2 << 24) | (DRIVERMAJREV << 16) | DRIVERMI

[PATCH v2 25/60] staging: ced1401: fix ced_send_string()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_send_string()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   15 ---
 drivers/staging/ced1401/usb1401.h |2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 81289d7..0c96202 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -103,18 +103,19 @@ static int ced_put_chars(struct ced_data *ced, const char 
*ch,
 }
 
 /*
-** Add the data in pData (local pointer) of length n to the output buffer, and
+** Add the data in "data" local pointer of length n to the output buffer, and
 ** trigger an output transfer if this is appropriate. User mode.
 ** Holds the io_mutex
 */
-int ced_send_string(struct ced_data *ced, const char __user *pData,
+int ced_send_string(struct ced_data *ced, const char __user *data,
   unsigned int n)
 {
-   int iReturn = U14ERR_NOERROR;   /*  assume all will be well */
-   char buffer[OUTBUF_SZ + 1]; /*  space in our address space for 
characters */
+   int ret = U14ERR_NOERROR;   /* assume all will be well */
+   char buffer[OUTBUF_SZ + 1]; /* space in our address space */
+   /* for characters */
if (n > OUTBUF_SZ)  /*  check space in local buffer... */
return U14ERR_NOOUT;/*  ...too many characters */
-   if (copy_from_user(buffer, pData, n))
+   if (copy_from_user(buffer, data, n))
return -EFAULT;
buffer[n] = 0;  /*  terminate for debug purposes */
 
@@ -122,13 +123,13 @@ int ced_send_string(struct ced_data *ced, const char 
__user *pData,
if (n > 0) {/*  do nothing if nowt to do! */
dev_dbg(&ced->interface->dev, "%s: n=%d>%s<\n",
__func__, n, buffer);
-   iReturn = ced_put_chars(ced, buffer, n);
+   ret = ced_put_chars(ced, buffer, n);
}
 
ced_allowi(ced);/*  make sure we have input int */
mutex_unlock(&ced->io_mutex);
 
-   return iReturn;
+   return ret;
 }
 
 /
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index f1825a3..0c91562 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -222,7 +222,7 @@ extern int ced_read_write_mem(struct ced_data *ced, bool 
read,
 
 /*  in ced_ioc.c */
 extern int ced_clear_area(struct ced_data *ced, int nArea);
-extern int ced_send_string(struct ced_data *ced, const char __user *pData, 
unsigned int n);
+extern int ced_send_string(struct ced_data *ced, const char __user *data, 
unsigned int n);
 extern int ced_send_char(struct ced_data *ced, char c);
 extern int ced_get_state(struct ced_data *ced, __u32 *state, __u32 *error);
 extern int ced_read_write_cancel(struct ced_data *ced);
-- 
1.7.10.4

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


[PATCH v2 31/60] staging: ced1401: fix ced_get_char()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_get_char()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 350c7d6..9a19c84 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -436,7 +436,7 @@ int ced_reset(struct ced_data *ced)
 /
 int ced_get_char(struct ced_data *ced)
 {
-   int iReturn = U14ERR_NOIN;  /*  assume we will get  nothing */
+   int ret = U14ERR_NOIN;  /*  assume we will get  nothing */
mutex_lock(&ced->io_mutex); /*  Protect disconnect from new i/o */
 
dev_dbg(&ced->interface->dev, "%s\n", __func__);
@@ -446,18 +446,18 @@ int ced_get_char(struct ced_data *ced)
 
spin_lock_irq(&ced->char_in_lock);
if (ced->num_input > 0) {   /*  worth looking */
-   iReturn = ced->input_buffer[ced->in_buff_get++];
+   ret = ced->input_buffer[ced->in_buff_get++];
if (ced->in_buff_get >= INBUF_SZ)
ced->in_buff_get = 0;
ced->num_input--;
} else
-   iReturn = U14ERR_NOIN;  /*  no input data to read */
+   ret = U14ERR_NOIN;  /*  no input data to read */
spin_unlock_irq(&ced->char_in_lock);
 
ced_allowi(ced);/*  Make sure char reads are running */
 
mutex_unlock(&ced->io_mutex);   /*  Protect disconnect from new i/o */
-   return iReturn;
+   return ret;
 }
 
 /
-- 
1.7.10.4

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


[PATCH v2 35/60] staging: ced1401: fix ced_get_out_buf_space()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_get_out_buf_space()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index d7645c4..3f8bf6d 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -585,13 +585,19 @@ int ced_line_count(struct ced_data *ced)
 */
 int ced_get_out_buf_space(struct ced_data *ced)
 {
-   int iReturn;
+   int ret;
+
mutex_lock(&ced->io_mutex); /*  Protect disconnect from new i/o */
+
ced_send_chars(ced);/*  send any buffered chars */
-   iReturn = (int)(OUTBUF_SZ - ced->num_output); /* no lock needed for 
single read */
-   dev_dbg(&ced->interface->dev, "%s: %d\n", __func__, iReturn);
+
+/* no lock needed for single read */
+   ret = (int)(OUTBUF_SZ - ced->num_output);
+
+   dev_dbg(&ced->interface->dev, "%s: %d\n", __func__, ret);
+
mutex_unlock(&ced->io_mutex);   /*  Protect disconnect from new i/o */
-   return iReturn;
+   return ret;
 }
 
 /
-- 
1.7.10.4

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


[PATCH v2 32/60] staging: ced1401: fix ced_get_string()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_get_string()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   58 ++---
 drivers/staging/ced1401/usb1401.h |2 +-
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 9a19c84..28697c0 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -471,10 +471,10 @@ int ced_get_char(struct ced_data *ced)
 ** returns the count of characters (including the terminator, or 0 if none
 ** or a negative error code.
 /
-int ced_get_string(struct ced_data *ced, char __user *pUser, int n)
+int ced_get_string(struct ced_data *ced, char __user *user, int n)
 {
-   int nAvailable; /*  character in the buffer */
-   int iReturn = U14ERR_NOIN;
+   int available;  /*  character in the buffer */
+   int ret = U14ERR_NOIN;
if (n <= 0)
return -ENOMEM;
 
@@ -483,49 +483,49 @@ int ced_get_string(struct ced_data *ced, char __user 
*pUser, int n)
ced_send_chars(ced);/*  and send any buffered chars */
 
spin_lock_irq(&ced->char_in_lock);
-   nAvailable = ced->num_input;/*  characters available now */
-   if (nAvailable > n) /*  read max of space in pUser... */
-   nAvailable = n; /*  ...or input characters */
-
-   if (nAvailable > 0) {   /*  worth looking? */
-   char buffer[INBUF_SZ + 1];  /*  space for a linear copy of 
data */
-   int nGot = 0;
-   int nCopyToUser;/*  number to copy to user */
-   char cData;
+   available = ced->num_input; /*  characters available now */
+   if (available > n)  /*  read max of space in user... */
+   available = n;  /*  ...or input characters */
+
+   if (available > 0) {/*  worth looking? */
+   char buffer[INBUF_SZ + 1]; /* space for a linear copy of data */
+   int got = 0;
+   int n_copy_to_user; /*  number to copy to user */
+   char data;
do {
-   cData = ced->input_buffer[ced->in_buff_get++];
-   if (cData == CR_CHAR)   /*  replace CR with zero */
-   cData = (char)0;
+   data = ced->input_buffer[ced->in_buff_get++];
+   if (data == CR_CHAR)/*  replace CR with zero */
+   data = (char)0;
 
if (ced->in_buff_get >= INBUF_SZ)
-   ced->in_buff_get = 0;   /*  wrap buffer pointer 
*/
+   ced->in_buff_get = 0; /* wrap buffer pointer */
 
-   buffer[nGot++] = cData; /*  save the output */
-   } while ((nGot < nAvailable) && cData);
+   buffer[got++] = data;   /*  save the output */
+   } while ((got < available) && data);
 
-   nCopyToUser = nGot; /*  what to copy... */
-   if (cData) {/*  do we need null */
-   buffer[nGot] = (char)0; /*  make it tidy */
-   if (nGot < n)   /*  if space in user buffer... */
-   ++nCopyToUser;  /*  ...copy the 0 as well. */
+   n_copy_to_user = got;   /*  what to copy... */
+   if (data) { /*  do we need null */
+   buffer[got] = (char)0;  /*  make it tidy */
+   if (got < n)/*  if space in user buffer... */
+   ++n_copy_to_user;   /*  ...copy the 0 as 
well. */
}
 
-   ced->num_input -= nGot;
+   ced->num_input -= got;
spin_unlock_irq(&ced->char_in_lock);
 
dev_dbg(&ced->interface->dev, "%s: read %d characters >%s<\n",
-   __func__, nGot, buffer);
-   if (copy_to_user(pUser, buffer, nCopyToUser))
-   iReturn = -EFAULT;
+   __func__, got, buffer);
+   if (copy_to_user(user, buffer, n_copy_to_user))
+   ret = -EFAULT;
else
-   iReturn = nGot; /*  report characters read */
+   ret = got;  /*  report characters read */
} else
spin_unlock_irq(&ced->char_in_lock);
 
ced_allowi(ced);/*  Make sure char reads are running */
mutex_unlock(&ced->io_mutex);   /*  Protect disconnect from new i/o */
 
-   return iReturn;
+   return ret;
 }
 
 
/***
diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index 0c91562.

[PATCH v2 18/60] staging: ced1401: fix ced_handle_esc()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_handle_esc()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   41 -
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index f360896..f47735f 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -1122,25 +1122,28 @@ static bool ced_read_dma_info(volatile struct dmadesc 
*dma_desc,
 **
 ** Parameters are
 **
-** dwCount - the number of characters in the device extension char in buffer,
+** count - the number of characters in the device extension char in buffer,
 **   this is known to be at least 2 or we will not be called.
 **
 /
-static int ced_handle_esc(struct ced_data *ced, char *pCh,
-unsigned int dwCount)
+static int ced_handle_esc(struct ced_data *ced, char *ch,
+unsigned int count)
 {
-   int iReturn = U14ERR_FAIL;
+   int retval = U14ERR_FAIL;
 
-   /*  I have no idea what this next test is about. '?' is 0x3f, which is 
area 3, code */
-   /*  15. At the moment, this is not used, so it does no harm, but unless 
someone can */
-   /*  tell me what this is for, it should be removed from this and the 
Windows driver. */
-   if (pCh[0] == '?') {/*  Is this an information response */
+   /* I have no idea what this next test is about. '?' is 0x3f, which is */
+   /* area 3, code 15. At the moment, this is not used, so it does no*/
+   /* harm, but unless someone can tell me what this is for, it should   */
+   /* be removed from this and the Windows driver. */
+   if (ch[0] == '?') { /*  Is this an information response */
/*  Parse and save the information */
} else {
spin_lock(&ced->staged_lock);   /*  Lock others out */
 
-   if (ced_read_dma_info(&ced->dma_info, ced, pCh, dwCount)) { 
/*  Get DMA parameters */
-   unsigned short wTransType = ced->dma_info.trans_type;   
/*  check transfer type */
+   /* Get DMA parameters */
+   if (ced_read_dma_info(&ced->dma_info, ced, ch, count)) {
+   /* check transfer type */
+   unsigned short trans_type = ced->dma_info.trans_type;
 
dev_dbg(&ced->interface->dev,
"%s: xfer to %s, offset %d, length %d\n",
@@ -1154,22 +1157,22 @@ static int ced_handle_esc(struct ced_data *ced, char 
*pCh,
dev_err(&ced->interface->dev,
"ERROR: DMA setup while transfer still 
waiting\n");
} else {
-   if ((wTransType == TM_EXTTOHOST)
-   || (wTransType == TM_EXTTO1401)) {
-   iReturn =
+   if ((trans_type == TM_EXTTOHOST)
+   || (trans_type == TM_EXTTO1401)) {
+   retval =
ced_read_write_mem(ced,
 !ced->dma_info.outward,
 ced->dma_info.ident,
 ced->dma_info.offset,
 ced->dma_info.size);
-   if (iReturn != U14ERR_NOERROR)
+   if (retval != U14ERR_NOERROR)
dev_err(&ced->interface->dev,
"%s: 
ced_read_write_mem() failed %d\n",
-   __func__, iReturn);
-   } else  /*  This covers non-linear transfer 
setup */
+   __func__, retval);
+   } else  /* This covers non-linear transfer 
setup */
dev_err(&ced->interface->dev,
"%s: Unknown block xfer type 
%d\n",
-   __func__, wTransType);
+   __func__, trans_type);
}
} else  /*  Failed to read parameters */
dev_err(&ced->interface->dev, "%s: ced_read_dma_info() 
fail\n",
@@ -1178,9 +1181,9 @@ static int ced_handle_esc(struct ced_data *ced, char *pCh,
spin_unlock(&ced->staged_lock); /*  OK here */
}
 
-   dev_dbg(&ced->interface->dev, "%s: returns %d\n", __func__, iReturn);
+   

[PATCH v2 15/60] staging: ced1401: fix ced_read_word()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_read_word()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index 17d1c60..d062d5d 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -959,15 +959,16 @@ static bool ced_read_char(unsigned char *character, char 
*buf,
 **
 ** ced_read_word
 **
-** Reads a word from the 1401, just uses ced_read_char twice; passes on any 
error
+** Reads a word from the 1401, just uses ced_read_char twice;
+** passes on any error
 **
 */
-static bool ced_read_word(unsigned short *pWord, char *pBuf, unsigned int 
*pdDone,
-unsigned int dGot)
+static bool ced_read_word(unsigned short *word, char *buf, unsigned int 
*n_done,
+unsigned int got)
 {
-   if (ced_read_char((unsigned char *)pWord, pBuf, pdDone, dGot))
-   return ced_read_char(((unsigned char *)pWord) + 1, pBuf, pdDone,
-   dGot);
+   if (ced_read_char((unsigned char *)word, buf, n_done, got))
+   return ced_read_char(((unsigned char *)word) + 1, buf, n_done,
+   got);
else
return false;
 }
-- 
1.7.10.4

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


[PATCH v2 08/60] staging: ced1401: fix ced_writechar_callback()

2014-07-10 Thread Luca Ellero
Rename camel case locals in function ced_writechar_callback()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index 7341da0..482431c 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -260,24 +260,24 @@ static bool can_accept_io_requests(struct ced_data *ced)
 ** Callback routine to complete writes. This may need to fire off another
 ** urb to complete the transfer.
 /
-static void ced_writechar_callback(struct urb *pUrb)
+static void ced_writechar_callback(struct urb *urb)
 {
-   struct ced_data *ced = pUrb->context;
-   int nGot = pUrb->actual_length; /*  what we transferred */
+   struct ced_data *ced = urb->context;
+   int got = urb->actual_length;   /*  what we transferred */
 
-   if (pUrb->status) { /*  sync/async unlink faults aren't errors */
+   if (urb->status) {  /*  sync/async unlink faults aren't errors */
if (!
-   (pUrb->status == -ENOENT || pUrb->status == -ECONNRESET
-|| pUrb->status == -ESHUTDOWN)) {
+   (urb->status == -ENOENT || urb->status == -ECONNRESET
+|| urb->status == -ESHUTDOWN)) {
dev_err(&ced->interface->dev,
"%s: nonzero write bulk status received: %d\n",
-   __func__, pUrb->status);
+   __func__, urb->status);
}
 
spin_lock(&ced->err_lock);
-   ced->errors = pUrb->status;
+   ced->errors = urb->status;
spin_unlock(&ced->err_lock);
-   nGot = 0;   /*   and tidy up again if so */
+   got = 0;/*   and tidy up again if so */
 
spin_lock(&ced->char_out_lock); /* already at irq level */
ced->out_buff_get = 0;  /*  Reset the output buffer */
@@ -290,16 +290,16 @@ static void ced_writechar_callback(struct urb *pUrb)
"%s: char out done, 0 chars sent\n", __func__);
} else {
dev_dbg(&ced->interface->dev,
-   "%s: char out done, %d chars sent\n", __func__, nGot);
+   "%s: char out done, %d chars sent\n", __func__, got);
spin_lock(&ced->char_out_lock); /*  already at irq level */
-   ced->num_output -= nGot;/*  Now adjust the char send 
buffer */
-   ced->out_buff_get += nGot;  /*  to match what we did */
+   ced->num_output -= got; /*  Now adjust the char send buffer */
+   ced->out_buff_get += got;   /*  to match what we did */
if (ced->out_buff_get >= OUTBUF_SZ) /*  Can't do this any 
earlier as data could be overwritten */
ced->out_buff_get = 0;
 
if (ced->num_output > 0) {  /*  if more to be done... */
-   int nPipe = 0;  /*  The pipe number to use */
-   int iReturn;
+   int pipe = 0;   /*  The pipe number to use */
+   int ret;
char *pDat = &ced->output_buffer[ced->out_buff_get];
unsigned int dwCount = ced->num_output; /*  maximum to 
send */
if ((ced->out_buff_get + dwCount) > OUTBUF_SZ)  /*  
does it cross buffer end? */
@@ -317,17 +317,17 @@ static void ced_writechar_callback(struct urb *pUrb)
ced->urb_char_out->transfer_flags |=
URB_NO_TRANSFER_DMA_MAP;
usb_anchor_urb(ced->urb_char_out, &ced->submitted); 
/*  in case we need to kill it */
-   iReturn = usb_submit_urb(ced->urb_char_out, GFP_ATOMIC);
+   ret = usb_submit_urb(ced->urb_char_out, GFP_ATOMIC);
dev_dbg(&ced->interface->dev, "%s: n=%d>%s<\n",
__func__, dwCount, pDat);
spin_lock(&ced->char_out_lock); /*  grab lock for 
errors */
-   if (iReturn) {
-   ced->pipe_error[nPipe] = 1; /*  Flag an 
error to be handled later */
+   if (ret) {
+   ced->pipe_error[pipe] = 1;  /*  Flag an 
error to be handled later */
ced->send_chars_pending = false;/*  
Allow other threads again */
usb_unanchor_urb(ced->urb_char_out);
dev_err(&ced->interface->dev,
"%s: usb_submit_urb() returned %d\n",
-   __func__, iRet

[PATCH v2 20/60] staging: ced1401: fix ced_allowi()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_allowi()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   47 -
 1 file changed, 26 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index 4f478bd..122d521 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -1272,32 +1272,35 @@ static void ced_readchar_callback(struct urb *urb)
 /
 int ced_allowi(struct ced_data *ced)
 {
-   int iReturn = U14ERR_NOERROR;
+   int retval = U14ERR_NOERROR;
unsigned long flags;
 
/* can be called in multiple contexts */
spin_lock_irqsave(&ced->char_in_lock, flags);
 
-   /*  We don't want char input running while DMA is in progress as we 
know that this */
-   /*   can cause sequencing problems for the 2270. So don't. It will also 
allow the */
-   /*   ERR response to get back to the host code too early on some PCs, 
even if there */
-   /*   is no actual driver failure, so we don't allow this at all. */
-   if (!ced->in_draw_down &&   /*  stop input if */
-   !ced->read_chars_pending && /*  If no read request outstanding */
-   (ced->num_input < (INBUF_SZ / 2)) &&/*   and there is some 
space */
+   /* We don't want char input running while DMA is in progress as we*/
+   /* know that this can cause sequencing problems for the 2270. So  */
+   /* don't. It will also allow the ERR response to get back to the host */
+   /* code too early on some PCs, even if there is no actual driver  */
+   /* failure, so we don't allow this at all. */
+   if (!ced->in_draw_down &&   /* stop input if */
+   !ced->read_chars_pending && /* If no read request outstanding */
+   (ced->num_input < (INBUF_SZ / 2)) && /*  and there is some space */
(ced->dma_flag == MODE_CHAR) && /*   not doing any DMA */
(!ced->xfer_waiting) &&   /* no xfer waiting to start */
-   (can_accept_io_requests(ced)))  { /*   and activity is 
generally OK */
+   (can_accept_io_requests(ced))) { /* and activity is generally OK */
/*   then off we go */
-   unsigned int nMax = INBUF_SZ - ced->num_input; /*  max we could 
read */
-   int nPipe = ced->n_pipes == 4 ? 1 : 0;  /*  The pipe number to 
use */
+   /* max we could read */
+   unsigned int max = INBUF_SZ - ced->num_input;
+   /* The pipe number to use */
+   int pipe = ced->n_pipes == 4 ? 1 : 0;
 
dev_dbg(&ced->interface->dev, "%s: %d chars in input buffer\n",
__func__, ced->num_input);
 
usb_fill_int_urb(ced->urb_char_in, ced->udev,
-usb_rcvintpipe(ced->udev, ced->ep_addr[nPipe]),
-ced->coher_char_in, nMax, 
ced_readchar_callback,
+usb_rcvintpipe(ced->udev, ced->ep_addr[pipe]),
+ced->coher_char_in, max, ced_readchar_callback,
 ced, ced->interval);
 
/* short xfers are OK by default */
@@ -1306,21 +1309,23 @@ int ced_allowi(struct ced_data *ced)
/* in case we need to kill it */
usb_anchor_urb(ced->urb_char_in, &ced->submitted);
 
-   iReturn = usb_submit_urb(ced->urb_char_in, GFP_ATOMIC);
-   if (iReturn) {
-   usb_unanchor_urb(ced->urb_char_in); /*  remove from 
list of active Urbs */
-   ced->pipe_error[nPipe] = 1; /*  Flag an error to be 
handled later */
+   retval = usb_submit_urb(ced->urb_char_in, GFP_ATOMIC);
+   if (retval) {
+   /* remove from list of active Urbs */
+   usb_unanchor_urb(ced->urb_char_in);
+   /* Flag an error to be handled later */
+   ced->pipe_error[pipe] = 1;
dev_err(&ced->interface->dev,
"%s: submit urb failed: %d\n",
-   __func__, iReturn);
+   __func__, retval);
} else
-   ced->read_chars_pending = true; /*  Flag that we are 
active here */
+   /* Flag that we are active here */
+   ced->read_chars_pending = true;
}
 
spin_unlock_irqrestore(&ced->char_in_lock, flags);
 
-   return iReturn;
-
+   return retval;
 }
 
 /*
-- 
1.7.10.4

___
devel mailing list
de...@linuxdriverproject.org
http://driv

[PATCH v2 10/60] staging: ced1401: fix ced_copy_user_space()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_copy_user_space()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   66 +
 1 file changed, 37 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index b02db1c..019e8c0 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -448,57 +448,65 @@ int ced_send_chars(struct ced_data *ced)
 ***/
 static void ced_copy_user_space(struct ced_data *ced, int n)
 {
-   unsigned int nArea = ced->staged_id;
-   if (nArea < MAX_TRANSAREAS) {
+   unsigned int area = ced->staged_id;
+   if (area < MAX_TRANSAREAS) {
/*  area to be used */
-   struct transarea *pArea = &ced->trans_def[nArea];
-   unsigned int dwOffset =
-   ced->staged_done + ced->staged_offset + pArea->base_offset;
-   char *pCoherBuf = ced->coher_staged_io; /*  coherent buffer */
-   if (!pArea->used) {
+   struct transarea *ta = &ced->trans_def[area];
+   unsigned int offset =
+   ced->staged_done + ced->staged_offset + ta->base_offset;
+   char *coher_buf = ced->coher_staged_io; /*  coherent buffer */
+   if (!ta->used) {
dev_err(&ced->interface->dev, "%s: area %d unused\n",
-   __func__, nArea);
+   __func__, area);
return;
}
 
while (n) {
-   int nPage = dwOffset >> PAGE_SHIFT; /*  page number 
in table */
-   if (nPage < pArea->n_pages) {
-   char *pvAddress =
-   (char *)kmap_atomic(pArea->pages[nPage]);
-   if (pvAddress) {
-   unsigned int uiPageOff = dwOffset & 
(PAGE_SIZE - 1);/*  offset into the page */
-   size_t uiXfer = PAGE_SIZE - uiPageOff;  
/*  max to transfer on this page */
-   if (uiXfer > n) /*  limit byte count if 
too much */
-   uiXfer = n; /*  for the 
page */
+   /*  page number in table */
+   int page = offset >> PAGE_SHIFT;
+
+   if (page < ta->n_pages) {
+   char *address =
+   (char *)kmap_atomic(ta->pages[page]);
+   if (address) {
+   /* offset into the page */
+   unsigned int page_off =
+   offset & (PAGE_SIZE - 1);
+   /* max to transfer on this page */
+   size_t xfer = PAGE_SIZE - page_off;
+
+   /* limit byte count if too much */
+   /* for the page */
+   if (xfer > n)
+   xfer = n;
if (ced->staged_read)
-   memcpy(pvAddress + uiPageOff,
-  pCoherBuf, uiXfer);
+   memcpy(address + page_off,
+  coher_buf, xfer);
else
-   memcpy(pCoherBuf,
-  pvAddress + uiPageOff,
-  uiXfer);
-   kunmap_atomic(pvAddress);
-   dwOffset += uiXfer;
-   pCoherBuf += uiXfer;
-   n -= uiXfer;
+   memcpy(coher_buf,
+  address + page_off,
+  xfer);
+   kunmap_atomic(address);
+   offset += xfer;
+   coher_buf += xfer;
+   n -= xfer;
} else {
dev_err(&ced->interface->dev,
"%s: did not map page %d\n",
-   __func__, nPage);
+   __func__, page);
 

[PATCH v2 09/60] staging: ced1401: fix ced_send_chars()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_send_chars()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   44 ++---
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index 482431c..b02db1c 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -344,33 +344,33 @@ static void ced_writechar_callback(struct urb *urb)
 /
 int ced_send_chars(struct ced_data *ced)
 {
-   int iReturn = U14ERR_NOERROR;
+   int retval = U14ERR_NOERROR;
 
spin_lock_irq(&ced->char_out_lock); /*  Protect ourselves */
 
if ((!ced->send_chars_pending) &&   /*  Not currently sending */
(ced->num_output > 0) &&/*   has characters to output */
(can_accept_io_requests(ced)))  { /*   and current activity is 
OK */
-   unsigned int dwCount = ced->num_output; /* Get a copy of the */
+   unsigned int count = ced->num_output;   /* Get a copy of the */
/* character count   */
ced->send_chars_pending = true; /*  Set flag to lock out other 
threads */
 
dev_dbg(&ced->interface->dev,
"Send %d chars to 1401, EP0 flag %d\n",
-   dwCount, ced->n_pipes == 3);
+   count, ced->n_pipes == 3);
/*  If we have only 3 end points we must send the characters to 
the 1401 using EP0. */
if (ced->n_pipes == 3) {
/*  For EP0 character transmissions to the 1401, we 
have to hang about until they */
/*  are gone, as otherwise without more character IO 
activity they will never go. */
-   unsigned int count = dwCount;   /*  Local char counter 
*/
+   unsigned int i = count; /*  Local char counter */
unsigned int index = 0; /*  The index into the char 
buffer */
 
spin_unlock_irq(&ced->char_out_lock);   /*  Free 
spinlock as we call USBD */
 
-   while ((count > 0) && (iReturn == U14ERR_NOERROR)) {
+   while ((i > 0) && (retval == U14ERR_NOERROR)) {
/*  We have to break the transfer up into 
64-byte chunks because of a 2270 problem */
-   int n = count > 64 ? 64 : count;/*  
Chars for this xfer, max of 64 */
-   int nSent = usb_control_msg(ced->udev,
+   int n = i > 64 ? 64 : i;/*  Chars for 
this xfer, max of 64 */
+   int sent = usb_control_msg(ced->udev,

usb_sndctrlpipe(ced->udev, 0),  /*  use end point 0 */
DB_CHARS,   /*  
bRequest */
(H_TO_D | VENDOR | 
DEVREQ), /*  to the device, vendor request to the device */
@@ -378,16 +378,16 @@ int ced_send_chars(struct ced_data *ced)

&ced->output_buffer[index], /*  where to send from */
n,  /*  how much to 
send */
1000);  /*  
timeout in jiffies */
-   if (nSent <= 0) {
-   iReturn = nSent ? nSent : -ETIMEDOUT;   
/*  if 0 chars says we timed out */
+   if (sent <= 0) {
+   retval = sent ? sent : -ETIMEDOUT;  
/*  if 0 chars says we timed out */
dev_err(&ced->interface->dev,
"Send %d chars by EP0 failed: 
%d\n",
-   n, iReturn);
+   n, retval);
} else {
dev_dbg(&ced->interface->dev,
"Sent %d chars by EP0\n", n);
-   count -= nSent;
-   index += nSent;
+   i -= sent;
+   index += sent;
}
}
 
@@ -397,28 +397,28 @@ int ced_send_chars(struct ced_data *ced)
ced->num_output = 0;/*  and clear the buffer count 
*/
ced->send_chars_pending = false;/*  Allow other 
threads again */
} else {/*  Here for sending chars norm

[PATCH v2 13/60] staging: ced1401: fix ced_read_write_mem()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_read_write_mem()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   86 +
 drivers/staging/ced1401/usb1401.h |5 ++-
 2 files changed, 52 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index e0d7aa0..8007085 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -825,19 +825,20 @@ static int ced_stage_chunk(struct ced_data *ced)
 **
 ** Arguments:
 **DeviceObject - pointer to our FDO (Functional Device Object)
-**Read - TRUE for read, FALSE for write. This is from POV of the driver
-**wIdent - the transfer area number - defines memory area and more.
-**dwOffs - the start offset within the transfer area of the start of this
+**read - TRUE for read, FALSE for write. This is from POV of the driver
+**ident - the transfer area number - defines memory area and more.
+**offs - the start offset within the transfer area of the start of this
 ** transfer.
-**dwLen - the number of bytes to transfer.
+**len - the number of bytes to transfer.
 */
-int ced_read_write_mem(struct ced_data *ced, bool Read, unsigned short wIdent,
-unsigned int dwOffs, unsigned int dwLen)
+int ced_read_write_mem(struct ced_data *ced, bool read, unsigned short ident,
+unsigned int offs, unsigned int len)
 {
/* Transfer area info */
-   struct transarea *pArea = &ced->trans_def[wIdent];
+   struct transarea *ta = &ced->trans_def[ident];
 
-   if (!can_accept_io_requests(ced)) { /*  Are we in a state to accept 
new requests? */
+   /*  Are we in a state to accept new requests? */
+   if (!can_accept_io_requests(ced)) {
dev_err(&ced->interface->dev, "%s: can't accept requests\n",
__func__);
return U14ERR_FAIL;
@@ -845,10 +846,11 @@ int ced_read_write_mem(struct ced_data *ced, bool Read, 
unsigned short wIdent,
 
dev_dbg(&ced->interface->dev,
"%s: xfer %d bytes to %s, offset %d, area %d\n",
-   __func__, dwLen, Read ? "host" : "1401", dwOffs, wIdent);
+   __func__, len, read ? "host" : "1401", offs, ident);
 
-   /*  Amazingly, we can get an escape sequence back before the current 
staged Urb is done, so we */
-   /*   have to check for this situation and, if so, wait until all is OK. 
*/
+   /* Amazingly, we can get an escape sequence back before the current   */
+   /* staged Urb is done, so we have to check for this situation and, if */
+   /* so, wait until all is OK. */
if (ced->staged_urb_pending) {
ced->xfer_waiting = true;   /*  Flag we are waiting */
dev_info(&ced->interface->dev,
@@ -857,36 +859,46 @@ int ced_read_write_mem(struct ced_data *ced, bool Read, 
unsigned short wIdent,
return U14ERR_NOERROR;
}
 
-   if (dwLen == 0) {   /*  allow 0-len read or write; just 
return success */
+   if (len == 0) { /* allow 0-len read or write; just return success */
dev_dbg(&ced->interface->dev,
"%s: OK; zero-len read/write request\n", __func__);
return U14ERR_NOERROR;
}
 
-   if ((pArea->circular) &&/*  Circular transfer? */
-   (pArea->circ_to_host) && (Read)) {  /*  In a supported direction */
+   if ((ta->circular) &&   /*  Circular transfer? */
+   (ta->circ_to_host) && (read)) { /*  In a supported direction */
/*  If so, we sort out offset ourself */
bool bWait = false; /*  Flag for transfer having to wait */
 
dev_dbg(&ced->interface->dev,
"Circular buffers are %d at %d and %d at %d\n",
-   pArea->blocks[0].size, pArea->blocks[0].offset,
-   pArea->blocks[1].size, pArea->blocks[1].offset);
-   if (pArea->blocks[1].size > 0) {/*  Using the second 
block already? */
-   dwOffs = pArea->blocks[1].offset + 
pArea->blocks[1].size;   /*  take offset from that */
-   bWait = (dwOffs + dwLen) > pArea->blocks[0].offset; 
/*  Wait if will overwrite block 0? */
-   bWait |= (dwOffs + dwLen) > pArea->length;  /*  or 
if it overflows the buffer */
-   } else {/*  Area 1 not in use, try to use area 
0 */
-   if (pArea->blocks[0].size == 0) /*  Reset block 0 if 
not in use */
-   pArea->blocks[0].offset = 0;
-   dwOffs =
-   pArea->blocks[0].offset +
-   pArea->blocks[0].size;
-   if ((dwOffs + dwLen) > pArea->length) { /*  Off the end 
of the 

[PATCH v2 05/60] staging: ced1401: rename members of struct transarea

2014-07-10 Thread Luca Ellero
Rename members with CamelCase and Hungarian notation

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |  118 
 drivers/staging/ced1401/usb1401.c |  137 +++--
 drivers/staging/ced1401/usb1401.h |   39 ++-
 3 files changed, 152 insertions(+), 142 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 20acda2..2eb1eb9 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -595,7 +595,7 @@ int ced_clear_area(struct ced_data *ced, int nArea)
} else {
/* to save typing */
struct transarea *pTA = &ced->rTransDef[nArea];
-   if (!pTA->bUsed)/*  if not used... */
+   if (!pTA->used) /*  if not used... */
iReturn = U14ERR_NOTSET;/*  ...nothing to be 
done */
else {
/*  We must save the memory we return as we shouldn't 
mess with memory while */
@@ -614,17 +614,17 @@ int ced_clear_area(struct ced_data *ced, int nArea)
"%s: call on area %d while active\n",
__func__, nArea);
} else {
-   pPages = pTA->pPages;   /*  save page address 
list */
-   nPages = pTA->nPages;   /*  and page count */
-   if (pTA->dwEventSz) /*  if events flagging 
in use */
-   wake_up_interruptible(&pTA->wqEvent);   
/*  release anything that was waiting */
+   pPages = pTA->pages;/*  save page address 
list */
+   nPages = pTA->n_pages;  /*  and page count */
+   if (pTA->event_sz)  /*  if events flagging 
in use */
+   wake_up_interruptible(&pTA->event); 
/*  release anything that was waiting */
 
if (ced->bXFerWaiting
&& (ced->rDMAInfo.wIdent == nArea))
ced->bXFerWaiting = false;  /*  
Cannot have pending xfer if area cleared */
 
/*  Clean out the struct transarea except for 
the wait queue, which is at the end */
-   /*  This sets bUsed to false and dwEventSz to 0 
to say area not used and no events. */
+   /*  This sets used to false and event_sz to 0 
to say area not used and no events. */
memset(pTA, 0,
   sizeof(struct transarea) -
   sizeof(wait_queue_head_t));
@@ -701,20 +701,20 @@ static int ced_set_area(struct ced_data *ced, int nArea, 
char __user *puBuf,
/*  kmap() or kmap_atomic() to get a virtual address. 
page_address will give you */
/*  (null) or at least it does in this context with an x86 
machine. */
spin_lock_irq(&ced->stagedLock);
-   pTA->lpvBuff = puBuf;   /*  keep start of region (user address) 
*/
-   pTA->dwBaseOffset = ulOffset;   /*  save offset in first page 
to start of xfer */
-   pTA->dwLength = dwLength;   /*  Size if the region in bytes 
*/
-   pTA->pPages = pPages;   /*  list of pages that are used by 
buffer */
-   pTA->nPages = nPages;   /*  number of pages */
+   pTA->buff = puBuf;  /*  keep start of region (user address) 
*/
+   pTA->base_offset = ulOffset;/*  save offset in first page 
to start of xfer */
+   pTA->length = dwLength; /*  Size if the region in bytes */
+   pTA->pages = pPages;/*  list of pages that are used by 
buffer */
+   pTA->n_pages = nPages;  /*  number of pages */
 
-   pTA->bCircular = bCircular;
-   pTA->bCircToHost = bCircToHost;
+   pTA->circular = bCircular;
+   pTA->circ_to_host = bCircToHost;
 
-   pTA->aBlocks[0].offset = 0;
-   pTA->aBlocks[0].size = 0;
-   pTA->aBlocks[1].offset = 0;
-   pTA->aBlocks[1].size = 0;
-   pTA->bUsed = true;  /*  This is now a used block */
+   pTA->blocks[0].offset = 0;
+   pTA->blocks[0].size = 0;
+   pTA->blocks[1].offset = 0;
+   pTA->blocks[1].size = 0;
+   pTA->used = true;   /*  This is now a used block */
 
spin_unlock_irq(&ced->stagedLock);
iReturn = U14ERR_NOERROR;   /*  say all was well */
@@ -795,11 +795,11 @@ int ced_set_event(struct ced_data *ced, struct 
transfer_event __user *pTE)
struct transarea *pTA = &ced->rTransDef[te.wAreaNum];
mutex_loc

[PATCH v2 30/60] staging: ced1401: fix ced_quick_check()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_quick_check()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   36 +++-
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 194aa18..350c7d6 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -366,50 +366,52 @@ static bool ced_is_1401(struct ced_data *ced)
 **  all is OK.
 **
 ** If any of the above conditions are not met, or if the state or type of the
-**  1401 has changed since the previous test, the full ced_is_1401 test is 
done, but
-**  only if bCanReset is also TRUE.
+**  1401 has changed since the previous test, the full ced_is_1401 test is 
done,
+** but only if can_reset is also TRUE.
 **
 ** The return value is TRUE if a useable 1401 is found, FALSE if not
 */
-static bool ced_quick_check(struct ced_data *ced, bool bTestBuff, bool 
bCanReset)
+static bool ced_quick_check(struct ced_data *ced, bool test_buff,
+   bool can_reset)
 {
-   bool bRet = false;  /*  assume it will fail and we will reset */
-   bool bShortTest;
+   bool ret = false;   /*  assume it will fail and we will reset */
+   bool short_test;
 
-   bShortTest = ((ced->dma_flag == MODE_CHAR) &&   /*  no DMA running */
- (!ced->force_reset) &&/*  Not had a real reset forced 
*/
- (ced->current_state >= U14ERR_STD));  /*  No 1401 
errors stored */
+   short_test = ((ced->dma_flag == MODE_CHAR) &&   /*  no DMA running */
+ (!ced->force_reset) && /* Not had a real reset forced */
+ (ced->current_state >= U14ERR_STD)); /* No 1401 errors 
stored */
 
dev_dbg(&ced->interface->dev,
"%s: DMAFlag:%d, state:%d, force:%d, testBuff:%d, short:%d\n",
__func__, ced->dma_flag, ced->current_state, ced->force_reset,
-   bTestBuff, bShortTest);
+   test_buff, short_test);
 
-   if ((bTestBuff) &&  /*  Buffer check requested, and... */
+   if ((test_buff) &&  /*  Buffer check requested, and... */
(ced->num_input || ced->num_output)) {  /*  ...characters were 
in the buffer? */
-   bShortTest = false; /*  Then do the full test */
+   short_test = false; /*  Then do the full test */
dev_dbg(&ced->interface->dev,
"%s: will reset as buffers not empty\n", __func__);
}
 
-   if (bShortTest || !bCanReset) { /*  Still OK to try the short test? */
+   if (short_test || !can_reset) { /*  Still OK to try the short test? */
/*  Always test if no reset - we want state 
update */
unsigned int state, error;
dev_dbg(&ced->interface->dev, "%s: ced_get_state\n", __func__);
if (ced_get_state(ced, &state, &error) == U14ERR_NOERROR) { 
/*  Check on the 1401 state */
if ((state & 0xFF) == 0)/*  If call worked, 
check the status value */
-   bRet = true;/*  If that was zero, all is 
OK, no reset needed */
+   ret = true; /* If that was zero, all is OK, */
+   /* no reset needed  */
}
}
 
-   if (!bRet && bCanReset) { /*  If all not OK, then */
+   if (!ret && can_reset)  { /*  If all not OK, then */
dev_info(&ced->interface->dev, "%s: ced_is_1401 %d %d %d %d\n",
-__func__, bShortTest, ced->current_state, bTestBuff,
+__func__, short_test, ced->current_state, test_buff,
 ced->force_reset);
-   bRet = ced_is_1401(ced);/*   do full test */
+   ret = ced_is_1401(ced); /*   do full test */
}
 
-   return bRet;
+   return ret;
 }
 
 /
-- 
1.7.10.4

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


[PATCH v2 12/60] staging: ced1401: fix ced_stage_chunk()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function ced_stage_chunk()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |   53 ++---
 1 file changed, 31 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index 99c8d2f..e0d7aa0 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -757,16 +757,19 @@ static void staged_callback(struct urb *urb)
 ** Generates the next chunk of data making up a staged transfer.
 **
 ** The calling code must have acquired the staging spinlock before calling
-**  this function, and is responsible for releasing it. We are at callback 
level.
+** this function, and is responsible for releasing it. We are at callback 
level.
 /
 static int ced_stage_chunk(struct ced_data *ced)
 {
-   int iReturn = U14ERR_NOERROR;
-   unsigned int ChunkSize;
-   int nPipe = ced->staged_read ? 3 : 2;   /*  The pipe number to use for 
reads or writes */
+   int retval = U14ERR_NOERROR;
+   unsigned int chunk_size;
+   int pipe = ced->staged_read ? 3 : 2; /* The pipe number to use for */
+/* reads or writes*/
+
if (ced->n_pipes == 3)
-   nPipe--;/*  Adjust for the 3-pipe case */
-   if (nPipe < 0)  /*  and trap case that should never happen */
+   pipe--; /* Adjust for the 3-pipe case */
+
+   if (pipe < 0)   /* and trap case that should never happen */
return U14ERR_FAIL;
 
if (!can_accept_io_requests(ced)) { /*  got sudden remove? */
@@ -775,34 +778,40 @@ static int ced_stage_chunk(struct ced_data *ced)
return U14ERR_FAIL; /*  could do with a better error */
}
 
-   ChunkSize = (ced->staged_length - ced->staged_done);/*  transfer 
length remaining */
-   if (ChunkSize > STAGED_SZ)  /*  make sure to keep legal */
-   ChunkSize = STAGED_SZ;  /*   limit to max allowed */
+   /* transfer length remaining */
+   chunk_size = (ced->staged_length - ced->staged_done);
+   if (chunk_size > STAGED_SZ) /*  make sure to keep legal */
+   chunk_size = STAGED_SZ; /*   limit to max allowed */
 
if (!ced->staged_read)  /*  if writing... */
-   ced_copy_user_space(ced, ChunkSize);/*  ...copy data into 
the buffer */
+   /* ...copy data into the buffer */
+   ced_copy_user_space(ced, chunk_size);
 
usb_fill_bulk_urb(ced->staged_urb, ced->udev,
  ced->staged_read ? usb_rcvbulkpipe(ced->udev,
ced->
-   ep_addr[nPipe]) :
- usb_sndbulkpipe(ced->udev, ced->ep_addr[nPipe]),
- ced->coher_staged_io, ChunkSize,
+   ep_addr[pipe]) :
+ usb_sndbulkpipe(ced->udev, ced->ep_addr[pipe]),
+ ced->coher_staged_io, chunk_size,
  staged_callback, ced);
ced->staged_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
-   usb_anchor_urb(ced->staged_urb, &ced->submitted);   /*  in case we 
need to kill it */
-   iReturn = usb_submit_urb(ced->staged_urb, GFP_ATOMIC);
-   if (iReturn) {
+   /* in case we need to kill it */
+   usb_anchor_urb(ced->staged_urb, &ced->submitted);
+   retval = usb_submit_urb(ced->staged_urb, GFP_ATOMIC);
+   if (retval) {
usb_unanchor_urb(ced->staged_urb);  /*  kill it */
-   ced->pipe_error[nPipe] = 1; /*  Flag an error to be handled 
later */
-   dev_err(&ced->interface->dev, "%s: submit urb failed, code 
%d\n",
-   __func__, iReturn);
+   ced->pipe_error[pipe] = 1; /* Flag an error to be */
+  /* handled later   */
+   dev_err(&ced->interface->dev,
+   "%s: submit urb failed, code %d\n",
+   __func__, retval);
} else
-   ced->staged_urb_pending = true; /*  Set the flag for staged URB 
pending */
+   /* Set the flag for staged URB pending */
+   ced->staged_urb_pending = true;
dev_dbg(&ced->interface->dev, "%s: done so far:%d, this size:%d\n",
-   __func__, ced->staged_done, ChunkSize);
+   __func__, ced->staged_done, chunk_size);
 
-   return iReturn;
+   return retval;
 }
 
 /***
-- 
1.7.10.4

___
devel mailing list
de...@linuxdriv

[PATCH v2 01/60] staging: ced1401: remove typedef for TRANSAREA

2014-07-10 Thread Luca Ellero
Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/ced_ioc.c |   21 -
 drivers/staging/ced1401/usb1401.c |9 ++---
 drivers/staging/ced1401/usb1401.h |6 +++---
 3 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index 36cf974..f6f681f 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -593,7 +593,8 @@ int ced_clear_area(DEVICE_EXTENSION *pdx, int nArea)
dev_err(&pdx->interface->dev, "%s: Attempt to clear area %d\n",
__func__, nArea);
} else {
-   TRANSAREA *pTA = &pdx->rTransDef[nArea];/*  to save 
typing */
+   /* to save typing */
+   struct transarea *pTA = &pdx->rTransDef[nArea];
if (!pTA->bUsed)/*  if not used... */
iReturn = U14ERR_NOTSET;/*  ...nothing to be 
done */
else {
@@ -622,10 +623,10 @@ int ced_clear_area(DEVICE_EXTENSION *pdx, int nArea)
&& (pdx->rDMAInfo.wIdent == nArea))
pdx->bXFerWaiting = false;  /*  
Cannot have pending xfer if area cleared */
 
-   /*  Clean out the TRANSAREA except for the wait 
queue, which is at the end */
+   /*  Clean out the struct transarea except for 
the wait queue, which is at the end */
/*  This sets bUsed to false and dwEventSz to 0 
to say area not used and no events. */
memset(pTA, 0,
-  sizeof(TRANSAREA) -
+  sizeof(struct transarea) -
   sizeof(wait_queue_head_t));
}
spin_unlock_irq(&pdx->stagedLock);
@@ -670,7 +671,7 @@ static int ced_set_area(DEVICE_EXTENSION *pdx, int nArea, 
char __user *puBuf,
unsigned int ulOffset = ((unsigned long)puBuf) & (PAGE_SIZE - 1);
int len = (dwLength + ulOffset + PAGE_SIZE - 1) >> PAGE_SHIFT;
 
-   TRANSAREA *pTA = &pdx->rTransDef[nArea];/*  to save typing */
+   struct transarea *pTA = &pdx->rTransDef[nArea]; /*  to save typing */
struct page **pPages = NULL;/*  space for page tables */
int nPages = 0; /*  and number of pages */
 
@@ -791,7 +792,7 @@ int ced_set_event(DEVICE_EXTENSION *pdx, struct 
transfer_event __user *pTE)
if (te.wAreaNum >= MAX_TRANSAREAS)  /*  the area must exist */
return U14ERR_BADAREA;
else {
-   TRANSAREA *pTA = &pdx->rTransDef[te.wAreaNum];
+   struct transarea *pTA = &pdx->rTransDef[te.wAreaNum];
mutex_lock(&pdx->io_mutex); /*  make sure we have no 
competitor */
spin_lock_irq(&pdx->stagedLock);
if (pTA->bUsed) {   /*  area must be in use */
@@ -821,7 +822,7 @@ int ced_wait_event(DEVICE_EXTENSION *pdx, int nArea, int 
msTimeOut)
return U14ERR_BADAREA;
else {
int iWait;
-   TRANSAREA *pTA = &pdx->rTransDef[nArea];
+   struct transarea *pTA = &pdx->rTransDef[nArea];
msTimeOut = (msTimeOut * HZ + 999) / 1000;  /*  convert 
timeout to jiffies */
 
/*  We cannot wait holding the mutex, but we check the flags 
while holding */
@@ -867,7 +868,7 @@ int ced_test_event(DEVICE_EXTENSION *pdx, int nArea)
if ((unsigned)nArea >= MAX_TRANSAREAS)
iReturn = U14ERR_BADAREA;
else {
-   TRANSAREA *pTA = &pdx->rTransDef[nArea];
+   struct transarea *pTA = &pdx->rTransDef[nArea];
mutex_lock(&pdx->io_mutex); /*  make sure we have no 
competitor */
spin_lock_irq(&pdx->stagedLock);
iReturn = pTA->iWakeUp; /*  get wakeup count since last call */
@@ -1354,7 +1355,8 @@ int ced_get_circ_block(DEVICE_EXTENSION *pdx, TCIRCBLOCK 
__user *pCB)
cb.dwSize = 0;
 
if (nArea < MAX_TRANSAREAS) {   /*  The area number must be OK */
-   TRANSAREA *pArea = &pdx->rTransDef[nArea];  /*  Pointer to 
relevant info */
+   /* Pointer to relevant info */
+   struct transarea *pArea = &pdx->rTransDef[nArea];
spin_lock_irq(&pdx->stagedLock);/*  Lock others out */
 
if ((pArea->bUsed) && (pArea->bCircular) && /*  Must be 
circular area */
@@ -1405,7 +1407,8 @@ int ced_free_circ_block(DEVICE_EXTENSION *pdx, TCIRCBLOCK 
__user *pCB)
cb.dwSize = 0;
 
if (nArea < MAX_TRANSAREAS) {   /*  The area number must be OK */
-   TRANSAREA *pArea = &pdx->rTransDef[nArea];  /*  Pointer to 
relevant info */
+   /* Pointer to relevant info */
+   struct transar

[PATCH v2 11/60] staging: ced1401: fix staged_callback()

2014-07-10 Thread Luca Ellero
Rename camel case arguments and locals in function staged_callback()

Signed-off-by: Luca Ellero 
---
 drivers/staging/ced1401/usb1401.c |  254 +
 1 file changed, 147 insertions(+), 107 deletions(-)

diff --git a/drivers/staging/ced1401/usb1401.c 
b/drivers/staging/ced1401/usb1401.c
index 019e8c0..99c8d2f 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -511,202 +511,242 @@ static void ced_copy_user_space(struct ced_data *ced, 
int n)
 
 /*  Forward declarations for stuff used circularly */
 static int ced_stage_chunk(struct ced_data *ced);
+
 /***
 ** ReadWrite_Complete
 **
 **  Completion routine for our staged read/write Irps
 */
-static void staged_callback(struct urb *pUrb)
+static void staged_callback(struct urb *urb)
 {
-   struct ced_data *ced = pUrb->context;
-   unsigned int nGot = pUrb->actual_length;/*  what we transferred 
*/
-   bool bCancel = false;
-   bool bRestartCharInput; /*  used at the end */
+   struct ced_data *ced = urb->context;
+   unsigned int got = urb->actual_length;  /*  what we transferred */
+   bool cancel = false;
+   bool restart_char_input;/*  used at the end */
 
spin_lock(&ced->staged_lock); /* stop ced_read_write_mem() action */
  /* while this routine is running*/
-   ced->staged_urb_pending = false; /*  clear the flag for staged IRP 
pending */
 
-   if (pUrb->status) { /*  sync/async unlink faults aren't errors */
+/* clear the flag for staged IRP pending */
+   ced->staged_urb_pending = false;
+
+   if (urb->status) {  /*  sync/async unlink faults aren't errors */
if (!
-   (pUrb->status == -ENOENT || pUrb->status == -ECONNRESET
-|| pUrb->status == -ESHUTDOWN)) {
+   (urb->status == -ENOENT || urb->status == -ECONNRESET
+|| urb->status == -ESHUTDOWN)) {
dev_err(&ced->interface->dev,
"%s: nonzero write bulk status received: %d\n",
-   __func__, pUrb->status);
+   __func__, urb->status);
} else
dev_info(&ced->interface->dev,
 "%s: staged xfer cancelled\n", __func__);
 
spin_lock(&ced->err_lock);
-   ced->errors = pUrb->status;
+   ced->errors = urb->status;
spin_unlock(&ced->err_lock);
-   nGot = 0;   /*   and tidy up again if so */
-   bCancel = true;
+   got = 0;/*   and tidy up again if so */
+   cancel = true;
} else {
dev_dbg(&ced->interface->dev, "%s: %d chars xferred\n",
-   __func__, nGot);
-   if (ced->staged_read)   /*  if reading, save to user space */
-   ced_copy_user_space(ced, nGot); /*  copy from buffer to 
user */
-   if (nGot == 0)
+   __func__, got);
+   if (ced->staged_read)   /* if reading, save to user space */
+   /* copy from buffer to user */
+   ced_copy_user_space(ced, got);
+   if (got == 0)
dev_dbg(&ced->interface->dev, "%s: ZLP\n", __func__);
}
 
-   /*  Update the transfer length based on the TransferBufferLength value 
in the URB */
-   ced->staged_done += nGot;
+   /* Update the transfer length based on the TransferBufferLength value */
+   /* in the URB */
+   ced->staged_done += got;
 
dev_dbg(&ced->interface->dev, "%s: done %d bytes of %d\n",
__func__, ced->staged_done, ced->staged_length);
 
-   if ((ced->staged_done == ced->staged_length) || /*  If no more to do */
-   (bCancel)) {/*  or this IRP was cancelled */
+   if ((ced->staged_done == ced->staged_length) || /* If no more to do */
+   (cancel)) { /*  or this IRP was cancelled */
/*  Transfer area info */
-   struct transarea *pArea = &ced->trans_def[ced->staged_id];
+   struct transarea *ta = &ced->trans_def[ced->staged_id];
+
dev_dbg(&ced->interface->dev,
"%s: transfer done, bytes %d, cancel %d\n",
-   __func__, ced->staged_done, bCancel);
-
-   /*  Here is where we sort out what to do with this transfer if 
using a circular buffer. We have */
-   /*   a completed transfer that can be assumed to fit into the 
transfer area. We should be able to */
-   /*   add this to the end of a growing block or to use it to 
start a new block unless the 

  1   2   >