Re: [PATCH 04/10] staging: unisys: fix all logical continuation virthba

2014-10-28 Thread Dan Carpenter
On Mon, Oct 27, 2014 at 05:14:02PM -0400, Erik Arfvidson wrote:
 This patch fixes all logical continuations issues in virthba.c
 
 Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
 ---
  drivers/staging/unisys/virthba/virthba.c | 42 
 
  1 file changed, 21 insertions(+), 21 deletions(-)
 
 diff --git a/drivers/staging/unisys/virthba/virthba.c 
 b/drivers/staging/unisys/virthba/virthba.c
 index 6c0ee48..73a7307 100644
 --- a/drivers/staging/unisys/virthba/virthba.c
 +++ b/drivers/staging/unisys/virthba/virthba.c
 @@ -431,10 +431,10 @@ virthba_ISR(int irq, void *dev_id)
   virthbainfo-interrupts_rcvd++;
   pChannelHeader = virthbainfo-chinfo.queueinfo-chan;
   if (((readq(pChannelHeader-Features)
 -ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS) != 0)
 -  ((readq(pChannelHeader-Features) 
 -  ULTRA_IO_DRIVER_DISABLES_INTS) !=
 - 0)) {
 +   ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS) != 0) 

This isn't right.

foo means address.
 foo means bitwise AND.

!= 0 doesn't add anything here.  When you have if (strcmp(a, b) != 0)
that's idiomatic and the != means a != b.  When you are talking about
the number zero then not equal to zero can be appropriate.  But in this
case it's just a double negative that makes the code slightly not easier
to understand.

The ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS is clown shoes
name.  It's silly long.

Also the last  should be a logical .

You can fix this stuff up in a later patch since it doesn't have to do
with whitespace.

TODO-list: 2014-10-28: unisys: various style issues

regards,
dan carpenter

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


Re: [PATCH] staging: skein: skein_api.c: removed space before ','

2014-10-28 Thread Dan Carpenter
On Mon, Oct 27, 2014 at 11:17:02PM +0100, Mikael Svantesson wrote:
 Signed-off-by: Mikael Svantesson mik...@distopic.net

The patch is corrupt (and in a totally weird way as well).  Please read
the first paragraph for Documentation/email-clients.txt.

regards,
dan carpenter

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


Re: [patch] Documentation/SubmittingPatches: Reported-by tags and permission

2014-10-28 Thread Jonathan Corbet
On Fri, 14 Feb 2014 12:30:01 +0300
Dan Carpenter dan.carpen...@oracle.com wrote:

 -If this patch fixes a problem reported by somebody else, consider adding a
 -Reported-by: tag to credit the reporter for their contribution.  Please
 -note that this tag should not be added without the reporter's permission,
 -especially if the problem was not reported in a public forum.  That said,
 -if we diligently credit our bug reporters, they will, hopefully, be
 -inspired to help us again in the future.
 +The Reported-by tag is to give credit to people who find bugs and report 
 them.
 +Please note that if the bug was reported in private, then ask for permission
 +first before using the Reported-by tag.

As the guy who wrote the original text, I think this is an
improvement...but can we get a version that retains the motivation for
crediting bug reporters in the first place?

Thanks,

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


[PATCH] staging: comedi: comedi_test: fix timer lock-up

2014-10-28 Thread Ian Abbott
Commit 240512474424 (staging: comedi: comedi_test: use
comedi_handle_events()) resulted in the timer routine
`waveform_ai_interrupt()` calling `comedi_handle_events()` instead of
`comedi_events()`.  That had the advantage of automatically stopping the
acquisition on overflow/error/end-of-acquisition conditions (by calling
the comedi subdevice's cancel handler), but currently results in the
timer routine locking when one of those conditions occur.  This is
because the cancel handler `waveform_ai_cancel()` calls
`del_timer_sync()`.

Fix it by adding a bit to the device private data that indicates whether
the acquisition is active or not, and changing the cancel handler to
use `del_timer()` instead of `del_timer_sync()`.  The bit is set when
starting the acquisition, cleared when ending the acquisition (in the
cancel handler), and tested in the timer routine, which will do
nothing if the acquisition is inactive.  Also, make sure any scheduled
timeout event gets cancelled when the low-level device gets detached
from the comedi core by calling `del_timer_sync()` in the detach
handler `waveform_detach()`.

Fixes: 240512474424 (staging: comedi: comedi_test: use comedi_handle_events())
Signed-off-by: Ian Abbott abbo...@mev.co.uk
---
Greg, this fix is for linux-next and staging-next.
---
 drivers/staging/comedi/drivers/comedi_test.c | 21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/comedi_test.c 
b/drivers/staging/comedi/drivers/comedi_test.c
index 8845075..d4fa855 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -55,6 +55,10 @@ zero volts).
 
 #define N_CHANS 8
 
+enum waveform_state_bits {
+   WAVEFORM_AI_RUNNING = 0
+};
+
 /* Data unique to this driver */
 struct waveform_private {
struct timer_list timer;
@@ -64,6 +68,7 @@ struct waveform_private {
unsigned long usec_current; /* current time (mod waveform period) */
unsigned long usec_remainder;   /* usec since last scan */
unsigned long ai_count; /* number of conversions remaining */
+   unsigned long state_bits;
unsigned int scan_period;   /* scan period in usec */
unsigned int convert_period;/* conversion period in usec */
unsigned int ao_loopbacks[N_CHANS];
@@ -174,6 +179,10 @@ static void waveform_ai_interrupt(unsigned long arg)
struct timeval now;
bool stopping = false;
 
+   /* check command is still active */
+   if (!test_bit(WAVEFORM_AI_RUNNING, devpriv-state_bits))
+   return;
+
do_gettimeofday(now);
 
elapsed_time =
@@ -322,6 +331,10 @@ static int waveform_ai_cmd(struct comedi_device *dev,
devpriv-usec_remainder = 0;
 
devpriv-timer.expires = jiffies + 1;
+   /* mark command as active */
+   smp_mb__before_atomic();
+   set_bit(WAVEFORM_AI_RUNNING, devpriv-state_bits);
+   smp_mb__after_atomic();
add_timer(devpriv-timer);
return 0;
 }
@@ -331,7 +344,11 @@ static int waveform_ai_cancel(struct comedi_device *dev,
 {
struct waveform_private *devpriv = dev-private;
 
-   del_timer_sync(devpriv-timer);
+   /* mark command as no longer active */
+   clear_bit(WAVEFORM_AI_RUNNING, devpriv-state_bits);
+   smp_mb__after_atomic();
+   /* cannot call del_timer_sync() as may be called from timer routine */
+   del_timer(devpriv-timer);
return 0;
 }
 
@@ -433,7 +450,7 @@ static void waveform_detach(struct comedi_device *dev)
struct waveform_private *devpriv = dev-private;
 
if (devpriv)
-   waveform_ai_cancel(dev, dev-read_subdev);
+   del_timer_sync(devpriv-timer);
 }
 
 static struct comedi_driver waveform_driver = {
-- 
2.1.1

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


[PATCH] staging: unisys: fix macro spacing in uisutils.h

2014-10-28 Thread Benjamin Romer
Add some space between the macros in uisutils.h for readability.

Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com
---
 drivers/staging/unisys/include/uisutils.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/unisys/include/uisutils.h 
b/drivers/staging/unisys/include/uisutils.h
index 20758ae..7414220 100644
--- a/drivers/staging/unisys/include/uisutils.h
+++ b/drivers/staging/unisys/include/uisutils.h
@@ -179,11 +179,14 @@ struct chaninfo {
set_current_state(TASK_INTERRUPTIBLE); \
schedule_timeout(msecs_to_jiffies(x)); \
 }
+
 #define UIS_THREAD_WAIT_USEC(x) { \
set_current_state(TASK_INTERRUPTIBLE); \
schedule_timeout(usecs_to_jiffies(x)); \
 }
+
 #define UIS_THREAD_WAIT UIS_THREAD_WAIT_MSEC(5)
+
 #define UIS_THREAD_WAIT_SEC(x) { \
set_current_state(TASK_INTERRUPTIBLE); \
schedule_timeout((x)*HZ); \
-- 
2.1.0

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


Re: [patch] Documentation/SubmittingPatches: Reported-by tags and permission

2014-10-28 Thread Jason Cooper
On Tue, Oct 28, 2014 at 09:04:51AM -0400, Jonathan Corbet wrote:
 On Fri, 14 Feb 2014 12:30:01 +0300
 Dan Carpenter dan.carpen...@oracle.com wrote:
 
  -If this patch fixes a problem reported by somebody else, consider adding a
  -Reported-by: tag to credit the reporter for their contribution.  Please
  -note that this tag should not be added without the reporter's permission,
  -especially if the problem was not reported in a public forum.  That said,
  -if we diligently credit our bug reporters, they will, hopefully, be
  -inspired to help us again in the future.
  +The Reported-by tag is to give credit to people who find bugs and report 
  them.
  +Please note that if the bug was reported in private, then ask for 
  permission
  +first before using the Reported-by tag.
 
 As the guy who wrote the original text, I think this is an
 improvement...but can we get a version that retains the motivation for
 crediting bug reporters in the first place?

At the risk of upsetting the apple cart, I'd prefer we downplay anything
that walks down the path of gamification (by focusing on credit).

As best anyone has ever explained it to me, the Acked-by, Reviewed-by,
etc are there to impart information regarding a specific commit.  In the
event that a commit is fingered in a bisect, you have a much better list
of names to Cc, instead of just the maintainer from MAINTAINERS and the
author from the top of the offending file.  The author has often moved
on, and the maintainer may not have been around for the bugfix.

I know Greg has spoken out against gamification before, and I also
understand the desire to encourage bug reporters.  Perhaps I should just
suggest the following:


The Reported-by tag helps us maintain contact info for people with
intimate knowledge of a commit or a bug fix.  Please seek the reporter's
permission before adding the tag to the commit.  That said, if we
diligently credit our bug reporters, they will, hopefully, be inspired
to help us again in the future.


It's most likely ok here since it's rather hard to manufacture a list of
bugs in order to inflate ones count of Reported-by's.  Unlike S-o-b,
Ack's, etc.

thx,

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


[PATCH] staging: comedi: widen subdevice number argument in ioctl handlers

2014-10-28 Thread Ian Abbott
For the `COMEDI_LOCK`, `COMEDI_UNLOCK`, `COMEDI_CANCEL`, and
`COMEDI_POLL` ioctls the third argument is a comedi subdevice number.
This is passed as an `unsigned long`, but when it is passed down to the
ioctl command-specific handler functions `do_lock_ioctl()`,
`do_unlock_ioctl()`, `do_cancel_ioctl()`, and `do_poll_ioctl()`, the
value has been narrowed to an `unsigned int`.  Pass through the argument
as an `unsigned long` to avoid truncating the value on 64-bit
architectures.

Signed-off-by: Ian Abbott abbo...@mev.co.uk
---
 drivers/staging/comedi/comedi_fops.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index 224af2b..ab6cbc8 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1642,7 +1642,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
 
 */
 
-static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg,
+static int do_lock_ioctl(struct comedi_device *dev, unsigned long arg,
 void *file)
 {
int ret = 0;
@@ -1679,7 +1679,7 @@ static int do_lock_ioctl(struct comedi_device *dev, 
unsigned int arg,
This function isn't protected by the semaphore, since
we already own the lock.
 */
-static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg,
+static int do_unlock_ioctl(struct comedi_device *dev, unsigned long arg,
   void *file)
 {
struct comedi_subdevice *s;
@@ -1714,7 +1714,7 @@ static int do_unlock_ioctl(struct comedi_device *dev, 
unsigned int arg,
nothing
 
 */
-static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
+static int do_cancel_ioctl(struct comedi_device *dev, unsigned long arg,
   void *file)
 {
struct comedi_subdevice *s;
@@ -1748,7 +1748,7 @@ static int do_cancel_ioctl(struct comedi_device *dev, 
unsigned int arg,
nothing
 
 */
-static int do_poll_ioctl(struct comedi_device *dev, unsigned int arg,
+static int do_poll_ioctl(struct comedi_device *dev, unsigned long arg,
 void *file)
 {
struct comedi_subdevice *s;
-- 
2.1.1

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


Re: [patch] Documentation/SubmittingPatches: Reported-by tags and permission

2014-10-28 Thread Jonathan Corbet
On Tue, 28 Oct 2014 12:58:27 -0400
Jason Cooper ja...@lakedaemon.net wrote:

 At the risk of upsetting the apple cart, I'd prefer we downplay anything
 that walks down the path of gamification (by focusing on credit).
 
 As best anyone has ever explained it to me, the Acked-by, Reviewed-by,
 etc are there to impart information regarding a specific commit.  In the
 event that a commit is fingered in a bisect, you have a much better list
 of names to Cc, instead of just the maintainer from MAINTAINERS and the
 author from the top of the offending file.  The author has often moved
 on, and the maintainer may not have been around for the bugfix.

As I understand it, having been in the room when these tags were
developed and encouraged, was that credit was a big part of the initial
motivation.  We need more testers and bug reporters; this was a way to
give them credit for the valuable work that they do.  I still think
that's important, for whatever that's worth.

 I know Greg has spoken out against gamification before, and I also
 understand the desire to encourage bug reporters.  Perhaps I should just
 suggest the following:
 
 
 The Reported-by tag helps us maintain contact info for people with
 intimate knowledge of a commit or a bug fix.  Please seek the reporter's
 permission before adding the tag to the commit.  That said, if we
 diligently credit our bug reporters, they will, hopefully, be inspired
 to help us again in the future.
 

That addresses my concern, but loses the point of the initial patch:
publicly reporting a bug can be seen as implicit permission to credit the
reporter.

Thanks,

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


[PATCH] Staging: dgnc: fix macro coding style issue in digi.h

2014-10-28 Thread Cheng-Yi He
This is a patch to the digi.h file that fixes up the following error
found by the checkpatch tool.
ERROR: Macros with complex values should be enclosed in parentheses

Signed-off-by: Cheng-Yi He chengyihetai...@gmail.com
---
 drivers/staging/dgnc/digi.h | 60 ++---
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h
index 3181a35..d6e0b9f 100644
--- a/drivers/staging/dgnc/digi.h
+++ b/drivers/staging/dgnc/digi.h
@@ -38,8 +38,8 @@
 
 #if !defined(TIOCMODG)
 
-#defineTIOCMODG('d'8) | 250  /* get modem ctrl state 
*/
-#defineTIOCMODS('d'8) | 251  /* set modem ctrl state 
*/
+#defineTIOCMODG(('d'8) | 250)/* get modem ctrl state 
*/
+#defineTIOCMODS(('d'8) | 251)/* set modem ctrl state 
*/
 
 #ifndef TIOCM_LE
 #defineTIOCM_LE0x01/* line enable  
*/
@@ -58,44 +58,44 @@
 #endif
 
 #if !defined(TIOCMSET)
-#defineTIOCMSET('d'8) | 252  /* set modem ctrl state 
*/
-#defineTIOCMGET('d'8) | 253  /* set modem ctrl state 
*/
+#defineTIOCMSET(('d'8) | 252)/* set modem ctrl state 
*/
+#defineTIOCMGET(('d'8) | 253)/* set modem ctrl state 
*/
 #endif
 
 #if !defined(TIOCMBIC)
-#defineTIOCMBIC('d'8) | 254  /* set modem ctrl state 
*/
-#defineTIOCMBIS('d'8) | 255  /* set modem ctrl state 
*/
+#defineTIOCMBIC(('d'8) | 254)/* set modem ctrl state 
*/
+#defineTIOCMBIS(('d'8) | 255)/* set modem ctrl state 
*/
 #endif
 
 
 #if !defined(TIOCSDTR)
-#defineTIOCSDTR('e'8) | 0/* set DTR  
*/
-#defineTIOCCDTR('e'8) | 1/* clear DTR
*/
+#defineTIOCSDTR(('e'8) | 0)  /* set DTR  
*/
+#defineTIOCCDTR(('e'8) | 1)  /* clear DTR
*/
 #endif
 
 /
  * Ioctl command arguments for DIGI parameters.
  /
-#define DIGI_GETA  ('e'8) | 94   /* Read params  */
+#define DIGI_GETA  (('e'8) | 94) /* Read params  */
 
-#define DIGI_SETA  ('e'8) | 95   /* Set params   */
-#define DIGI_SETAW ('e'8) | 96   /* Drain  set params   */
-#define DIGI_SETAF ('e'8) | 97   /* Drain, flush  set params */
+#define DIGI_SETA  (('e'8) | 95) /* Set params   */
+#define DIGI_SETAW (('e'8) | 96) /* Drain  set params   */
+#define DIGI_SETAF (('e'8) | 97) /* Drain, flush  set params */
 
-#define DIGI_KME   ('e'8) | 98   /* Read/Write Host  */
+#define DIGI_KME   (('e'8) | 98) /* Read/Write Host  */
/* Adapter Memory   */
 
-#defineDIGI_GETFLOW('e'8) | 99   /* Get startc/stopc 
flow */
+#defineDIGI_GETFLOW(('e'8) | 99) /* Get startc/stopc 
flow */
/* control characters*/
-#defineDIGI_SETFLOW('e'8) | 100  /* Set startc/stopc 
flow */
+#defineDIGI_SETFLOW(('e'8) | 100)/* Set startc/stopc 
flow */
/* control characters*/
-#defineDIGI_GETAFLOW   ('e'8) | 101  /* Get Aux. 
startc/stopc */
+#defineDIGI_GETAFLOW   (('e'8) | 101)/* Get Aux. 
startc/stopc */
/* flow control chars*/
-#defineDIGI_SETAFLOW   ('e'8) | 102  /* Set Aux. 
startc/stopc */
+#defineDIGI_SETAFLOW   (('e'8) | 102)/* Set Aux. 
startc/stopc */
/* flow control chars*/
 
-#define DIGI_GEDELAY   ('d'8) | 246  /* Get edelay */
-#define DIGI_SEDELAY   ('d'8) | 247  /* Set edelay */
+#define DIGI_GEDELAY   (('d'8) | 246)/* Get edelay */
+#define DIGI_SEDELAY   (('d'8) | 247)/* Set edelay */
 
 struct digiflow_t {
unsigned char   startc; /* flow cntl start char 
*/
@@ -104,8 +104,8 @@ struct  digiflow_t {
 
 
 #ifdef FLOW_2200
-#defineF2200_GETA  ('e'8) | 104  /* Get 2x36 flow cntl 
flags */
-#defineF2200_SETAW ('e'8) | 105  /* Set 2x36 flow cntl 
flags */
+#defineF2200_GETA  (('e'8) | 104)/* Get 2x36 flow cntl 
flags */
+#defineF2200_SETAW (('e'8) | 105)/* Set 2x36 flow cntl 
flags */
 #defineF2200_MASK  0x03/* 2200 flow cntl bit 
mask  */
 #define

[PATCH RESEND v2 0/2] Staging: rts5208: rtsx_reset_chip style clean up

2014-10-28 Thread Fabio Falzoi
Clean up the code in rtsx_reset_chip function defining two new helper
functions rtsx_reset_aspm and rtsx_enable_pcie_intr.
Specifically, the following checkpatch warnings are corrected:
* PARENTHESIS_ALIGNMENT at rows 295, 313
This patch is inspired by the following post on LKML regarding another
clean up for rts5208 module:
http://www.spinics.net/lists/linux-driver-devel/msg55038.html

Changes in v2:
* rebased against staging-testing branch of staging driver development
tree

Fabio Falzoi (2):
  Staging: rts5208: helper function to manage aspm during reset
  Staging: rts5208: helper function to enable interrupts during reset

 drivers/staging/rts5208/rtsx_chip.c | 165 +++-
 1 file changed, 87 insertions(+), 78 deletions(-)

-- 
2.1.1

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


[PATCH RESEND v2 1/2] Staging: rts5208: helper function to manage aspm during reset

2014-10-28 Thread Fabio Falzoi
Define the helper function rtsx_reset_aspm to shorten the
rtsx_reset_chip code and get rid of the LONG_LINE checkpatch warnings.

Signed-off-by: Fabio Falzoi fabio.falzo...@gmail.com
Reviewed-by: Dan Carpenter dan.carpe...@oracle.com
---
 drivers/staging/rts5208/rtsx_chip.c | 70 +
 1 file changed, 39 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_chip.c 
b/drivers/staging/rts5208/rtsx_chip.c
index ffcf5de..ea6cfd1 100644
--- a/drivers/staging/rts5208/rtsx_chip.c
+++ b/drivers/staging/rts5208/rtsx_chip.c
@@ -227,6 +227,42 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip *chip)
 }
 #endif
 
+static int rtsx_reset_aspm(struct rtsx_chip *chip)
+{
+   int ret;
+
+   if (chip-dynamic_aspm) {
+   if (!CHK_SDIO_EXIST(chip) || !CHECK_PID(chip, 0x5288))
+   return STATUS_SUCCESS;
+
+   ret = rtsx_write_cfg_dw(chip, 2, 0xC0, 0xFF,
+   chip-aspm_l0s_l1_en);
+   if (ret != STATUS_SUCCESS)
+   TRACE_RET(chip, STATUS_FAIL);
+
+   return STATUS_SUCCESS;
+   }
+
+   if (CHECK_PID(chip, 0x5208))
+   RTSX_WRITE_REG(chip, ASPM_FORCE_CTL, 0xFF, 0x3F);
+   ret = rtsx_write_config_byte(chip, LCTLR, chip-aspm_l0s_l1_en);
+   if (ret != STATUS_SUCCESS)
+   TRACE_RET(chip, STATUS_FAIL);
+
+   chip-aspm_level[0] = chip-aspm_l0s_l1_en;
+   if (CHK_SDIO_EXIST(chip)) {
+   chip-aspm_level[1] = chip-aspm_l0s_l1_en;
+   ret = rtsx_write_cfg_dw(chip, CHECK_PID(chip, 0x5288) ? 2 : 1,
+   0xC0, 0xFF, chip-aspm_l0s_l1_en);
+   if (ret != STATUS_SUCCESS)
+   TRACE_RET(chip, STATUS_FAIL);
+   }
+
+   chip-aspm_enabled = 1;
+
+   return STATUS_SUCCESS;
+}
+
 int rtsx_reset_chip(struct rtsx_chip *chip)
 {
int retval;
@@ -289,37 +325,9 @@ int rtsx_reset_chip(struct rtsx_chip *chip)
 
/* Enable ASPM */
if (chip-aspm_l0s_l1_en) {
-   if (chip-dynamic_aspm) {
-   if (CHK_SDIO_EXIST(chip)  CHECK_PID(chip, 0x5288)) {
-   retval = rtsx_write_cfg_dw(chip, 2, 0xC0, 0xFF,
-   chip-aspm_l0s_l1_en);
-   if (retval != STATUS_SUCCESS)
-   TRACE_RET(chip, STATUS_FAIL);
-   }
-   } else {
-   if (CHECK_PID(chip, 0x5208))
-   RTSX_WRITE_REG(chip, ASPM_FORCE_CTL,
-  0xFF, 0x3F);
-
-   retval = rtsx_write_config_byte(chip, LCTLR,
-   chip-aspm_l0s_l1_en);
-   if (retval != STATUS_SUCCESS)
-   TRACE_RET(chip, STATUS_FAIL);
-
-   chip-aspm_level[0] = chip-aspm_l0s_l1_en;
-   if (CHK_SDIO_EXIST(chip)) {
-   chip-aspm_level[1] = chip-aspm_l0s_l1_en;
-   retval = rtsx_write_cfg_dw(chip,
-   CHECK_PID(chip, 0x5288) ? 2 : 1,
-   0xC0, 0xFF,
-   chip-aspm_l0s_l1_en);
-
-   if (retval != STATUS_SUCCESS)
-   TRACE_RET(chip, STATUS_FAIL);
-   }
-
-   chip-aspm_enabled = 1;
-   }
+   retval = rtsx_reset_aspm(chip);
+   if (retval != STATUS_SUCCESS)
+   TRACE_RET(chip, STATUS_FAIL);
} else {
if (chip-asic_code  CHECK_PID(chip, 0x5208)) {
retval = rtsx_write_phy_register(chip, 0x07, 0x0129);
-- 
2.1.1

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


[PATCH RESEND v2 2/2] Staging: rts5208: helper function to enable interrupts during reset

2014-10-28 Thread Fabio Falzoi
Define the helper function rtsx_enable_pcie_intr to shorten the
rtsx_reset_chip code and get rid of the LONG_LINE checkpatch warnings.

Signed-off-by: Fabio Falzoi fabio.falzo...@gmail.com
Reviewed-by: Dan Carpenter dan.carpe...@oracle.com
---
 drivers/staging/rts5208/rtsx_chip.c | 95 +++--
 1 file changed, 48 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_chip.c 
b/drivers/staging/rts5208/rtsx_chip.c
index ea6cfd1..9593d81 100644
--- a/drivers/staging/rts5208/rtsx_chip.c
+++ b/drivers/staging/rts5208/rtsx_chip.c
@@ -263,6 +263,51 @@ static int rtsx_reset_aspm(struct rtsx_chip *chip)
return STATUS_SUCCESS;
 }
 
+static int rtsx_enable_pcie_intr(struct rtsx_chip *chip)
+{
+   int ret;
+
+   if (!chip-asic_code || !CHECK_PID(chip, 0x5208)) {
+   rtsx_enable_bus_int(chip);
+   return STATUS_SUCCESS;
+   }
+
+   if (chip-phy_debug_mode) {
+   RTSX_WRITE_REG(chip, CDRESUMECTL, 0x77, 0);
+   rtsx_disable_bus_int(chip);
+   } else {
+   rtsx_enable_bus_int(chip);
+   }
+
+   if (chip-ic_version = IC_VER_D) {
+   u16 reg;
+
+   ret = rtsx_read_phy_register(chip, 0x00, reg);
+   if (ret != STATUS_SUCCESS)
+   TRACE_RET(chip, STATUS_FAIL);
+
+   reg = 0xFE7F;
+   reg |= 0x80;
+   ret = rtsx_write_phy_register(chip, 0x00, reg);
+   if (ret != STATUS_SUCCESS)
+   TRACE_RET(chip, STATUS_FAIL);
+
+   ret = rtsx_read_phy_register(chip, 0x1C, reg);
+   if (ret != STATUS_SUCCESS)
+   TRACE_RET(chip, STATUS_FAIL);
+
+   reg = 0xFFF7;
+   ret = rtsx_write_phy_register(chip, 0x1C, reg);
+   if (ret != STATUS_SUCCESS)
+   TRACE_RET(chip, STATUS_FAIL);
+   }
+
+   if (chip-driver_first_load  (chip-ic_version  IC_VER_C))
+   rtsx_calibration(chip);
+
+   return STATUS_SUCCESS;
+}
+
 int rtsx_reset_chip(struct rtsx_chip *chip)
 {
int retval;
@@ -367,53 +412,9 @@ int rtsx_reset_chip(struct rtsx_chip *chip)
 
RTSX_WRITE_REG(chip, PERST_GLITCH_WIDTH, 0xFF, 0x80);
 
-   /* Enable PCIE interrupt */
-   if (chip-asic_code) {
-   if (CHECK_PID(chip, 0x5208)) {
-   if (chip-phy_debug_mode) {
-   RTSX_WRITE_REG(chip, CDRESUMECTL, 0x77, 0);
-   rtsx_disable_bus_int(chip);
-   } else {
-   rtsx_enable_bus_int(chip);
-   }
-
-   if (chip-ic_version = IC_VER_D) {
-   u16 reg;
-
-   retval = rtsx_read_phy_register(chip, 0x00,
-   reg);
-   if (retval != STATUS_SUCCESS)
-   TRACE_RET(chip, STATUS_FAIL);
-
-   reg = 0xFE7F;
-   reg |= 0x80;
-   retval = rtsx_write_phy_register(chip, 0x00,
-reg);
-   if (retval != STATUS_SUCCESS)
-   TRACE_RET(chip, STATUS_FAIL);
-
-   retval = rtsx_read_phy_register(chip, 0x1C,
-   reg);
-   if (retval != STATUS_SUCCESS)
-   TRACE_RET(chip, STATUS_FAIL);
-
-   reg = 0xFFF7;
-   retval = rtsx_write_phy_register(chip, 0x1C,
-reg);
-   if (retval != STATUS_SUCCESS)
-   TRACE_RET(chip, STATUS_FAIL);
-   }
-
-   if (chip-driver_first_load 
-   (chip-ic_version  IC_VER_C))
-   rtsx_calibration(chip);
-
-   } else {
-   rtsx_enable_bus_int(chip);
-   }
-   } else {
-   rtsx_enable_bus_int(chip);
-   }
+   retval = rtsx_enable_pcie_intr(chip);
+   if (retval != STATUS_SUCCESS)
+   TRACE_RET(chip, STATUS_FAIL);
 
chip-need_reset = 0;
 
-- 
2.1.1

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


[PATCH] staging: lustre: Fix coding style. Switch and case at the same indent.

2014-10-28 Thread Evaldas Palaima
Fix a style issue reported by checkpatch.pl for the Eudyptula challenge.

Signed-off-by: Evaldas Palaima evaldas.pala...@gmail.com
---
 drivers/staging/lustre/lustre/libcfs/fail.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/fail.c 
b/drivers/staging/lustre/lustre/libcfs/fail.c
index e73ca3d..92444b0 100644
--- a/drivers/staging/lustre/lustre/libcfs/fail.c
+++ b/drivers/staging/lustre/lustre/libcfs/fail.c
@@ -103,18 +103,18 @@ int __cfs_fail_check_set(__u32 id, __u32 value, int set)
}
 
switch (set) {
-   case CFS_FAIL_LOC_NOSET:
-   case CFS_FAIL_LOC_VALUE:
-   break;
-   case CFS_FAIL_LOC_ORSET:
-   cfs_fail_loc |= value  ~(CFS_FAILED | CFS_FAIL_ONCE);
-   break;
-   case CFS_FAIL_LOC_RESET:
-   cfs_fail_loc = value;
-   break;
-   default:
-   LASSERTF(0, called with bad set %u\n, set);
-   break;
+   case CFS_FAIL_LOC_NOSET:
+   case CFS_FAIL_LOC_VALUE:
+   break;
+   case CFS_FAIL_LOC_ORSET:
+   cfs_fail_loc |= value  ~(CFS_FAILED | CFS_FAIL_ONCE);
+   break;
+   case CFS_FAIL_LOC_RESET:
+   cfs_fail_loc = value;
+   break;
+   default:
+   LASSERTF(0, called with bad set %u\n, set);
+   break;
}
 
return 1;
-- 
2.1.2

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


Re: [PATCH] staging: skein: skein_api.c: removed space before ','

2014-10-28 Thread Mikael Svantesson
On 2014-10-28 07:50, Dan Carpenter wrote:
 On Mon, Oct 27, 2014 at 11:17:02PM +0100, Mikael Svantesson wrote:
 Signed-off-by: Mikael Svantesson mik...@distopic.net
 
 The patch is corrupt (and in a totally weird way as well).  Please read
 the first paragraph for Documentation/email-clients.txt.
 
 regards,
 dan carpenter
 
After all checking and making sure things looked correct, I still failed
to disable word wrapping.

Thanks, I'll resubmit a working patch.

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


[PATCH 04/10] staging: unisys: fix all logical continuation virthba

2014-10-28 Thread Erik Arfvidson
This patch fixes all logical continuations issues in virthba.c

v2: fixed spacing around bitwise operator suggested by dan carpenter
Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
---
 drivers/staging/unisys/virthba/virthba.c | 44 
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index f30ef08..ee379b7 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -430,11 +430,11 @@ virthba_ISR(int irq, void *dev_id)
return IRQ_NONE;
virthbainfo-interrupts_rcvd++;
pChannelHeader = virthbainfo-chinfo.queueinfo-chan;
-   if (((readq(pChannelHeader-features)
-  ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS) != 0)
-((readq(pChannelHeader-features) 
-ULTRA_IO_DRIVER_DISABLES_INTS) !=
-   0)) {
+   if (((readq(pChannelHeader-features) 
+ ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS) != 0) 
+   ((readq(pChannelHeader-features) 
+ ULTRA_IO_DRIVER_DISABLES_INTS) !=
+0)) {
virthbainfo-interrupts_disabled++;
mask = ~ULTRA_CHANNEL_ENABLE_INTS;
rc1 = uisqueue_interlocked_and(virthbainfo-flags_addr, mask);
@@ -809,9 +809,9 @@ virthba_abort_handler(struct scsi_cmnd *scsicmd)
scsidev = scsicmd-device;
for (vdisk = ((struct virthba_info *)scsidev-host-hostdata)-head;
 vdisk-next; vdisk = vdisk-next) {
-   if ((scsidev-channel == vdisk-channel)
-(scsidev-id == vdisk-id)
-(scsidev-lun == vdisk-lun)) {
+   if ((scsidev-channel == vdisk-channel) 
+   (scsidev-id == vdisk-id) 
+   (scsidev-lun == vdisk-lun)) {
if (atomic_read(vdisk-error_count) 
VIRTHBA_ERROR_COUNT) {
atomic_inc(vdisk-error_count);
@@ -835,9 +835,9 @@ virthba_bus_reset_handler(struct scsi_cmnd *scsicmd)
scsidev = scsicmd-device;
for (vdisk = ((struct virthba_info *)scsidev-host-hostdata)-head;
 vdisk-next; vdisk = vdisk-next) {
-   if ((scsidev-channel == vdisk-channel)
-(scsidev-id == vdisk-id)
-(scsidev-lun == vdisk-lun)) {
+   if ((scsidev-channel == vdisk-channel) 
+   (scsidev-id == vdisk-id) 
+   (scsidev-lun == vdisk-lun)) {
if (atomic_read(vdisk-error_count) 
VIRTHBA_ERROR_COUNT) {
atomic_inc(vdisk-error_count);
@@ -861,9 +861,9 @@ virthba_device_reset_handler(struct scsi_cmnd *scsicmd)
scsidev = scsicmd-device;
for (vdisk = ((struct virthba_info *)scsidev-host-hostdata)-head;
 vdisk-next; vdisk = vdisk-next) {
-   if ((scsidev-channel == vdisk-channel)
-(scsidev-id == vdisk-id)
-(scsidev-lun == vdisk-lun)) {
+   if ((scsidev-channel == vdisk-channel) 
+   (scsidev-id == vdisk-id) 
+   (scsidev-lun == vdisk-lun)) {
if (atomic_read(vdisk-error_count) 
VIRTHBA_ERROR_COUNT) {
atomic_inc(vdisk-error_count);
@@ -1132,9 +1132,9 @@ do_scsi_linuxstat(struct uiscmdrsp *cmdrsp, struct 
scsi_cmnd *scsicmd)
/* Okay see what our error_count is here */
for (vdisk = ((struct virthba_info *)scsidev-host-hostdata)-head;
 vdisk-next; vdisk = vdisk-next) {
-   if ((scsidev-channel != vdisk-channel)
-   || (scsidev-id != vdisk-id)
-   || (scsidev-lun != vdisk-lun))
+   if ((scsidev-channel != vdisk-channel) ||
+   (scsidev-id != vdisk-id) ||
+   (scsidev-lun != vdisk-lun))
continue;
 
if (atomic_read(vdisk-error_count)  VIRTHBA_ERROR_COUNT) {
@@ -1170,8 +1170,8 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct 
scsi_cmnd *scsicmd)
struct virtdisk_info *vdisk;
 
scsidev = scsicmd-device;
-   if ((cmdrsp-scsi.cmnd[0] == INQUIRY)
-(cmdrsp-scsi.bufflen = MIN_INQUIRY_RESULT_LEN)) {
+   if ((cmdrsp-scsi.cmnd[0] == INQUIRY) 
+   (cmdrsp-scsi.bufflen = MIN_INQUIRY_RESULT_LEN)) {
if (cmdrsp-scsi.no_disk_result == 0)
return;
 
@@ -1210,9 +1210,9 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct 
scsi_cmnd *scsicmd)
} else {
vdisk = ((struct virthba_info *)scsidev-host-hostdata)-head;
for ( ; vdisk-next; vdisk = vdisk-next) {
-   if ((scsidev-channel != vdisk-channel)
-   || 

[PATCH 05/10] staging: unisys: added spinlock comments visorchannel_funcs

2014-10-28 Thread Erik Arfvidson
This patch adds comment documentation to visorchannel_tag struct

Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
---
 drivers/staging/unisys/visorchannel/visorchannel_funcs.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c 
b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
index c24052b..0490194 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
+++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
@@ -33,9 +33,13 @@ struct VISORCHANNEL_Tag {
struct channel_header chan_hdr;
uuid_le guid;
ulong size;
-   BOOL needs_lock;
-   spinlock_t insert_lock;
-   spinlock_t remove_lock;
+   BOOL needs_lock; /* Some channels don't need lock due to simplicity */
+   /* The guest can remove from certain queues, but cannot insert into
+* those queues. The guest can insert into other queues, but can't
+* remove from those queues . This is based on the queue type.
+*/
+   spinlock_t insert_lock; /* Protects queue insertion variables */
+   spinlock_t remove_lock; /* Protects queue from removal variables */
 
struct {
struct signal_queue_header req_queue;
-- 
1.9.1

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


[PATCH 03/10] staging: unisys: virthba fix all alingment issues

2014-10-28 Thread Erik Arfvidson
this patch fixes all aligment issues in virthba.c

Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
---
 drivers/staging/unisys/virthba/virthba.c | 82 
 1 file changed, 42 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 6acdfd3..f30ef08 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -110,9 +110,10 @@ static int virthba_serverdown(struct virtpci_dev 
*virtpcidev, u32 state);
 static void doDiskAddRemove(struct work_struct *work);
 static void virthba_serverdown_complete(struct work_struct *work);
 static ssize_t info_debugfs_read(struct file *file, char __user *buf,
-   size_t len, loff_t *offset);
+size_t len, loff_t *offset);
 static ssize_t enable_ints_write(struct file *file,
-   const char __user *buffer, size_t count, loff_t *ppos);
+const char __user *buffer, size_t count,
+loff_t *ppos);
 
 /*/
 /* Globals   */
@@ -263,7 +264,7 @@ add_scsipending_entry(struct virthba_info *vhbainfo, char 
cmdtype, void *new)
insert_location = (insert_location + 1) % MAX_PENDING_REQUESTS;
if (insert_location == (int)vhbainfo-nextinsert) {
LOGERR(Queue should be full. insert_location%d  
Unable to find open slot for pending commands.\n,
-insert_location);
+  insert_location);
spin_unlock_irqrestore(vhbainfo-privlock, flags);
return -1;
}
@@ -301,13 +302,13 @@ del_scsipending_entry(struct virthba_info *vhbainfo, 
uintptr_t del)
 
if (del = MAX_PENDING_REQUESTS) {
LOGERR(Invalid queue position %lu given to delete. 
MAX_PENDING_REQUESTS %d\n,
-(unsigned long)del, MAX_PENDING_REQUESTS);
+  (unsigned long)del, MAX_PENDING_REQUESTS);
} else {
spin_lock_irqsave(vhbainfo-privlock, flags);
 
if (vhbainfo-pending[del].sent == NULL)
LOGERR(Deleting already cleared queue entry at 
%lu.\n,
-(unsigned long)del);
+  (unsigned long)del);
 
sent = vhbainfo-pending[del].sent;
 
@@ -357,8 +358,8 @@ SendDiskAddRemove(struct diskaddremove *dar)
dar-lun);
if (error)
LOGERR(Failed scsi_add_device: 
host_no=%d[chan=%d:id=%d:lun=%d]\n,
-dar-shost-host_no, dar-channel, dar-id,
-dar-lun);
+  dar-shost-host_no, dar-channel, dar-id,
+  dar-lun);
} else
LOGERR(Failed scsi_device_lookup:[chan=%d:id=%d:lun=%d]\n,
   dar-channel, dar-id, dar-lun);
@@ -408,8 +409,8 @@ process_disk_notify(struct Scsi_Host *shost, struct 
uiscmdrsp *cmdrsp)
QUEUE_DISKADDREMOVE(dar);
} else {
LOGERR(kmalloc failed for dar. 
host_no=%d[chan=%d:id=%d:lun=%d]\n,
-shost-host_no, cmdrsp-disknotify.channel,
-cmdrsp-disknotify.id, cmdrsp-disknotify.lun);
+  shost-host_no, cmdrsp-disknotify.channel,
+  cmdrsp-disknotify.id, cmdrsp-disknotify.lun);
}
 }
 
@@ -502,11 +503,11 @@ virthba_probe(struct virtpci_dev *virtpcidev, const 
struct pci_device_id *id)
 * the max-channel value.
 */
LOGINF(virtpcidev-scsi.max.max_channel=%u, max_id=%u, max_lun=%u, 
cmd_per_lun=%u, max_io_size=%u\n,
-(unsigned)virtpcidev-scsi.max.max_channel - 1,
-(unsigned)virtpcidev-scsi.max.max_id,
-(unsigned)virtpcidev-scsi.max.max_lun,
-(unsigned)virtpcidev-scsi.max.cmd_per_lun,
-(unsigned)virtpcidev-scsi.max.max_io_size);
+  (unsigned)virtpcidev-scsi.max.max_channel - 1,
+  (unsigned)virtpcidev-scsi.max.max_id,
+  (unsigned)virtpcidev-scsi.max.max_lun,
+  (unsigned)virtpcidev-scsi.max.cmd_per_lun,
+  (unsigned)virtpcidev-scsi.max.max_io_size);
scsihost-max_channel = (unsigned)virtpcidev-scsi.max.max_channel;
scsihost-max_id = (unsigned)virtpcidev-scsi.max.max_id;
scsihost-max_lun = (unsigned)virtpcidev-scsi.max.max_lun;
@@ -518,12 +519,12 @@ virthba_probe(struct virtpci_dev *virtpcidev, const 
struct pci_device_id *id)
if (scsihost-sg_tablesize  MAX_PHYS_INFO)
scsihost-sg_tablesize = MAX_PHYS_INFO;
LOGINF(scsihost-max_channel=%u, max_id=%u, max_lun=%llu, 
cmd_per_lun=%u, 

[PATCH 07/10] staging: unisys: fixed logical continuation visorchannel_funcs

2014-10-28 Thread Erik Arfvidson
this patch fixes a logical continuation check in visorchannel

Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
---
 drivers/staging/unisys/visorchannel/visorchannel_funcs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c 
b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
index 85a7039..dbcb043 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
+++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
@@ -393,8 +393,8 @@ safe_sig_queue_validate(struct signal_queue_header 
*psafe_sqh,
struct signal_queue_header *punsafe_sqh,
u32 *phead, u32 *ptail)
 {
-   if ((*phead = psafe_sqh-max_slots)
-   || (*ptail = psafe_sqh-max_slots)) {
+   if ((*phead = psafe_sqh-max_slots) ||
+   (*ptail = psafe_sqh-max_slots)) {
/* Choose 0 or max, maybe based on current tail value */
*phead = 0;
*ptail = 0;
-- 
1.9.1

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


[PATCH 10/10] staging: unisys: fixed braces check in visorchannel_funcs

2014-10-28 Thread Erik Arfvidson
this patch adds braces to an else statement to remove check in
checkpatch.pl for visorchannel_funcs.c

Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
---
 drivers/staging/unisys/visorchannel/visorchannel_funcs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c 
b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
index d116a0e..389078a 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
+++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
@@ -594,8 +594,9 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues,
if (off == 0) {
phdr = channel-chan_hdr;
seq_puts(seq, (following data may be stale)\n);
-   } else
+   } else {
return;
+   }
}
nbytes = (ulong)(phdr-size);
seq_printf(seq, --- Begin channel @0x%-16.16Lx for 0x%lx bytes 
(region=0x%lx bytes) ---\n,
-- 
1.9.1

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


[PATCH 09/10] staging: unisys: remove unnecessary blank line in visorchannel_funcs

2014-10-28 Thread Erik Arfvidson
this patch removes unnecessary blank line in visorchannel_funcs

Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
---
 drivers/staging/unisys/visorchannel/visorchannel_funcs.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c 
b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
index 688f69a..d116a0e 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
+++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
@@ -508,7 +508,6 @@ Away:
 }
 EXPORT_SYMBOL_GPL(visorchannel_signalinsert);
 
-
 int
 visorchannel_signalqueue_slots_avail(VISORCHANNEL *channel, u32 queue)
 {
-- 
1.9.1

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


[PATCH 08/10] staging: unisys: fixed aligment in visorchannel_funcs

2014-10-28 Thread Erik Arfvidson
this patch fixes aligment for visorchanne_funcs

Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
---
 drivers/staging/unisys/visorchannel/visorchannel_funcs.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c 
b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
index dbcb043..688f69a 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
+++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
@@ -230,7 +230,7 @@ visorchannel_read(VISORCHANNEL *channel, ulong offset,
int rc = visor_memregion_read(channel-memregion, offset,
  local, nbytes);
if ((rc = 0)  (offset == 0) 
-  (nbytes = sizeof(struct channel_header))) {
+   (nbytes = sizeof(struct channel_header))) {
memcpy(channel-chan_hdr, local,
   sizeof(struct channel_header));
}
@@ -404,8 +404,7 @@ safe_sig_queue_validate(struct signal_queue_header 
*psafe_sqh,
punsafe_sqh-tail = *ptail;
 
ERRDRV(safe_sig_queue_validate: head = 0x%x, tail = 0x%x, 
MaxSlots = 0x%x,
-*phead, *ptail, psafe_sqh-max_slots);
-   return 0;
+  *phead, *ptail, psafe_sqh-max_slots);
}
return 1;
 }  /* end safe_sig_queue_validate */
@@ -628,9 +627,10 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues,
struct signal_queue_header q;
 
errcode = visorchannel_read(channel,
-   off + phdr-ch_space_offset +
-   (i * sizeof(q)),
-   q, sizeof(q));
+   off +
+   phdr-ch_space_offset +
+   (i * sizeof(q)),
+   q, sizeof(q));
if (errcode  0) {
seq_printf(seq,
   failed to read signal queue #%d 
from channel @0x%-16.16Lx errcode=%d\n,
-- 
1.9.1

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


[PATCH 02/10] staging: unisys: virthba fix all spaces after cast

2014-10-28 Thread Erik Arfvidson
This patch fixes all spaces after cast for virthba

Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
---
 drivers/staging/unisys/virthba/virthba.c | 130 +++
 1 file changed, 65 insertions(+), 65 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 7475124..6acdfd3 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -261,7 +261,7 @@ add_scsipending_entry(struct virthba_info *vhbainfo, char 
cmdtype, void *new)
insert_location = vhbainfo-nextinsert;
while (vhbainfo-pending[insert_location].sent != NULL) {
insert_location = (insert_location + 1) % MAX_PENDING_REQUESTS;
-   if (insert_location == (int) vhbainfo-nextinsert) {
+   if (insert_location == (int)vhbainfo-nextinsert) {
LOGERR(Queue should be full. insert_location%d  
Unable to find open slot for pending commands.\n,
 insert_location);
spin_unlock_irqrestore(vhbainfo-privlock, flags);
@@ -290,7 +290,7 @@ add_scsipending_entry_with_wait(struct virthba_info 
*vhbainfo, char cmdtype,
insert_location = add_scsipending_entry(vhbainfo, cmdtype, new);
}
 
-   return (unsigned int) insert_location;
+   return (unsigned int)insert_location;
 }
 
 static void *
@@ -301,13 +301,13 @@ del_scsipending_entry(struct virthba_info *vhbainfo, 
uintptr_t del)
 
if (del = MAX_PENDING_REQUESTS) {
LOGERR(Invalid queue position %lu given to delete. 
MAX_PENDING_REQUESTS %d\n,
-(unsigned long) del, MAX_PENDING_REQUESTS);
+(unsigned long)del, MAX_PENDING_REQUESTS);
} else {
spin_lock_irqsave(vhbainfo-privlock, flags);
 
if (vhbainfo-pending[del].sent == NULL)
LOGERR(Deleting already cleared queue entry at 
%lu.\n,
-(unsigned long) del);
+(unsigned long)del);
 
sent = vhbainfo-pending[del].sent;
 
@@ -419,7 +419,7 @@ process_disk_notify(struct Scsi_Host *shost, struct 
uiscmdrsp *cmdrsp)
 static irqreturn_t
 virthba_ISR(int irq, void *dev_id)
 {
-   struct virthba_info *virthbainfo = (struct virthba_info *) dev_id;
+   struct virthba_info *virthbainfo = (struct virthba_info *)dev_id;
struct channel_header __iomem *pChannelHeader;
struct signal_queue_header __iomem *pqhdr;
u64 mask;
@@ -443,7 +443,7 @@ virthba_ISR(int irq, void *dev_id)
return IRQ_NONE;
}
pqhdr = (struct signal_queue_header __iomem *)
-   ((char __iomem *) pChannelHeader +
+   ((char __iomem *)pChannelHeader +
 readq(pChannelHeader-ch_space_offset)) + IOCHAN_FROM_IOPART;
writeq(readq(pqhdr-num_irq_received) + 1,
   pqhdr-num_irq_received);
@@ -502,19 +502,19 @@ virthba_probe(struct virtpci_dev *virtpcidev, const 
struct pci_device_id *id)
 * the max-channel value.
 */
LOGINF(virtpcidev-scsi.max.max_channel=%u, max_id=%u, max_lun=%u, 
cmd_per_lun=%u, max_io_size=%u\n,
-(unsigned) virtpcidev-scsi.max.max_channel - 1,
-(unsigned) virtpcidev-scsi.max.max_id,
-(unsigned) virtpcidev-scsi.max.max_lun,
-(unsigned) virtpcidev-scsi.max.cmd_per_lun,
-(unsigned) virtpcidev-scsi.max.max_io_size);
-   scsihost-max_channel = (unsigned) virtpcidev-scsi.max.max_channel;
-   scsihost-max_id = (unsigned) virtpcidev-scsi.max.max_id;
-   scsihost-max_lun = (unsigned) virtpcidev-scsi.max.max_lun;
-   scsihost-cmd_per_lun = (unsigned) virtpcidev-scsi.max.cmd_per_lun;
+(unsigned)virtpcidev-scsi.max.max_channel - 1,
+(unsigned)virtpcidev-scsi.max.max_id,
+(unsigned)virtpcidev-scsi.max.max_lun,
+(unsigned)virtpcidev-scsi.max.cmd_per_lun,
+(unsigned)virtpcidev-scsi.max.max_io_size);
+   scsihost-max_channel = (unsigned)virtpcidev-scsi.max.max_channel;
+   scsihost-max_id = (unsigned)virtpcidev-scsi.max.max_id;
+   scsihost-max_lun = (unsigned)virtpcidev-scsi.max.max_lun;
+   scsihost-cmd_per_lun = (unsigned)virtpcidev-scsi.max.cmd_per_lun;
scsihost-max_sectors =
-   (unsigned short) (virtpcidev-scsi.max.max_io_size  9);
+   (unsigned short)(virtpcidev-scsi.max.max_io_size  9);
scsihost-sg_tablesize =
-   (unsigned short) (virtpcidev-scsi.max.max_io_size / PAGE_SIZE);
+   (unsigned short)(virtpcidev-scsi.max.max_io_size / PAGE_SIZE);
if (scsihost-sg_tablesize  MAX_PHYS_INFO)
scsihost-sg_tablesize = MAX_PHYS_INFO;
LOGINF(scsihost-max_channel=%u, max_id=%u, max_lun=%llu, 
cmd_per_lun=%u, max_sectors=%hu, sg_tablesize=%hu\n,
@@ -545,7 +545,7 @@ 

[PATCH 06/10] staging: unisys: remove all unnecessary space after cast visorchannel_funcs

2014-10-28 Thread Erik Arfvidson
This patch removes all unnecessary spaces after cast for visorchannel_funcs

Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
---
 .../unisys/visorchannel/visorchannel_funcs.c   | 25 +++---
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c 
b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
index 0490194..85a7039 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
+++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
@@ -93,7 +93,7 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong 
channelBytes,
}
if (channelBytes == 0)
/* we had better be a CLIENT of this channel */
-   channelBytes = (ulong) p-chan_hdr.size;
+   channelBytes = (ulong)p-chan_hdr.size;
if (uuid_le_cmp(guid, NULL_UUID_LE) == 0)
/* we had better be a CLIENT of this channel */
guid = p-chan_hdr.chtype;
@@ -291,7 +291,7 @@ EXPORT_SYMBOL_GPL(visorchannel_clear);
 void __iomem  *
 visorchannel_get_header(VISORCHANNEL *channel)
 {
-   return (void __iomem *) (channel-chan_hdr);
+   return (void __iomem *)channel-chan_hdr;
 }
 EXPORT_SYMBOL_GPL(visorchannel_get_header);
 
@@ -338,7 +338,8 @@ sig_read_header(VISORCHANNEL *channel, u32 queue,
 sizeof(struct signal_queue_header))  0) {
ERRDRV(queue=%d SIG_QUEUE_OFFSET=%d,
   queue, (int)SIG_QUEUE_OFFSET(channel-chan_hdr, queue));
-   ERRDRV(visor_memregion_read of signal queue failed: 
(status=%d)\n, rc);
+   ERRDRV(visor_memregion_read of signal queue failed: 
(status=%d)\n,
+  rc);
goto Away;
}
rc = TRUE;
@@ -524,7 +525,7 @@ visorchannel_signalqueue_slots_avail(VISORCHANNEL *channel, 
u32 queue)
head = head + sig_hdr.max_slots;
slots_used = (head - tail);
slots_avail = sig_hdr.max_signals - slots_used;
-   return (int) slots_avail;
+   return (int)slots_avail;
 }
 EXPORT_SYMBOL_GPL(visorchannel_signalqueue_slots_avail);
 
@@ -535,7 +536,7 @@ visorchannel_signalqueue_max_slots(VISORCHANNEL *channel, 
u32 queue)
 
if (!sig_read_header(channel, queue, sig_hdr))
return 0;
-   return (int) sig_hdr.max_signals;
+   return (int)sig_hdr.max_signals;
 }
 EXPORT_SYMBOL_GPL(visorchannel_signalqueue_max_slots);
 
@@ -598,13 +599,13 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues,
} else
return;
}
-   nbytes = (ulong) (phdr-size);
+   nbytes = (ulong)(phdr-size);
seq_printf(seq, --- Begin channel @0x%-16.16Lx for 0x%lx bytes 
(region=0x%lx bytes) ---\n,
   addr + off, nbytes, nbytes_region);
seq_printf(seq, Type= %pUL\n, phdr-chtype);
seq_printf(seq, ZoneGuid= %pUL\n, phdr-zone_uuid);
seq_printf(seq, Signature   = 0x%-16.16Lx\n,
-  (long long) phdr-signature);
+  (long long)phdr-signature);
seq_printf(seq, LegacyState = %lu\n, (ulong)phdr-legacy_state);
seq_printf(seq, SrvState= %lu\n, (ulong)phdr-srv_state);
seq_printf(seq, CliStateBoot= %lu\n, (ulong)phdr-cli_state_boot);
@@ -612,14 +613,14 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues,
seq_printf(seq, HeaderSize  = %lu\n, (ulong)phdr-header_size);
seq_printf(seq, Size= %llu\n, (long long)phdr-size);
seq_printf(seq, Features= 0x%-16.16llx\n,
-  (long long) phdr-features);
+  (long long)phdr-features);
seq_printf(seq, PartitionHandle = 0x%-16.16llx\n,
-  (long long) phdr-partition_handle);
+  (long long)phdr-partition_handle);
seq_printf(seq, Handle  = 0x%-16.16llx\n,
-  (long long) phdr-handle);
-   seq_printf(seq, VersionId   = %lu\n, (ulong) phdr-version_id);
+  (long long)phdr-handle);
+   seq_printf(seq, VersionId   = %lu\n, (ulong)phdr-version_id);
seq_printf(seq, oChannelSpace   = %llu\n,
-  (long long) phdr-ch_space_offset);
+  (long long)phdr-ch_space_offset);
if ((phdr-ch_space_offset == 0) || (errcode  0))
;
else
-- 
1.9.1

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


[PATCH 01/10] staging: unisys: fix blank lines virthba

2014-10-28 Thread Erik Arfvidson
This patch removes unnecessary blanks lines and adds necessary blank lines in 
virthba.

Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
---
 drivers/staging/unisys/virthba/virthba.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index ee1be5a..7475124 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -101,7 +101,6 @@ static DEF_SCSI_QCMD(virthba_queue_command)
 #define virthba_queue_command virthba_queue_command_lck
 #endif
 
-
 static int virthba_slave_alloc(struct scsi_device *scsidev);
 static int virthba_slave_configure(struct scsi_device *scsidev);
 static void virthba_slave_destroy(struct scsi_device *scsidev);
@@ -166,6 +165,7 @@ struct virtdisk_info {
atomic_t error_count;
struct virtdisk_info *next;
 };
+
 /* Each Scsi_Host has a host_data area that contains this struct. */
 struct virthba_info {
struct Scsi_Host *scsihost;
@@ -990,7 +990,6 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd,
sgl = scsi_sglist(scsicmd);
 
for_each_sg(sgl, sg, scsi_sg_count(scsicmd), i) {
-
cmdrsp-scsi.gpi_list[i].address = sg_phys(sg);
cmdrsp-scsi.gpi_list[i].length = sg-length;
if ((i != 0)  (sg-offset != 0))
@@ -1208,7 +1207,6 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct 
scsi_cmnd *scsicmd)
bufind += sg[i].length;
}
} else {
-
vdisk = ((struct virthba_info *)scsidev-host-hostdata)-head;
for ( ; vdisk-next; vdisk = vdisk-next) {
if ((scsidev-channel != vdisk-channel)
@@ -1323,7 +1321,6 @@ drain_queue(struct virthba_info *virthbainfo, struct 
chaninfo *dc,
}
 }
 
-
 /* main function for the thread that waits for scsi commands to arrive
  * in a specified queue
  */
@@ -1657,7 +1654,6 @@ virthba_mod_init(void)
POSTCODE_LINUX_3(VHBA_CREATE_FAILURE_PC, error,
 POSTCODE_SEVERITY_ERR);
} else {
-
/* create the debugfs directories and entries */
virthba_debugfs_dir = debugfs_create_dir(virthba, NULL);
debugfs_create_file(info, S_IRUSR, virthba_debugfs_dir,
@@ -1748,7 +1744,6 @@ virthba_mod_exit(void)
 
debugfs_remove_recursive(virthba_debugfs_dir);
LOGINF(Leaving virthba_mod_exit\n);
-
 }
 
 /* specify function to be run at module insertion time */
-- 
1.9.1

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


[PATCH v2 1/1] staging: skein: Removes skein_debug include

2014-10-28 Thread Eric Rost
Removes skein_debug.h include since skein_debug.h is nonexistent.
Removes unneeded debug empty macro defines and their uses.

Signed-off-by: Eric Rost eric.r...@mybabylon.net
---
 drivers/staging/skein/skein_base.c  | 18 --
 drivers/staging/skein/skein_base.h  | 17 -
 drivers/staging/skein/skein_block.c | 30 +-
 3 files changed, 1 insertion(+), 64 deletions(-)

diff --git a/drivers/staging/skein/skein_base.c 
b/drivers/staging/skein/skein_base.c
index ebc436a..7e700a6 100644
--- a/drivers/staging/skein/skein_base.c
+++ b/drivers/staging/skein/skein_base.c
@@ -124,8 +124,6 @@ int skein_256_init_ext(struct skein_256_ctx *ctx, size_t 
hash_bit_len,
/* tree hash config info (or SKEIN_CFG_TREE_INFO_SEQUENTIAL) */
cfg.w[2] = skein_swap64(tree_info);
 
-   skein_show_key(256, ctx-h, key, key_bytes);
-
/* compute the initial chaining values from config block */
skein_256_process_block(ctx, cfg.b, 1, SKEIN_CFG_STR_LEN);
 
@@ -232,8 +230,6 @@ int skein_256_final(struct skein_256_ctx *ctx, u8 *hash_val)
/* output the ctr mode bytes */
skein_put64_lsb_first(hash_val+i*SKEIN_256_BLOCK_BYTES, ctx-x,
  n);
-   skein_show_final(256, ctx-h, n,
-hash_val+i*SKEIN_256_BLOCK_BYTES);
/* restore the counter mode key for next time */
memcpy(ctx-x, x, sizeof(x));
}
@@ -353,8 +349,6 @@ int skein_512_init_ext(struct skein_512_ctx *ctx, size_t 
hash_bit_len,
/* tree hash config info (or SKEIN_CFG_TREE_INFO_SEQUENTIAL) */
cfg.w[2] = skein_swap64(tree_info);
 
-   skein_show_key(512, ctx-h, key, key_bytes);
-
/* compute the initial chaining values from config block */
skein_512_process_block(ctx, cfg.b, 1, SKEIN_CFG_STR_LEN);
 
@@ -461,8 +455,6 @@ int skein_512_final(struct skein_512_ctx *ctx, u8 *hash_val)
/* output the ctr mode bytes */
skein_put64_lsb_first(hash_val+i*SKEIN_512_BLOCK_BYTES, ctx-x,
  n);
-   skein_show_final(512, ctx-h, n,
-hash_val+i*SKEIN_512_BLOCK_BYTES);
/* restore the counter mode key for next time */
memcpy(ctx-x, x, sizeof(x));
}
@@ -577,8 +569,6 @@ int skein_1024_init_ext(struct skein_1024_ctx *ctx, size_t 
hash_bit_len,
/* tree hash config info (or SKEIN_CFG_TREE_INFO_SEQUENTIAL) */
cfg.w[2] = skein_swap64(tree_info);
 
-   skein_show_key(1024, ctx-h, key, key_bytes);
-
/* compute the initial chaining values from config block */
skein_1024_process_block(ctx, cfg.b, 1, SKEIN_CFG_STR_LEN);
 
@@ -685,8 +675,6 @@ int skein_1024_final(struct skein_1024_ctx *ctx, u8 
*hash_val)
/* output the ctr mode bytes */
skein_put64_lsb_first(hash_val+i*SKEIN_1024_BLOCK_BYTES, ctx-x,
  n);
-   skein_show_final(1024, ctx-h, n,
-hash_val+i*SKEIN_1024_BLOCK_BYTES);
/* restore the counter mode key for next time */
memcpy(ctx-x, x, sizeof(x));
}
@@ -794,8 +782,6 @@ int skein_256_output(struct skein_256_ctx *ctx, u8 
*hash_val)
/* output the ctr mode bytes */
skein_put64_lsb_first(hash_val+i*SKEIN_256_BLOCK_BYTES, ctx-x,
  n);
-   skein_show_final(256, ctx-h, n,
-hash_val+i*SKEIN_256_BLOCK_BYTES);
/* restore the counter mode key for next time */
memcpy(ctx-x, x, sizeof(x));
}
@@ -833,8 +819,6 @@ int skein_512_output(struct skein_512_ctx *ctx, u8 
*hash_val)
/* output the ctr mode bytes */
skein_put64_lsb_first(hash_val+i*SKEIN_512_BLOCK_BYTES, ctx-x,
  n);
-   skein_show_final(256, ctx-h, n,
-hash_val+i*SKEIN_512_BLOCK_BYTES);
/* restore the counter mode key for next time */
memcpy(ctx-x, x, sizeof(x));
}
@@ -872,8 +856,6 @@ int skein_1024_output(struct skein_1024_ctx *ctx, u8 
*hash_val)
/* output the ctr mode bytes */
skein_put64_lsb_first(hash_val+i*SKEIN_1024_BLOCK_BYTES, ctx-x,
  n);
-   skein_show_final(256, ctx-h, n,
-hash_val+i*SKEIN_1024_BLOCK_BYTES);
/* restore the counter mode key for next time */
memcpy(ctx-x, x, sizeof(x));
}
diff --git a/drivers/staging/skein/skein_base.h 
b/drivers/staging/skein/skein_base.h
index 0111fa4..993b951 100644
--- a/drivers/staging/skein/skein_base.h
+++ b/drivers/staging/skein/skein_base.h
@@ -15,10 +15,6 @@
 **
 ** The default 

Re: [PATCH 04/10] staging: unisys: fix all logical continuation virthba

2014-10-28 Thread Dan Carpenter
On Tue, Oct 28, 2014 at 06:42:40PM -0400, Erik Arfvidson wrote:
 This patch fixes all logical continuations issues in virthba.c
 
 v2: fixed spacing around bitwise operator suggested by dan carpenter

I said was ok with this stuff to be fixed in a later patch.  It slows
you down to redo everything and it's not like a missing space character
will ruin it forever.

regards,
dan carpenter

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


Re: [PATCH 1/3] staging: ion: shrink page-pool by page unit

2014-10-28 Thread Gioh Kim


2014-10-28 오전 9:36에 Gioh Kim 이(가) 쓴 글:
 This patch shrink page-pool by page unit.
 
 Shrinker usually get the pool size with the pool-scanner
 and pass the size to the pool-counter to shrink entire pool.
 But the pool-scanner is working in block unit.
 and pool-counter page unit.
 So it is confused.
 
 Signed-off-by: Gioh Kim gioh@lge.com
 ---
   drivers/staging/android/ion/ion_page_pool.c   |5 +++--
   drivers/staging/android/ion/ion_system_heap.c |7 +--
   2 files changed, 8 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/staging/android/ion/ion_page_pool.c 
 b/drivers/staging/android/ion/ion_page_pool.c
 index 5864f3d..165152f 100644
 --- a/drivers/staging/android/ion/ion_page_pool.c
 +++ b/drivers/staging/android/ion/ion_page_pool.c
 @@ -116,7 +116,7 @@ static int ion_page_pool_total(struct ion_page_pool 
 *pool, bool high)
   int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask,
   int nr_to_scan)
   {
 - int freed;
 + int freed = 0;
   bool high;
   
   if (current_is_kswapd())
 @@ -127,7 +127,7 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, 
 gfp_t gfp_mask,
   if (nr_to_scan == 0)
   return ion_page_pool_total(pool, high);
   
 - for (freed = 0; freed  nr_to_scan; freed++) {
 + while (freed = nr_to_scan) {
   struct page *page;
   
   mutex_lock(pool-mutex);
 @@ -141,6 +141,7 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, 
 gfp_t gfp_mask,
   }
   mutex_unlock(pool-mutex);
   ion_page_pool_free_pages(pool, page);
 + freed += (1  pool-order);
   }
   
   return freed;
 diff --git a/drivers/staging/android/ion/ion_system_heap.c 
 b/drivers/staging/android/ion/ion_system_heap.c
 index da2a63c..91d862f 100644
 --- a/drivers/staging/android/ion/ion_system_heap.c
 +++ b/drivers/staging/android/ion/ion_system_heap.c
 @@ -211,7 +211,7 @@ static int ion_system_heap_shrink(struct ion_heap *heap, 
 gfp_t gfp_mask,
   int nr_to_scan)
   {
   struct ion_system_heap *sys_heap;
 - int nr_total = 0;
 + int nr_total = 0, nr_freed;
   int i;
   
   sys_heap = container_of(heap, struct ion_system_heap, heap);
 @@ -219,7 +219,10 @@ static int ion_system_heap_shrink(struct ion_heap *heap, 
 gfp_t gfp_mask,
   for (i = 0; i  num_orders; i++) {
   struct ion_page_pool *pool = sys_heap-pools[i];
   
 - nr_total += ion_page_pool_shrink(pool, gfp_mask, nr_to_scan);
 + nr_freed = ion_page_pool_shrink(pool, gfp_mask, nr_to_scan);

I found a mistake that if nr_to_scan is 0, this works wrong.
Please ignore this patch and I'm going to send v2.


 + nr_total += nr_freed;
 + /* nr_to_scan can be negative */
 + nr_to_scan -= nr_freed;
   }
   
   return nr_total;
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/02] staging:lustre:lnet:selftest: fix sparse warnings

2014-10-28 Thread Anton Saraev
Patch fix simple sparse warnings: make functions static and remove
unused code. I'm doing only little testing: module was loaded properly,
output of lst without real server is the same as before.

Anton Saraev (2):
  staging:lustre:lnet:selftest: fix sparse warnings
  staging:lustre:lnet:selftest: remove unused function

 drivers/staging/lustre/lnet/selftest/conctl.c| 34 
 drivers/staging/lustre/lnet/selftest/conrpc.c| 20 +-
 drivers/staging/lustre/lnet/selftest/framework.c | 50 
 drivers/staging/lustre/lnet/selftest/module.c| 15 +--
 drivers/staging/lustre/lnet/selftest/rpc.c   | 34 
 drivers/staging/lustre/lnet/selftest/timer.c |  8 ++--
 6 files changed, 75 insertions(+), 86 deletions(-)

-- 
1.9.1

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


[PATCH 01/02] staging:lustre:lnet:selftest: fix sparse warnings

2014-10-28 Thread Anton Saraev
Fix sparse warnings: symbol X was not declared. Should it be static?
Some functions used only in files where they are declared. They can
be static.

Signed-off-by: Anton Saraev antonysar...@gmail.com
---
 drivers/staging/lustre/lnet/selftest/conctl.c| 34 
 drivers/staging/lustre/lnet/selftest/conrpc.c| 20 +-
 drivers/staging/lustre/lnet/selftest/framework.c | 50 
 drivers/staging/lustre/lnet/selftest/module.c|  6 +--
 drivers/staging/lustre/lnet/selftest/rpc.c   | 34 
 drivers/staging/lustre/lnet/selftest/timer.c |  8 ++--
 6 files changed, 76 insertions(+), 76 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c 
b/drivers/staging/lustre/lnet/selftest/conctl.c
index ae7b0fc..5bc6153 100644
--- a/drivers/staging/lustre/lnet/selftest/conctl.c
+++ b/drivers/staging/lustre/lnet/selftest/conctl.c
@@ -45,7 +45,7 @@
 #include ../../include/linux/lnet/lnetst.h
 #include console.h
 
-int
+static int
 lst_session_new_ioctl(lstio_session_new_args_t *args)
 {
char  *name;
@@ -82,7 +82,7 @@ lst_session_new_ioctl(lstio_session_new_args_t *args)
return rc;
 }
 
-int
+static int
 lst_session_end_ioctl(lstio_session_end_args_t *args)
 {
if (args-lstio_ses_key != console_session.ses_key)
@@ -91,7 +91,7 @@ lst_session_end_ioctl(lstio_session_end_args_t *args)
return lstcon_session_end();
 }
 
-int
+static int
 lst_session_info_ioctl(lstio_session_info_args_t *args)
 {
/* no checking of key */
@@ -113,7 +113,7 @@ lst_session_info_ioctl(lstio_session_info_args_t *args)
   args-lstio_ses_nmlen);
 }
 
-int
+static int
 lst_debug_ioctl(lstio_debug_args_t *args)
 {
char   *name   = NULL;
@@ -194,7 +194,7 @@ out:
return rc;
 }
 
-int
+static int
 lst_group_add_ioctl(lstio_group_add_args_t *args)
 {
char   *name;
@@ -228,7 +228,7 @@ lst_group_add_ioctl(lstio_group_add_args_t *args)
return rc;
 }
 
-int
+static int
 lst_group_del_ioctl(lstio_group_del_args_t *args)
 {
int rc;
@@ -262,7 +262,7 @@ lst_group_del_ioctl(lstio_group_del_args_t *args)
return rc;
 }
 
-int
+static int
 lst_group_update_ioctl(lstio_group_update_args_t *args)
 {
int rc;
@@ -320,7 +320,7 @@ lst_group_update_ioctl(lstio_group_update_args_t *args)
return rc;
 }
 
-int
+static int
 lst_nodes_add_ioctl(lstio_group_nodes_args_t *args)
 {
unsigned feats;
@@ -365,7 +365,7 @@ lst_nodes_add_ioctl(lstio_group_nodes_args_t *args)
return rc;
 }
 
-int
+static int
 lst_group_list_ioctl(lstio_group_list_args_t *args)
 {
if (args-lstio_grp_key != console_session.ses_key)
@@ -382,7 +382,7 @@ lst_group_list_ioctl(lstio_group_list_args_t *args)
  args-lstio_grp_namep);
 }
 
-int
+static int
 lst_group_info_ioctl(lstio_group_info_args_t *args)
 {
char   *name;
@@ -446,7 +446,7 @@ lst_group_info_ioctl(lstio_group_info_args_t *args)
return 0;
 }
 
-int
+static int
 lst_batch_add_ioctl(lstio_batch_add_args_t *args)
 {
int  rc;
@@ -480,7 +480,7 @@ lst_batch_add_ioctl(lstio_batch_add_args_t *args)
return rc;
 }
 
-int
+static int
 lst_batch_run_ioctl(lstio_batch_run_args_t *args)
 {
int  rc;
@@ -515,7 +515,7 @@ lst_batch_run_ioctl(lstio_batch_run_args_t *args)
return rc;
 }
 
-int
+static int
 lst_batch_stop_ioctl(lstio_batch_stop_args_t *args)
 {
int  rc;
@@ -551,7 +551,7 @@ lst_batch_stop_ioctl(lstio_batch_stop_args_t *args)
return rc;
 }
 
-int
+static int
 lst_batch_query_ioctl(lstio_batch_query_args_t *args)
 {
char   *name;
@@ -593,7 +593,7 @@ lst_batch_query_ioctl(lstio_batch_query_args_t *args)
return rc;
 }
 
-int
+static int
 lst_batch_list_ioctl(lstio_batch_list_args_t *args)
 {
if (args-lstio_bat_key != console_session.ses_key)
@@ -610,7 +610,7 @@ lst_batch_list_ioctl(lstio_batch_list_args_t *args)
  args-lstio_bat_namep);
 }
 
-int
+static int
 lst_batch_info_ioctl(lstio_batch_info_args_t *args)
 {
char   *name;
@@ -675,7 +675,7 @@ lst_batch_info_ioctl(lstio_batch_info_args_t *args)
return rc;
 }
 
-int
+static int
 lst_stat_query_ioctl(lstio_stat_args_t *args)
 {
int  rc;
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index a3a60d6..b0d 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -88,7 +88,7 @@ lstcon_rpc_done(srpc_client_rpc_t *rpc)
spin_unlock(rpc-crpc_lock);
 }
 
-int
+static int
 lstcon_rpc_init(lstcon_node_t *nd, int service, unsigned feats,
int bulk_npg, int bulk_len, int embedded, lstcon_rpc_t *crpc)
 {
@@ -113,7 +113,7 @@ lstcon_rpc_init(lstcon_node_t *nd, int service, unsigned 
feats,
return 0;
 }
 
-int
+static int
 

[PATCH 02/02] staging:lustre:lnet:selftest: remove unused function

2014-10-28 Thread Anton Saraev
Function lnet_selftest_structure_assertion is never used and can
be removed.

Signed-off-by: Anton Saraev antonysar...@gmail.com
---
 drivers/staging/lustre/lnet/selftest/module.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/module.c 
b/drivers/staging/lustre/lnet/selftest/module.c
index 718663f..92520c2 100644
--- a/drivers/staging/lustre/lnet/selftest/module.c
+++ b/drivers/staging/lustre/lnet/selftest/module.c
@@ -90,17 +90,6 @@ lnet_selftest_fini(void)
return;
 }
 
-static void
-lnet_selftest_structure_assertion(void)
-{
-   CLASSERT(sizeof(srpc_msg_t) == 160);
-   CLASSERT(sizeof(srpc_test_reqst_t) == 70);
-   CLASSERT(offsetof(srpc_msg_t, msg_body.tes_reqst.tsr_concur) == 72);
-   CLASSERT(offsetof(srpc_msg_t, msg_body.tes_reqst.tsr_ndest) == 78);
-   CLASSERT(sizeof(srpc_stat_reply_t) == 136);
-   CLASSERT(sizeof(srpc_stat_reqst_t) == 28);
-}
-
 static int
 lnet_selftest_init(void)
 {
-- 
1.9.1

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


[RFC] stating: ion: use hot page first in pool

2014-10-28 Thread Gioh Kim

Hello,

I found that ion insert freed-page at the tail of list
and extract at the head.

I think it is good for cache to use the most recently used page
but these pages in pool are not cached memory.
So I'm not sure using hot page is better or not in this case.

What do you think about using hot page first?

-- 8 -

From 14c8455cc80628e56a27ace9603d29e5056835b5 Mon Sep 17 00:00:00 2001
From: Gioh Kim gioh@lge.com
Date: Wed, 29 Oct 2014 13:44:28 +0900
Subject: [PATCH] staging: ion: use hot-page first

A page near the head is hot for cache.
This patch makes pool use hot page first.

Signed-off-by: Gioh Kim gioh@lge.com
---
 drivers/staging/android/ion/ion_page_pool.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_page_pool.c 
b/drivers/staging/android/ion/ion_page_pool.c
index 5864f3d..3d6ac4f 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -45,10 +45,10 @@ static int ion_page_pool_add(struct ion_page_pool *pool, 
struct page *page)
 {
mutex_lock(pool-mutex);
if (PageHighMem(page)) {
-   list_add_tail(page-lru, pool-high_items);
+   list_add(page-lru, pool-high_items);
pool-high_count++;
} else {
-   list_add_tail(page-lru, pool-low_items);
+   list_add(page-lru, pool-low_items);
pool-low_count++;
}
mutex_unlock(pool-mutex);
--
1.7.9.5

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


Re: [PATCH v2] staging: skein: skein_api.c: removed space before ','

2014-10-28 Thread Sudip Mukherjee
On Tue, Oct 28, 2014 at 09:07:00PM +0100, Mikael Svantesson wrote:
 Signed-off-by: Mikael Svantesson mik...@distopic.net
still the same problem.

ERROR: patch seems to be corrupt (line wrapped?)


 ---
  drivers/staging/skein/skein_api.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/staging/skein/skein_api.c 
 b/drivers/staging/skein/skein_api.c
 index 6e700ee..5bfce07 100644
 --- a/drivers/staging/skein/skein_api.c
 +++ b/drivers/staging/skein/skein_api.c
 @@ -31,7 +31,7 @@ int skein_ctx_prepare(struct skein_ctx *ctx, enum 
 skein_size size)
  {
   skein_assert_ret(ctx  size, SKEIN_FAIL);
  -memset(ctx , 0, sizeof(struct skein_ctx));
 + memset(ctx, 0, sizeof(struct skein_ctx));
   ctx-skein_size = size;
   return SKEIN_SUCCESS;
 -- 
 2.1.1
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv2 0/3] staging: ion: enable pool shrinking in page unit

2014-10-28 Thread Gioh Kim
Hello,

Current pool shrinking is not page unit, block unit.
But shrinker returns the pool size in page unit,
so it is confused.

And there is no way to control pool size and shrink pool directly.

I have 3 patches like followings.

1. Patch 1/3: make pool be shrinked by page unit
This patch shrinks pool in page unit.

2. Patch 2/3: limit pool size
This patch specifies pool size limit via debugfs.
The default value of limit is 0.
cat /sys/kernel/debug/ion/heaps/system_limit returns 0.
If you want to create 4 pools and limit each pool by 10MB,
you can write 40MB(=41943040) at system_limit debugfs file
like following:
echo 41943040  /sys/kernel/debug/ion/heaps/system_limit

2. Patch 3/3: enable debugfs to shrink page directly
This patch enables debugfs to specify shrink amount.
For instance, this shrinks all pages in every pool.
echo 0  /sys/kernel/debug/ion/heaps/system_shrink
And this shrinks 300-pages from entire pool.
echo 30  /sys/kernel/debug/ion/heaps/system_shrink
It try to shrink high-order pool first because high-order pages is necessary
more than low-order when the system has low memory.

This patchset is based on linux-next-20141023.


Gioh Kim (3):
  staging: ion: shrink page-pool by page unit
  staging: ion: limit pool size
  staging: ion: debugfs to shrink pool

 drivers/staging/android/ion/ion.c |   62 -
 drivers/staging/android/ion/ion_page_pool.c   |   32 -
 drivers/staging/android/ion/ion_system_heap.c |   20 ++--
 3 files changed, 75 insertions(+), 39 deletions(-)

-- 
1.7.9.5

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


[PATCHv2 3/3] staging: ion: debugfs to shrink pool

2014-10-28 Thread Gioh Kim
This patch enables debugfs files /sys/kernel/debug/ion/heaps/system_shrink
,which was commented out, to shrink pool or get pool size
Reading the file returns pool size and writing occurs to shrink pool.

Signed-off-by: Gioh Kim gioh@lge.com
---
 drivers/staging/android/ion/ion.c   |   31 +++
 drivers/staging/android/ion/ion_page_pool.c |5 -
 2 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 036e29b..4879076 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1463,43 +1463,29 @@ static const struct file_operations debug_heap_fops = {
.release = single_release,
 };
 
-#ifdef DEBUG_HEAP_SHRINKER
 static int debug_shrink_set(void *data, u64 val)
 {
struct ion_heap *heap = data;
-   struct shrink_control sc;
int objs;
 
-   sc.gfp_mask = -1;
-   sc.nr_to_scan = 0;
-
-   if (!val)
-   return 0;
-
-   objs = heap-shrinker.shrink(heap-shrinker, sc);
-   sc.nr_to_scan = objs;
+   if (val)
+   objs = val;
+   else
+   objs = heap-ops-shrink(heap, __GFP_HIGHMEM, 0);
 
-   heap-shrinker.shrink(heap-shrinker, sc);
+   (void)heap-ops-shrink(heap, __GFP_HIGHMEM, objs);
return 0;
 }
 
 static int debug_shrink_get(void *data, u64 *val)
 {
struct ion_heap *heap = data;
-   struct shrink_control sc;
-   int objs;
-
-   sc.gfp_mask = -1;
-   sc.nr_to_scan = 0;
-
-   objs = heap-shrinker.shrink(heap-shrinker, sc);
-   *val = objs;
+   *val = heap-ops-shrink(heap, __GFP_HIGHMEM, 0);
return 0;
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops, debug_shrink_get,
debug_shrink_set, %llu\n);
-#endif
 
 extern int pool_limit;
 extern const int num_orders;
@@ -1553,8 +1539,7 @@ void ion_device_add_heap(struct ion_device *dev, struct 
ion_heap *heap)
path, heap-name);
}
 
-#ifdef DEBUG_HEAP_SHRINKER
-   if (heap-shrinker.shrink) {
+   if (heap-ops-shrink) {
char debug_name[64];
 
snprintf(debug_name, 64, %s_shrink, heap-name);
@@ -1581,7 +1566,7 @@ void ion_device_add_heap(struct ion_device *dev, struct 
ion_heap *heap)
   path, debug_name);
 }
}
-#endif
+
up_write(dev-lock);
 }
 
diff --git a/drivers/staging/android/ion/ion_page_pool.c 
b/drivers/staging/android/ion/ion_page_pool.c
index 15d1ac8..c473c2a 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -25,6 +25,9 @@
 #include linux/kconfig.h
 #include ion_priv.h
 
+/* limit number of pages each pool can have */
+int pool_limit;
+
 static void *ion_page_pool_alloc_pages(struct ion_page_pool *pool)
 {
struct page *page = alloc_pages(pool-gfp_mask, pool-order);
@@ -54,7 +57,7 @@ static int ion_page_pool_total(struct ion_page_pool *pool, 
bool high)
 
 static int ion_page_pool_add(struct ion_page_pool *pool, struct page *page)
 {
-   if (CONFIG_ION_POOL_LIMIT  ion_page_pool_total(pool, 1)  POOL_LIMIT)
+   if (pool_limit  ion_page_pool_total(pool, 1)  pool_limit)
return 1;
 
mutex_lock(pool-mutex);
-- 
1.7.9.5

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


[PATCHv2 1/3] staging: ion: shrink page-pool by page unit

2014-10-28 Thread Gioh Kim
This patch shrink page-pool by page unit.

Shrinker usually get the pool size with the pool-scanner
and pass the size to the pool-counter to shrink entire pool.
But the pool-scanner is working in block unit.
and pool-counter page unit.
So it is confused.

Change-Id: If25c693c09f6ebd14c87809feddb72f9058e8308
Signed-off-by: Gioh Kim gioh@lge.com
---
 drivers/staging/android/ion/ion_page_pool.c   |5 +++--
 drivers/staging/android/ion/ion_system_heap.c |   18 +++---
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/android/ion/ion_page_pool.c 
b/drivers/staging/android/ion/ion_page_pool.c
index 5864f3d..165152f 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -116,7 +116,7 @@ static int ion_page_pool_total(struct ion_page_pool *pool, 
bool high)
 int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask,
int nr_to_scan)
 {
-   int freed;
+   int freed = 0;
bool high;
 
if (current_is_kswapd())
@@ -127,7 +127,7 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t 
gfp_mask,
if (nr_to_scan == 0)
return ion_page_pool_total(pool, high);
 
-   for (freed = 0; freed  nr_to_scan; freed++) {
+   while (freed = nr_to_scan) {
struct page *page;
 
mutex_lock(pool-mutex);
@@ -141,6 +141,7 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t 
gfp_mask,
}
mutex_unlock(pool-mutex);
ion_page_pool_free_pages(pool, page);
+   freed += (1  pool-order);
}
 
return freed;
diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index da2a63c..0ba8aaf 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -29,7 +29,7 @@
 static gfp_t high_order_gfp_flags = (GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN |
 __GFP_NORETRY)  ~__GFP_WAIT;
 static gfp_t low_order_gfp_flags  = (GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN);
-static const unsigned int orders[] = {8, 4, 0};
+static const unsigned int orders[] = {8, 6, 4, 0};
 static const int num_orders = ARRAY_SIZE(orders);
 static int order_to_index(unsigned int order)
 {
@@ -212,14 +212,26 @@ static int ion_system_heap_shrink(struct ion_heap *heap, 
gfp_t gfp_mask,
 {
struct ion_system_heap *sys_heap;
int nr_total = 0;
-   int i;
+   int i, nr_freed;
+   int only_scan = 0;
 
sys_heap = container_of(heap, struct ion_system_heap, heap);
 
+   if (!nr_to_scan)
+   only_scan = 1;
+
for (i = 0; i  num_orders; i++) {
struct ion_page_pool *pool = sys_heap-pools[i];
 
-   nr_total += ion_page_pool_shrink(pool, gfp_mask, nr_to_scan);
+   nr_freed = ion_page_pool_shrink(pool, gfp_mask, nr_to_scan);
+   nr_total += nr_freed;
+
+   if (!only_scan) {
+   nr_to_scan -= nr_freed;
+   /* shrink completed */
+   if (nr_to_scan = 0)
+   break;
+   }
}
 
return nr_total;
-- 
1.7.9.5

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