Re: [PATCH 2/7] staging: sm750fb: remove needless goto statements and lables

2015-11-04 Thread Mike Rapoport
On Wed, Nov 04, 2015 at 12:50:30PM +0530, Sudip Mukherjee wrote:
> On Sun, Nov 01, 2015 at 10:55:48AM +0200, Mike Rapoport wrote:
> > In lynxfb_pci_probe return error immediately in cases no cleanup is
> > required.
> > 
> > Signed-off-by: Mike Rapoport 
> > ---
> 
> NACK.
> It should be:
> 
> diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> index c78421b..3713a8d 100644
> --- a/drivers/staging/sm750fb/sm750.c
> +++ b/drivers/staging/sm750fb/sm750.c
> @@ -1010,7 +1010,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
>   /* enable device */
>   if (pci_enable_device(pdev)) {
>   pr_err("can not enable device.\n");
> - goto err_enable;
> + return -ENODEV;
>   }
>  
>   sm750_dev = kzalloc(sizeof(*sm750_dev), GFP_KERNEL);
> @@ -1132,7 +1132,7 @@ err_info0_alloc:
>  err_map:
>   kfree(sm750_dev);
>  err_share:
> -err_enable:
> + pci_disable_device(pdev);
>   return -ENODEV;
>  }
> 
> 
> Ahh, well, this is also not entirely correct. We are returning -ENODEV
> in all cases. The actual error code should be returned.

I take care of actual return code in later patches. I didn't add
pci_disable_device, though...
 
> regards
> sudip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: staging: lustre: provide separate buffers for libcfs_*2str()

2015-11-04 Thread Eremin, Dmitry
Hello Dan,

Thanks to report this.  This issue was fixed in our code but not up streamed 
yet. The patch is available 
http://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commit;h=d47f00d5a420b594b49564b2e00efca4602c3fb5

index 02764bd..c8ce66c 100644
--- a/lustre/obdclass/lprocfs_status.c
+++ b/lustre/obdclass/lprocfs_status.c
@@ -789,14 +789,17 @@ int lprocfs_import_seq_show(struct seq_file *m, void *data
seq_printf(m, "%s%s", j ? ", " : "", nidstr);
j++;
}
-   libcfs_nid2str_r(imp->imp_connection->c_peer.nid,
-nidstr, sizeof(nidstr));
+   if (imp->imp_connection != NULL)
+   libcfs_nid2str_r(imp->imp_connection->c_peer.nid,
+nidstr, sizeof(nidstr));
+   else
+   strncpy(nidstr, "", sizeof(nidstr));
seq_printf(m, " ]\n"
  "   current_connection: %s\n"
  "   connection_attempts: %u\n"
  "   generation: %u\n"
  "   in-progress_invalidations: %u\n",
- imp->imp_connection == NULL ? "" : nidstr,
+ nidstr,
  imp->imp_conn_cnt,
  imp->imp_generation,
  atomic_read(&imp->imp_inval_count));

Dmitry.
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Tuesday, November 3, 2015 3:11 PM
> To: Eremin, Dmitry 
> Cc: de...@driverdev.osuosl.org
> Subject: re: staging: lustre: provide separate buffers for libcfs_*2str()
> 
> Hello Dmitry Eremin,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 80feb1ef349e: "staging: lustre: provide separate buffers for
> libcfs_*2str()" from Oct 21, 2015, leads to the following Smatch
> complaint:
> 
> drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:676
> lprocfs_rd_import()
>warn: variable dereferenced before check 'imp->imp_connection'
> (see line 668)
> 
> drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
>667}
>668libcfs_nid2str_r(imp->imp_connection->c_peer.nid,
>  ^ Patch introduces a new
> dereference.
> 
>669 nidstr, sizeof(nidstr));
>670seq_printf(m,
>671  "]\n"
>672  "   current_connection: %s\n"
>673  "   connection_attempts: %u\n"
>674  "   generation: %u\n"
>675  "   in-progress_invalidations: %u\n",
>676  imp->imp_connection == NULL ? "" : 
> nidstr,
>   ^^^ Old code assumes it can be 
> NULL.
> 
>677  imp->imp_conn_cnt,
>678  imp->imp_generation,
> 
> regards,
> dan carpenter


Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park,
17 Krylatskaya Str., Bldg 4, Moscow 121614,
Russian Federation

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 3/7] staging: sm750fb: lynxfb_pci_probe: return actual errors

2015-11-04 Thread Mike Rapoport
The lynxfb_pci_probe always returned -ENODEV in case of error. Modify it
so that actual error code will be propogated to the caller.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/sm750fb/sm750.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index c80b11c..8f666c0 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1006,17 +1006,18 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
struct fb_info *info[] = {NULL, NULL};
struct sm750_dev *sm750_dev = NULL;
int fbidx;
+   int err = -ENOMEM;
 
/* enable device */
if (pci_enable_device(pdev)) {
pr_err("can not enable device.\n");
-   goto err_enable;
+   return -ENODEV;
}
 
sm750_dev = kzalloc(sizeof(*sm750_dev), GFP_KERNEL);
if (!sm750_dev) {
pr_err("Could not allocate memory for share.\n");
-   goto err_share;
+   goto err_alloc_dev;
}
 
sm750_dev->fbinfo[0] = sm750_dev->fbinfo[1] = NULL;
@@ -1051,7 +1052,8 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
sm750fb_setup(sm750_dev, g_settings);
 
/* call chip specific mmap routine */
-   if (hw_sm750_map(sm750_dev, pdev)) {
+   err = hw_sm750_map(sm750_dev, pdev);
+   if (err) {
pr_err("Memory map failed\n");
goto err_map;
}
@@ -1082,7 +1084,6 @@ ALLOC_FB:
goto err_info1_alloc;
} else {
struct lynxfb_par *par;
-   int errno;
 
pr_info("framebuffer #%d alloc okay\n", fbidx);
sm750_dev->fbinfo[fbidx] = info[fbidx];
@@ -1100,11 +1101,11 @@ ALLOC_FB:
 
/* register frame buffer */
pr_info("Ready to register framebuffer #%d.\n", fbidx);
-   errno = register_framebuffer(info[fbidx]);
-   if (errno < 0) {
+   err = register_framebuffer(info[fbidx]);
+   if (err < 0) {
pr_err("Failed to register fb_info #%d. err %d\n",
   fbidx,
-  errno);
+  err);
if (fbidx == 0)
goto err_register0;
else
@@ -1131,10 +1132,9 @@ err_info0_set:
 err_info0_alloc:
 err_map:
kfree(sm750_dev);
-err_share:
+err_alloc_dev:
pci_disable_device(pdev);
-err_enable:
-   return -ENODEV;
+   return err;
 }
 
 static void lynxfb_pci_remove(struct pci_dev *pdev)
-- 
2.1.0

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


[PATCH v2 2/7] staging: sm750fb: disable PCI device if lynxfb_pci_probe fails

2015-11-04 Thread Mike Rapoport
In case of error during lynxfb_pci_probe, the function returned without
calling pci_disable_device. Fix it by adding pci_disable_device on the
error cleanup path.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/sm750fb/sm750.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index c78421b..c80b11c 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1132,6 +1132,7 @@ err_info0_alloc:
 err_map:
kfree(sm750_dev);
 err_share:
+   pci_disable_device(pdev);
 err_enable:
return -ENODEV;
 }
-- 
2.1.0

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


[PATCH v2 5/7] staging: sm750fb: replace dual member of sm750_dev with fb_count

2015-11-04 Thread Mike Rapoport
Will be used in futher refactoring of driver _probe and _remove methods.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/sm750fb/sm750.c | 24 +---
 drivers/staging/sm750fb/sm750.h |  2 +-
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 5f0ce81..769078d 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -189,7 +189,7 @@ static void lynxfb_ops_fillrect(struct fb_info *info,
 * If not use spin_lock,system will die if user load driver
 * and immediately unload driver frequently (dual)
 */
-   if (sm750_dev->dual)
+   if (sm750_dev->fb_count > 1)
spin_lock(&sm750_dev->slock);
 
sm750_dev->accel.de_fillrect(&sm750_dev->accel,
@@ -197,7 +197,7 @@ static void lynxfb_ops_fillrect(struct fb_info *info,
 region->dx, region->dy,
 region->width, region->height,
 color, rop);
-   if (sm750_dev->dual)
+   if (sm750_dev->fb_count > 1)
spin_unlock(&sm750_dev->slock);
 }
 
@@ -223,7 +223,7 @@ static void lynxfb_ops_copyarea(struct fb_info *info,
 * If not use spin_lock, system will die if user load driver
 * and immediately unload driver frequently (dual)
 */
-   if (sm750_dev->dual)
+   if (sm750_dev->fb_count > 1)
spin_lock(&sm750_dev->slock);
 
sm750_dev->accel.de_copyarea(&sm750_dev->accel,
@@ -231,7 +231,7 @@ static void lynxfb_ops_copyarea(struct fb_info *info,
 base, pitch, Bpp, region->dx, region->dy,
 region->width, region->height,
 HW_ROP2_COPY);
-   if (sm750_dev->dual)
+   if (sm750_dev->fb_count > 1)
spin_unlock(&sm750_dev->slock);
 }
 
@@ -272,7 +272,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info,
 * If not use spin_lock, system will die if user load driver
 * and immediately unload driver frequently (dual)
 */
-   if (sm750_dev->dual)
+   if (sm750_dev->fb_count > 1)
spin_lock(&sm750_dev->slock);
 
sm750_dev->accel.de_imageblit(&sm750_dev->accel,
@@ -281,7 +281,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info,
  image->dx, image->dy,
  image->width, image->height,
  fgcol, bgcol, HW_ROP2_COPY);
-   if (sm750_dev->dual)
+   if (sm750_dev->fb_count > 1)
spin_unlock(&sm750_dev->slock);
 }
 
@@ -650,8 +650,10 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
output = &par->output;
crtc = &par->crtc;
 
-   crtc->vidmem_size = (sm750_dev->dual) ? sm750_dev->vidmem_size >> 1 :
-sm750_dev->vidmem_size;
+   crtc->vidmem_size = sm750_dev->vidmem_size;
+   if (sm750_dev->fb_count > 1)
+   crtc->vidmem_size >>= 1;
+
/* setup crtc and output member */
sm750_dev->hwCursor = g_hwcursor;
 
@@ -981,7 +983,7 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char 
*src)
 
 NO_PARAM:
if (sm750_dev->revid != SM750LE_REVISION_ID) {
-   if (sm750_dev->dual) {
+   if (sm750_dev->fb_count > 1) {
if (swap)
sm750_dev->dataflow = sm750_dual_swap;
else
@@ -1029,7 +1031,6 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
sm750_dev->mtrr_off = g_nomtrr;
sm750_dev->mtrr.vram = 0;
sm750_dev->accel_off = g_noaccel;
-   sm750_dev->dual = g_dualview;
spin_lock_init(&sm750_dev->slock);
 
if (!sm750_dev->accel_off) {
@@ -1116,7 +1117,8 @@ ALLOC_FB:
 
/* no dual view by far */
fbidx++;
-   if (sm750_dev->dual && fbidx < 2)
+   sm750_dev->fb_count++;
+   if (g_dualview && fbidx < 2)
goto ALLOC_FB;
 
return 0;
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index b0a93cd..fddffac 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -79,7 +79,7 @@ struct sm750_dev {
struct fb_info *fbinfo[2];
struct lynx_accel accel;
int accel_off;
-   int dual;
+   int fb_count;
int mtrr_off;
struct{
int vram;
-- 
2.1.0

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


[PATCH v2 4/7] staging: sm750fb: lynxfb_pci_remove: remove unused variable

2015-11-04 Thread Mike Rapoport
The par variable in lynxfb_pci_remove is only assigned a value and never
used afterwards. Remove it.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/sm750fb/sm750.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 8f666c0..5f0ce81 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1141,7 +1141,6 @@ static void lynxfb_pci_remove(struct pci_dev *pdev)
 {
struct fb_info *info;
struct sm750_dev *sm750_dev;
-   struct lynxfb_par *par;
int cnt;
 
cnt = 2;
@@ -1151,7 +1150,6 @@ static void lynxfb_pci_remove(struct pci_dev *pdev)
info = sm750_dev->fbinfo[cnt];
if (!info)
continue;
-   par = info->par;
 
unregister_framebuffer(info);
/* release frame buffer */
-- 
2.1.0

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


[PATCH v2 1/7] staging: sm750fb: remove unused modedb.h

2015-11-04 Thread Mike Rapoport
The modedb.h defines unused set of videomodes and can be removed

Signed-off-by: Mike Rapoport 
---
 drivers/staging/sm750fb/modedb.h | 233 ---
 drivers/staging/sm750fb/sm750.c  |   2 -
 2 files changed, 235 deletions(-)
 delete mode 100644 drivers/staging/sm750fb/modedb.h

diff --git a/drivers/staging/sm750fb/modedb.h b/drivers/staging/sm750fb/modedb.h
deleted file mode 100644
index 83cb2e2..000
--- a/drivers/staging/sm750fb/modedb.h
+++ /dev/null
@@ -1,233 +0,0 @@
-
-static const struct fb_videomode modedb2[] = {
-   {
-   /* 640x400 @ 70 Hz, 31.5 kHz hsync */
-   NULL, 70, 640, 400, 39721, 40, 24, 39, 9, 96, 2,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 640x480 @ 60 Hz, 31.5 kHz hsync */
-   NULL, 60, 640, 480, 39721, 40, 24, 32, 11, 96, 2,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 800x600 @ 56 Hz, 35.15 kHz hsync */
-   NULL, 56, 800, 600, 2, 128, 24, 22, 1, 72, 2,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 1024x768 @ 87 Hz interlaced, 35.5 kHz hsync */
-   NULL, 87, 1024, 768, 22271, 56, 24, 33, 8, 160, 8,
-   0, FB_VMODE_INTERLACED
-   }, {
-   /* 640x400 @ 85 Hz, 37.86 kHz hsync */
-   NULL, 85, 640, 400, 31746, 96, 32, 41, 1, 64, 3,
-   FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
-   }, {
-   /* 640x480 @ 72 Hz, 36.5 kHz hsync */
-   NULL, 72, 640, 480, 31746, 144, 40, 30, 8, 40, 3,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 640x480 @ 75 Hz, 37.50 kHz hsync */
-   NULL, 75, 640, 480, 31746, 120, 16, 16, 1, 64, 3,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 800x600 @ 60 Hz, 37.8 kHz hsync */
-   NULL, 60, 800, 600, 25000, 88, 40, 23, 1, 128, 4,
-   FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
-   FB_VMODE_NONINTERLACED
-   }, {
-   /* 640x480 @ 85 Hz, 43.27 kHz hsync */
-   NULL, 85, 640, 480, 2, 80, 56, 25, 1, 56, 3,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 1152x864 @ 89 Hz interlaced, 44 kHz hsync */
-   NULL, 69, 1152, 864, 15384, 96, 16, 110, 1, 216, 10,
-   0, FB_VMODE_INTERLACED
-   }, {
-   /* 800x600 @ 72 Hz, 48.0 kHz hsync */
-   NULL, 72, 800, 600, 2, 64, 56, 23, 37, 120, 6,
-   FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
-   FB_VMODE_NONINTERLACED
-   }, {
-   /* 1024x768 @ 60 Hz, 48.4 kHz hsync */
-   NULL, 60, 1024, 768, 15384, 168, 8, 29, 3, 144, 6,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 640x480 @ 100 Hz, 53.01 kHz hsync */
-   NULL, 100, 640, 480, 21834, 96, 32, 36, 8, 96, 6,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 1152x864 @ 60 Hz, 53.5 kHz hsync */
-   NULL, 60, 1152, 864, 11123, 208, 64, 16, 4, 256, 8,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 800x600 @ 85 Hz, 55.84 kHz hsync */
-   NULL, 85, 800, 600, 16460, 160, 64, 36, 16, 64, 5,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 1024x768 @ 70 Hz, 56.5 kHz hsync */
-   NULL, 70, 1024, 768, 1, 144, 24, 29, 3, 136, 6,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /*  1280x960-60 VESA */
-   NULL, 60, 1280, 960, 9259, 312, 96, 36, 1, 112, 3,
-   FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
-   FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA
-   }, {
-   /*  1280x1024-60 VESA */
-   NULL, 60, 1280, 1024, 9259, 248, 48, 38, 1, 112, 3,
-   FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
-   FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA
-   }, {
-   /* 1280x1024 @ 87 Hz interlaced, 51 kHz hsync */
-   NULL, 87, 1280, 1024, 12500, 56, 16, 128, 1, 216, 12,
-   0, FB_VMODE_INTERLACED
-   }, {
-   /* 800x600 @ 100 Hz, 64.02 kHz hsync */
-   NULL, 100, 800, 600, 14357, 160, 64, 30, 4, 64, 6,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 1024x768 @ 76 Hz, 62.5 kHz hsync */
-   NULL, 76, 1024, 768, 11764, 208, 8, 36, 16, 120, 3,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 1152x864 @ 70 Hz, 62.4 kHz hsync */
-   NULL, 70, 1152, 864, 10869, 106, 56, 20, 1, 160, 10,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 1280x1024 @ 61 Hz, 64.2 kHz hsync */
-   NULL, 61, 1280, 1024, 9090, 200, 48, 26, 1, 184, 3,
-   0, FB_VMODE_NONINTERLACED
-   }, {
-   /* 1400x1050 @ 60Hz, 63.9 kHz hsync */
-   NULL, 68, 

[PATCH v2 0/7] staging: sm750fb: refactor lynxfb_pci_probe

2015-11-04 Thread Mike Rapoport
Hi,

These patches refactor the lynxfb_pci_probe along with some minor cleanups

v2 changes:
* add pci_disable_device on the cleanup path
* return actual error rather than ENODEV

Mike Rapoport (7):
  staging: sm750fb: remove unused modedb.h
  staging: sm750fb: disable PCI device if lynxfb_pci_probe fails
  staging: sm750fb: lynxfb_pci_probe: return actual errors
  staging: sm750fb: lynxfb_pci_remove: remove unused variable
  staging: sm750fb: replace dual member of sm750_dev with fb_count
  staging: sm750fb: introduce sm750fb_frambuffer_release
  staging: sm750fb: introduce sm750fb_frambuffer_alloc

 drivers/staging/sm750fb/modedb.h | 233 ---
 drivers/staging/sm750fb/sm750.c  | 169 ++--
 drivers/staging/sm750fb/sm750.h  |   2 +-
 3 files changed, 82 insertions(+), 322 deletions(-)
 delete mode 100644 drivers/staging/sm750fb/modedb.h

-- 
2.1.0

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


[PATCH v2 6/7] staging: sm750fb: introduce sm750fb_frambuffer_release

2015-11-04 Thread Mike Rapoport
Use a function to unregister framebuffer info and release its resources.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/sm750fb/sm750.c | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 769078d..045238f 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1002,6 +1002,18 @@ NO_PARAM:
}
 }
 
+static void sm750fb_frambuffer_release(struct sm750_dev *sm750_dev)
+{
+   struct fb_info *fb_info;
+
+   while (sm750_dev->fb_count) {
+   fb_info = sm750_dev->fbinfo[sm750_dev->fb_count - 1];
+   unregister_framebuffer(fb_info);
+   framebuffer_release(fb_info);
+   sm750_dev->fb_count--;
+   }
+}
+
 static int lynxfb_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
 {
@@ -1141,22 +1153,11 @@ err_alloc_dev:
 
 static void lynxfb_pci_remove(struct pci_dev *pdev)
 {
-   struct fb_info *info;
struct sm750_dev *sm750_dev;
-   int cnt;
 
-   cnt = 2;
sm750_dev = pci_get_drvdata(pdev);
 
-   while (cnt-- > 0) {
-   info = sm750_dev->fbinfo[cnt];
-   if (!info)
-   continue;
-
-   unregister_framebuffer(info);
-   /* release frame buffer */
-   framebuffer_release(info);
-   }
+   sm750fb_frambuffer_release(sm750_dev);
arch_phys_wc_del(sm750_dev->mtrr.vram);
 
iounmap(sm750_dev->pvReg);
-- 
2.1.0

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


[PATCH v2 7/7] staging: sm750fb: introduce sm750fb_frambuffer_alloc

2015-11-04 Thread Mike Rapoport
Split framebuffer allocation and registration into a dedicated function
to simplify lynxfb_pci_probe

Signed-off-by: Mike Rapoport 
---
 drivers/staging/sm750fb/sm750.c | 105 +++-
 1 file changed, 49 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 045238f..63cfbcf 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1014,11 +1014,51 @@ static void sm750fb_frambuffer_release(struct sm750_dev 
*sm750_dev)
}
 }
 
+static int sm750fb_frambuffer_alloc(struct sm750_dev *sm750_dev, int fbidx)
+{
+   struct fb_info *fb_info;
+   struct lynxfb_par *par;
+   int err;
+
+   fb_info = framebuffer_alloc(sizeof(struct lynxfb_par),
+   &sm750_dev->pdev->dev);
+   if (!fb_info) {
+   pr_err("Could not allocate framebuffer #%d.\n", fbidx);
+   return -ENOMEM;
+   }
+
+   sm750_dev->fbinfo[fbidx] = fb_info;
+   par = fb_info->par;
+   par->dev = sm750_dev;
+
+   err = lynxfb_set_fbinfo(fb_info, fbidx);
+   if (err) {
+   pr_err("Failed to initial fb_info #%d.\n", fbidx);
+   goto fb_release;
+   }
+
+   err = register_framebuffer(fb_info);
+   if (err < 0) {
+   pr_err("Failed to register fb_info #%d. err %d\n", fbidx, err);
+   goto fb_release;
+   }
+
+   sm750_dev->fb_count++;
+
+   pr_info("Accomplished register framebuffer #%d.\n", fbidx);
+
+   return 0;
+
+fb_release:
+   framebuffer_release(fb_info);
+   return err;
+}
+
 static int lynxfb_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
 {
-   struct fb_info *info[] = {NULL, NULL};
struct sm750_dev *sm750_dev = NULL;
+   int max_fb;
int fbidx;
int err = -ENOMEM;
 
@@ -1085,65 +1125,18 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
/* call chipInit routine */
hw_sm750_inithw(sm750_dev, pdev);
 
-   /* allocate frame buffer info structor according to g_dualview */
-   fbidx = 0;
-ALLOC_FB:
-   info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par), &pdev->dev);
-   if (!info[fbidx]) {
-   pr_err("Could not allocate framebuffer #%d.\n", fbidx);
-   if (fbidx == 0)
-   goto err_info0_alloc;
-   else
-   goto err_info1_alloc;
-   } else {
-   struct lynxfb_par *par;
-
-   pr_info("framebuffer #%d alloc okay\n", fbidx);
-   sm750_dev->fbinfo[fbidx] = info[fbidx];
-   par = info[fbidx]->par;
-   par->dev = sm750_dev;
-
-   /* set fb_info structure */
-   if (lynxfb_set_fbinfo(info[fbidx], fbidx)) {
-   pr_err("Failed to initial fb_info #%d.\n", fbidx);
-   if (fbidx == 0)
-   goto err_info0_set;
-   else
-   goto err_info1_set;
-   }
-
-   /* register frame buffer */
-   pr_info("Ready to register framebuffer #%d.\n", fbidx);
-   err = register_framebuffer(info[fbidx]);
-   if (err < 0) {
-   pr_err("Failed to register fb_info #%d. err %d\n",
-  fbidx,
-  err);
-   if (fbidx == 0)
-   goto err_register0;
-   else
-   goto err_register1;
-   }
-   pr_info("Accomplished register framebuffer #%d.\n", fbidx);
+   /* allocate frame buffer info structures according to g_dualview */
+   max_fb = g_dualview ? 2 : 1;
+   for (fbidx = 0; fbidx < max_fb; fbidx++) {
+   err = sm750fb_frambuffer_alloc(sm750_dev, fbidx);
+   if (err)
+   goto err_alloc_fb;
}
 
-   /* no dual view by far */
-   fbidx++;
-   sm750_dev->fb_count++;
-   if (g_dualview && fbidx < 2)
-   goto ALLOC_FB;
-
return 0;
 
-err_register1:
-err_info1_set:
-   framebuffer_release(info[1]);
-err_info1_alloc:
-   unregister_framebuffer(info[0]);
-err_register0:
-err_info0_set:
-   framebuffer_release(info[0]);
-err_info0_alloc:
+err_alloc_fb:
+   sm750fb_frambuffer_release(sm750_dev);
 err_map:
kfree(sm750_dev);
 err_alloc_dev:
-- 
2.1.0

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


Re: [PATCH 01/11] staging: rtl8188eu: new temporary variable added to _rtl88e_fill_dummy

2015-11-04 Thread Dan Carpenter
On Wed, Nov 04, 2015 at 10:11:19AM +0700, Ivan Safonov wrote:
> It makes easier to understand the transition to a simpler function form.
> 

You're really breaking your patches into to small pieces.  This patch
makes no sense on its own and introduces a static checker warning that
n is assigned but never used.

> Signed-off-by: Ivan Safonov 
> ---
>  drivers/staging/rtl8188eu/hal/fw.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8188eu/hal/fw.c 
> b/drivers/staging/rtl8188eu/hal/fw.c
> index 23aa6d3..d502606 100644
> --- a/drivers/staging/rtl8188eu/hal/fw.c
> +++ b/drivers/staging/rtl8188eu/hal/fw.c
> @@ -83,10 +83,11 @@ static void _rtl88e_fw_block_write(struct adapter *adapt,
>  
>  static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen)
>  {
> - u32 fwlen = *pfwlen;
> + u32 fwlen = *pfwlen, n;

Put these on separate lines.  Generally, it's one variable per line but
especially in this case where we have an initialization.

regards,
dan carpenter

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


Re: [PATCH 02/11] staging: rtl8188eu: for loop instead of while loop used

2015-11-04 Thread Dan Carpenter
On Wed, Nov 04, 2015 at 10:12:12AM +0700, Ivan Safonov wrote:
> diff --git a/drivers/staging/rtl8188eu/hal/fw.c 
> b/drivers/staging/rtl8188eu/hal/fw.c
> index d502606..6d6dd15 100644
> --- a/drivers/staging/rtl8188eu/hal/fw.c
> +++ b/drivers/staging/rtl8188eu/hal/fw.c
> @@ -89,10 +89,8 @@ static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen)
>   remain = (remain == 0) ? 0 : (4 - remain);
>   n = remain;
>  
> - while (remain > 0) {
> + for (; remain > 0; fwlen++, remain--) {
>   pfwbuf[fwlen] = 0;
> - fwlen++;
> - remain--;
>   }

So, this patch for example, because of your change now the for loop is a
one line loop.  It means you need to remove the curly braces.  Don't
introduce a checkpatch warning and then fix it in a later patch.

The one thing per patch rule is slightly tricky and fuzzy...

regards,
dan carpenter

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


Re: [PATCH 03/11] staging: rtl8188eu: traversal order of the 'remain' variable values inverted

2015-11-04 Thread Dan Carpenter
On Wed, Nov 04, 2015 at 10:12:51AM +0700, Ivan Safonov wrote:
> The number of the loop passes has not changed.
> 
> Signed-off-by: Ivan Safonov 
> ---
>  drivers/staging/rtl8188eu/hal/fw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8188eu/hal/fw.c 
> b/drivers/staging/rtl8188eu/hal/fw.c
> index 6d6dd15..9cd898c 100644
> --- a/drivers/staging/rtl8188eu/hal/fw.c
> +++ b/drivers/staging/rtl8188eu/hal/fw.c
> @@ -89,7 +89,7 @@ static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen)
>   remain = (remain == 0) ? 0 : (4 - remain);
>   n = remain;
>  
> - for (; remain > 0; fwlen++, remain--) {
> + for (remain = 0; remain < n; fwlen++, remain++) {

We are using the "remain" variable for a couple different things.  It
should only hold the remaining number of array elements.  It's shouldn't
be the iterator as well.

regards,
dan carpenter

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


Re: [PATCH 11/11] staging: rtl8188eu: return value and argument types changed in _rtl88e_write_fw function

2015-11-04 Thread Dan Carpenter
Really, it's probably easiest to just fold all these patches together as
one patch.  Re-writing a function is considered "one thing" under the
"one thing per patch" rule.  Re-writing a file is not considered one
thing.  Hopefully that's helpful in understanding where the line is.

regards,
dan carpenter

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


Re: [PATCH 11/11] staging: rtl8188eu: return value and argument types changed in _rtl88e_write_fw function

2015-11-04 Thread Ivan Safonov

On 11/04/2015 06:29 PM, Dan Carpenter wrote:

Really, it's probably easiest to just fold all these patches together as
one patch.  Re-writing a function is considered "one thing" under the
"one thing per patch" rule.  Re-writing a file is not considered one
thing.  Hopefully that's helpful in understanding where the line is.

regards,
dan carpenter

I like this rule. In fact I was easier to send all patches in one piece.
Thanks for the help!
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/7] staging: lustre: remove white space in libcfs_hash.h

2015-11-04 Thread Sudip Mukherjee
On Tue, Nov 03, 2015 at 07:46:07PM -0800, Greg Kroah-Hartman wrote:
> On Mon, Nov 02, 2015 at 12:22:07PM -0500, James Simmons wrote:
> > Cleanup all the unneeded white space in libcfs_hash.h.
> > 
> > Signed-off-by: James Simmons 
> > ---
> >  .../lustre/include/linux/libcfs/libcfs_hash.h  |  135 
> > ++--
> >  1 files changed, 70 insertions(+), 65 deletions(-)
> 
> Doesn't apply, did I already queue up this series?

No. This did not apply because of:
c7fdf4a3959f ("staging: lustre: fix remaining checkpatch issues for 
libcfs_hash.h")

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


[PATCH v2 1/2] staging: rtl8188eu: for loop instead of while loop used

2015-11-04 Thread Ivan Safonov
The range of elements to fill with zeros is determined by using a roundup macro

Signed-off-by: Ivan Safonov 
---
Changes in v2:
  - Many small patches have been merged into one.

 drivers/staging/rtl8188eu/hal/fw.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/fw.c 
b/drivers/staging/rtl8188eu/hal/fw.c
index 23aa6d3..c6cdca3 100644
--- a/drivers/staging/rtl8188eu/hal/fw.c
+++ b/drivers/staging/rtl8188eu/hal/fw.c
@@ -83,18 +83,12 @@ static void _rtl88e_fw_block_write(struct adapter *adapt,
 
 static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen)
 {
-   u32 fwlen = *pfwlen;
-   u8 remain = (u8)(fwlen % 4);
+   u32 i;
 
-   remain = (remain == 0) ? 0 : (4 - remain);
+   for (i = *pfwlen; i < roundup(*pfwlen, 4); i++)
+   pfwbuf[i] = 0;
 
-   while (remain > 0) {
-   pfwbuf[fwlen] = 0;
-   fwlen++;
-   remain--;
-   }
-
-   *pfwlen = fwlen;
+   *pfwlen = i;
 }
 
 static void _rtl88e_fw_page_write(struct adapter *adapt,
-- 
2.4.10

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


[PATCH v2 2/2] staging: rtl8188eu: return value and argument types changed in _rtl88e_write_fw function

2015-11-04 Thread Ivan Safonov
Ideally the function should not change the variables outside of its body.

Signed-off-by: Ivan Safonov 
---
Changes in v2: no changes.

 drivers/staging/rtl8188eu/hal/fw.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/fw.c 
b/drivers/staging/rtl8188eu/hal/fw.c
index c6cdca3..a35e058 100644
--- a/drivers/staging/rtl8188eu/hal/fw.c
+++ b/drivers/staging/rtl8188eu/hal/fw.c
@@ -81,14 +81,14 @@ static void _rtl88e_fw_block_write(struct adapter *adapt,
}
 }
 
-static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen)
+static u32 _rtl88e_fill_dummy(u8 *pfwbuf, u32 pfwlen)
 {
u32 i;
 
-   for (i = *pfwlen; i < roundup(*pfwlen, 4); i++)
+   for (i = pfwlen; i < roundup(pfwlen, 4); i++)
pfwbuf[i] = 0;
 
-   *pfwlen = i;
+   return i;
 }
 
 static void _rtl88e_fw_page_write(struct adapter *adapt,
@@ -109,7 +109,7 @@ static void _rtl88e_write_fw(struct adapter *adapt, u8 
*buffer, u32 size)
u32 page_no, remain;
u32 page, offset;
 
-   _rtl88e_fill_dummy(buf_ptr, &size);
+   size = _rtl88e_fill_dummy(buf_ptr, size);
 
page_no = size / FW_8192C_PAGE_SIZE;
remain = size % FW_8192C_PAGE_SIZE;
-- 
2.4.10

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


Re: [PATCH v2 1/2] staging: rtl8188eu: for loop instead of while loop used

2015-11-04 Thread Dan Carpenter
These look good.  Thanks!

Reviewed-by: Dan Carpenter 

regards,
dan carpenter

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


[PATCH 1/2] staging: rtl8188eu: rarely used macros replaced by their definitions

2015-11-04 Thread Ivan Safonov
IS_* macros (except one) occur only once.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/hal_com.c | 14 +++---
 drivers/staging/rtl8188eu/hal/rtl8188e_dm.c |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c 
b/drivers/staging/rtl8188eu/hal/hal_com.c
index 38e9fdc..3871cda 100644
--- a/drivers/staging/rtl8188eu/hal/hal_com.c
+++ b/drivers/staging/rtl8188eu/hal/hal_com.c
@@ -32,19 +32,19 @@ void dump_chip_info(struct HAL_VERSION  chip_vers)
char buf[128];
 
cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8188E_");
-   cnt += sprintf((buf+cnt), "%s_", IS_NORMAL_CHIP(chip_vers) ?
+   cnt += sprintf((buf+cnt), "%s_", chip_vers.ChipType == NORMAL_CHIP ?
   "Normal_Chip" : "Test_Chip");
-   cnt += sprintf((buf+cnt), "%s_", IS_CHIP_VENDOR_TSMC(chip_vers) ?
+   cnt += sprintf((buf+cnt), "%s_", chip_vers.VendorType == 
CHIP_VENDOR_TSMC ?
   "TSMC" : "UMC");
-   if (IS_A_CUT(chip_vers))
+   if (chip_vers.CUTVersion == A_CUT_VERSION)
cnt += sprintf((buf+cnt), "A_CUT_");
-   else if (IS_B_CUT(chip_vers))
+   else if (chip_vers.CUTVersion == B_CUT_VERSION)
cnt += sprintf((buf+cnt), "B_CUT_");
-   else if (IS_C_CUT(chip_vers))
+   else if (chip_vers.CUTVersion == C_CUT_VERSION)
cnt += sprintf((buf+cnt), "C_CUT_");
-   else if (IS_D_CUT(chip_vers))
+   else if (chip_vers.CUTVersion == D_CUT_VERSION)
cnt += sprintf((buf+cnt), "D_CUT_");
-   else if (IS_E_CUT(chip_vers))
+   else if (chip_vers.CUTVersion == E_CUT_VERSION)
cnt += sprintf((buf+cnt), "E_CUT_");
else
cnt += sprintf((buf+cnt), "UNKNOWN_CUT(%d)_",
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c 
b/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c
index fca5909..199a77a 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c
@@ -67,7 +67,7 @@ static void Init_ODM_ComInfo_88E(struct adapter *Adapter)
ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_FAB_VER, fab_ver);
ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_CUT_VER, cut_ver);
 
-   ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_MP_TEST_CHIP, 
IS_NORMAL_CHIP(hal_data->VersionID));
+   ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_MP_TEST_CHIP, 
hal_data->VersionID.ChipType == NORMAL_CHIP ? true : false);
 
ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_PATCH_ID, hal_data->CustomerID);
ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_BWIFI_TEST, 
Adapter->registrypriv.wifi_spec);
-- 
2.4.10

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


[PATCH 2/2] staging: rtl8188eu: unused macros removed

2015-11-04 Thread Ivan Safonov
These macros does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c |  7 --
 drivers/staging/rtl8188eu/include/HalVerDef.h  | 33 --
 2 files changed, 40 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
index 22f5b45..cf60717 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
@@ -27,13 +27,6 @@
 
 extern void indicate_wx_scan_complete_event(struct adapter *padapter);
 
-#define IS_MAC_ADDRESS_BROADCAST(addr) \
-(\
-   ((addr[0] == 0xff) && (addr[1] == 0xff) && \
-   (addr[2] == 0xff) && (addr[3] == 0xff) && \
-   (addr[4] == 0xff) && (addr[5] == 0xff))  ? true : false \
-)
-
 u8 rtw_do_join(struct adapter *padapter)
 {
struct list_head *plist, *phead;
diff --git a/drivers/staging/rtl8188eu/include/HalVerDef.h 
b/drivers/staging/rtl8188eu/include/HalVerDef.h
index 56b4ff0..6f2b2a4 100644
--- a/drivers/staging/rtl8188eu/include/HalVerDef.h
+++ b/drivers/staging/rtl8188eu/include/HalVerDef.h
@@ -47,37 +47,4 @@ struct HAL_VERSION {
enum HAL_VENDOR VendorType;
 };
 
-/*  Get element */
-#define GET_CVID_CHIP_TYPE(version)(((version).ChipType))
-#define GET_CVID_MANUFACTUER(version)  (((version).VendorType))
-#define GET_CVID_CUT_VERSION(version)  (((version).CUTVersion))
-
-/* Common Macro. -- */
-/* HAL_VERSION VersionID */
-
-/* HAL_CHIP_TYPE_E */
-#define IS_TEST_CHIP(version)  \
-   ((GET_CVID_CHIP_TYPE(version) == TEST_CHIP) ? true : false)
-#define IS_NORMAL_CHIP(version)\
-   ((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? true : false)
-
-/* HAL_CUT_VERSION_E */
-#define IS_A_CUT(version)  \
-   ((GET_CVID_CUT_VERSION(version) == A_CUT_VERSION) ? true : false)
-#define IS_B_CUT(version)  \
-   ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true : false)
-#define IS_C_CUT(version)  \
-   ((GET_CVID_CUT_VERSION(version) == C_CUT_VERSION) ? true : false)
-#define IS_D_CUT(version)  \
-   ((GET_CVID_CUT_VERSION(version) == D_CUT_VERSION) ? true : false)
-#define IS_E_CUT(version)  \
-   ((GET_CVID_CUT_VERSION(version) == E_CUT_VERSION) ? true : false)
-
-
-/* HAL_VENDOR_E */
-#define IS_CHIP_VENDOR_TSMC(version)   \
-   ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_TSMC) ? true : false)
-#define IS_CHIP_VENDOR_UMC(version)\
-   ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_UMC) ? true : false)
-
 #endif
-- 
2.4.10

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


RE: [PATCH v2 1/7] staging: lustre: remove white space in libcfs_hash.h

2015-11-04 Thread Simmons, James A.
>On Mon, Nov 02, 2015 at 12:22:07PM -0500, James Simmons wrote:
>> Cleanup all the unneeded white space in libcfs_hash.h.
>> 
>> Signed-off-by: James Simmons 
>> ---
>>  .../lustre/include/linux/libcfs/libcfs_hash.h  |  135 
>> ++--
>>  1 files changed, 70 insertions(+), 65 deletions(-)
>
>Doesn't apply, did I already queue up this series?

I did a second version of those patches. In one batch you will notice [PATCH 
v2].
The reason I did a second batch was to break up the "fix checkpatch issues" 
patch
in the first series. I was trying to behave :-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [lustre-devel] [PATCH v2 1/7] staging: lustre: remove white space in libcfs_hash.h

2015-11-04 Thread Simmons, James A.
>On Tue, Nov 03, 2015 at 07:46:07PM -0800, Greg Kroah-Hartman wrote:
>> On Mon, Nov 02, 2015 at 12:22:07PM -0500, James Simmons wrote:
>> > Cleanup all the unneeded white space in libcfs_hash.h.
>> > 
>> > Signed-off-by: James Simmons 
>> > ---
>> >  .../lustre/include/linux/libcfs/libcfs_hash.h  |  135 
>> > ++--
>> >  1 files changed, 70 insertions(+), 65 deletions(-)
>> 
>> Doesn't apply, did I already queue up this series?
>
>No. This did not apply because of:
>c7fdf4a3959f ("staging: lustre: fix remaining checkpatch issues for 
>libcfs_hash.h")

Surprise this was merged which is why I did a second series for this.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/22] staging: comedi: adv_pci1710: tidy up driver

2015-11-04 Thread H Hartley Sweeten
Now that the PCI-1720 support has been moved to a separate driver, remove
some unnecessary boardinfo in this driver and tidy it up a bit.

H Hartley Sweeten (22):
  staging: comedi: adv_pci1710: remove 'has_irq' boardinfo
  staging: comedi: adv_pci1710: remove 'has_counter' boardinfo
  staging: comedi: adv_pci1710: don't "reset" board when detaching
  staging: comedi: adv_pci1710: refactor ai range programming
  staging: comedi: adv_pci1710: define the mux control register bits
  staging: comedi: adv_pci1710: remove 'n_aichan' boardinfo
  staging: comedi: adv_pci1710: remove 'has_di_do' boardinfo
  staging: comedi: adv_pci1710: remove 'has_large_fifo' and 'has_diff_ai' 
boardinfo
  staging: comedi: adv_pci1710: tidy up boardinfo definition
  staging: comedi: adv_pci1710: rename interrupt_service_pci1710()
  staging: comedi: adv_pci1710: rename pci171x_insn_counter_config()
  staging: comedi: adv_pci1710: rename pci171x_d[io]_insn_bits
  staging: comedi: adv_pci1710: rename pci171x_ao_insn_write()
  staging: comedi: adv_pci1710: support external analog output reference
  staging: comedi: adv_pci1710: tidy up analog output subdev_flags
  staging: comedi: adv_pci1710: post increment 'subdev' in (*auto_attach)
  staging: comedi: adv_pci1710: ai (*cancel) should not enable software trigger
  staging: comedi: adv_pci1710: tidy up pci1710_reset()
  staging: comedi: adv_pci1710: fix counter 0 internal clock source
  staging: comedi: adv_pci1710: fix ai (*insn_read)
  staging: comedi: adv_pci1710: rename pci171x_ai_{cmd,cmdtest}()
  staging: comedi: adv_pci1710: rename pci171x_ai_*()

 drivers/staging/comedi/drivers/adv_pci1710.c | 433 +--
 1 file changed, 201 insertions(+), 232 deletions(-)

-- 
2.5.1

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


[PATCH 01/22] staging: comedi: adv_pci1710: remove 'has_irq' boardinfo

2015-11-04 Thread H Hartley Sweeten
All the boards supported by this driver can use an interrupt. Remove
the unnecessary boardinfo.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/adv_pci1710.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 45d7f42..032d1d4 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -134,7 +134,6 @@ struct boardtype {
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
const char *rangecode_ai;   /*  range codes for programming */
unsigned int is_pci1713:1;
-   unsigned int has_irq:1;
unsigned int has_large_fifo:1;  /* 4K or 1K FIFO */
unsigned int has_diff_ai:1;
unsigned int has_ao:1;
@@ -148,7 +147,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
-   .has_irq= 1,
.has_large_fifo = 1,
.has_diff_ai= 1,
.has_ao = 1,
@@ -160,7 +158,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.rangelist_ai   = &range_pci1710hg,
.rangecode_ai   = range_codes_pci1710hg,
-   .has_irq= 1,
.has_large_fifo = 1,
.has_diff_ai= 1,
.has_ao = 1,
@@ -172,7 +169,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
-   .has_irq= 1,
.has_ao = 1,
.has_di_do  = 1,
.has_counter= 1,
@@ -183,7 +179,6 @@ static const struct boardtype boardtypes[] = {
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
.is_pci1713 = 1,
-   .has_irq= 1,
.has_large_fifo = 1,
.has_diff_ai= 1,
},
@@ -192,7 +187,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
-   .has_irq= 1,
.has_di_do  = 1,
},
 };
@@ -806,7 +800,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
 
pci1710_reset(dev);
 
-   if (board->has_irq && pcidev->irq) {
+   if (pcidev->irq) {
ret = request_irq(pcidev->irq, interrupt_service_pci1710,
  IRQF_SHARED, dev->board_name, dev);
if (ret == 0)
-- 
2.5.1

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


[PATCH 03/22] staging: comedi: adv_pci1710: don't "reset" board when detaching

2015-11-04 Thread H Hartley Sweeten
Currently this driver calls pci1710_reset() during the (*detach) of
the driver. That function does the following:

  1) program the control register to stop any operations
  2) clears the analog input FIFO
  3) clears any pending interrupts
  4) sets all the analog output channels to unipolar 5V range and 0V output
  5) sets all the digital outputs to 0V

Before detaching the comedi core will (*cancel) any running async commands.
This will handle 1-3 above.

Depending on the application, it might not be safe to reset the analog and
digital outputs when the driver is detached.

Remove the board reset when detaching and just use comedi_pci_detach()
directly for the driver (*detach).

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/adv_pci1710.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index f0d091a..b5a598f 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -878,18 +878,11 @@ static int pci1710_auto_attach(struct comedi_device *dev,
return 0;
 }
 
-static void pci1710_detach(struct comedi_device *dev)
-{
-   if (dev->iobase)
-   pci1710_reset(dev);
-   comedi_pci_detach(dev);
-}
-
 static struct comedi_driver adv_pci1710_driver = {
.driver_name= "adv_pci1710",
.module = THIS_MODULE,
.auto_attach= pci1710_auto_attach,
-   .detach = pci1710_detach,
+   .detach = comedi_pci_detach,
 };
 
 static int adv_pci1710_pci_probe(struct pci_dev *dev,
-- 
2.5.1

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


[PATCH 02/22] staging: comedi: adv_pci1710: remove 'has_counter' boardinfo

2015-11-04 Thread H Hartley Sweeten
All the boards supported by this driver have a counter device. Remove
the unnecessary boardinfo.

This also fixes the pci1713 and pci1731 subdevice support. Those boards
have a counter but did not have the 'has_counter' boardinfo. This
prevented the subdevice from being allocated and initialized.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 032d1d4..f0d091a 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -138,7 +138,6 @@ struct boardtype {
unsigned int has_diff_ai:1;
unsigned int has_ao:1;
unsigned int has_di_do:1;
-   unsigned int has_counter:1;
 };
 
 static const struct boardtype boardtypes[] = {
@@ -151,7 +150,6 @@ static const struct boardtype boardtypes[] = {
.has_diff_ai= 1,
.has_ao = 1,
.has_di_do  = 1,
-   .has_counter= 1,
},
[BOARD_PCI1710HG] = {
.name   = "pci1710hg",
@@ -162,7 +160,6 @@ static const struct boardtype boardtypes[] = {
.has_diff_ai= 1,
.has_ao = 1,
.has_di_do  = 1,
-   .has_counter= 1,
},
[BOARD_PCI1711] = {
.name   = "pci1711",
@@ -171,7 +168,6 @@ static const struct boardtype boardtypes[] = {
.rangecode_ai   = range_codes_pci17x1,
.has_ao = 1,
.has_di_do  = 1,
-   .has_counter= 1,
},
[BOARD_PCI1713] = {
.name   = "pci1713",
@@ -784,15 +780,13 @@ static int pci1710_auto_attach(struct comedi_device *dev,
if (!dev->pacer)
return -ENOMEM;
 
-   n_subdevices = 0;
+   n_subdevices = 1;   /* all boards have a counter */
if (board->n_aichan)
n_subdevices++;
if (board->has_ao)
n_subdevices++;
if (board->has_di_do)
n_subdevices += 2;
-   if (board->has_counter)
-   n_subdevices++;
 
ret = comedi_alloc_subdevices(dev, n_subdevices);
if (ret)
@@ -867,18 +861,16 @@ static int pci1710_auto_attach(struct comedi_device *dev,
}
 
/* Counter subdevice (8254) */
-   if (board->has_counter) {
-   s = &dev->subdevices[subdev];
-   comedi_8254_subdevice_init(s, dev->pacer);
+   s = &dev->subdevices[subdev];
+   comedi_8254_subdevice_init(s, dev->pacer);
 
-   dev->pacer->insn_config = pci171x_insn_counter_config;
+   dev->pacer->insn_config = pci171x_insn_counter_config;
 
-   /* counters 1 and 2 are used internally for the pacer */
-   comedi_8254_set_busy(dev->pacer, 1, true);
-   comedi_8254_set_busy(dev->pacer, 2, true);
+   /* counters 1 and 2 are used internally for the pacer */
+   comedi_8254_set_busy(dev->pacer, 1, true);
+   comedi_8254_set_busy(dev->pacer, 2, true);
 
-   subdev++;
-   }
+   subdev++;
 
/* max_samples is half the FIFO size (2 bytes/sample) */
devpriv->max_samples = (board->has_large_fifo) ? 2048 : 512;
-- 
2.5.1

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


[PATCH 04/22] staging: comedi: adv_pci1710: refactor ai range programming

2015-11-04 Thread H Hartley Sweeten
The gain codes used to program the analog output range are currently
stored in const char arrays. The values look a bit "magic" and it's
not clear how they associate with the comedi_lrange without looking
through user manuals.

Refactor the ai range programming to clarify the driver and remove
the magic numbers. Also, refine the bits in the range register that
set the differential and unipolar modes.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index b5a598f..ef3e088 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -41,6 +41,9 @@
 #define PCI171X_AD_DATA_REG0x00/* R:   A/D data */
 #define PCI171X_SOFTTRG_REG0x00/* W:   soft trigger for A/D */
 #define PCI171X_RANGE_REG  0x02/* W:   A/D gain/range register */
+#define PCI171X_RANGE_DIFF BIT(5)
+#define PCI171X_RANGE_UNI  BIT(4)
+#define PCI171X_RANGE_GAIN(x)  (((x) & 0x7) << 0)
 #define PCI171X_MUX_REG0x04/* W:   A/D multiplexor control 
*/
 #define PCI171X_STATUS_REG 0x06/* R:   status register */
 #define PCI171X_STATUS_IRQ BIT(11) /* 1=IRQ occurred */
@@ -63,56 +66,47 @@
 #define PCI171X_DO_REG 0x10/* W:   digital outputs */
 #define PCI171X_TIMER_BASE 0x18/* R/W: 8254 timer */
 
-static const struct comedi_lrange range_pci1710_3 = {
+static const struct comedi_lrange pci1710_ai_range = {
9, {
-   BIP_RANGE(5),
-   BIP_RANGE(2.5),
-   BIP_RANGE(1.25),
-   BIP_RANGE(0.625),
-   BIP_RANGE(10),
-   UNI_RANGE(10),
-   UNI_RANGE(5),
-   UNI_RANGE(2.5),
-   UNI_RANGE(1.25)
+   BIP_RANGE(5),   /* gain 1   (0x00) */
+   BIP_RANGE(2.5), /* gain 2   (0x01) */
+   BIP_RANGE(1.25),/* gain 4   (0x02) */
+   BIP_RANGE(0.625),   /* gain 8   (0x03) */
+   BIP_RANGE(10),  /* gain 0.5 (0x04) */
+   UNI_RANGE(10),  /* gain 1   (0x00 | UNI) */
+   UNI_RANGE(5),   /* gain 2   (0x01 | UNI) */
+   UNI_RANGE(2.5), /* gain 4   (0x02 | UNI) */
+   UNI_RANGE(1.25) /* gain 8   (0x03 | UNI) */
}
 };
 
-static const char range_codes_pci1710_3[] = { 0x00, 0x01, 0x02, 0x03, 0x04,
- 0x10, 0x11, 0x12, 0x13 };
-
-static const struct comedi_lrange range_pci1710hg = {
+static const struct comedi_lrange pci1710hg_ai_range = {
12, {
-   BIP_RANGE(5),
-   BIP_RANGE(0.5),
-   BIP_RANGE(0.05),
-   BIP_RANGE(0.005),
-   BIP_RANGE(10),
-   BIP_RANGE(1),
-   BIP_RANGE(0.1),
-   BIP_RANGE(0.01),
-   UNI_RANGE(10),
-   UNI_RANGE(1),
-   UNI_RANGE(0.1),
-   UNI_RANGE(0.01)
+   BIP_RANGE(5),   /* gain 1(0x00) */
+   BIP_RANGE(0.5), /* gain 10   (0x01) */
+   BIP_RANGE(0.05),/* gain 100  (0x02) */
+   BIP_RANGE(0.005),   /* gain 1000 (0x03) */
+   BIP_RANGE(10),  /* gain 0.5  (0x04) */
+   BIP_RANGE(1),   /* gain 5(0x05) */
+   BIP_RANGE(0.1), /* gain 50   (0x06) */
+   BIP_RANGE(0.01),/* gain 500  (0x07) */
+   UNI_RANGE(10),  /* gain 1(0x00 | UNI) */
+   UNI_RANGE(1),   /* gain 10   (0x01 | UNI) */
+   UNI_RANGE(0.1), /* gain 100  (0x02 | UNI) */
+   UNI_RANGE(0.01) /* gain 1000 (0x03 | UNI) */
}
 };
 
-static const char range_codes_pci1710hg[] = { 0x00, 0x01, 0x02, 0x03, 0x04,
- 0x05, 0x06, 0x07, 0x10, 0x11,
- 0x12, 0x13 };
-
-static const struct comedi_lrange range_pci17x1 = {
+static const struct comedi_lrange pci1711_ai_range = {
5, {
-   BIP_RANGE(10),
-   BIP_RANGE(5),
-   BIP_RANGE(2.5),
-   BIP_RANGE(1.25),
-   BIP_RANGE(0.625)
+   BIP_RANGE(10),  /* gain 1  (0x00) */
+   BIP_RANGE(5),   /* gain 2  (0x01) */
+   BIP_RANGE(2.5), /* gain 4  (0x02) */
+   BIP_RANGE(1.25),/* gain 8  (0x03) */
+   BIP_RANGE(0.625)/* gain 16 (0x04) */
}
 };
 
-static const char range_codes_pci17x1[] = { 0x00, 0x01, 0x02, 0x03, 0x04 };
-
 static const struct comedi_lrange pci171x_ao_range = {
2, {
   

[PATCH 07/22] staging: comedi: adv_pci1710: remove 'has_di_do' boardinfo

2015-11-04 Thread H Hartley Sweeten
This member of the boardinfo isn't really necessary. All the boards
except the pci1713 have 16 digital inputs and 16 digital outputs.

There is already a 'is_pci1713' member in the boardinfo so that can
be used to determine the subdevices for the digital inputs and outputs
need to be allocated and initialized.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index ab136dd..4d0de74 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -132,7 +132,6 @@ struct boardtype {
unsigned int has_large_fifo:1;  /* 4K or 1K FIFO */
unsigned int has_diff_ai:1;
unsigned int has_ao:1;
-   unsigned int has_di_do:1;
 };
 
 static const struct boardtype boardtypes[] = {
@@ -142,7 +141,6 @@ static const struct boardtype boardtypes[] = {
.has_large_fifo = 1,
.has_diff_ai= 1,
.has_ao = 1,
-   .has_di_do  = 1,
},
[BOARD_PCI1710HG] = {
.name   = "pci1710hg",
@@ -150,13 +148,11 @@ static const struct boardtype boardtypes[] = {
.has_large_fifo = 1,
.has_diff_ai= 1,
.has_ao = 1,
-   .has_di_do  = 1,
},
[BOARD_PCI1711] = {
.name   = "pci1711",
.rangelist_ai   = &pci1711_ai_range,
.has_ao = 1,
-   .has_di_do  = 1,
},
[BOARD_PCI1713] = {
.name   = "pci1713",
@@ -168,7 +164,6 @@ static const struct boardtype boardtypes[] = {
[BOARD_PCI1731] = {
.name   = "pci1731",
.rangelist_ai   = &pci1711_ai_range,
-   .has_di_do  = 1,
},
 };
 
@@ -775,7 +770,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
n_subdevices = 2;
if (board->has_ao)
n_subdevices++;
-   if (board->has_di_do)
+   if (!board->is_pci1713) /* all others have digital input and output */
n_subdevices += 2;
 
ret = comedi_alloc_subdevices(dev, n_subdevices);
@@ -837,7 +832,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
subdev++;
}
 
-   if (board->has_di_do) {
+   if (!board->is_pci1713) {
s = &dev->subdevices[subdev];
s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE;
-- 
2.5.1

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


[PATCH 06/22] staging: comedi: adv_pci1710: remove 'n_aichan' boardinfo

2015-11-04 Thread H Hartley Sweeten
This member of the boardinfo isn't really necessary. All the boards
have analog inputs, the pci1713 has 32 channels the rest have 16
channels.

There is already a 'is_pci1713' member in the boardinfo so that can
be used to determine the number of channels for the analog input
subdevice.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 0c41596..ab136dd 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -127,7 +127,6 @@ enum pci1710_boardid {
 
 struct boardtype {
const char *name;   /*  board name */
-   int n_aichan;   /*  num of A/D chans */
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
unsigned int is_pci1713:1;
unsigned int has_large_fifo:1;  /* 4K or 1K FIFO */
@@ -139,7 +138,6 @@ struct boardtype {
 static const struct boardtype boardtypes[] = {
[BOARD_PCI1710] = {
.name   = "pci1710",
-   .n_aichan   = 16,
.rangelist_ai   = &pci1710_ai_range,
.has_large_fifo = 1,
.has_diff_ai= 1,
@@ -148,7 +146,6 @@ static const struct boardtype boardtypes[] = {
},
[BOARD_PCI1710HG] = {
.name   = "pci1710hg",
-   .n_aichan   = 16,
.rangelist_ai   = &pci1710hg_ai_range,
.has_large_fifo = 1,
.has_diff_ai= 1,
@@ -157,14 +154,12 @@ static const struct boardtype boardtypes[] = {
},
[BOARD_PCI1711] = {
.name   = "pci1711",
-   .n_aichan   = 16,
.rangelist_ai   = &pci1711_ai_range,
.has_ao = 1,
.has_di_do  = 1,
},
[BOARD_PCI1713] = {
.name   = "pci1713",
-   .n_aichan   = 32,
.rangelist_ai   = &pci1710_ai_range,
.is_pci1713 = 1,
.has_large_fifo = 1,
@@ -172,7 +167,6 @@ static const struct boardtype boardtypes[] = {
},
[BOARD_PCI1731] = {
.name   = "pci1731",
-   .n_aichan   = 16,
.rangelist_ai   = &pci1711_ai_range,
.has_di_do  = 1,
},
@@ -777,9 +771,8 @@ static int pci1710_auto_attach(struct comedi_device *dev,
if (!dev->pacer)
return -ENOMEM;
 
-   n_subdevices = 1;   /* all boards have a counter */
-   if (board->n_aichan)
-   n_subdevices++;
+   /* all boards have analog inputs and a counter */
+   n_subdevices = 2;
if (board->has_ao)
n_subdevices++;
if (board->has_di_do)
@@ -800,36 +793,34 @@ static int pci1710_auto_attach(struct comedi_device *dev,
 
subdev = 0;
 
-   if (board->n_aichan) {
-   s = &dev->subdevices[subdev];
-   s->type = COMEDI_SUBD_AI;
-   s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND;
-   if (board->has_diff_ai)
-   s->subdev_flags |= SDF_DIFF;
-   s->n_chan   = board->n_aichan;
-   s->maxdata  = 0x0fff;
-   s->range_table  = board->rangelist_ai;
-   s->insn_read= pci171x_ai_insn_read;
-   if (dev->irq) {
-   dev->read_subdev = s;
-   s->subdev_flags |= SDF_CMD_READ;
-   s->len_chanlist = s->n_chan;
-   s->do_cmdtest   = pci171x_ai_cmdtest;
-   s->do_cmd   = pci171x_ai_cmd;
-   s->cancel   = pci171x_ai_cancel;
-   }
+   s = &dev->subdevices[subdev];
+   s->type = COMEDI_SUBD_AI;
+   s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND;
+   if (board->has_diff_ai)
+   s->subdev_flags |= SDF_DIFF;
+   s->n_chan   = board->is_pci1713 ? 32 : 16;
+   s->maxdata  = 0x0fff;
+   s->range_table  = board->rangelist_ai;
+   s->insn_read= pci171x_ai_insn_read;
+   if (dev->irq) {
+   dev->read_subdev = s;
+   s->subdev_flags |= SDF_CMD_READ;
+   s->len_chanlist = s->n_chan;
+   s->do_cmdtest   = pci171x_ai_cmdtest;
+   s->do_cmd   = pci171x_ai_cmd;
+   s->cancel   = pci171x_ai_cancel;
+   }
 
-   /* find the value needed to adjust for unipolar gain codes */
-   for (i = 0; i < s->range_table->length; i++) {
-   if (comedi_range_is_unipolar(s, i)) {
-   devpriv->unipolar_ga

[PATCH 08/22] staging: comedi: adv_pci1710: remove 'has_large_fifo' and 'has_diff_ai' boardinfo

2015-11-04 Thread H Hartley Sweeten
The pci1711/31 boards are the only ones that have a smaller FIFO (1K vs 4K) and
single-ended analog inputs (no differential).

Replace the 'has_large_fifo' and 'has_diff_ai' members of the boardinfo with
'is_pci1711' and use that to determine how to initialize the analog input
subdev_flags as well as the private data 'max_samples'.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 4d0de74..459d688 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -128,9 +128,8 @@ enum pci1710_boardid {
 struct boardtype {
const char *name;   /*  board name */
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
+   unsigned int is_pci1711:1;
unsigned int is_pci1713:1;
-   unsigned int has_large_fifo:1;  /* 4K or 1K FIFO */
-   unsigned int has_diff_ai:1;
unsigned int has_ao:1;
 };
 
@@ -138,32 +137,28 @@ static const struct boardtype boardtypes[] = {
[BOARD_PCI1710] = {
.name   = "pci1710",
.rangelist_ai   = &pci1710_ai_range,
-   .has_large_fifo = 1,
-   .has_diff_ai= 1,
.has_ao = 1,
},
[BOARD_PCI1710HG] = {
.name   = "pci1710hg",
.rangelist_ai   = &pci1710hg_ai_range,
-   .has_large_fifo = 1,
-   .has_diff_ai= 1,
.has_ao = 1,
},
[BOARD_PCI1711] = {
.name   = "pci1711",
.rangelist_ai   = &pci1711_ai_range,
+   .is_pci1711 = 1,
.has_ao = 1,
},
[BOARD_PCI1713] = {
.name   = "pci1713",
.rangelist_ai   = &pci1710_ai_range,
.is_pci1713 = 1,
-   .has_large_fifo = 1,
-   .has_diff_ai= 1,
},
[BOARD_PCI1731] = {
.name   = "pci1731",
.rangelist_ai   = &pci1711_ai_range,
+   .is_pci1711 = 1,
},
 };
 
@@ -791,7 +786,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
s = &dev->subdevices[subdev];
s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND;
-   if (board->has_diff_ai)
+   if (!board->is_pci1711)
s->subdev_flags |= SDF_DIFF;
s->n_chan   = board->is_pci1713 ? 32 : 16;
s->maxdata  = 0x0fff;
@@ -865,7 +860,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
subdev++;
 
/* max_samples is half the FIFO size (2 bytes/sample) */
-   devpriv->max_samples = (board->has_large_fifo) ? 2048 : 512;
+   devpriv->max_samples = (board->is_pci1711) ? 512 : 2048;
 
return 0;
 }
-- 
2.5.1

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


[PATCH 05/22] staging: comedi: adv_pci1710: define the mux control register bits

2015-11-04 Thread H Hartley Sweeten
For aesthetics, define some macros to set the bits in the mux control
register. Also, rename the 'mux_ext' member of the private data.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index ef3e088..0c41596 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -45,6 +45,9 @@
 #define PCI171X_RANGE_UNI  BIT(4)
 #define PCI171X_RANGE_GAIN(x)  (((x) & 0x7) << 0)
 #define PCI171X_MUX_REG0x04/* W:   A/D multiplexor control 
*/
+#define PCI171X_MUX_CHANH(x)   (((x) & 0xf) << 8)
+#define PCI171X_MUX_CHANL(x)   (((x) & 0xf) << 0)
+#define PCI171X_MUX_CHAN(x)(PCI171X_MUX_CHANH(x) | PCI171X_MUX_CHANL(x))
 #define PCI171X_STATUS_REG 0x06/* R:   status register */
 #define PCI171X_STATUS_IRQ BIT(11) /* 1=IRQ occurred */
 #define PCI171X_STATUS_FF  BIT(10) /* 1=FIFO is full, fatal error */
@@ -179,7 +182,7 @@ struct pci1710_private {
unsigned int max_samples;
unsigned int ctrl;  /* control register value */
unsigned int ctrl_ext;  /* used to switch from TRIG_EXT to TRIG_xxx */
-   unsigned int mux_ext;   /* used to set the channel interval to scan */
+   unsigned int mux_scan;  /* used to set the channel interval to scan */
unsigned char ai_et;
unsigned int act_chanlist[32];  /*  list of scanned channel */
unsigned char saved_seglen; /* len of the non-repeating chanlist */
@@ -279,7 +282,7 @@ static void pci171x_ai_setup_chanlist(struct comedi_device 
*dev,
rangeval |= PCI171X_RANGE_GAIN(range);
 
/* select channel and set range */
-   outw(chan | (chan << 8), dev->iobase + PCI171X_MUX_REG);
+   outw(PCI171X_MUX_CHAN(chan), dev->iobase + PCI171X_MUX_REG);
outw(rangeval, dev->iobase + PCI171X_RANGE_REG);
 
devpriv->act_chanlist[i] = chan;
@@ -288,8 +291,9 @@ static void pci171x_ai_setup_chanlist(struct comedi_device 
*dev,
devpriv->act_chanlist[i] = CR_CHAN(chanlist[i]);
 
/* select channel interval to scan */
-   devpriv->mux_ext = first_chan | (last_chan << 8);
-   outw(devpriv->mux_ext, dev->iobase + PCI171X_MUX_REG);
+   devpriv->mux_scan = PCI171X_MUX_CHANL(first_chan) |
+   PCI171X_MUX_CHANH(last_chan);
+   outw(devpriv->mux_scan, dev->iobase + PCI171X_MUX_REG);
 }
 
 static int pci171x_ai_eoc(struct comedi_device *dev,
@@ -551,7 +555,7 @@ static irqreturn_t interrupt_service_pci1710(int irq, void 
*d)
outb(0, dev->iobase + PCI171X_CLRFIFO_REG);
outb(0, dev->iobase + PCI171X_CLRINT_REG);
/* no sample on this interrupt; reset the channel interval */
-   outw(devpriv->mux_ext, dev->iobase + PCI171X_MUX_REG);
+   outw(devpriv->mux_scan, dev->iobase + PCI171X_MUX_REG);
outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG);
comedi_8254_pacer_enable(dev->pacer, 1, 2, true);
return IRQ_HANDLED;
-- 
2.5.1

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


[PATCH 10/22] staging: comedi: adv_pci1710: rename interrupt_service_pci1710()

2015-11-04 Thread H Hartley Sweeten
Rename this function so it has namespace associated with the driver.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 85f65b0..09be1b4 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -513,7 +513,7 @@ static void pci1710_handle_fifo(struct comedi_device *dev,
outb(0, dev->iobase + PCI171X_CLRINT_REG);
 }
 
-static irqreturn_t interrupt_service_pci1710(int irq, void *d)
+static irqreturn_t pci1710_irq_handler(int irq, void *d)
 {
struct comedi_device *dev = d;
struct pci1710_private *devpriv = dev->private;
@@ -775,7 +775,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
pci1710_reset(dev);
 
if (pcidev->irq) {
-   ret = request_irq(pcidev->irq, interrupt_service_pci1710,
+   ret = request_irq(pcidev->irq, pci1710_irq_handler,
  IRQF_SHARED, dev->board_name, dev);
if (ret == 0)
dev->irq = pcidev->irq;
-- 
2.5.1

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


[PATCH 09/22] staging: comedi: adv_pci1710: tidy up boardinfo definition

2015-11-04 Thread H Hartley Sweeten
Remove the unnecessary comments and rename the 'rangelist_ai' member for
aesthetics.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 459d688..85f65b0 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -126,8 +126,8 @@ enum pci1710_boardid {
 };
 
 struct boardtype {
-   const char *name;   /*  board name */
-   const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
+   const char *name;
+   const struct comedi_lrange *ai_range;
unsigned int is_pci1711:1;
unsigned int is_pci1713:1;
unsigned int has_ao:1;
@@ -136,28 +136,28 @@ struct boardtype {
 static const struct boardtype boardtypes[] = {
[BOARD_PCI1710] = {
.name   = "pci1710",
-   .rangelist_ai   = &pci1710_ai_range,
+   .ai_range   = &pci1710_ai_range,
.has_ao = 1,
},
[BOARD_PCI1710HG] = {
.name   = "pci1710hg",
-   .rangelist_ai   = &pci1710hg_ai_range,
+   .ai_range   = &pci1710hg_ai_range,
.has_ao = 1,
},
[BOARD_PCI1711] = {
.name   = "pci1711",
-   .rangelist_ai   = &pci1711_ai_range,
+   .ai_range   = &pci1711_ai_range,
.is_pci1711 = 1,
.has_ao = 1,
},
[BOARD_PCI1713] = {
.name   = "pci1713",
-   .rangelist_ai   = &pci1710_ai_range,
+   .ai_range   = &pci1710_ai_range,
.is_pci1713 = 1,
},
[BOARD_PCI1731] = {
.name   = "pci1731",
-   .rangelist_ai   = &pci1711_ai_range,
+   .ai_range   = &pci1711_ai_range,
.is_pci1711 = 1,
},
 };
@@ -790,7 +790,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
s->subdev_flags |= SDF_DIFF;
s->n_chan   = board->is_pci1713 ? 32 : 16;
s->maxdata  = 0x0fff;
-   s->range_table  = board->rangelist_ai;
+   s->range_table  = board->ai_range;
s->insn_read= pci171x_ai_insn_read;
if (dev->irq) {
dev->read_subdev = s;
-- 
2.5.1

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


[PATCH 11/22] staging: comedi: adv_pci1710: rename pci171x_insn_counter_config()

2015-11-04 Thread H Hartley Sweeten
Rename this function so it has namespace associated with the driver.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 09be1b4..6d45bb3 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -668,7 +668,7 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev,
return 0;
 }
 
-static int pci171x_insn_counter_config(struct comedi_device *dev,
+static int pci1710_counter_insn_config(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn,
   unsigned int *data)
@@ -851,7 +851,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
s = &dev->subdevices[subdev];
comedi_8254_subdevice_init(s, dev->pacer);
 
-   dev->pacer->insn_config = pci171x_insn_counter_config;
+   dev->pacer->insn_config = pci1710_counter_insn_config;
 
/* counters 1 and 2 are used internally for the pacer */
comedi_8254_set_busy(dev->pacer, 1, true);
-- 
2.5.1

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


[PATCH 12/22] staging: comedi: adv_pci1710: rename pci171x_d[io]_insn_bits

2015-11-04 Thread H Hartley Sweeten
Rename these functions so they have namespace associated with the driver.

For aesthetics, move the functions so they are not located in the middle
of the analog input/output support functions.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 6d45bb3..6952d30 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -387,29 +387,6 @@ static int pci171x_ao_insn_write(struct comedi_device *dev,
return insn->n;
 }
 
-static int pci171x_di_insn_bits(struct comedi_device *dev,
-   struct comedi_subdevice *s,
-   struct comedi_insn *insn,
-   unsigned int *data)
-{
-   data[1] = inw(dev->iobase + PCI171X_DI_REG);
-
-   return insn->n;
-}
-
-static int pci171x_do_insn_bits(struct comedi_device *dev,
-   struct comedi_subdevice *s,
-   struct comedi_insn *insn,
-   unsigned int *data)
-{
-   if (comedi_dio_update_state(s, data))
-   outw(s->state, dev->iobase + PCI171X_DO_REG);
-
-   data[1] = s->state;
-
-   return insn->n;
-}
-
 static int pci171x_ai_cancel(struct comedi_device *dev,
 struct comedi_subdevice *s)
 {
@@ -668,6 +645,29 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev,
return 0;
 }
 
+static int pci1710_di_insn_bits(struct comedi_device *dev,
+   struct comedi_subdevice *s,
+   struct comedi_insn *insn,
+   unsigned int *data)
+{
+   data[1] = inw(dev->iobase + PCI171X_DI_REG);
+
+   return insn->n;
+}
+
+static int pci1710_do_insn_bits(struct comedi_device *dev,
+   struct comedi_subdevice *s,
+   struct comedi_insn *insn,
+   unsigned int *data)
+{
+   if (comedi_dio_update_state(s, data))
+   outw(s->state, dev->iobase + PCI171X_DO_REG);
+
+   data[1] = s->state;
+
+   return insn->n;
+}
+
 static int pci1710_counter_insn_config(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn,
@@ -834,7 +834,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
s->n_chan   = 16;
s->maxdata  = 1;
s->range_table  = &range_digital;
-   s->insn_bits= pci171x_di_insn_bits;
+   s->insn_bits= pci1710_di_insn_bits;
subdev++;
 
s = &dev->subdevices[subdev];
@@ -843,7 +843,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
s->n_chan   = 16;
s->maxdata  = 1;
s->range_table  = &range_digital;
-   s->insn_bits= pci171x_do_insn_bits;
+   s->insn_bits= pci1710_do_insn_bits;
subdev++;
}
 
-- 
2.5.1

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


[PATCH 14/22] staging: comedi: adv_pci1710: support external analog output reference

2015-11-04 Thread H Hartley Sweeten
The analog outputs can use an external reference to create the D/A output
range. Add an entry to the comedi_lrange table for it and modify the
(*insn_write) to support it.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 86ed288..339130b 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -65,6 +65,8 @@
 #define PCI171X_CLRFIFO_REG0x09/* W:   clear FIFO */
 #define PCI171X_DA_REG(x)  (0x0a + ((x) * 2)) /* W:   D/A register */
 #define PCI171X_DAREF_REG  0x0e/* W:   D/A reference control */
+#define PCI171X_DAREF(c, r)(((r) & 0x3) << ((c) * 2))
+#define PCI171X_DAREF_MASK(c)  PCI171X_DAREF((c), 0x3)
 #define PCI171X_DI_REG 0x10/* R:   digital inputs */
 #define PCI171X_DO_REG 0x10/* W:   digital outputs */
 #define PCI171X_TIMER_BASE 0x18/* R/W: 8254 timer */
@@ -111,9 +113,10 @@ static const struct comedi_lrange pci1711_ai_range = {
 };
 
 static const struct comedi_lrange pci171x_ao_range = {
-   2, {
-   UNI_RANGE(5),
-   UNI_RANGE(10)
+   3, {
+   UNI_RANGE(5),   /* internal -5V ref */
+   UNI_RANGE(10),  /* internal -10V ref */
+   RANGE_ext(0, 1) /* external Vref (+/-10V max) */
}
 };
 
@@ -631,8 +634,8 @@ static int pci1710_ao_insn_write(struct comedi_device *dev,
unsigned int val = s->readback[chan];
int i;
 
-   devpriv->da_ranges &= ~(1 << (chan << 1));
-   devpriv->da_ranges |= (range << (chan << 1));
+   devpriv->da_ranges &= ~PCI171X_DAREF_MASK(chan);
+   devpriv->da_ranges |= PCI171X_DAREF(chan, range);
outw(devpriv->da_ranges, dev->iobase + PCI171X_DAREF_REG);
 
for (i = 0; i < insn->n; i++) {
-- 
2.5.1

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


[PATCH 15/22] staging: comedi: adv_pci1710: tidy up analog output subdev_flags

2015-11-04 Thread H Hartley Sweeten
The SDF_GROUND and SDF_COMMON flags are not needed for the analog output
subdevice. Just remove them.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/adv_pci1710.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 339130b..0511f26 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -817,7 +817,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
if (board->has_ao) {
s = &dev->subdevices[subdev];
s->type = COMEDI_SUBD_AO;
-   s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
+   s->subdev_flags = SDF_WRITABLE;
s->n_chan   = 2;
s->maxdata  = 0x0fff;
s->range_table  = &pci171x_ao_range;
-- 
2.5.1

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


[PATCH 13/22] staging: comedi: adv_pci1710: rename pci171x_ao_insn_write()

2015-11-04 Thread H Hartley Sweeten
Rename this function so it has namespace associated with the driver.

For aesthetics, move the function so it is located in the middle of
the analog input support functions.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 6952d30..86ed288 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -362,31 +362,6 @@ static int pci171x_ai_insn_read(struct comedi_device *dev,
return ret ? ret : insn->n;
 }
 
-static int pci171x_ao_insn_write(struct comedi_device *dev,
-struct comedi_subdevice *s,
-struct comedi_insn *insn,
-unsigned int *data)
-{
-   struct pci1710_private *devpriv = dev->private;
-   unsigned int chan = CR_CHAN(insn->chanspec);
-   unsigned int range = CR_RANGE(insn->chanspec);
-   unsigned int val = s->readback[chan];
-   int i;
-
-   devpriv->da_ranges &= ~(1 << (chan << 1));
-   devpriv->da_ranges |= (range << (chan << 1));
-   outw(devpriv->da_ranges, dev->iobase + PCI171X_DAREF_REG);
-
-   for (i = 0; i < insn->n; i++) {
-   val = data[i];
-   outw(val, dev->iobase + PCI171X_DA_REG(chan));
-   }
-
-   s->readback[chan] = val;
-
-   return insn->n;
-}
-
 static int pci171x_ai_cancel(struct comedi_device *dev,
 struct comedi_subdevice *s)
 {
@@ -645,6 +620,31 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev,
return 0;
 }
 
+static int pci1710_ao_insn_write(struct comedi_device *dev,
+struct comedi_subdevice *s,
+struct comedi_insn *insn,
+unsigned int *data)
+{
+   struct pci1710_private *devpriv = dev->private;
+   unsigned int chan = CR_CHAN(insn->chanspec);
+   unsigned int range = CR_RANGE(insn->chanspec);
+   unsigned int val = s->readback[chan];
+   int i;
+
+   devpriv->da_ranges &= ~(1 << (chan << 1));
+   devpriv->da_ranges |= (range << (chan << 1));
+   outw(devpriv->da_ranges, dev->iobase + PCI171X_DAREF_REG);
+
+   for (i = 0; i < insn->n; i++) {
+   val = data[i];
+   outw(val, dev->iobase + PCI171X_DA_REG(chan));
+   }
+
+   s->readback[chan] = val;
+
+   return insn->n;
+}
+
 static int pci1710_di_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
@@ -818,7 +818,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
s->n_chan   = 2;
s->maxdata  = 0x0fff;
s->range_table  = &pci171x_ao_range;
-   s->insn_write   = pci171x_ao_insn_write;
+   s->insn_write   = pci1710_ao_insn_write;
 
ret = comedi_alloc_subdev_readback(s);
if (ret)
-- 
2.5.1

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


[PATCH 17/22] staging: comedi: adv_pci1710: ai (*cancel) should not enable software trigger

2015-11-04 Thread H Hartley Sweeten
The (*cancel) operation should do just that. Remove the setting of the SW bit
which enables the software trigger.

For aesthetics, rename the function so it has namespace associated with the
driver and add a couple comments.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 1819bcf..732f7b1 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -365,16 +365,19 @@ static int pci171x_ai_insn_read(struct comedi_device *dev,
return ret ? ret : insn->n;
 }
 
-static int pci171x_ai_cancel(struct comedi_device *dev,
+static int pci1710_ai_cancel(struct comedi_device *dev,
 struct comedi_subdevice *s)
 {
struct pci1710_private *devpriv = dev->private;
 
-   devpriv->ctrl &= PCI171X_CTRL_CNT0;
-   devpriv->ctrl |= PCI171X_CTRL_SW;
-   /* reset any operations */
+   /* disable A/D triggers and interrupt sources */
+   devpriv->ctrl &= PCI171X_CTRL_CNT0; /* preserve counter 0 clk src */
outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG);
+
+   /* disable pacer */
comedi_8254_pacer_enable(dev->pacer, 1, 2, false);
+
+   /* clear A/D FIFO and any pending interrutps */
outb(0, dev->iobase + PCI171X_CLRFIFO_REG);
outb(0, dev->iobase + PCI171X_CLRINT_REG);
 
@@ -801,7 +804,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
s->len_chanlist = s->n_chan;
s->do_cmdtest   = pci171x_ai_cmdtest;
s->do_cmd   = pci171x_ai_cmd;
-   s->cancel   = pci171x_ai_cancel;
+   s->cancel   = pci1710_ai_cancel;
}
 
/* find the value needed to adjust for unipolar gain codes */
-- 
2.5.1

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


[PATCH 18/22] staging: comedi: adv_pci1710: tidy up pci1710_reset()

2015-11-04 Thread H Hartley Sweeten
Change the return type to void, this function always succeeds and the
caller does not check the return value anyway.

Fix the initial programming of the control register. The SW bit enables
the software trigger and should not be set here. Setting CNT0 selects the
external clock source for counter 0 (the user counter). It makes more
sense to select the internal 1 MHz clock.

Remove the unnecessary initialization of the private data members. This
function is only called during the (*auto_attach) after the private
data was kzalloc'ed.

Remove the redundant clearing of the A/D FIFO and pending interrupts.
Just do it once.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 732f7b1..c5f8bff 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -711,29 +711,29 @@ static int pci1710_counter_insn_config(struct 
comedi_device *dev,
return insn->n;
 }
 
-static int pci1710_reset(struct comedi_device *dev)
+static void pci1710_reset(struct comedi_device *dev)
 {
const struct boardtype *board = dev->board_ptr;
-   struct pci1710_private *devpriv = dev->private;
 
-   /* Software trigger, CNT0=external */
-   devpriv->ctrl = PCI171X_CTRL_SW | PCI171X_CTRL_CNT0;
-   /* reset any operations */
-   outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG);
+   /*
+* Disable A/D triggers and interrupt sources, set counter 0
+* to use internal 1 MHz clock.
+*/
+   outw(0, dev->iobase + PCI171X_CTRL_REG);
+
+   /* clear A/D FIFO and any pending interrutps */
outb(0, dev->iobase + PCI171X_CLRFIFO_REG);
outb(0, dev->iobase + PCI171X_CLRINT_REG);
-   devpriv->da_ranges = 0;
+
if (board->has_ao) {
/* set DACs to 0..5V and outputs to 0V */
-   outb(devpriv->da_ranges, dev->iobase + PCI171X_DAREF_REG);
+   outb(0, dev->iobase + PCI171X_DAREF_REG);
outw(0, dev->iobase + PCI171X_DA_REG(0));
outw(0, dev->iobase + PCI171X_DA_REG(1));
}
-   outw(0, dev->iobase + PCI171X_DO_REG);  /*  digital outputs to 0 */
-   outb(0, dev->iobase + PCI171X_CLRFIFO_REG);
-   outb(0, dev->iobase + PCI171X_CLRINT_REG);
 
-   return 0;
+   /* set digital outputs to 0 */
+   outw(0, dev->iobase + PCI171X_DO_REG);
 }
 
 static int pci1710_auto_attach(struct comedi_device *dev,
-- 
2.5.1

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


[PATCH 16/22] staging: comedi: adv_pci1710: post increment 'subdev' in (*auto_attach)

2015-11-04 Thread H Hartley Sweeten
For aesthetics, post-increment the 'subdev' index when used to get a
comedi_subdevice pointer instead of incrementing it after the subdevice
is initialized.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 0511f26..1819bcf 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -786,7 +786,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
 
subdev = 0;
 
-   s = &dev->subdevices[subdev];
+   s = &dev->subdevices[subdev++];
s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND;
if (!board->is_pci1711)
@@ -812,10 +812,8 @@ static int pci1710_auto_attach(struct comedi_device *dev,
}
}
 
-   subdev++;
-
if (board->has_ao) {
-   s = &dev->subdevices[subdev];
+   s = &dev->subdevices[subdev++];
s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE;
s->n_chan   = 2;
@@ -826,32 +824,28 @@ static int pci1710_auto_attach(struct comedi_device *dev,
ret = comedi_alloc_subdev_readback(s);
if (ret)
return ret;
-
-   subdev++;
}
 
if (!board->is_pci1713) {
-   s = &dev->subdevices[subdev];
+   s = &dev->subdevices[subdev++];
s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE;
s->n_chan   = 16;
s->maxdata  = 1;
s->range_table  = &range_digital;
s->insn_bits= pci1710_di_insn_bits;
-   subdev++;
 
-   s = &dev->subdevices[subdev];
+   s = &dev->subdevices[subdev++];
s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITABLE;
s->n_chan   = 16;
s->maxdata  = 1;
s->range_table  = &range_digital;
s->insn_bits= pci1710_do_insn_bits;
-   subdev++;
}
 
/* Counter subdevice (8254) */
-   s = &dev->subdevices[subdev];
+   s = &dev->subdevices[subdev++];
comedi_8254_subdevice_init(s, dev->pacer);
 
dev->pacer->insn_config = pci1710_counter_insn_config;
@@ -860,8 +854,6 @@ static int pci1710_auto_attach(struct comedi_device *dev,
comedi_8254_set_busy(dev->pacer, 1, true);
comedi_8254_set_busy(dev->pacer, 2, true);
 
-   subdev++;
-
/* max_samples is half the FIFO size (2 bytes/sample) */
devpriv->max_samples = (board->is_pci1711) ? 512 : 2048;
 
-- 
2.5.1

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


[PATCH 20/22] staging: comedi: adv_pci1710: fix ai (*insn_read)

2015-11-04 Thread H Hartley Sweeten
An (*insn_read) can only happen if the subdevice is in a non-busy state,
i.e. an async command is not running. The board reset and subdevice
(*cancel) will ensure that the control bits (devpriv->ctrl) are already
cleared.

The (*insn_read) only needs to enable the software trigger before reading
samples. It should also disable the software trigger when done. Fix the
(*insn_read) to do this.

For aesthetics, rename the function so it has namespace associated with
the driver.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 9e45f3d..f4e9a20 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -325,7 +325,7 @@ static int pci171x_ai_read_sample(struct comedi_device *dev,
return 0;
 }
 
-static int pci171x_ai_insn_read(struct comedi_device *dev,
+static int pci1710_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
@@ -334,9 +334,10 @@ static int pci171x_ai_insn_read(struct comedi_device *dev,
int ret = 0;
int i;
 
-   devpriv->ctrl &= PCI171X_CTRL_CNT0;
-   devpriv->ctrl |= PCI171X_CTRL_SW;   /*  set software trigger */
+   /* enable software trigger */
+   devpriv->ctrl |= PCI171X_CTRL_SW;
outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG);
+
outb(0, dev->iobase + PCI171X_CLRFIFO_REG);
outb(0, dev->iobase + PCI171X_CLRINT_REG);
 
@@ -359,6 +360,10 @@ static int pci171x_ai_insn_read(struct comedi_device *dev,
data[i] = val;
}
 
+   /* disable software trigger */
+   devpriv->ctrl &= ~PCI171X_CTRL_SW;
+   outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG);
+
outb(0, dev->iobase + PCI171X_CLRFIFO_REG);
outb(0, dev->iobase + PCI171X_CLRINT_REG);
 
@@ -797,7 +802,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
s->n_chan   = board->is_pci1713 ? 32 : 16;
s->maxdata  = 0x0fff;
s->range_table  = board->ai_range;
-   s->insn_read= pci171x_ai_insn_read;
+   s->insn_read= pci1710_ai_insn_read;
if (dev->irq) {
dev->read_subdev = s;
s->subdev_flags |= SDF_CMD_READ;
-- 
2.5.1

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


[PATCH 19/22] staging: comedi: adv_pci1710: fix counter 0 internal clock source

2015-11-04 Thread H Hartley Sweeten
Counters 1 and 2 of the 8254 are cascaeded to create the 32-bit timer
used for the analog input pacer trigger. The base clock to these counters
is 10 MHz.

Counter 0 is available to the user for general purpose use. This counter
can use either an internal 1 MHz clock or an external clock. The
(*insn_config) for the counter subdevice provides support for
INSN_CONFIG_{SET,GET}_CLOCK_SRC to allow the user to select the
clock source to use. Fix the INSN_CONFIG_GET_CLOCK_SRC so it returns
the correct speed of the internal clock.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/adv_pci1710.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index c5f8bff..9e45f3d 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -701,7 +701,7 @@ static int pci1710_counter_insn_config(struct comedi_device 
*dev,
data[2] = 0;
} else {
data[1] = 0;
-   data[2] = I8254_OSC_BASE_10MHZ;
+   data[2] = I8254_OSC_BASE_1MHZ;
}
break;
default:
-- 
2.5.1

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


[PATCH 21/22] staging: comedi: adv_pci1710: rename pci171x_ai_{cmd, cmdtest}()

2015-11-04 Thread H Hartley Sweeten
Rename these functions so they have namespace associated with the driver.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index f4e9a20..a6da24a 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -518,7 +518,7 @@ static irqreturn_t pci1710_irq_handler(int irq, void *d)
return IRQ_HANDLED;
 }
 
-static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice 
*s)
+static int pci1710_ai_cmd(struct comedi_device *dev, struct comedi_subdevice 
*s)
 {
struct pci1710_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
@@ -559,7 +559,7 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
return 0;
 }
 
-static int pci171x_ai_cmdtest(struct comedi_device *dev,
+static int pci1710_ai_cmdtest(struct comedi_device *dev,
  struct comedi_subdevice *s,
  struct comedi_cmd *cmd)
 {
@@ -807,8 +807,8 @@ static int pci1710_auto_attach(struct comedi_device *dev,
dev->read_subdev = s;
s->subdev_flags |= SDF_CMD_READ;
s->len_chanlist = s->n_chan;
-   s->do_cmdtest   = pci171x_ai_cmdtest;
-   s->do_cmd   = pci171x_ai_cmd;
+   s->do_cmdtest   = pci1710_ai_cmdtest;
+   s->do_cmd   = pci1710_ai_cmd;
s->cancel   = pci1710_ai_cancel;
}
 
-- 
2.5.1

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


[PATCH 22/22] staging: comedi: adv_pci1710: rename pci171x_ai_*()

2015-11-04 Thread H Hartley Sweeten
Rename these functions so they have namespace associated with the driver.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index a6da24a..6ad60c3 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -177,7 +177,7 @@ struct pci1710_private {
unsigned char unipolar_gain;/* adjust for unipolar gain codes */
 };
 
-static int pci171x_ai_check_chanlist(struct comedi_device *dev,
+static int pci1710_ai_check_chanlist(struct comedi_device *dev,
 struct comedi_subdevice *s,
 struct comedi_cmd *cmd)
 {
@@ -243,7 +243,7 @@ static int pci171x_ai_check_chanlist(struct comedi_device 
*dev,
return 0;
 }
 
-static void pci171x_ai_setup_chanlist(struct comedi_device *dev,
+static void pci1710_ai_setup_chanlist(struct comedi_device *dev,
  struct comedi_subdevice *s,
  unsigned int *chanlist,
  unsigned int n_chan,
@@ -283,7 +283,7 @@ static void pci171x_ai_setup_chanlist(struct comedi_device 
*dev,
outw(devpriv->mux_scan, dev->iobase + PCI171X_MUX_REG);
 }
 
-static int pci171x_ai_eoc(struct comedi_device *dev,
+static int pci1710_ai_eoc(struct comedi_device *dev,
  struct comedi_subdevice *s,
  struct comedi_insn *insn,
  unsigned long context)
@@ -296,7 +296,7 @@ static int pci171x_ai_eoc(struct comedi_device *dev,
return -EBUSY;
 }
 
-static int pci171x_ai_read_sample(struct comedi_device *dev,
+static int pci1710_ai_read_sample(struct comedi_device *dev,
  struct comedi_subdevice *s,
  unsigned int cur_chan,
  unsigned int *val)
@@ -341,7 +341,7 @@ static int pci1710_ai_insn_read(struct comedi_device *dev,
outb(0, dev->iobase + PCI171X_CLRFIFO_REG);
outb(0, dev->iobase + PCI171X_CLRINT_REG);
 
-   pci171x_ai_setup_chanlist(dev, s, &insn->chanspec, 1, 1);
+   pci1710_ai_setup_chanlist(dev, s, &insn->chanspec, 1, 1);
 
for (i = 0; i < insn->n; i++) {
unsigned int val;
@@ -349,11 +349,11 @@ static int pci1710_ai_insn_read(struct comedi_device *dev,
/* start conversion */
outw(0, dev->iobase + PCI171X_SOFTTRG_REG);
 
-   ret = comedi_timeout(dev, s, insn, pci171x_ai_eoc, 0);
+   ret = comedi_timeout(dev, s, insn, pci1710_ai_eoc, 0);
if (ret)
break;
 
-   ret = pci171x_ai_read_sample(dev, s, 0, &val);
+   ret = pci1710_ai_read_sample(dev, s, 0, &val);
if (ret)
break;
 
@@ -413,7 +413,7 @@ static void pci1710_handle_every_sample(struct 
comedi_device *dev,
outb(0, dev->iobase + PCI171X_CLRINT_REG);
 
for (; !(inw(dev->iobase + PCI171X_STATUS_REG) & PCI171X_STATUS_FE);) {
-   ret = pci171x_ai_read_sample(dev, s, s->async->cur_chan, &val);
+   ret = pci1710_ai_read_sample(dev, s, s->async->cur_chan, &val);
if (ret) {
s->async->events |= COMEDI_CB_ERROR;
break;
@@ -457,7 +457,7 @@ static void pci1710_handle_fifo(struct comedi_device *dev,
unsigned int val;
int ret;
 
-   ret = pci171x_ai_read_sample(dev, s, s->async->cur_chan, &val);
+   ret = pci1710_ai_read_sample(dev, s, s->async->cur_chan, &val);
if (ret) {
s->async->events |= COMEDI_CB_ERROR;
break;
@@ -523,7 +523,7 @@ static int pci1710_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
struct pci1710_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
 
-   pci171x_ai_setup_chanlist(dev, s, cmd->chanlist, cmd->chanlist_len,
+   pci1710_ai_setup_chanlist(dev, s, cmd->chanlist, cmd->chanlist_len,
  devpriv->saved_seglen);
 
outb(0, dev->iobase + PCI171X_CLRFIFO_REG);
@@ -623,7 +623,7 @@ static int pci1710_ai_cmdtest(struct comedi_device *dev,
 
/* Step 5: check channel list */
 
-   err |= pci171x_ai_check_chanlist(dev, s, cmd);
+   err |= pci1710_ai_check_chanlist(dev, s, cmd);
 
if (err)
return 5;
-- 
2.5.1

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


Re: [PATCH 2/2] staging: rtl8188eu: unused macros removed

2015-11-04 Thread Greg KH
On Wed, Nov 04, 2015 at 09:09:11PM +0700, Ivan Safonov wrote:
> These macros does not used.

I can not understand this sentance.

> 
> Signed-off-by: Ivan Safonov 
> ---
>  drivers/staging/rtl8188eu/core/rtw_ioctl_set.c |  7 --
>  drivers/staging/rtl8188eu/include/HalVerDef.h  | 33 
> --
>  2 files changed, 40 deletions(-)

Please always use scripts/get_maintainer.pl to determine who to cc: on a
patch.

thanks,

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


Re: [lustre-devel] [PATCH v2 1/7] staging: lustre: remove white space in libcfs_hash.h

2015-11-04 Thread Greg Kroah-Hartman
On Wed, Nov 04, 2015 at 03:07:13PM +, Simmons, James A. wrote:
> >On Tue, Nov 03, 2015 at 07:46:07PM -0800, Greg Kroah-Hartman wrote:
> >> On Mon, Nov 02, 2015 at 12:22:07PM -0500, James Simmons wrote:
> >> > Cleanup all the unneeded white space in libcfs_hash.h.
> >> > 
> >> > Signed-off-by: James Simmons 
> >> > ---
> >> >  .../lustre/include/linux/libcfs/libcfs_hash.h  |  135 
> >> > ++--
> >> >  1 files changed, 70 insertions(+), 65 deletions(-)
> >> 
> >> Doesn't apply, did I already queue up this series?
> >
> >No. This did not apply because of:
> >c7fdf4a3959f ("staging: lustre: fix remaining checkpatch issues for 
> >libcfs_hash.h")
> 
> Surprise this was merged which is why I did a second series for this.

Oops, my mistake, I've now dropped this patch from my tree.  Please
resend this series so I can try to sync up properly.

thanks,

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


Re: [patch] staging: lustre: potential underflow in libcfs_kkuc_group_add()

2015-11-04 Thread Dan Carpenter
On Tue, Nov 03, 2015 at 05:49:00PM -0600, Frank Zago wrote:
> Yes, but for consistency, all 4 functions should be changed.

Thanks for the review.  I will send a v2.

regards,
dan carpenter

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


[PATCH 07/10] staging: lustre: Handle nodemask on UMP machines

2015-11-04 Thread James Simmons
For UMP and SMP machines the struct cfs_cpt_table are
defined differently. In the case handled by this patch
nodemask is defined as a integer for the UMP case and
as a pointer for the SMP case. This will cause a problem
for ost_setup which reads the nodemask directly. Instead
we create a UMP version of cfs_cpt_nodemask and use that
in ost_setup.

Signed-off-by: James Simmons 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4199
Reviewed-on: http://review.whamcloud.com/9219
Reviewed-by: Liang Zhen 
Reviewed-by: Li Xi 
Reviewed-by: Andreas Dilger 
---
 drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c 
b/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c
index 933525c..de9d289 100644
--- a/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c
+++ b/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c
@@ -58,6 +58,7 @@ cfs_cpt_table_alloc(unsigned int ncpt)
LIBCFS_ALLOC(cptab, sizeof(*cptab));
if (cptab != NULL) {
cptab->ctb_version = CFS_CPU_VERSION_MAGIC;
+   set_bit(0, &cptab->ctb_nodemask);
cptab->ctb_nparts  = ncpt;
}
 
@@ -111,6 +112,13 @@ cfs_cpt_online(struct cfs_cpt_table *cptab, int cpt)
 }
 EXPORT_SYMBOL(cfs_cpt_online);
 
+nodemask_t *
+cfs_cpt_nodemask(struct cfs_cpt_table *cptab, int cpt)
+{
+   return &cptab->ctb_nodemask;
+}
+EXPORT_SYMBOL(cfs_cpt_cpumask);
+
 int
 cfs_cpt_set_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
 {
-- 
1.7.1

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


[PATCH 05/10] staging: lustre: Fix possible NULL pointer dereference in lprocfs_status.c

2015-11-04 Thread James Simmons
From: Dmitry Eremin 

The imp->imp_connection really could be NULL, we better check for it
before dereferencing it in taht call to libcfs_nid2str_r.

Signed-off-by: Dmitry Eremin 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6507
Reviewed-on: http://review.whamcloud.com/14808
Reviewed-by: Bob Glossman 
Reviewed-by: John L. Hammond 
Reviewed-by: Oleg Drokin 
---
 .../lustre/lustre/obdclass/lprocfs_status.c|9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c 
b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 2de3c1b..dda5ad1 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -665,15 +665,18 @@ int lprocfs_rd_import(struct seq_file *m, void *data)
seq_printf(m, "%s%s", j ? ", " : "", nidstr);
j++;
}
-   libcfs_nid2str_r(imp->imp_connection->c_peer.nid,
-nidstr, sizeof(nidstr));
+   if (imp->imp_connection != NULL)
+   libcfs_nid2str_r(imp->imp_connection->c_peer.nid,
+nidstr, sizeof(nidstr));
+   else
+   strncpy(nidstr, "", sizeof(nidstr));
seq_printf(m,
  "]\n"
  "   current_connection: %s\n"
  "   connection_attempts: %u\n"
  "   generation: %u\n"
  "   in-progress_invalidations: %u\n",
- imp->imp_connection == NULL ? "" : nidstr,
+ nidstr,
  imp->imp_conn_cnt,
  imp->imp_generation,
  atomic_read(&imp->imp_inval_count));
-- 
1.7.1

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


[PATCH 01/10] staging: lustre: wrong parameter to cfs_hash_keycpy

2015-11-04 Thread James Simmons
From: Liang Zhen 

cfs_hash_rehash_key() passed wrong parameter to cfs_hash_keycpy,
hnode should be the second parameter not the third one.

Signed-off-by: Liang Zhen 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4362
Reviewed-on: http://review.whamcloud.com/8509
Reviewed-by: Bobi Jam 
Reviewed-by: Johann Lombardi 
---
 drivers/staging/lustre/lustre/libcfs/hash.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c 
b/drivers/staging/lustre/lustre/libcfs/hash.c
index 98c19b6..8800d64 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -2005,7 +2005,7 @@ void cfs_hash_rehash_key(struct cfs_hash *hs, const void 
*old_key,
}
/* overwrite key inside locks, otherwise may screw up with
 * other operations, i.e: rehash */
-   cfs_hash_keycpy(hs, new_key, hnode);
+   cfs_hash_keycpy(hs, hnode, new_key);
 
cfs_hash_multi_bd_unlock(hs, bds, 3, 1);
cfs_hash_unlock(hs, 0);
-- 
1.7.1

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


[PATCH 06/10] staging: lustre: Update module author to OpenSFS

2015-11-04 Thread James Simmons
The modinfo data has gone stale for the author information.
This patch changes all the MODULE_AUTHOR to OpenSFS.

Signed-off-by: James Simmons 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6204
Reviewed-on: http://review.whamcloud.com/16132
Reviewed-by: Frank Zago 
Reviewed-by: Andreas Dilger 
Reviewed-by: John L. Hammond 
Reviewed-by: Oleg Drokin 
---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c|2 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|2 +-
 drivers/staging/lustre/lnet/lnet/module.c  |2 +-
 drivers/staging/lustre/lustre/fid/fid_request.c|2 +-
 drivers/staging/lustre/lustre/fld/fld_request.c|2 +-
 drivers/staging/lustre/lustre/libcfs/module.c  |2 +-
 drivers/staging/lustre/lustre/llite/lloop.c|2 +-
 drivers/staging/lustre/lustre/llite/super25.c  |2 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c|2 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c|2 +-
 drivers/staging/lustre/lustre/mdc/mdc_request.c|2 +-
 drivers/staging/lustre/lustre/mgc/mgc_request.c|2 +-
 drivers/staging/lustre/lustre/obdclass/class_obd.c |2 +-
 .../staging/lustre/lustre/obdecho/echo_client.c|2 +-
 drivers/staging/lustre/lustre/osc/osc_request.c|2 +-
 .../staging/lustre/lustre/ptlrpc/ptlrpc_module.c   |2 +-
 16 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index 7c730e3..de0f85f 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -2865,7 +2865,7 @@ static int __init kiblnd_module_init(void)
return 0;
 }
 
-MODULE_AUTHOR("Sun Microsystems, Inc. ");
+MODULE_AUTHOR("OpenSFS, Inc. ");
 MODULE_DESCRIPTION("Kernel OpenIB gen2 LND v2.00");
 MODULE_LICENSE("GPL");
 
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 46a24b4..ebde036 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -2869,7 +2869,7 @@ ksocknal_module_init(void)
return 0;
 }
 
-MODULE_AUTHOR("Sun Microsystems, Inc. ");
+MODULE_AUTHOR("OpenSFS, Inc. ");
 MODULE_DESCRIPTION("Kernel TCP Socket LND v3.0.0");
 MODULE_LICENSE("GPL");
 MODULE_VERSION("3.0.0");
diff --git a/drivers/staging/lustre/lnet/lnet/module.c 
b/drivers/staging/lustre/lnet/lnet/module.c
index 576201a..ac2fdf0 100644
--- a/drivers/staging/lustre/lnet/lnet/module.c
+++ b/drivers/staging/lustre/lnet/lnet/module.c
@@ -146,7 +146,7 @@ fini_lnet(void)
lnet_fini();
 }
 
-MODULE_AUTHOR("Peter J. Braam ");
+MODULE_AUTHOR("OpenSFS, Inc. ");
 MODULE_DESCRIPTION("LNet v3.1");
 MODULE_LICENSE("GPL");
 MODULE_VERSION("1.0.0");
diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c 
b/drivers/staging/lustre/lustre/fid/fid_request.c
index e817628..fe7c39a 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -462,7 +462,7 @@ static void __exit fid_mod_exit(void)
ldebugfs_remove(&seq_debugfs_dir);
 }
 
-MODULE_AUTHOR("Sun Microsystems, Inc. ");
+MODULE_AUTHOR("OpenSFS, Inc. ");
 MODULE_DESCRIPTION("Lustre FID Module");
 MODULE_LICENSE("GPL");
 MODULE_VERSION("0.1.0");
diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c 
b/drivers/staging/lustre/lustre/fld/fld_request.c
index 3fd91bc..469df68 100644
--- a/drivers/staging/lustre/lustre/fld/fld_request.c
+++ b/drivers/staging/lustre/lustre/fld/fld_request.c
@@ -501,7 +501,7 @@ static void __exit fld_mod_exit(void)
ldebugfs_remove(&fld_debugfs_dir);
 }
 
-MODULE_AUTHOR("Sun Microsystems, Inc. ");
+MODULE_AUTHOR("OpenSFS, Inc. ");
 MODULE_DESCRIPTION("Lustre FLD");
 MODULE_LICENSE("GPL");
 
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c 
b/drivers/staging/lustre/lustre/libcfs/module.c
index 50e8fd2..50659c6 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -62,7 +62,7 @@
 #include "../../include/linux/lnet/lnet.h"
 #include "tracefile.h"
 
-MODULE_AUTHOR("Peter J. Braam ");
+MODULE_AUTHOR("OpenSFS, Inc. ");
 MODULE_DESCRIPTION("Portals v3.1");
 MODULE_LICENSE("GPL");
 
diff --git a/drivers/staging/lustre/lustre/llite/lloop.c 
b/drivers/staging/lustre/lustre/llite/lloop.c
index e6974c3..8abfba2 100644
--- a/drivers/staging/lustre/lustre/llite/lloop.c
+++ b/drivers/staging/lustre/lustre/llite/lloop.c
@@ -876,6 +876,6 @@ module_exit(lloop_exit);
 
 module_param(max_loop, int, 0444);
 MODULE_PARM_DESC(max_loop, "maximum of lloop_device");
-MODULE_AUTH

[PATCH 04/10] staging: lustre: fix buffer overflow of string buffer

2015-11-04 Thread James Simmons
From: Dmitry Eremin 

Buffer overflow of string buffer due to non null terminated string.
Use strlcpy() when it's justifiable.
Use sizeof(var) instead of constants.

Signed-off-by: Dmitry Eremin 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
Reviewed-on: http://review.whamcloud.com/9389
Reviewed-by: Andreas Dilger 
Reviewed-by: Oleg Drokin 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|9 +
 drivers/staging/lustre/lnet/lnet/config.c  |   14 --
 drivers/staging/lustre/lnet/selftest/conrpc.c  |4 ++--
 drivers/staging/lustre/lnet/selftest/console.c |6 --
 .../staging/lustre/lustre/include/lustre_disk.h|1 +
 drivers/staging/lustre/lustre/libcfs/debug.c   |6 +++---
 drivers/staging/lustre/lustre/libcfs/hash.c|3 +--
 drivers/staging/lustre/lustre/libcfs/workitem.c|4 ++--
 drivers/staging/lustre/lustre/llite/dir.c  |2 +-
 drivers/staging/lustre/lustre/lov/lov_pool.c   |3 +--
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |   10 +++---
 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c |1 +
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  |3 +--
 13 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index ecfe733..46a24b4 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -2621,8 +2621,8 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)
 
net->ksnn_interfaces[j].ksni_ipaddr = ip;
net->ksnn_interfaces[j].ksni_netmask = mask;
-   strncpy(&net->ksnn_interfaces[j].ksni_name[0],
-   names[i], IFNAMSIZ);
+   strlcpy(net->ksnn_interfaces[j].ksni_name,
+   names[i], sizeof(net->ksnn_interfaces[j].ksni_name));
j++;
}
 
@@ -2805,8 +2805,9 @@ ksocknal_startup(lnet_ni_t *ni)
goto fail_1;
}
 
-   strncpy(&net->ksnn_interfaces[i].ksni_name[0],
-   ni->ni_interfaces[i], IFNAMSIZ);
+   strlcpy(net->ksnn_interfaces[i].ksni_name,
+   ni->ni_interfaces[i],
+   sizeof(net->ksnn_interfaces[i].ksni_name));
}
net->ksnn_ninterfaces = i;
}
diff --git a/drivers/staging/lustre/lnet/lnet/config.c 
b/drivers/staging/lustre/lnet/lnet/config.c
index 4e8b54b..5390ee9 100644
--- a/drivers/staging/lustre/lnet/lnet/config.c
+++ b/drivers/staging/lustre/lnet/lnet/config.c
@@ -650,8 +650,8 @@ lnet_parse_route(char *str, int *im_a_router)
INIT_LIST_HEAD(&nets);
 
/* save a copy of the string for error messages */
-   strncpy(cmd, str, sizeof(cmd) - 1);
-   cmd[sizeof(cmd) - 1] = 0;
+   strncpy(cmd, str, sizeof(cmd));
+   cmd[sizeof(cmd) - 1] = '\0';
 
sep = str;
for (;;) {
@@ -972,11 +972,13 @@ lnet_splitnets(char *source, struct list_head *nets)
return 0;
 
offset += (int)(sep - tb->ltb_text);
-   tb2 = lnet_new_text_buf(strlen(sep));
+   len = strlen(sep);
+   tb2 = lnet_new_text_buf(len);
if (tb2 == NULL)
return -ENOMEM;
 
-   strcpy(tb2->ltb_text, sep);
+   strncpy(tb2->ltb_text, sep, len);
+   tb2->ltb_text[len] = '\0';
list_add_tail(&tb2->ltb_list, nets);
 
tb = tb2;
@@ -1021,8 +1023,8 @@ lnet_match_networks(char **networksp, char *ip2nets, 
__u32 *ipaddrs, int nip)
tb = list_entry(raw_entries.next, struct lnet_text_buf_t,
ltb_list);
 
-   strncpy(source, tb->ltb_text, sizeof(source)-1);
-   source[sizeof(source)-1] = 0;
+   strncpy(source, tb->ltb_text, sizeof(source));
+   source[sizeof(source)-1] = '\0';
 
/* replace ltb_text with the network(s) add on match */
rc = lnet_match_network_tokens(tb->ltb_text, ipaddrs, nip);
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 0060ff6..a16d7a5 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -612,8 +612,8 @@ lstcon_sesrpc_prep(lstcon_node_t *nd, int transop,
msrq = &(*crpc)->crp_rpc->crpc_reqstmsg.msg_body.mksn_reqst;
msrq->mksn_sid = console_session.ses_id;
msrq->mksn_force   = console_session.ses_force;
-   strncpy(msrq->mksn_name, console_session.ses_name,
-   strlen(console_session.ses_name));
+   strlcpy(msrq->mksn_name, console_session.ses_name,

[PATCH 02/10] staging: lustre: remove unnecessary EXPORT_SYMBOL in libcfs

2015-11-04 Thread James Simmons
From: frank zago 

A lot of symbols don't need to be exported at all because they are
only used in the module they belong to.

Signed-off-by: frank zago 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5829
Reviewed-on: http://review.whamcloud.com/13319
Reviewed-by: James Simmons 
Reviewed-by: John L. Hammond 
Reviewed-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/debug.c   |   10 --
 drivers/staging/lustre/lustre/libcfs/hash.c|   10 --
 drivers/staging/lustre/lustre/libcfs/libcfs_mem.c  |2 --
 .../lustre/lustre/libcfs/linux/linux-debug.c   |1 -
 4 files changed, 0 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c 
b/drivers/staging/lustre/lustre/libcfs/debug.c
index 1d1c671..4272a7c 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -94,17 +94,14 @@ static struct kernel_param_ops param_ops_debugmb = {
 static unsigned int libcfs_debug_mb;
 module_param(libcfs_debug_mb, debugmb, 0644);
 MODULE_PARM_DESC(libcfs_debug_mb, "Total debug buffer size.");
-EXPORT_SYMBOL(libcfs_debug_mb);
 
 unsigned int libcfs_printk = D_CANTMASK;
 module_param(libcfs_printk, uint, 0644);
 MODULE_PARM_DESC(libcfs_printk, "Lustre kernel debug console mask");
-EXPORT_SYMBOL(libcfs_printk);
 
 unsigned int libcfs_console_ratelimit = 1;
 module_param(libcfs_console_ratelimit, uint, 0644);
 MODULE_PARM_DESC(libcfs_console_ratelimit, "Lustre kernel debug console 
ratelimit (0 to disable)");
-EXPORT_SYMBOL(libcfs_console_ratelimit);
 
 static int param_set_delay_minmax(const char *val,
  const struct kernel_param *kp,
@@ -135,9 +132,7 @@ static int param_get_delay(char *buffer, const struct 
kernel_param *kp)
 }
 
 unsigned int libcfs_console_max_delay;
-EXPORT_SYMBOL(libcfs_console_max_delay);
 unsigned int libcfs_console_min_delay;
-EXPORT_SYMBOL(libcfs_console_min_delay);
 
 static int param_set_console_max_delay(const char *val,
   const struct kernel_param *kp)
@@ -207,10 +202,8 @@ static struct kernel_param_ops param_ops_uintpos = {
 unsigned int libcfs_console_backoff = CDEBUG_DEFAULT_BACKOFF;
 module_param(libcfs_console_backoff, uintpos, 0644);
 MODULE_PARM_DESC(libcfs_console_backoff, "Lustre kernel debug console backoff 
factor");
-EXPORT_SYMBOL(libcfs_console_backoff);
 
 unsigned int libcfs_debug_binary = 1;
-EXPORT_SYMBOL(libcfs_debug_binary);
 
 unsigned int libcfs_stack = 3 * THREAD_SIZE / 4;
 EXPORT_SYMBOL(libcfs_stack);
@@ -221,7 +214,6 @@ EXPORT_SYMBOL(libcfs_catastrophe);
 unsigned int libcfs_panic_on_lbug = 1;
 module_param(libcfs_panic_on_lbug, uint, 0644);
 MODULE_PARM_DESC(libcfs_panic_on_lbug, "Lustre kernel panic on LBUG");
-EXPORT_SYMBOL(libcfs_panic_on_lbug);
 
 static wait_queue_head_t debug_ctlwq;
 
@@ -572,5 +564,3 @@ void libcfs_debug_set_level(unsigned int debug_level)
   debug_level);
libcfs_debug = debug_level;
 }
-
-EXPORT_SYMBOL(libcfs_debug_set_level);
diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c 
b/drivers/staging/lustre/lustre/libcfs/hash.c
index 8800d64..f23a11d 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -593,7 +593,6 @@ cfs_hash_bd_move_locked(struct cfs_hash *hs, struct 
cfs_hash_bd *bd_old,
if (unlikely(nbkt->hsb_version == 0))
nbkt->hsb_version++;
 }
-EXPORT_SYMBOL(cfs_hash_bd_move_locked);
 
 enum {
/** always set, for sanity (avoid ZERO intent) */
@@ -830,21 +829,18 @@ cfs_hash_dual_bd_get(struct cfs_hash *hs, const void *key,
 
cfs_hash_bd_order(&bds[0], &bds[1]);
 }
-EXPORT_SYMBOL(cfs_hash_dual_bd_get);
 
 void
 cfs_hash_dual_bd_lock(struct cfs_hash *hs, struct cfs_hash_bd *bds, int excl)
 {
cfs_hash_multi_bd_lock(hs, bds, 2, excl);
 }
-EXPORT_SYMBOL(cfs_hash_dual_bd_lock);
 
 void
 cfs_hash_dual_bd_unlock(struct cfs_hash *hs, struct cfs_hash_bd *bds, int excl)
 {
cfs_hash_multi_bd_unlock(hs, bds, 2, excl);
 }
-EXPORT_SYMBOL(cfs_hash_dual_bd_unlock);
 
 struct hlist_node *
 cfs_hash_dual_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds,
@@ -852,7 +848,6 @@ cfs_hash_dual_bd_lookup_locked(struct cfs_hash *hs, struct 
cfs_hash_bd *bds,
 {
return cfs_hash_multi_bd_lookup_locked(hs, bds, 2, key);
 }
-EXPORT_SYMBOL(cfs_hash_dual_bd_lookup_locked);
 
 struct hlist_node *
 cfs_hash_dual_bd_findadd_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds,
@@ -862,7 +857,6 @@ cfs_hash_dual_bd_findadd_locked(struct cfs_hash *hs, struct 
cfs_hash_bd *bds,
return cfs_hash_multi_bd_findadd_locked(hs, bds, 2, key,
hnode, noref);
 }
-EXPORT_SYMBOL(cfs_hash_dual_bd_findadd_locked);
 
 struct hlist_node *
 cfs_hash_dual_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds,
@@ -870,7 +864,6 @@ cfs_hash_dual_bd_finddel_locked(struct cfs_hash *hs, struct 

[PATCH 10/10] staging: lustre: fix 'error handling' issues for libcfs workitem.c

2015-11-04 Thread James Simmons
From: Sebastien Buisson 

Fix 'error handling' issues found by Coverity version 6.5.1:
Unchecked return value (CHECKED_RETURN)
Calling function without checking return value.

Signed-off-by: Sebastien Buisson 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3427
Reviewed-on: http://review.whamcloud.com/7103
Reviewed-by: Bobbie Lind 
Reviewed-by: Dmitry Eremin 
Reviewed-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/workitem.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c 
b/drivers/staging/lustre/lustre/libcfs/workitem.c
index f6cc434..e405fc2 100644
--- a/drivers/staging/lustre/lustre/libcfs/workitem.c
+++ b/drivers/staging/lustre/lustre/libcfs/workitem.c
@@ -225,7 +225,9 @@ cfs_wi_scheduler (void *arg)
 
/* CPT affinity scheduler? */
if (sched->ws_cptab != NULL)
-   cfs_cpt_bind(sched->ws_cptab, sched->ws_cpt);
+   if (cfs_cpt_bind(sched->ws_cptab, sched->ws_cpt) != 0)
+   CWARN("Failed to bind %s on CPT %d\n",
+ sched->ws_name, sched->ws_cpt);
 
spin_lock(&cfs_wi_data.wi_glock);
 
-- 
1.7.1

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


[PATCH 09/10] staging: lustre: remove page_collection::pc_lock in libcfs

2015-11-04 Thread James Simmons
From: Liang Zhen 

page_collection::pc_lock is supposed to protect race between
functions called by smp_call_function(), however we don't have
this use-case for ages and page_collection only lives in stack
of thread, so it is safe to remove it.

Signed-off-by: Liang Zhen 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3055
Reviewed-on: http://review.whamcloud.com/7660
Reviewed-by: Bobi Jam 
Reviewed-by: Sebastien Buisson 
Reviewed-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/tracefile.c |   14 --
 drivers/staging/lustre/lustre/libcfs/tracefile.h |8 
 2 files changed, 0 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index 973c7c2..6fe7dfb 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -199,7 +199,6 @@ static void cfs_tcd_shrink(struct cfs_trace_cpu_data *tcd)
   pgcount + 1, tcd->tcd_cur_pages);
 
INIT_LIST_HEAD(&pc.pc_pages);
-   spin_lock_init(&pc.pc_lock);
 
list_for_each_entry_safe(tage, tmp, &tcd->tcd_pages, linkage) {
if (pgcount-- == 0)
@@ -522,7 +521,6 @@ static void collect_pages_on_all_cpus(struct 
page_collection *pc)
struct cfs_trace_cpu_data *tcd;
int i, cpu;
 
-   spin_lock(&pc->pc_lock);
for_each_possible_cpu(cpu) {
cfs_tcd_for_each_type_lock(tcd, i, cpu) {
list_splice_init(&tcd->tcd_pages, &pc->pc_pages);
@@ -534,7 +532,6 @@ static void collect_pages_on_all_cpus(struct 
page_collection *pc)
}
}
}
-   spin_unlock(&pc->pc_lock);
 }
 
 static void collect_pages(struct page_collection *pc)
@@ -555,7 +552,6 @@ static void put_pages_back_on_all_cpus(struct 
page_collection *pc)
struct cfs_trace_page *tmp;
int i, cpu;
 
-   spin_lock(&pc->pc_lock);
for_each_possible_cpu(cpu) {
cfs_tcd_for_each_type_lock(tcd, i, cpu) {
cur_head = tcd->tcd_pages.next;
@@ -573,7 +569,6 @@ static void put_pages_back_on_all_cpus(struct 
page_collection *pc)
}
}
}
-   spin_unlock(&pc->pc_lock);
 }
 
 static void put_pages_back(struct page_collection *pc)
@@ -592,7 +587,6 @@ static void put_pages_on_tcd_daemon_list(struct 
page_collection *pc,
struct cfs_trace_page *tage;
struct cfs_trace_page *tmp;
 
-   spin_lock(&pc->pc_lock);
list_for_each_entry_safe(tage, tmp, &pc->pc_pages, linkage) {
 
__LASSERT_TAGE_INVARIANT(tage);
@@ -616,7 +610,6 @@ static void put_pages_on_tcd_daemon_list(struct 
page_collection *pc,
tcd->tcd_cur_daemon_pages--;
}
}
-   spin_unlock(&pc->pc_lock);
 }
 
 static void put_pages_on_daemon_list(struct page_collection *pc)
@@ -636,8 +629,6 @@ void cfs_trace_debug_print(void)
struct cfs_trace_page *tage;
struct cfs_trace_page *tmp;
 
-   spin_lock_init(&pc.pc_lock);
-
pc.pc_want_daemon_pages = 1;
collect_pages(&pc);
list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) {
@@ -692,7 +683,6 @@ int cfs_tracefile_dump_all_pages(char *filename)
goto out;
}
 
-   spin_lock_init(&pc.pc_lock);
pc.pc_want_daemon_pages = 1;
collect_pages(&pc);
if (list_empty(&pc.pc_pages)) {
@@ -739,8 +729,6 @@ void cfs_trace_flush_pages(void)
struct cfs_trace_page *tage;
struct cfs_trace_page *tmp;
 
-   spin_lock_init(&pc.pc_lock);
-
pc.pc_want_daemon_pages = 1;
collect_pages(&pc);
list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) {
@@ -970,7 +958,6 @@ static int tracefiled(void *arg)
/* we're started late enough that we pick up init's fs context */
/* this is so broken in uml?  what on earth is going on? */
 
-   spin_lock_init(&pc.pc_lock);
complete(&tctl->tctl_start);
 
while (1) {
@@ -1170,7 +1157,6 @@ static void cfs_trace_cleanup(void)
struct page_collection pc;
 
INIT_LIST_HEAD(&pc.pc_pages);
-   spin_lock_init(&pc.pc_lock);
 
trace_cleanup_on_all_cpus();
 
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h 
b/drivers/staging/lustre/lustre/libcfs/tracefile.h
index cb7a396..de37fb7 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.h
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h
@@ -196,14 +196,6 @@ extern union cfs_trace_data_union 
(*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS];
 struct page_collection {
struct list_headpc_pages;
/*
-* spin-lock protecting ->pc_pages. It is taken by smp_call_function()
-* call-back functions. XXX nikita: Which is horrible: all processors
-* receive NMI at the same time only to be serialized by this
-  

[PATCH 03/10] staging: lustre: remove libcfs_debug_set_level prototype from libcfs_private.h

2015-11-04 Thread James Simmons
From: frank zago 

The function libcfs_debug_set_level is used only internally so no reason
to expose it in libcfs_private.h. This is broken out from LU-5829 patch
http://review.whamcloud.com/13319.

Signed-off-by: frank zago 
---
 .../lustre/include/linux/libcfs/libcfs_private.h   |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
index 6af733d..dc2fe1f 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
@@ -185,8 +185,6 @@ int libcfs_debug_cleanup(void);
 int libcfs_debug_clear_buffer(void);
 int libcfs_debug_mark_buffer(const char *text);
 
-void libcfs_debug_set_level(unsigned int debug_level);
-
 /*
  * allocate per-cpu-partition data, returned value is an array of pointers,
  * variable can be indexed by CPU ID.
-- 
1.7.1

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


[PATCH 08/10] staging: lustre: race condition for check/use cfs_fail_val

2015-11-04 Thread James Simmons
From: Fan Yong 

There are some race conditions when check/use cfs_fail_val.
For example: when inject failure stub for LFSCK test as following:

764   if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_DELAY2) &&
765   cfs_fail_val > 0) {
766   struct l_wait_info lwi;
767
768   lwi = LWI_TIMEOUT(cfs_time_seconds(cfs_fail_val),
769 NULL, NULL);
770   l_wait_event(thread->t_ctl_waitq,
771!thread_is_running(thread),
772&lwi);
773
774   if (unlikely(!thread_is_running(thread))) {
775   CDEBUG(D_LFSCK, "%s: scan dir exit for engine "
776  "stop, parent "DFID", cookie "LPX64"n",
777  lfsck_lfsck2name(lfsck),
778  PFID(lfsck_dto2fid(dir)),
779  lfsck->li_cookie_dir);
780   RETURN(0);
781   }
782   }

The "cfs_fail_val" may be changed as zero by others after the check
at the line 765 but before using it at the line 768. Then the LFSCK
engine will fall into "wait" until someone run "lfsck_stop".

Signed-off-by: Fan Yong 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6146
Reviewed-on: http://review.whamcloud.com/13481
Reviewed-by: Lai Siyao 
Reviewed-by: Andreas Dilger 
---
 drivers/staging/lustre/lustre/libcfs/fail.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/fail.c 
b/drivers/staging/lustre/lustre/libcfs/fail.c
index d39fece..ea059b0 100644
--- a/drivers/staging/lustre/lustre/libcfs/fail.c
+++ b/drivers/staging/lustre/lustre/libcfs/fail.c
@@ -126,7 +126,7 @@ int __cfs_fail_timeout_set(__u32 id, __u32 value, int ms, 
int set)
int ret;
 
ret = __cfs_fail_check_set(id, value, set);
-   if (ret) {
+   if (ret && likely(ms > 0)) {
CERROR("cfs_fail_timeout id %x sleeping for %dms\n",
   id, ms);
set_current_state(TASK_UNINTERRUPTIBLE);
-- 
1.7.1

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


RE: [patch] staging: lustre: potential underflow in libcfs_kkuc_group_add()

2015-11-04 Thread Simmons, James A.
>On Tue, Nov 03, 2015 at 05:49:00PM -0600, Frank Zago wrote:
>> Yes, but for consistency, all 4 functions should be changed.
>
>Thanks for the review.  I will send a v2.

Greg merged your original patch so it will be a new patch.

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


RE: staging: lustre: provide separate buffers for libcfs_*2str()

2015-11-04 Thread Simmons, James A.
>Hello Dan,
>
>Thanks to report this.  This issue was fixed in our code but not up streamed 
>yet. The patch is available 
>http://git.whamcloud.com/?p=fs%2Flustre->release.git;a=commit;h=d47f00d5a420b594b49564b2e00efca4602c3fb5

I just pushed a proper patch just a bit ago.

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


[PATCH] Staging: comedi: adv_pci_dio: fixed a comment style

2015-11-04 Thread Philippe Loctaux
Fixed a comment issue.

Signed-off-by: Philippe Loctaux 
---
 drivers/staging/comedi/drivers/adv_pci_dio.c | 44 ++--
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c 
b/drivers/staging/comedi/drivers/adv_pci_dio.c
index f1b3c5a..1ace5f1 100644
--- a/drivers/staging/comedi/drivers/adv_pci_dio.c
+++ b/drivers/staging/comedi/drivers/adv_pci_dio.c
@@ -5,29 +5,29 @@
  *
  *  Hardware driver for Advantech PCI DIO cards.
 */
-/*
-Driver: adv_pci_dio
-Description: Advantech PCI-1730, PCI-1733, PCI-1734, PCI-1735U,
-   PCI-1736UP, PCI-1739U, PCI-1750, PCI-1751, PCI-1752,
-   PCI-1753/E, PCI-1754, PCI-1756, PCI-1760, PCI-1762
-Author: Michal Dobes 
-Devices: [Advantech] PCI-1730 (adv_pci_dio), PCI-1733,
-  PCI-1734, PCI-1735U, PCI-1736UP, PCI-1739U, PCI-1750,
-  PCI-1751, PCI-1752, PCI-1753,
-  PCI-1753+PCI-1753E, PCI-1754, PCI-1756,
-  PCI-1760, PCI-1762
-Status: untested
-Updated: Mon, 09 Jan 2012 12:40:46 +
-
-This driver supports now only insn interface for DI/DO/DIO.
-
-Configuration options:
-  [0] - PCI bus of device (optional)
-  [1] - PCI slot of device (optional)
-   If bus/slot is not specified, the first available PCI
-   device will be used.
 
-*/
+/*
+ * Driver: adv_pci_dio
+ * Description: Advantech PCI-1730, PCI-1733, PCI-1734, PCI-1735U,
+ * PCI-1736UP, PCI-1739U, PCI-1750, PCI-1751, PCI-1752,
+ * PCI-1753/E, PCI-1754, PCI-1756, PCI-1760, PCI-1762
+ * Author: Michal Dobes 
+ * Devices: [Advantech] PCI-1730 (adv_pci_dio), PCI-1733,
+ * PCI-1734, PCI-1735U, PCI-1736UP, PCI-1739U, PCI-1750,
+ * PCI-1751, PCI-1752, PCI-1753,
+ * PCI-1753+PCI-1753E, PCI-1754, PCI-1756,
+ * PCI-1760, PCI-1762
+ * Status: untested
+ * Updated: Mon, 09 Jan 2012 12:40:46 +
+ *
+ * This driver supports now only insn interface for DI/DO/DIO.
+ *
+ * Configuration options:
+ *  [0] - PCI bus of device (optional)
+ *  [1] - PCI slot of device (optional)
+ * If bus/slot is not specified, the first available PCI
+ * device will be used.
+ */
 
 #include 
 #include 
-- 
2.6.2

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


Re: [PATCH RESEND 11/12] staging: wilc1000: rename os_context to wilc

2015-11-04 Thread Greg KH
On Thu, Oct 29, 2015 at 12:18:51PM +0900, Glen Lee wrote:
> This patch rename os_context to wilc because it is used as struct wilc and
> move os_private from struct wilc_wlan_os_context_t to struct wilc_wlan_inp_t.
> Finally, delete wilc_wlan_os_context_t.
> 
> Signed-off-by: Glen Lee 
> ---
>  drivers/staging/wilc1000/linux_wlan.c   | 2 +-
>  drivers/staging/wilc1000/wilc_sdio.c| 6 +++---
>  drivers/staging/wilc1000/wilc_spi.c | 6 +++---
>  drivers/staging/wilc1000/wilc_wlan_if.h | 6 +-
>  4 files changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/linux_wlan.c 
> b/drivers/staging/wilc1000/linux_wlan.c
> index 017799f..d0161cd 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -1012,7 +1012,7 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc 
> *nic)
>  
>   PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
>  
> - nwi->os_context.os_private = (void *)nic;
> + nwi->wilc = (void *)nic;

Why do you need the cast to a void * here?


>  
>  #ifdef WILC_SDIO
>   nwi->io_func.io_type = HIF_SDIO;
> diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
> b/drivers/staging/wilc1000/wilc_sdio.c
> index 300c571..82f68eb 100644
> --- a/drivers/staging/wilc1000/wilc_sdio.c
> +++ b/drivers/staging/wilc1000/wilc_sdio.c
> @@ -14,7 +14,7 @@
>  #define WILC_SDIO_BLOCK_SIZE 512
>  
>  typedef struct {
> - void *os_context;
> + void *wilc;

This should be a struct wilc *, right?  Don't add a void pointer for
something that you know what it is.

thanks,

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


Re: [PATCH RESEND 12/12] staging: wilc1000: add argument wilc and use it instead of g_linux_wlan

2015-11-04 Thread Greg KH
On Thu, Oct 29, 2015 at 12:18:52PM +0900, Glen Lee wrote:
> This patch adds new argument wilc to linux_sdio_cmd53 and linux_sdio_cmd52
> , and use it instead of g_linux_wlan. Pass wilc to the functions as well.
> The void type wilc will be changed with struct wilc when SDIO and SPI
> modules are reworked.
> 
> Signed-off-by: Glen Lee 
> ---
>  drivers/staging/wilc1000/linux_wlan_sdio.c |  8 ++--
>  drivers/staging/wilc1000/linux_wlan_sdio.h |  4 +-
>  drivers/staging/wilc1000/wilc_sdio.c   | 66 
> +++---
>  drivers/staging/wilc1000/wilc_wlan_if.h|  4 +-
>  4 files changed, 41 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
> b/drivers/staging/wilc1000/linux_wlan_sdio.c
> index bf05e22..8150d6f 100644
> --- a/drivers/staging/wilc1000/linux_wlan_sdio.c
> +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
> @@ -53,9 +53,9 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
>  }
>  
>  
> -int linux_sdio_cmd52(sdio_cmd52_t *cmd)
> +int linux_sdio_cmd52(void *wilc, sdio_cmd52_t *cmd)

Again, why a void *?  Please use the correct type, you know what it is,
that way you can get rid of horrid stuff like this:

>  {
> - struct sdio_func *func = g_linux_wlan->wilc_sdio_func;
> + struct sdio_func *func = ((struct wilc*)wilc)->wilc_sdio_func;

All of those casts should not be needed.

thanks,

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


Re: [PATCH V2 02/17] staging: wilc1000: send_config_pkt: add argument struct net_device

2015-11-04 Thread Greg KH
On Fri, Oct 30, 2015 at 06:47:08PM +0900, Glen Lee wrote:
> This patch adds new argument struct net_device and pass dev to the function
> as well.
> 
> Signed-off-by: Glen Lee 
> ---
>  drivers/staging/wilc1000/coreconfigurator.c |   3 +-
>  drivers/staging/wilc1000/coreconfigurator.h |   3 +-
>  drivers/staging/wilc1000/host_interface.c   | 196 
> +---
>  drivers/staging/wilc1000/wilc_wlan_if.h |   1 +
>  4 files changed, 156 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
> b/drivers/staging/wilc1000/coreconfigurator.c
> index e10c6ff..3b4a950 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -586,7 +586,8 @@ s32 DeallocateAssocRespInfo(tstrConnectRespInfo 
> *pstrConnectRespInfo)
>   *  @date1 Mar 2012
>   *  @version 1.0
>   */
> -s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv)
> +s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
> + u32 count, u32 drv)
>  {
>   s32 counter = 0, ret = 0;
>  

But you don't do anything with this new argument?

And why struct net_device, why not your "local" structure instead?

thanks,

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


Re: [PATCH V2 03/17] staging: wilc1000: wilc_wlan_cfg_get: add argument struct net_device

2015-11-04 Thread Greg KH
On Fri, Oct 30, 2015 at 06:47:09PM +0900, Glen Lee wrote:
> Adds argument struct net_device and use netdev private data member wilc
> instead of g_linux_wlan, pass dev to the functions as well.
> 
> Signed-off-by: Glen Lee 
> ---
>  drivers/staging/wilc1000/coreconfigurator.c | 3 ++-
>  drivers/staging/wilc1000/linux_wlan.c   | 2 +-
>  drivers/staging/wilc1000/wilc_wlan.c| 8 ++--
>  drivers/staging/wilc1000/wilc_wlan.h| 3 ++-
>  4 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
> b/drivers/staging/wilc1000/coreconfigurator.c
> index 3b4a950..530d64a 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -595,7 +595,8 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, 
> struct wid *wids,
>   for (counter = 0; counter < count; counter++) {
>   PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet 
> [%d][%d]\n", !counter,
>  (counter == count - 1));
> - if (!wilc_wlan_cfg_get(!counter,
> + if (!wilc_wlan_cfg_get(dev,
> +!counter,
>  wids[counter].id,
>  (counter == count - 1),
>  drv)) {
> diff --git a/drivers/staging/wilc1000/linux_wlan.c 
> b/drivers/staging/wilc1000/linux_wlan.c
> index d0161cd..4ed324c 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -1153,7 +1153,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
> perInterface_wlan_t *p_nic)
>  
>   wilc_bus_set_max_speed();
>  
> - if (wilc_wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) {
> + if (wilc_wlan_cfg_get(dev, 1, WID_FIRMWARE_VERSION, 1, 0)) {
>   int size;
>   char Firmware_ver[20];
>  
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
> b/drivers/staging/wilc1000/wilc_wlan.c
> index 16224ce..768fd30 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -1809,12 +1809,16 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, 
> u32 buffer_size,
>  
>   return ret_size;
>  }
> -int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler)
> +int wilc_wlan_cfg_get(struct net_device *dev, int start, u32 wid, int commit,
> +   u32 drvHandler)
>  {
>   wilc_wlan_dev_t *p = &g_wlan;
>   u32 offset;
>   int ret_size;
> + perInterface_wlan_t *nic = netdev_priv(dev);
> + struct wilc *wilc;
>  
> + wilc = nic->wilc;

As you really want 'wilc', why not just pass that instead of a struct
net_device *?  You don't have to make it this complex :)

thanks,

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


Re: [PATCH V2 04/17] staging: wilc1000: wilc_wlan_cfg_set: add argument struct net_device

2015-11-04 Thread Greg KH
On Fri, Oct 30, 2015 at 06:47:10PM +0900, Glen Lee wrote:
> This patch adds new argument net_device and use netdev private data member
> wilc instead of g_linux_wlan, pass dev to the functions also.
> 
> Signed-off-by: Glen Lee 
> ---
>  drivers/staging/wilc1000/coreconfigurator.c |  3 +-
>  drivers/staging/wilc1000/linux_wlan.c   | 86 
> ++---
>  drivers/staging/wilc1000/wilc_wlan.c|  9 ++-
>  drivers/staging/wilc1000/wilc_wlan.h|  4 +-
>  4 files changed, 53 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
> b/drivers/staging/wilc1000/coreconfigurator.c
> index 530d64a..74fb556 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -616,7 +616,8 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, 
> struct wid *wids,
>   } else if (mode == SET_CFG) {
>   for (counter = 0; counter < count; counter++) {
>   PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET 
> WID:%x\n", wids[counter].id);
> - if (!wilc_wlan_cfg_set(!counter,
> + if (!wilc_wlan_cfg_set(dev,
> +!counter,
>  wids[counter].id,
>  wids[counter].val,
>  wids[counter].size,
> diff --git a/drivers/staging/wilc1000/linux_wlan.c 
> b/drivers/staging/wilc1000/linux_wlan.c
> index 4ed324c..6ffa2a1 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -662,53 +662,53 @@ static int linux_wlan_init_test_config(struct 
> net_device *dev, struct wilc *p_ni
>  
>   *(int *)c_val = 1;
>  
> - if (!wilc_wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
>   goto _fail_;
>  
>   /*to tell fw that we are going to use PC test - WILC specific*/
>   c_val[0] = 0;
> - if (!wilc_wlan_cfg_set(0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
>   goto _fail_;
>  
>   c_val[0] = INFRASTRUCTURE;
> - if (!wilc_wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
>   goto _fail_;
>  
>   /* c_val[0] = RATE_AUTO; */
>   c_val[0] = RATE_AUTO;
> - if (!wilc_wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
>   goto _fail_;
>  
>   c_val[0] = G_MIXED_11B_2_MODE;
> - if (!wilc_wlan_cfg_set(0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0))
>   goto _fail_;
>  
>   c_val[0] = 1;
> - if (!wilc_wlan_cfg_set(0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
>   goto _fail_;
>  
>   c_val[0] = G_SHORT_PREAMBLE;
> - if (!wilc_wlan_cfg_set(0, WID_PREAMBLE, c_val, 1, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 0, WID_PREAMBLE, c_val, 1, 0, 0))
>   goto _fail_;
>  
>   c_val[0] = AUTO_PROT;
> - if (!wilc_wlan_cfg_set(0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
>   goto _fail_;
>  
>   c_val[0] = ACTIVE_SCAN;
> - if (!wilc_wlan_cfg_set(0, WID_SCAN_TYPE, c_val, 1, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 0, WID_SCAN_TYPE, c_val, 1, 0, 0))
>   goto _fail_;
>  
>   c_val[0] = SITE_SURVEY_OFF;
> - if (!wilc_wlan_cfg_set(0, WID_SITE_SURVEY, c_val, 1, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 0, WID_SITE_SURVEY, c_val, 1, 0, 0))
>   goto _fail_;
>  
>   *((int *)c_val) = 0x; /* Never use RTS-CTS */
> - if (!wilc_wlan_cfg_set(0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
>   goto _fail_;
>  
>   *((int *)c_val) = 2346;
> - if (!wilc_wlan_cfg_set(0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
>   goto _fail_;
>  
>   /*  SSID
>  */
> @@ -719,23 +719,23 @@ static int linux_wlan_init_test_config(struct 
> net_device *dev, struct wilc *p_ni
>   /*  to enable Broadcast SSID suppport ) 
>  */
>   /*  --  
>  */
>   c_val[0] = 0;
> - if (!wilc_wlan_cfg_set(0, WID_BCAST_SSID, c_val, 1, 0, 0))
> + if (!wilc_wlan_cfg_set(dev, 0, WID_BCAST_SSID, c_val, 1, 0, 0))
>   goto _fail_;
>  
>   c

Re: [PATCH 01/38] staging: wilc1000: rename pu8IPAddr of fuction Handle_set_IPAddress

2015-11-04 Thread Greg KH
On Mon, Nov 02, 2015 at 05:50:44PM +0900, Glen Lee wrote:
> From: Leo Kim 
> 
> This patch renames pu8IPAddr of fuction Handle_set_IPAddress to ip_addr
> to avoid CamelCase naming convention.
> 
> Signed-off-by: Leo Kim 
> Signed-off-by: Glen Lee 
> ---
>  drivers/staging/wilc1000/host_interface.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)

This series doesn't apply probably because I didn't take your previous
series.  Please resend after you refresh and resend that one.

thanks,

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


Re: [PATCH 1/5] staging: wilc1000: change enum variable name with lower case

2015-11-04 Thread Greg KH
On Tue, Nov 03, 2015 at 04:20:58PM +0900, Glen Lee wrote:
> This patch changes WID_TYPE with wid_type which is preferred style.
> 
> Signed-off-by: Glen Lee 
> ---
>  drivers/staging/wilc1000/coreconfigurator.h | 2 +-
>  drivers/staging/wilc1000/wilc_wlan_if.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Some of these patches applied, some did not, please refresh and resend
the ones I didn't take.

thanks,

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


[PATCH v4] staging: rdma: amso1100: c2: Remove wrapper function

2015-11-04 Thread Amitoj Kaur Chawla
This patch removes the c2_print_macaddr() wrapper function which calls
the pr_debug standard kernel function only.

c2_print_macaddr() has been replaced by directly calling pr_debug().

Signed-off-by: Amitoj Kaur Chawla 
---
Changes in v2:
-Removed comment added in previous version
Changes in v3:
-Corrected indentation
Changes in v4:
-Removed trailing whitespace

 drivers/staging/rdma/amso1100/c2.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rdma/amso1100/c2.c 
b/drivers/staging/rdma/amso1100/c2.c
index 7f1e794..20bdb8c 100644
--- a/drivers/staging/rdma/amso1100/c2.c
+++ b/drivers/staging/rdma/amso1100/c2.c
@@ -87,11 +87,6 @@ static struct pci_device_id c2_pci_table[] = {
 
 MODULE_DEVICE_TABLE(pci, c2_pci_table);
 
-static void c2_print_macaddr(struct net_device *netdev)
-{
-   pr_debug("%s: MAC %pM, IRQ %u\n", netdev->name, netdev->dev_addr, 
netdev->irq);
-}
-
 static void c2_set_rxbufsize(struct c2_port *c2_port)
 {
struct net_device *netdev = c2_port->netdev;
@@ -908,7 +903,8 @@ static struct net_device *c2_devinit(struct c2_dev *c2dev,
/* Validate the MAC address */
if (!is_valid_ether_addr(netdev->dev_addr)) {
pr_debug("Invalid MAC Address\n");
-   c2_print_macaddr(netdev);
+   pr_debug("%s: MAC %pM, IRQ %u\n", netdev->name,
+netdev->dev_addr, netdev->irq);
free_netdev(netdev);
return NULL;
}
@@ -1142,7 +1138,8 @@ static int c2_probe(struct pci_dev *pcidev, const struct 
pci_device_id *ent)
}
 
/* Print out the MAC address */
-   c2_print_macaddr(netdev);
+   pr_debug("%s: MAC %pM, IRQ %u\n", netdev->name, netdev->dev_addr,
+netdev->irq);
 
ret = c2_rnic_init(c2dev);
if (ret) {
-- 
1.9.1

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


Re: [PATCH] Staging: comedi: adv_pci_dio: fixed a comment style

2015-11-04 Thread Greg KH
On Wed, Nov 04, 2015 at 09:36:30PM +0100, Philippe Loctaux wrote:
> Fixed a comment issue.

What comment issue would that be?

And please always use get_maintainer.pl to determine who to cc: patches
to.

thanks,

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


[PATCH v2] staging: rtl8712: rtl871x_sta_mgt: Remove wrapper function

2015-11-04 Thread Amitoj Kaur Chawla
Remove wrapper function mfree_sta_priv_lock() that can be replaced by a 
direct call to mfree_all_stainfo().

Signed-off-by: Amitoj Kaur Chawla 
---
Changes in v2:
-Removed trailing whitespace

 drivers/staging/rtl8712/rtl871x_sta_mgt.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c 
b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
index 6ae8cdc..fd986e1 100644
--- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c
+++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
@@ -89,16 +89,11 @@ static void mfree_all_stainfo(struct sta_priv *pstapriv)
spin_unlock_irqrestore(&pstapriv->sta_hash_lock, irqL);
 }
 
-
-static void mfree_sta_priv_lock(struct sta_priv *pstapriv)
-{
-mfree_all_stainfo(pstapriv); /* be done before free sta_hash_lock */
-}
-
 u32 _r8712_free_sta_priv(struct sta_priv *pstapriv)
 {
if (pstapriv) {
-   mfree_sta_priv_lock(pstapriv);
+   /* be done before free sta_hash_lock */
+   mfree_all_stainfo(pstapriv);
kfree(pstapriv->pallocated_stainfo_buf);
}
return _SUCCESS;
-- 
1.9.1

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


Re: [PATCH V2 01/12] staging: wilc1000: fix return type of host_int_del_beacon

2015-11-04 Thread Greg KH
On Fri, Oct 30, 2015 at 08:17:37AM +0900, Chaehyun Lim wrote:
> This patch changes return type of host_int_del_beacon from s32 to int.
> The result variable gets return value from wilc_mq_send that has return
> type of int. It should be changed return type of this function as well
> as data type of result variable.
> 
> Signed-off-by: Chaehyun Lim 
> ---
> V2: resend because 11/12 patch is changed.

Due to changes sent before your series, this series does not apply.
Please refresh and resend.

thanks,

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


Re: [PATCH 07/10] staging: lustre: Handle nodemask on UMP machines

2015-11-04 Thread kbuild test robot
Hi James,

[auto build test WARNING on: staging/staging-next]
[also build test WARNING on: next-20151104]
[cannot apply to: v4.3]

url:
https://github.com/0day-ci/linux/commits/James-Simmons/staging-lustre-wrong-parameter-to-cfs_hash_keycpy/20151105-024407
config: i386-randconfig-b0-11050505 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c: In function 
'cfs_cpt_table_alloc':
>> drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c:61:14: warning: passing 
>> argument 2 of 'set_bit' from incompatible pointer type 
>> [-Wincompatible-pointer-types]
  set_bit(0, &cptab->ctb_nodemask);
 ^
   In file included from include/linux/bitops.h:36:0,
from 
drivers/staging/lustre/lustre/libcfs/../../include/linux/libcfs/linux/libcfs.h:44,
from 
drivers/staging/lustre/lustre/libcfs/../../include/linux/libcfs/libcfs.h:40,
from drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c:38:
   arch/x86/include/asm/bitops.h:72:1: note: expected 'volatile long unsigned 
int *' but argument is of type 'nodemask_t * {aka struct  *}'
set_bit(long nr, volatile unsigned long *addr)
^

vim +/set_bit +61 drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c

45  
46  #define CFS_CPU_VERSION_MAGIC  0xbabecafe
47  
48  struct cfs_cpt_table *
49  cfs_cpt_table_alloc(unsigned int ncpt)
50  {
51  struct cfs_cpt_table *cptab;
52  
53  if (ncpt != 1) {
54  CERROR("Can't support cpu partition number %d\n", ncpt);
55  return NULL;
56  }
57  
58  LIBCFS_ALLOC(cptab, sizeof(*cptab));
59  if (cptab != NULL) {
60  cptab->ctb_version = CFS_CPU_VERSION_MAGIC;
  > 61  set_bit(0, &cptab->ctb_nodemask);
62  cptab->ctb_nparts  = ncpt;
63  }
64  
65  return cptab;
66  }
67  EXPORT_SYMBOL(cfs_cpt_table_alloc);
68  
69  void

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[staging:staging-testing 2491/2494] drivers/staging/wilc1000/wilc_wlan.c:1954:5: error: conflicting types for 'wilc_wlan_init'

2015-11-04 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
staging-testing
head:   f0c94bc642d5ff9fbfd18edcf71b9db165e365d3
commit: 30135ce26df214c03c3a9bfe25bcd8f56020bc50 [2491/2494] staging: wilc1000: 
wilc_wlan_init: add argument struct net_device
config: i386-allyesconfig (attached as .config)
reproduce:
git checkout 30135ce26df214c03c3a9bfe25bcd8f56020bc50
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from drivers/staging/wilc1000/coreconfigurator.h:14:0,
from drivers/staging/wilc1000/coreconfigurator.c:11:
>> drivers/staging/wilc1000/wilc_wlan_if.h:940:27: warning: 'struct net_device' 
>> declared inside parameter list
int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp);
  ^
>> drivers/staging/wilc1000/wilc_wlan_if.h:940:27: warning: its scope is only 
>> this definition or declaration, which is probably not what you want
   In file included from drivers/staging/wilc1000/coreconfigurator.c:13:0:
   drivers/staging/wilc1000/wilc_wlan.h:302:10: warning: 'struct net_device' 
declared inside parameter list
 u32 buffer_size, wilc_tx_complete_func_t func);
 ^
   drivers/staging/wilc1000/wilc_wlan.h:303:33: warning: 'struct net_device' 
declared inside parameter list
int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount);
^
   drivers/staging/wilc1000/wilc_wlan.h:305:31: warning: 'struct net_device' 
declared inside parameter list
void wilc_wlan_cleanup(struct net_device *dev);
  ^
   drivers/staging/wilc1000/wilc_wlan.h:311:11: warning: 'struct net_device' 
declared inside parameter list
  u32 buffer_size, wilc_tx_complete_func_t func);
  ^
--
   In file included from drivers/staging/wilc1000/coreconfigurator.h:14:0,
from drivers/staging/wilc1000/host_interface.h:4,
from drivers/staging/wilc1000/host_interface.c:5:
>> drivers/staging/wilc1000/wilc_wlan_if.h:940:27: warning: 'struct net_device' 
>> declared inside parameter list
int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp);
  ^
>> drivers/staging/wilc1000/wilc_wlan_if.h:940:27: warning: its scope is only 
>> this definition or declaration, which is probably not what you want
   In file included from drivers/staging/wilc1000/host_interface.c:5:0:
   drivers/staging/wilc1000/host_interface.h:372:50: warning: 'struct 
net_device' declared inside parameter list
s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
 ^
   drivers/staging/wilc1000/host_interface.c:4080:5: error: conflicting types 
for 'host_int_init'
s32 host_int_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
^
   In file included from drivers/staging/wilc1000/host_interface.c:5:0:
   drivers/staging/wilc1000/host_interface.h:372:5: note: previous declaration 
of 'host_int_init' was here
s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
^
--
   In file included from drivers/staging/wilc1000/wilc_debugfs.c:18:0:
>> drivers/staging/wilc1000/wilc_wlan_if.h:940:27: warning: 'struct net_device' 
>> declared inside parameter list
int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp);
  ^
>> drivers/staging/wilc1000/wilc_wlan_if.h:940:27: warning: its scope is only 
>> this definition or declaration, which is probably not what you want
--
   In file included from drivers/staging/wilc1000/wilc_wlan.c:10:0:
>> drivers/staging/wilc1000/wilc_wlan_if.h:940:27: warning: 'struct net_device' 
>> declared inside parameter list
int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp);
  ^
>> drivers/staging/wilc1000/wilc_wlan_if.h:940:27: warning: its scope is only 
>> this definition or declaration, which is probably not what you want
>> drivers/staging/wilc1000/wilc_wlan.c:1954:5: error: conflicting types for 
>> 'wilc_wlan_init'
int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp)
^
   In file included from drivers/staging/wilc1000/wilc_wlan.c:10:0:
   drivers/staging/wilc1000/wilc_wlan_if.h:940:5: note: previous declaration of 
'wilc_wlan_init' was here
int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp);
^

vim +/wilc_wlan_init +1954 drivers/staging/wilc1000/wilc_wlan.c

  1948  chipid = tempchipid;
  1949  }
  1950  _fail_:
  1951  return chipid;
  1952  }
  1953  
> 1954  int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp)
  1955  {
  1956  
  1957  int ret = 0;

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/piper

Re: [PATCH 07/10] staging: lustre: Handle nodemask on UMP machines

2015-11-04 Thread kbuild test robot
Hi James,

[auto build test WARNING on: staging/staging-next]
[also build test WARNING on: next-20151104]
[cannot apply to: v4.3]

url:
https://github.com/0day-ci/linux/commits/James-Simmons/staging-lustre-wrong-parameter-to-cfs_hash_keycpy/20151105-024407
config: m68k-allmodconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k 

All warnings (new ones prefixed by >>):

   In file included from include/linux/bitops.h:36:0,
from 
drivers/staging/lustre/lustre/libcfs/../../include/linux/libcfs/linux/libcfs.h:44,
from 
drivers/staging/lustre/lustre/libcfs/../../include/linux/libcfs/libcfs.h:40,
from drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c:38:
   drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c: In function 
'cfs_cpt_table_alloc':
>> arch/m68k/include/asm/bitops.h:64:5: warning: passing argument 2 of 
>> 'bset_mem_set_bit' from incompatible pointer type
bset_mem_set_bit(nr, vaddr) : \
^
>> drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c:61:3: note: in expansion 
>> of macro 'set_bit'
  set_bit(0, &cptab->ctb_nodemask);
  ^
   arch/m68k/include/asm/bitops.h:41:20: note: expected 'volatile long unsigned 
int *' but argument is of type 'struct nodemask_t *'
static inline void bset_mem_set_bit(int nr, volatile unsigned long *vaddr)
   ^
>> arch/m68k/include/asm/bitops.h:65:5: warning: passing argument 2 of 
>> 'bfset_mem_set_bit' from incompatible pointer type
bfset_mem_set_bit(nr, vaddr))
^
>> drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c:61:3: note: in expansion 
>> of macro 'set_bit'
  set_bit(0, &cptab->ctb_nodemask);
  ^
   arch/m68k/include/asm/bitops.h:50:20: note: expected 'volatile long unsigned 
int *' but argument is of type 'struct nodemask_t *'
static inline void bfset_mem_set_bit(int nr, volatile unsigned long *vaddr)
   ^

vim +/set_bit +61 drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c

32   *
33   * Author: li...@whamcloud.com
34   */
35  
36  #define DEBUG_SUBSYSTEM S_LNET
37  
  > 38  #include "../../include/linux/libcfs/libcfs.h"
39  
40  /** Global CPU partition table */
41  struct cfs_cpt_table   *cfs_cpt_table __read_mostly;
42  EXPORT_SYMBOL(cfs_cpt_table);
43  
44  #ifndef HAVE_LIBCFS_CPT
45  
46  #define CFS_CPU_VERSION_MAGIC  0xbabecafe
47  
48  struct cfs_cpt_table *
49  cfs_cpt_table_alloc(unsigned int ncpt)
50  {
51  struct cfs_cpt_table *cptab;
52  
53  if (ncpt != 1) {
54  CERROR("Can't support cpu partition number %d\n", ncpt);
55  return NULL;
56  }
57  
58  LIBCFS_ALLOC(cptab, sizeof(*cptab));
59  if (cptab != NULL) {
60  cptab->ctb_version = CFS_CPU_VERSION_MAGIC;
  > 61  set_bit(0, &cptab->ctb_nodemask);
62  cptab->ctb_nparts  = ncpt;
63  }
64  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V2 04/17] staging: wilc1000: wilc_wlan_cfg_set: add argument struct net_device

2015-11-04 Thread glen lee



On 2015년 11월 05일 05:46, Greg KH wrote:

On Fri, Oct 30, 2015 at 06:47:10PM +0900, Glen Lee wrote:

This patch adds new argument net_device and use netdev private data member
wilc instead of g_linux_wlan, pass dev to the functions also.

Signed-off-by: Glen Lee 
---
  drivers/staging/wilc1000/coreconfigurator.c |  3 +-
  drivers/staging/wilc1000/linux_wlan.c   | 86 ++---
  drivers/staging/wilc1000/wilc_wlan.c|  9 ++-
  drivers/staging/wilc1000/wilc_wlan.h|  4 +-
  4 files changed, 53 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 530d64a..74fb556 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -616,7 +616,8 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct 
wid *wids,
} else if (mode == SET_CFG) {
for (counter = 0; counter < count; counter++) {
PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET 
WID:%x\n", wids[counter].id);
-   if (!wilc_wlan_cfg_set(!counter,
+   if (!wilc_wlan_cfg_set(dev,
+  !counter,
   wids[counter].id,
   wids[counter].val,
   wids[counter].size,
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 4ed324c..6ffa2a1 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -662,53 +662,53 @@ static int linux_wlan_init_test_config(struct net_device 
*dev, struct wilc *p_ni
  
  	*(int *)c_val = 1;
  
-	if (!wilc_wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))

+   if (!wilc_wlan_cfg_set(dev, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
goto _fail_;
  
  	/*to tell fw that we are going to use PC test - WILC specific*/

c_val[0] = 0;
-   if (!wilc_wlan_cfg_set(0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
goto _fail_;
  
  	c_val[0] = INFRASTRUCTURE;

-   if (!wilc_wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
goto _fail_;
  
  	/* c_val[0] = RATE_AUTO; */

c_val[0] = RATE_AUTO;
-   if (!wilc_wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
goto _fail_;
  
  	c_val[0] = G_MIXED_11B_2_MODE;

-   if (!wilc_wlan_cfg_set(0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0))
goto _fail_;
  
  	c_val[0] = 1;

-   if (!wilc_wlan_cfg_set(0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
goto _fail_;
  
  	c_val[0] = G_SHORT_PREAMBLE;

-   if (!wilc_wlan_cfg_set(0, WID_PREAMBLE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_PREAMBLE, c_val, 1, 0, 0))
goto _fail_;
  
  	c_val[0] = AUTO_PROT;

-   if (!wilc_wlan_cfg_set(0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
goto _fail_;
  
  	c_val[0] = ACTIVE_SCAN;

-   if (!wilc_wlan_cfg_set(0, WID_SCAN_TYPE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_SCAN_TYPE, c_val, 1, 0, 0))
goto _fail_;
  
  	c_val[0] = SITE_SURVEY_OFF;

-   if (!wilc_wlan_cfg_set(0, WID_SITE_SURVEY, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_SITE_SURVEY, c_val, 1, 0, 0))
goto _fail_;
  
  	*((int *)c_val) = 0x; /* Never use RTS-CTS */

-   if (!wilc_wlan_cfg_set(0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
goto _fail_;
  
  	*((int *)c_val) = 2346;

-   if (!wilc_wlan_cfg_set(0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
goto _fail_;
  
  	/*  SSID */

@@ -719,23 +719,23 @@ static int linux_wlan_init_test_config(struct net_device 
*dev, struct wilc *p_ni
/*  to enable Broadcast SSID suppport ) 
 */
/*  --  
 */
c_val[0] = 0;
-   if (!wilc_wlan_cfg_set(0, WID_BCAST_SSID, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_BCAST_SSID, c_val, 1, 0, 0))
goto _fail_;
  
  	c_val[0] = 1;

-   if (!wilc_wlan_cfg_set(0, WID_QOS_ENABLE, c_val, 1, 0, 0))
+   if (!w

[PATCH] staging/rdma/hfi1: set Gen3 half-swing for integrated devices

2015-11-04 Thread ira . weiny
From: Dean Luick 

Correctly set half-swing for integrated devices.  A0 needs all fields set for
CcePcieCtrl.  B0 and later only need a few fields set.

Reviewed-by: Stuart Summers 
Signed-off-by: Dean Luick 
Signed-off-by: Ira Weiny 
---
 drivers/staging/rdma/hfi1/chip_registers.h | 11 +
 drivers/staging/rdma/hfi1/pcie.c   | 74 --
 2 files changed, 81 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/chip_registers.h 
b/drivers/staging/rdma/hfi1/chip_registers.h
index bf45de29d8bd..d0deb2278635 100644
--- a/drivers/staging/rdma/hfi1/chip_registers.h
+++ b/drivers/staging/rdma/hfi1/chip_registers.h
@@ -549,6 +549,17 @@
 #define CCE_MSIX_TABLE_UPPER (CCE + 0x0018)
 #define CCE_MSIX_TABLE_UPPER_RESETCSR 0x0001ull
 #define CCE_MSIX_VEC_CLR_WITHOUT_INT (CCE + 0x00110400)
+#define CCE_PCIE_CTRL (CCE + 0x00C0)
+#define CCE_PCIE_CTRL_PCIE_LANE_BUNDLE_MASK 0x3ull
+#define CCE_PCIE_CTRL_PCIE_LANE_BUNDLE_SHIFT 0
+#define CCE_PCIE_CTRL_PCIE_LANE_DELAY_MASK 0xFull
+#define CCE_PCIE_CTRL_PCIE_LANE_DELAY_SHIFT 2
+#define CCE_PCIE_CTRL_XMT_MARGIN_OVERWRITE_ENABLE_SHIFT 8
+#define CCE_PCIE_CTRL_XMT_MARGIN_SHIFT 9
+#define CCE_PCIE_CTRL_XMT_MARGIN_GEN1_GEN2_OVERWRITE_ENABLE_MASK 0x1ull
+#define CCE_PCIE_CTRL_XMT_MARGIN_GEN1_GEN2_OVERWRITE_ENABLE_SHIFT 12
+#define CCE_PCIE_CTRL_XMT_MARGIN_GEN1_GEN2_MASK 0x7ull
+#define CCE_PCIE_CTRL_XMT_MARGIN_GEN1_GEN2_SHIFT 13
 #define CCE_REVISION (CCE + 0x)
 #define CCE_REVISION2 (CCE + 0x0008)
 #define CCE_REVISION2_HFI_ID_MASK 0x1ull
diff --git a/drivers/staging/rdma/hfi1/pcie.c b/drivers/staging/rdma/hfi1/pcie.c
index a956044459a2..000f28f4b501 100644
--- a/drivers/staging/rdma/hfi1/pcie.c
+++ b/drivers/staging/rdma/hfi1/pcie.c
@@ -864,6 +864,75 @@ static void arm_gasket_logic(struct hfi1_devdata *dd)
read_csr(dd, ASIC_PCIE_SD_HOST_CMD);
 }
 
+/* CcePcieCtrl long name helper */
+#define PC(field) (CCE_PCIE_CTRL_##field)
+
+ /*
+  * Write xmt_margin for full-swing (WFR-B) or half-swing (WFR-C).
+  */
+static void write_xmt_margin(struct hfi1_devdata *dd, const char *fname)
+{
+   u64 pcie_ctrl;
+   u64 xmt_margin;
+   u64 xmt_margin_oe;
+   u64 lane_delay;
+   u64 lane_bundle;
+
+   pcie_ctrl = read_csr(dd, CCE_PCIE_CTRL);
+
+   /*
+* For Discrete, use full-swing.
+*  - PCIe TX defaults to full-swing.
+*Leave this register as default.
+* For Integrated, use half-swing
+*  - Copy xmt_margin and xmt_margin_oe
+*from Gen1/Gen2 to Gen3.
+*/
+   if (dd->pcidev->device == PCI_DEVICE_ID_INTEL1) { /* integrated */
+   /* extract initial fields */
+   xmt_margin = (pcie_ctrl >> PC(XMT_MARGIN_GEN1_GEN2_SHIFT))
+   & PC(XMT_MARGIN_GEN1_GEN2_MASK);
+   xmt_margin_oe =
+   (pcie_ctrl
+ >> PC(XMT_MARGIN_GEN1_GEN2_OVERWRITE_ENABLE_SHIFT))
+   & PC(XMT_MARGIN_GEN1_GEN2_OVERWRITE_ENABLE_MASK);
+   lane_delay = (pcie_ctrl >> PC(PCIE_LANE_DELAY_SHIFT))
+   & PC(PCIE_LANE_DELAY_MASK);
+   lane_bundle = (pcie_ctrl >> PC(PCIE_LANE_BUNDLE_SHIFT))
+   & PC(PCIE_LANE_BUNDLE_MASK);
+
+   /*
+* For A0, EFUSE values are not set.  Override with the
+* correct values.
+*/
+   if (is_a0(dd)) {
+   /*
+* xmt_margin and OverwiteEnabel should be the
+* same for Gen1/Gen2 and Gen3
+*/
+   xmt_margin= 0x5;
+   xmt_margin_oe = 0x1;
+   lane_delay= 0xF; /* Delay 240ns. */
+   lane_bundle   = 0x0; /* Set to 1 lane. */
+   }
+
+   /* overwrite existing values */
+   pcie_ctrl = (xmt_margin << PC(XMT_MARGIN_GEN1_GEN2_SHIFT))
+   | (xmt_margin_oe <<
+   PC(XMT_MARGIN_GEN1_GEN2_OVERWRITE_ENABLE_SHIFT))
+   | (xmt_margin << PC(XMT_MARGIN_SHIFT))
+   | (xmt_margin_oe <<
+   PC(XMT_MARGIN_OVERWRITE_ENABLE_SHIFT))
+   | (lane_delay << PC(PCIE_LANE_DELAY_SHIFT))
+   | (lane_bundle << PC(PCIE_LANE_BUNDLE_SHIFT));
+
+   write_csr(dd, CCE_PCIE_CTRL, pcie_ctrl);
+   }
+
+   dd_dev_info(dd, "%s: program XMT margin, CcePcieCtrl 0x%llx\n",
+   fname, pcie_ctrl);
+}
+
 /*
  * Do all the steps needed to transition the PCIe link to Gen3 speed.
  */
@@ -1072,11 +1141,8 @@ retry:
 
/*
 * step 5d: program XMT margin
-* Right now, leave the default alone.  To change, do a
-* read-modify-write of:
-  

Re: [PATCH V2 04/17] staging: wilc1000: wilc_wlan_cfg_set: add argument struct net_device

2015-11-04 Thread Greg KH
On Thu, Nov 05, 2015 at 10:39:59AM +0900, glen lee wrote:
> >>+int wilc_wlan_cfg_set(struct net_device *dev, int start, u32 wid, u8 
> >>*buffer,
> >>+ u32 buffer_size, int commit, u32 drvHandler)
> >>  {
> >>wilc_wlan_dev_t *p = &g_wlan;
> >>u32 offset;
> >>int ret_size;
> >>+   perInterface_wlan_t *nic = netdev_priv(dev);
> >>+   struct wilc *wilc;
> >>+   wilc = nic->wilc;
> >Again here, pass in a struct wilc *.
> 
> Thank you for your advise,
> I can use local structure wilc as you said but there are print line inside 
> the function.
> The custom print lines will be changed with netdev_xxx format later, so I 
> need to pass dev if necessary.
> I used wilc if net_device is unnecessary or unavailable.
> For this reason, Is this OK to use net_device if it is necessary?

You have a pointer to net_device in struct wilc, right?  Use that
pointer when you need it, wilc is your "primary" thing, not struct
net_device, to pass around.  You should never have to cast back and
forth when calling internal functions like this.

thanks,

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


[PATCH 0/3] staging/rdma/hfi1: complete fixes for ECN detection

2015-11-04 Thread ira . weiny
From: Ira Weiny 

The following 3 patches fix the ECN detection and add a module parameter to
turn the prescan of the receive queue on and off.

Arthur Kepner (2):
  staging/rdma/hfi1: don't cache "prescan head"
  staging/rdma/hfi1: optionally prescan rx queue for {B,F}ECNs - UC, RC

Vennila Megavannan (1):
  staging/rdma/hfi1: Method to toggle "fast ECN" detection

 drivers/staging/rdma/hfi1/Kconfig  |  14 ++---
 drivers/staging/rdma/hfi1/driver.c | 101 +++--
 drivers/staging/rdma/hfi1/hfi.h|  13 -
 drivers/staging/rdma/hfi1/rc.c |  10 ++--
 drivers/staging/rdma/hfi1/uc.c |  15 +++---
 drivers/staging/rdma/hfi1/verbs.c  |  41 ---
 6 files changed, 108 insertions(+), 86 deletions(-)

-- 
1.8.2

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


[PATCH 3/3] staging/rdma/hfi1: Method to toggle "fast ECN" detection

2015-11-04 Thread ira . weiny
From: Vennila Megavannan 

Add a module paramter to toggle prescan/Fast ECN Detection.

In addition change the PRESCAN_RXQ Kconfig default to "yes".

Reviewed-by: Arthur Kepner
Reviewed-by: Mike Marciniszyn
Signed-off-by: Vennila Megavannan
Signed-off-by: Ira Weiny 
---
 drivers/staging/rdma/hfi1/Kconfig  | 14 +++---
 drivers/staging/rdma/hfi1/driver.c | 24 +---
 2 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/Kconfig 
b/drivers/staging/rdma/hfi1/Kconfig
index fd25078ee923..cfc9f9324b8d 100644
--- a/drivers/staging/rdma/hfi1/Kconfig
+++ b/drivers/staging/rdma/hfi1/Kconfig
@@ -26,12 +26,12 @@ config SDMA_VERBOSITY
This is a configuration flag to enable verbose
SDMA debug
 config PRESCAN_RXQ
-   bool "Enable prescanning of the RX queue for ECNs"
+   bool "Enable optional prescanning of the RX queue for ECNs"
depends on INFINIBAND_HFI1
-   default n
+   default y
---help---
-   This option toggles the prescanning of the receive queue for
-   Explicit Congestion Notifications. If an ECN is detected, it
-   is processed as quickly as possible, the ECN is toggled off.
-   After the prescanning step, the receive queue is processed as
-   usual.
+   This option enables code for the prescanning of the receive queue for
+   Explicit Congestion Notifications.  Pre-scanning can be controlled via a
+   module option at run time.  If an ECN is detected, it is processed as
+   quickly as possible, the ECN is toggled off.  After the prescanning
+   step, the receive queue is processed as usual.
diff --git a/drivers/staging/rdma/hfi1/driver.c 
b/drivers/staging/rdma/hfi1/driver.c
index 9a4ec09af020..4c1dd7130d7a 100644
--- a/drivers/staging/rdma/hfi1/driver.c
+++ b/drivers/staging/rdma/hfi1/driver.c
@@ -83,6 +83,14 @@ unsigned int hfi1_cu = 1;
 module_param_named(cu, hfi1_cu, uint, S_IRUGO);
 MODULE_PARM_DESC(cu, "Credit return units");
 
+#ifdef CONFIG_PRESCAN_RXQ
+static unsigned int prescan_rx_queue;
+module_param_named(prescan_rxq, prescan_rx_queue, uint,
+  S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(prescan_rxq,
+"Used to toggle rx prescan. Set to 1 to enable prescan");
+#endif /* CONFIG_PRESCAN_RXQ */
+
 unsigned long hfi1_cap_mask = HFI1_CAP_MASK_DEFAULT;
 static int hfi1_caps_set(const char *, const struct kernel_param *);
 static int hfi1_caps_get(char *, const struct kernel_param *);
@@ -435,10 +443,8 @@ static inline void init_packet(struct hfi1_ctxtdata *rcd,
 }
 
 #ifndef CONFIG_PRESCAN_RXQ
-static void prescan_rxq(struct hfi1_packet *packet) {}
+#define prescan_rxq(packet)
 #else /* !CONFIG_PRESCAN_RXQ */
-static int prescan_receive_queue;
-
 static void process_ecn(struct hfi1_qp *qp, struct hfi1_ib_header *hdr,
struct hfi1_other_headers *ohdr,
u64 rhf, u32 bth1, struct ib_grh *grh)
@@ -541,15 +547,19 @@ static inline void update_ps_mdata(struct ps_mdata *mdata)
  * containing Excplicit Congestion Notifications (FECNs, or BECNs).
  * When an ECN is found, process the Congestion Notification, and toggle
  * it off.
+ * This is declared as a macro to allow quick checking of the module param and
+ * avoid the overhead of a function call if not enabled.
  */
-static void prescan_rxq(struct hfi1_packet *packet)
+#define prescan_rxq(packet) \
+   do { \
+   if (prescan_rx_queue) \
+   __prescan_rxq(packet); \
+   } while (0)
+static void __prescan_rxq(struct hfi1_packet *packet)
 {
struct hfi1_ctxtdata *rcd = packet->rcd;
struct ps_mdata mdata;
 
-   if (!prescan_receive_queue)
-   return;
-
init_ps_mdata(&mdata, packet);
 
while (1) {
-- 
1.8.2

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


[PATCH 1/3] staging/rdma/hfi1: don't cache "prescan head"

2015-11-04 Thread ira . weiny
From: Arthur Kepner 

When HFI1_CAP_DMA_RTAIL is toggled off the "prescan head" can get out of sync
with the receive context's "head". This happens when, after prescan_rxq() newly
arrived packets are then received, and processed by an RX interrupt handler.
This is an unavoidable race, and to avoid getting out of sync we always start
prescanning at the current "rcd->head" entry.

Reviewed-by: Mike Marciniszyn 
Reviewed-by: Dennis Dalessandro 
Signed-off-by: Arthur Kepner 
Signed-off-by: Ira Weiny 
---
 drivers/staging/rdma/hfi1/driver.c | 13 +++--
 drivers/staging/rdma/hfi1/hfi.h| 13 -
 2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/driver.c 
b/drivers/staging/rdma/hfi1/driver.c
index ce69141b56cb..cfcbe417fde9 100644
--- a/drivers/staging/rdma/hfi1/driver.c
+++ b/drivers/staging/rdma/hfi1/driver.c
@@ -509,14 +509,10 @@ static inline void init_ps_mdata(struct ps_mdata *mdata,
mdata->rsize = packet->rsize;
mdata->maxcnt = packet->maxcnt;
 
-   if (rcd->ps_state.initialized == 0) {
-   mdata->ps_head = packet->rhqoff;
-   rcd->ps_state.initialized++;
-   } else
-   mdata->ps_head = rcd->ps_state.ps_head;
+   mdata->ps_head = packet->rhqoff;
 
if (HFI1_CAP_IS_KSET(DMA_RTAIL)) {
-   mdata->ps_tail = packet->hdrqtail;
+   mdata->ps_tail = get_rcvhdrtail(rcd);
mdata->ps_seq = 0; /* not used with DMA_RTAIL */
} else {
mdata->ps_tail = 0; /* used only with DMA_RTAIL*/
@@ -533,12 +529,9 @@ static inline int ps_done(struct ps_mdata *mdata, u64 rhf)
 
 static inline void update_ps_mdata(struct ps_mdata *mdata)
 {
-   struct hfi1_ctxtdata *rcd = mdata->rcd;
-
mdata->ps_head += mdata->rsize;
-   if (mdata->ps_head > mdata->maxcnt)
+   if (mdata->ps_head >= mdata->maxcnt)
mdata->ps_head = 0;
-   rcd->ps_state.ps_head = mdata->ps_head;
if (!HFI1_CAP_IS_KSET(DMA_RTAIL)) {
if (++mdata->ps_seq > 13)
mdata->ps_seq = 1;
diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h
index 190f7a2f6773..96135b813fba 100644
--- a/drivers/staging/rdma/hfi1/hfi.h
+++ b/drivers/staging/rdma/hfi1/hfi.h
@@ -139,15 +139,6 @@ extern const struct pci_error_handlers 
hfi1_pci_err_handler;
 struct hfi1_opcode_stats_perctx;
 #endif
 
-/*
- * struct ps_state keeps state associated with RX queue "prescanning"
- * (prescanning for FECNs, and BECNs), if prescanning is in use.
- */
-struct ps_state {
-   u32 ps_head;
-   int initialized;
-};
-
 struct ctxt_eager_bufs {
ssize_t size;/* total size of eager buffers */
u32 count;   /* size of buffers array */
@@ -302,10 +293,6 @@ struct hfi1_ctxtdata {
struct list_head sdma_queues;
spinlock_t sdma_qlock;
 
-#ifdef CONFIG_PRESCAN_RXQ
-   struct ps_state ps_state;
-#endif /* CONFIG_PRESCAN_RXQ */
-
/*
 * The interrupt handler for a particular receive context can vary
 * throughout it's lifetime. This is not a lock protected data member so
-- 
1.8.2

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


[PATCH 2/3] staging/rdma/hfi1: optionally prescan rx queue for {B, F}ECNs - UC, RC

2015-11-04 Thread ira . weiny
From: Arthur Kepner 

To more rapidly respond to Explicit Congestion Notifications, prescan the
receive queue, and process FECNs, and BECNs first.  When a UC, or RC packet
containing a FECN, or BECN is found, immediately react to the ECN (either by
returning a CNP, or adjusting the injection rate). Afterward, the packet will
be processed normally.

Reviewed-by: Mike Marciniszyn 
Reviewed-by: Dennis Dalessandro 
Signed-off-by: Arthur Kepner 
Signed-off-by: Ira Weiny 
---
 drivers/staging/rdma/hfi1/driver.c | 64 +++---
 drivers/staging/rdma/hfi1/rc.c | 10 +++---
 drivers/staging/rdma/hfi1/uc.c | 15 +
 drivers/staging/rdma/hfi1/verbs.c  | 41 
 4 files changed, 81 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/driver.c 
b/drivers/staging/rdma/hfi1/driver.c
index cfcbe417fde9..9a4ec09af020 100644
--- a/drivers/staging/rdma/hfi1/driver.c
+++ b/drivers/staging/rdma/hfi1/driver.c
@@ -436,59 +436,58 @@ static inline void init_packet(struct hfi1_ctxtdata *rcd,
 
 #ifndef CONFIG_PRESCAN_RXQ
 static void prescan_rxq(struct hfi1_packet *packet) {}
-#else /* CONFIG_PRESCAN_RXQ */
+#else /* !CONFIG_PRESCAN_RXQ */
 static int prescan_receive_queue;
 
 static void process_ecn(struct hfi1_qp *qp, struct hfi1_ib_header *hdr,
struct hfi1_other_headers *ohdr,
-   u64 rhf, struct ib_grh *grh)
+   u64 rhf, u32 bth1, struct ib_grh *grh)
 {
struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num);
-   u32 bth1;
+   u32 rqpn = 0;
+   u16 rlid;
u8 sc5, svc_type;
-   int is_fecn, is_becn;
 
switch (qp->ibqp.qp_type) {
+   case IB_QPT_SMI:
+   case IB_QPT_GSI:
case IB_QPT_UD:
+   rlid = be16_to_cpu(hdr->lrh[3]);
+   rqpn = be32_to_cpu(ohdr->u.ud.deth[1]) & HFI1_QPN_MASK;
svc_type = IB_CC_SVCTYPE_UD;
break;
-   case IB_QPT_UC: /* LATER */
-   case IB_QPT_RC: /* LATER */
+   case IB_QPT_UC:
+   rlid = qp->remote_ah_attr.dlid;
+   rqpn = qp->remote_qpn;
+   svc_type = IB_CC_SVCTYPE_UC;
+   break;
+   case IB_QPT_RC:
+   rlid = qp->remote_ah_attr.dlid;
+   rqpn = qp->remote_qpn;
+   svc_type = IB_CC_SVCTYPE_RC;
+   break;
default:
return;
}
 
-   is_fecn = (be32_to_cpu(ohdr->bth[1]) >> HFI1_FECN_SHIFT) &
-   HFI1_FECN_MASK;
-   is_becn = (be32_to_cpu(ohdr->bth[1]) >> HFI1_BECN_SHIFT) &
-   HFI1_BECN_MASK;
-
sc5 = (be16_to_cpu(hdr->lrh[0]) >> 12) & 0xf;
if (rhf_dc_info(rhf))
sc5 |= 0x10;
 
-   if (is_fecn) {
-   u32 src_qpn = be32_to_cpu(ohdr->u.ud.deth[1]) & HFI1_QPN_MASK;
+   if (bth1 & HFI1_FECN_SMASK) {
u16 pkey = (u16)be32_to_cpu(ohdr->bth[0]);
u16 dlid = be16_to_cpu(hdr->lrh[1]);
-   u16 slid = be16_to_cpu(hdr->lrh[3]);
 
-   return_cnp(ibp, qp, src_qpn, pkey, dlid, slid, sc5, grh);
+   return_cnp(ibp, qp, rqpn, pkey, dlid, rlid, sc5, grh);
}
 
-   if (is_becn) {
+   if (bth1 & HFI1_BECN_SMASK) {
struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
-   u32 lqpn =  be32_to_cpu(ohdr->bth[1]) & HFI1_QPN_MASK;
+   u32 lqpn = bth1 & HFI1_QPN_MASK;
u8 sl = ibp->sc_to_sl[sc5];
 
-   process_becn(ppd, sl, 0, lqpn, 0, svc_type);
+   process_becn(ppd, sl, rlid, lqpn, rqpn, svc_type);
}
-
-   /* turn off BECN, or FECN */
-   bth1 = be32_to_cpu(ohdr->bth[1]);
-   bth1 &= ~(HFI1_FECN_MASK << HFI1_FECN_SHIFT);
-   bth1 &= ~(HFI1_BECN_MASK << HFI1_BECN_SHIFT);
-   ohdr->bth[1] = cpu_to_be32(bth1);
 }
 
 struct ps_mdata {
@@ -508,7 +507,6 @@ static inline void init_ps_mdata(struct ps_mdata *mdata,
mdata->rcd = rcd;
mdata->rsize = packet->rsize;
mdata->maxcnt = packet->maxcnt;
-
mdata->ps_head = packet->rhqoff;
 
if (HFI1_CAP_IS_KSET(DMA_RTAIL)) {
@@ -564,7 +562,7 @@ static void prescan_rxq(struct hfi1_packet *packet)
struct hfi1_other_headers *ohdr;
struct ib_grh *grh = NULL;
u64 rhf = rhf_to_cpu(rhf_addr);
-   u32 etype = rhf_rcv_type(rhf), qpn;
+   u32 etype = rhf_rcv_type(rhf), qpn, bth1;
int is_ecn = 0;
u8 lnh;
 
@@ -586,15 +584,13 @@ static void prescan_rxq(struct hfi1_packet *packet)
} else
goto next; /* just in case */
 
-   is_ecn |= be32_to_cpu(ohdr->bth[1]) &
-   (HFI1_FECN_MASK << HFI1_FECN_SHIFT);
-   is_ecn |= be32_to_cpu(ohdr->bth[1]) &
-   (HFI1_BECN_MASK << HFI1_BECN_SHIFT);
+   b

Re: [PATCH RESEND 12/12] staging: wilc1000: add argument wilc and use it instead of g_linux_wlan

2015-11-04 Thread glen lee


On 2015년 11월 05일 05:41, Greg KH wrote:

On Thu, Oct 29, 2015 at 12:18:52PM +0900, Glen Lee wrote:

This patch adds new argument wilc to linux_sdio_cmd53 and linux_sdio_cmd52
, and use it instead of g_linux_wlan. Pass wilc to the functions as well.
The void type wilc will be changed with struct wilc when SDIO and SPI
modules are reworked.

Signed-off-by: Glen Lee 
---
  drivers/staging/wilc1000/linux_wlan_sdio.c |  8 ++--
  drivers/staging/wilc1000/linux_wlan_sdio.h |  4 +-
  drivers/staging/wilc1000/wilc_sdio.c   | 66 +++---
  drivers/staging/wilc1000/wilc_wlan_if.h|  4 +-
  4 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index bf05e22..8150d6f 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -53,9 +53,9 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
  }
  
  
-int linux_sdio_cmd52(sdio_cmd52_t *cmd)

+int linux_sdio_cmd52(void *wilc, sdio_cmd52_t *cmd)

Again, why a void *?  Please use the correct type, you know what it is,
that way you can get rid of horrid stuff like this:


  {
-   struct sdio_func *func = g_linux_wlan->wilc_sdio_func;
+   struct sdio_func *func = ((struct wilc*)wilc)->wilc_sdio_func;

All of those casts should not be needed.


I was planning to change this void type with struct wilc as I commented in 
changelog.
But as you pointed out, I will do this after fixing current SDIO modules.

Regards,
glen lee.



thanks,

greg k-h


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


Re: [PATCH RESEND 12/12] staging: wilc1000: add argument wilc and use it instead of g_linux_wlan

2015-11-04 Thread Greg KH
On Thu, Nov 05, 2015 at 11:22:47AM +0900, glen lee wrote:
> 
> On 2015년 11월 05일 05:41, Greg KH wrote:
> >On Thu, Oct 29, 2015 at 12:18:52PM +0900, Glen Lee wrote:
> >>This patch adds new argument wilc to linux_sdio_cmd53 and linux_sdio_cmd52
> >>, and use it instead of g_linux_wlan. Pass wilc to the functions as well.
> >>The void type wilc will be changed with struct wilc when SDIO and SPI
> >>modules are reworked.
> >>
> >>Signed-off-by: Glen Lee 
> >>---
> >>  drivers/staging/wilc1000/linux_wlan_sdio.c |  8 ++--
> >>  drivers/staging/wilc1000/linux_wlan_sdio.h |  4 +-
> >>  drivers/staging/wilc1000/wilc_sdio.c   | 66 
> >> +++---
> >>  drivers/staging/wilc1000/wilc_wlan_if.h|  4 +-
> >>  4 files changed, 41 insertions(+), 41 deletions(-)
> >>
> >>diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
> >>b/drivers/staging/wilc1000/linux_wlan_sdio.c
> >>index bf05e22..8150d6f 100644
> >>--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
> >>+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
> >>@@ -53,9 +53,9 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
> >>  }
> >>-int linux_sdio_cmd52(sdio_cmd52_t *cmd)
> >>+int linux_sdio_cmd52(void *wilc, sdio_cmd52_t *cmd)
> >Again, why a void *?  Please use the correct type, you know what it is,
> >that way you can get rid of horrid stuff like this:
> >
> >>  {
> >>-   struct sdio_func *func = g_linux_wlan->wilc_sdio_func;
> >>+   struct sdio_func *func = ((struct wilc*)wilc)->wilc_sdio_func;
> >All of those casts should not be needed.
> 
> I was planning to change this void type with struct wilc as I commented in 
> changelog.

Sorry, I missed that.  But you should still not do an intermediate step
that you know is wrong :)

> But as you pointed out, I will do this after fixing current SDIO modules.

That sounds reasonable, thanks.

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


[PATCH] staging/rdma/hfi1: Convert dd_dev_info() to hfi1_cdbg() in process startup

2015-11-04 Thread jubin . john
From: Sebastian Sanchez 

Replacing dd_dev_info() for hfi1_cdbg() to avoid generating syslog
output for every context that is open by PSM.

Reviewed-by: Mitko Haralanov 
Signed-off-by: Sebastian Sanchez 
Signed-off-by: Jubin John 
---
 drivers/staging/rdma/hfi1/file_ops.c |   10 +-
 drivers/staging/rdma/hfi1/init.c |   31 ++-
 drivers/staging/rdma/hfi1/pio.c  |   19 ++-
 3 files changed, 33 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/file_ops.c 
b/drivers/staging/rdma/hfi1/file_ops.c
index aae9826..fba5889 100644
--- a/drivers/staging/rdma/hfi1/file_ops.c
+++ b/drivers/staging/rdma/hfi1/file_ops.c
@@ -687,9 +687,9 @@ static int hfi1_file_mmap(struct file *fp, struct 
vm_area_struct *vma)
}
 
vma->vm_flags = flags;
-   dd_dev_info(dd,
-   "%s: %u:%u type:%u io/vf:%d/%d, addr:0x%llx, len:%lu(%lu), 
flags:0x%lx\n",
-   __func__, ctxt, subctxt, type, mapio, vmf, memaddr, memlen,
+   hfi1_cdbg(PROC,
+ "%u:%u type:%u io/vf:%d/%d, addr:0x%llx, len:%lu(%lu), 
flags:0x%lx\n",
+   ctxt, subctxt, type, mapio, vmf, memaddr, memlen,
vma->vm_end - vma->vm_start, vma->vm_flags);
pfn = (unsigned long)(memaddr >> PAGE_SHIFT);
if (vmf) {
@@ -1011,8 +1011,8 @@ static int allocate_ctxt(struct file *fp, struct 
hfi1_devdata *dd,
if (!uctxt->sc)
return -ENOMEM;
 
-   dbg("allocated send context %u(%u)\n", uctxt->sc->sw_index,
-   uctxt->sc->hw_context);
+   hfi1_cdbg(PROC, "allocated send context %u(%u)\n", uctxt->sc->sw_index,
+ uctxt->sc->hw_context);
ret = sc_enable(uctxt->sc);
if (ret)
return ret;
diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c
index 47a1202..2e1efa7 100644
--- a/drivers/staging/rdma/hfi1/init.c
+++ b/drivers/staging/rdma/hfi1/init.c
@@ -60,6 +60,7 @@
 #include "hfi.h"
 #include "device.h"
 #include "common.h"
+#include "trace.h"
 #include "mad.h"
 #include "sdma.h"
 #include "debugfs.h"
@@ -208,7 +209,7 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct 
hfi1_pportdata *ppd, u32 ctxt)
if (rcd) {
u32 rcvtids, max_entries;
 
-   dd_dev_info(dd, "%s: setting up context %u\n", __func__, ctxt);
+   hfi1_cdbg(PROC, "setting up context %u\n", ctxt);
 
INIT_LIST_HEAD(&rcd->qp_wait_list);
rcd->ppd = ppd;
@@ -279,8 +280,9 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct 
hfi1_pportdata *ppd, u32 ctxt)
   rcd->ctxt);
rcd->egrbufs.count = MAX_EAGER_ENTRIES;
}
-   dd_dev_info(dd, "ctxt%u: max Eager buffer RcvArray entries: 
%u\n",
-   rcd->ctxt, rcd->egrbufs.count);
+   hfi1_cdbg(PROC,
+ "ctxt%u: max Eager buffer RcvArray entries: %u\n",
+ rcd->ctxt, rcd->egrbufs.count);
 
/*
 * Allocate array that will hold the eager buffer accounting
@@ -308,8 +310,8 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct 
hfi1_pportdata *ppd, u32 ctxt)
 */
if (rcd->egrbufs.size < hfi1_max_mtu) {
rcd->egrbufs.size = __roundup_pow_of_two(hfi1_max_mtu);
-   dd_dev_info(dd,
-   "ctxt%u: eager bufs size too small. 
Adjusting to %zu\n",
+   hfi1_cdbg(PROC,
+ "ctxt%u: eager bufs size too small. Adjusting 
to %zu\n",
rcd->ctxt, rcd->egrbufs.size);
}
rcd->egrbufs.rcvtid_size = HFI1_MAX_EAGER_BUFFER_SIZE;
@@ -1660,9 +1662,11 @@ int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd)
rcd->egrbufs.numbufs = idx;
rcd->egrbufs.size = alloced_bytes;
 
-   dd_dev_info(dd, "ctxt%u: Alloced %u rcv tid entries @ %uKB, total 
%zuKB\n",
-   rcd->ctxt, rcd->egrbufs.alloced, rcd->egrbufs.rcvtid_size,
-   rcd->egrbufs.size);
+   hfi1_cdbg(PROC,
+ "ctxt%u: Alloced %u rcv tid entries @ %uKB, total %zuKB\n",
+ rcd->ctxt, rcd->egrbufs.alloced, rcd->egrbufs.rcvtid_size,
+ rcd->egrbufs.size);
+
 
/*
 * Set the contexts rcv array head update threshold to the closest
@@ -1683,13 +1687,14 @@ int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd)
rcd->expected_count = MAX_TID_PAIR_ENTRIES * 2;
 
rcd->expected_base = rcd->eager_base + egrtop;
-   dd_dev_info(dd, "ctxt%u: eager:%u, exp:%u, egrbase:%u, expbase:%u\n",
-   rcd->ctxt, rcd->egrbufs.alloced, rcd->expected_count,
-   rcd->eager_base, rcd->expected_base);
+   hfi1_cdbg(PROC, "ctxt%u: eager:%u, exp:%u, egrbase:%u,

[PATCH] staging/rdma/hfi1: Clear the QSFP reset that is asserted on FLR

2015-11-04 Thread jubin . john
From: Easwar Hariharan 

The FLR on driver load asserts the QSFP reset pin and the driver does
not deassert it after. This patch allows the external QSFP cable to exit
reset by writing 1 to all the QSFP pins.

Reviewed-by: Dean Luick 
Signed-off-by: Easwar Hariharan 
Signed-off-by: Jubin John 
---
 drivers/staging/rdma/hfi1/chip.c |   13 +
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c
index e489819..e309828 100644
--- a/drivers/staging/rdma/hfi1/chip.c
+++ b/drivers/staging/rdma/hfi1/chip.c
@@ -9929,19 +9929,16 @@ static void init_chip(struct hfi1_devdata *dd)
setextled(dd, 0);
/*
 * Clear the QSFP reset.
-* A0 leaves the out lines floating on power on, then on an FLR
-* enforces a 0 on all out pins.  The driver does not touch
+* An FLR enforces a 0 on all out pins. The driver does not touch
 * ASIC_QSFPn_OUT otherwise.  This leaves RESET_N low and
-* anything  plugged constantly in reset, if it pays attention
+* anything plugged constantly in reset, if it pays attention
 * to RESET_N.
-* A prime example of this is SiPh. For now, set all pins high.
+* Prime examples of this are optical cables. Set all pins high.
 * I2CCLK and I2CDAT will change per direction, and INT_N and
 * MODPRS_N are input only and their value is ignored.
 */
-   if (is_a0(dd)) {
-   write_csr(dd, ASIC_QSFP1_OUT, 0x1f);
-   write_csr(dd, ASIC_QSFP2_OUT, 0x1f);
-   }
+   write_csr(dd, ASIC_QSFP1_OUT, 0x1f);
+   write_csr(dd, ASIC_QSFP2_OUT, 0x1f);
 }
 
 static void init_early_variables(struct hfi1_devdata *dd)
-- 
1.7.1

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


[PATCH] staging/rdma/hfi1: Enable WFR PCIe extended tags from the driver

2015-11-04 Thread jubin . john
From: Vennila Megavannan 

Some BIOS implementations turn off extended tags in DevCtl (a RW
field) even though it was originally set and is advertised in DevCap
Fix is to set it in the driver

Reviewed-by: Dean Luick 
Reviewed-by: Mike Marciniszyn 
Reviewed-by: Ashutosh Dixit 
Signed-off-by: Vennila Megavannan 
Signed-off-by: Jubin John 
---
 drivers/staging/rdma/hfi1/pcie.c |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/pcie.c b/drivers/staging/rdma/hfi1/pcie.c
index a956044..430e95a 100644
--- a/drivers/staging/rdma/hfi1/pcie.c
+++ b/drivers/staging/rdma/hfi1/pcie.c
@@ -475,8 +475,18 @@ static void tune_pcie_caps(struct hfi1_devdata *dd)
 {
struct pci_dev *parent;
u16 rc_mpss, rc_mps, ep_mpss, ep_mps;
-   u16 rc_mrrs, ep_mrrs, max_mrrs;
+   u16 rc_mrrs, ep_mrrs, max_mrrs, ectl;
 
+   /*
+* Turn on extended tags in DevCtl in case the BIOS has turned it off
+* to improve WFR SDMA bandwidth
+*/
+   pcie_capability_read_word(dd->pcidev, PCI_EXP_DEVCTL, &ectl);
+   if (!(ectl & PCI_EXP_DEVCTL_EXT_TAG)) {
+   dd_dev_info(dd, "Enabling PCIe extended tags\n");
+   ectl |= PCI_EXP_DEVCTL_EXT_TAG;
+   pcie_capability_write_word(dd->pcidev, PCI_EXP_DEVCTL, ectl);
+   }
/* Find out supported and configured values for parent (root) */
parent = dd->pcidev->bus->self;
if (!pci_is_root_bus(parent->bus)) {
-- 
1.7.1

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


[PATCH] staging/rdma/hfi1: Always download SBus firmware

2015-11-04 Thread jubin . john
From: Dean Luick 

B0 dual port parts require the SBus firmware to always be
downloaded.

Remove reset of the SBus Master spico.  It is not necessary
since the SBus firmware download already does that.

Reviewed-by: Dennis Dalessandro 
Signed-off-by: Dean Luick 
Signed-off-by: Jubin John 
---
 drivers/staging/rdma/hfi1/firmware.c |2 +-
 drivers/staging/rdma/hfi1/pcie.c |   12 +---
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/firmware.c 
b/drivers/staging/rdma/hfi1/firmware.c
index b4bdcf3..f311282 100644
--- a/drivers/staging/rdma/hfi1/firmware.c
+++ b/drivers/staging/rdma/hfi1/firmware.c
@@ -1568,7 +1568,7 @@ int load_pcie_firmware(struct hfi1_devdata *dd)
/* both firmware loads below use the SBus */
set_sbus_fast_mode(dd);
 
-   if (fw_sbus_load && (dd->flags & HFI1_DO_INIT_ASIC)) {
+   if (fw_sbus_load) {
turn_off_spicos(dd, SPICO_SBUS);
ret = load_sbus_firmware(dd, &fw_sbus);
if (ret)
diff --git a/drivers/staging/rdma/hfi1/pcie.c b/drivers/staging/rdma/hfi1/pcie.c
index a956044..6f0eff7 100644
--- a/drivers/staging/rdma/hfi1/pcie.c
+++ b/drivers/staging/rdma/hfi1/pcie.c
@@ -947,17 +947,7 @@ int do_pcie_gen3_transition(struct hfi1_devdata *dd)
}
 
 retry:
-
-   if (therm) {
-   /*
-* toggle SPICO_ENABLE to get back to the state
-* just after the firmware load
-*/
-   sbus_request(dd, SBUS_MASTER_BROADCAST, 0x01,
-   WRITE_SBUS_RECEIVER, 0x0040);
-   sbus_request(dd, SBUS_MASTER_BROADCAST, 0x01,
-   WRITE_SBUS_RECEIVER, 0x0140);
-   }
+   /* the SBus download will reset the spico for thermal */
 
/* step 3: download SBus Master firmware */
/* step 4: download PCIe Gen3 SerDes firmware */
-- 
1.7.1

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


[PATCH] staging/rdma/hfi1: Disable thermal polling before sensor initialization

2015-11-04 Thread jubin . john
From: jareer.h.abdel-qader 

During driver load the thermal sensor needs to be reset prior
to initialization of the sensor. This prevents a possible sensor lock
up which can cause the wrong temperature value to be reported.
This fix leads to remove disabling thermal polling from
reset_asic_csrs() function.

Reviewed by: Dennis Dalessandro 
Reviewed by: Easwar Hariharan 
Signed-off-by: Jareer Abdel-Qader 
Signed-off-by: Ira Weiny 
Signed-off-by: Jubin John 
---
 drivers/staging/rdma/hfi1/chip.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c
index e489819..e1951f4 100644
--- a/drivers/staging/rdma/hfi1/chip.c
+++ b/drivers/staging/rdma/hfi1/chip.c
@@ -9455,7 +9455,7 @@ static void reset_asic_csrs(struct hfi1_devdata *dd)
/* We might want to retain this state across FLR if we ever use it */
write_csr(dd, ASIC_CFG_DRV_STR, 0);
 
-   write_csr(dd, ASIC_CFG_THERM_POLL_EN, 0);
+   /* ASIC_CFG_THERM_POLL_EN leave alone */
/* ASIC_STS_THERM read-only */
/* ASIC_CFG_RESET leave alone */
 
@@ -10803,7 +10803,9 @@ static int thermal_init(struct hfi1_devdata *dd)
 
acquire_hw_mutex(dd);
dd_dev_info(dd, "Initializing thermal sensor\n");
-
+   /* Disable polling of thermal readings */
+   write_csr(dd, ASIC_CFG_THERM_POLL_EN, 0x0);
+   msleep(100);
/* Thermal Sensor Initialization */
/*Step 1: Reset the Thermal SBus Receiver */
ret = sbus_request_slow(dd, SBUS_THERMAL, 0x0,
-- 
1.7.1

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


[PATCH RESEND 02/38] staging: wilc1000: rename firmwareIPAddress of fuction Handle_set_IPAddress

2015-11-04 Thread Glen Lee
From: Leo Kim 

This patch renames firmwareIPAddress of fuction Handle_set_IPAddress to
firmware_ip_addr to avoid CamelCase naming convention.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index b1d8b17..4ad0dd0 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -401,7 +401,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 
*ip_addr, u8 idx)
 {
s32 result = 0;
struct wid wid;
-   char firmwareIPAddress[4] = {0};
+   char firmware_ip_addr[4] = {0};
 
if (ip_addr[0] < 192)
ip_addr[0] = 0;
@@ -419,7 +419,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 
*ip_addr, u8 idx)
result = send_config_pkt(SET_CFG, &wid, 1,
 get_id_from_handler(hif_drv));
 
-   host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx);
+   host_int_get_ipaddress(hif_drv, firmware_ip_addr, idx);
 
if (result) {
PRINT_ER("Failed to set IP address\n");
-- 
1.9.1

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


[PATCH RESEND 03/38] staging: wilc1000: remove unused parameter of fuction Handle_get_IPAddress

2015-11-04 Thread Glen Lee
From: Leo Kim 

This patch removes parameter pu8IPAddr of fuction Handle_get_IPAddress because
it is not used in the function. Remove argument in the function call also.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 4ad0dd0..463b86f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -431,7 +431,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 
*ip_addr, u8 idx)
return result;
 }
 
-s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
+s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 idx)
 {
s32 result = 0;
struct wid wid;
@@ -2974,7 +2974,7 @@ static int hostIFthread(void *pvArg)
 
case HOST_IF_MSG_GET_IPADDRESS:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n");
-   Handle_get_IPAddress(msg.drv, msg.body.ip_info.ip_addr, 
msg.body.ip_info.idx);
+   Handle_get_IPAddress(msg.drv, msg.body.ip_info.idx);
break;
 
case HOST_IF_MSG_SET_MAC_ADDRESS:
-- 
1.9.1

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


[PATCH RESEND 07/38] staging: wilc1000: remove return type of Handle_wait_msg_q_empty

2015-11-04 Thread Glen Lee
From: Leo Kim 

This patch changes return type of Handle_wait_msg_q_empty from s32 with void
because return value is not used.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 9b986bb..8494a032 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -813,11 +813,10 @@ ERRORHANDLER:
return result;
 }
 
-static s32 Handle_wait_msg_q_empty(void)
+static void Handle_wait_msg_q_empty(void)
 {
g_wilc_initialized = 0;
up(&hif_sema_wait_response);
-   return 0;
 }
 
 static s32 Handle_Scan(struct host_if_drv *hif_drv,
-- 
1.9.1

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


[PATCH RESEND 05/38] staging: wilc1000: rename pstrHostIfGetMacAddress of fuction Handle_GetMacAddress

2015-11-04 Thread Glen Lee
From: Leo Kim 

This patch renames pstrHostIfGetMacAddress of fuction Handle_GetMacAddress
to get_mac_addr to avoid CamelCase naming convention.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 35e9460..06994fb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -496,14 +496,14 @@ static s32 Handle_SetMacAddress(struct host_if_drv 
*hif_drv,
 }
 
 static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv,
-   struct get_mac_addr *pstrHostIfGetMacAddress)
+   struct get_mac_addr *get_mac_addr)
 {
s32 result = 0;
struct wid wid;
 
wid.id = (u16)WID_MAC_ADDR;
wid.type = WID_STR;
-   wid.val = pstrHostIfGetMacAddress->mac_addr;
+   wid.val = get_mac_addr->mac_addr;
wid.size = ETH_ALEN;
 
result = send_config_pkt(GET_CFG, &wid, 1,
-- 
1.9.1

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


[PATCH RESEND 10/38] staging: wilc1000: linux_wlan: remove unused define CUSTOMER_PLATFORM

2015-11-04 Thread Glen Lee
From: Leo Kim 

This patch remove unused define CUSTOMER_PLATFORM from linux_wlan.c.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index d50f0d6..a9052ed 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -31,18 +31,11 @@
 #include "linux_wlan_spi.h"
 #endif
 
-#if defined(CUSTOMER_PLATFORM)
-/*
- TODO : Write power control functions as customer platform.
- */
-#else
-
  #define _linux_wlan_device_power_on() {}
  #define _linux_wlan_device_power_off(){}
 
  #define _linux_wlan_device_detection(){}
  #define _linux_wlan_device_removal()  {}
-#endif
 
 extern bool g_obtainingIP;
 extern void resolve_disconnect_aberration(void *drvHandler);
@@ -278,15 +271,7 @@ static int init_irq(struct net_device *dev)
/*GPIO request*/
if ((gpio_request(GPIO_NUM, "WILC_INTR") == 0) &&
(gpio_direction_input(GPIO_NUM) == 0)) {
-#if defined(CUSTOMER_PLATFORM)
-/*
- TODO : save the registerd irq number to the private wilc context in kernel.
- *
- * ex) nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
- */
-#else
wl->dev_irq_num = gpio_to_irq(GPIO_NUM);
-#endif
} else {
ret = -1;
PRINT_ER("could not obtain gpio for WILC_INTR\n");
-- 
1.9.1

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


[PATCH RESEND 04/38] staging: wilc1000: rename pstrHostIfSetMacAddress of fuction Handle_SetMacAddress

2015-11-04 Thread Glen Lee
From: Leo Kim 

This patch renames pstrHostIfSetMacAddress of fuction Handle_SetMacAddress
to set_mac_addr to avoid CamelCase naming convention.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 463b86f..35e9460 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -466,7 +466,7 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 
idx)
 }
 
 static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv,
-   struct set_mac_addr *pstrHostIfSetMacAddress)
+   struct set_mac_addr *set_mac_addr)
 {
s32 result = 0;
struct wid wid;
@@ -476,7 +476,7 @@ static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv,
PRINT_ER("No buffer to send mac address\n");
return -EFAULT;
}
-   memcpy(mac_buf, pstrHostIfSetMacAddress->mac_addr, ETH_ALEN);
+   memcpy(mac_buf, set_mac_addr->mac_addr, ETH_ALEN);
 
wid.id = (u16)WID_MAC_ADDR;
wid.type = WID_STR;
-- 
1.9.1

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


[PATCH RESEND 01/38] staging: wilc1000: rename pu8IPAddr of fuction Handle_set_IPAddress

2015-11-04 Thread Glen Lee
From: Leo Kim 

This patch renames pu8IPAddr of fuction Handle_set_IPAddress to ip_addr
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 17826f3..b1d8b17 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -397,22 +397,23 @@ static s32 Handle_SetOperationMode(struct host_if_drv 
*hif_drv,
return result;
 }
 
-s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
+s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx)
 {
s32 result = 0;
struct wid wid;
char firmwareIPAddress[4] = {0};
 
-   if (pu8IPAddr[0] < 192)
-   pu8IPAddr[0] = 0;
+   if (ip_addr[0] < 192)
+   ip_addr[0] = 0;
 
-   PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set  IP = %pI4\n", idx, 
pu8IPAddr);
+   PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set  IP = %pI4\n",
+  idx, ip_addr);
 
-   memcpy(set_ip[idx], pu8IPAddr, IP_ALEN);
+   memcpy(set_ip[idx], ip_addr, IP_ALEN);
 
wid.id = (u16)WID_IP_ADDRESS;
wid.type = WID_STR;
-   wid.val = (u8 *)pu8IPAddr;
+   wid.val = (u8 *)ip_addr;
wid.size = IP_ALEN;
 
result = send_config_pkt(SET_CFG, &wid, 1,
-- 
1.9.1

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


[PATCH RESEND 06/38] staging: wilc1000: rename strHostIFCfgParamAttr of fuction Handle_CfgParam

2015-11-04 Thread Glen Lee
From: Leo Kim 

This patch renames strHostIFCfgParamAttr of fuction Handle_CfgParam
to cfg_param_attr to avoid CamelCase naming convention.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 154 --
 1 file changed, 83 insertions(+), 71 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 06994fb..9b986bb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -519,7 +519,7 @@ static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv,
 }
 
 static s32 Handle_CfgParam(struct host_if_drv *hif_drv,
-  struct cfg_param_attr *strHostIFCfgParamAttr)
+  struct cfg_param_attr *cfg_param_attr)
 {
s32 result = 0;
struct wid strWIDList[32];
@@ -529,13 +529,13 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv,
 
PRINT_D(HOSTINF_DBG, "Setting CFG params\n");
 
-   if (strHostIFCfgParamAttr->cfg_attr_info.flag & BSS_TYPE) {
-   if (strHostIFCfgParamAttr->cfg_attr_info.bss_type < 6) {
+   if (cfg_param_attr->cfg_attr_info.flag & BSS_TYPE) {
+   if (cfg_param_attr->cfg_attr_info.bss_type < 6) {
strWIDList[u8WidCnt].id = WID_BSS_TYPE;
-   strWIDList[u8WidCnt].val = (s8 
*)&strHostIFCfgParamAttr->cfg_attr_info.bss_type;
+   strWIDList[u8WidCnt].val = (s8 
*)&cfg_param_attr->cfg_attr_info.bss_type;
strWIDList[u8WidCnt].type = WID_CHAR;
strWIDList[u8WidCnt].size = sizeof(char);
-   hif_drv->cfg_values.bss_type = 
(u8)strHostIFCfgParamAttr->cfg_attr_info.bss_type;
+   hif_drv->cfg_values.bss_type = 
(u8)cfg_param_attr->cfg_attr_info.bss_type;
} else {
PRINT_ER("check value 6 over\n");
result = -EINVAL;
@@ -543,13 +543,15 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv,
}
u8WidCnt++;
}
-   if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTH_TYPE) {
-   if ((strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 1 || 
(strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 2 || 
(strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 5) {
+   if (cfg_param_attr->cfg_attr_info.flag & AUTH_TYPE) {
+   if (cfg_param_attr->cfg_attr_info.auth_type == 1 ||
+   cfg_param_attr->cfg_attr_info.auth_type == 2 ||
+   cfg_param_attr->cfg_attr_info.auth_type == 5) {
strWIDList[u8WidCnt].id = WID_AUTH_TYPE;
-   strWIDList[u8WidCnt].val = (s8 
*)&strHostIFCfgParamAttr->cfg_attr_info.auth_type;
+   strWIDList[u8WidCnt].val = (s8 
*)&cfg_param_attr->cfg_attr_info.auth_type;
strWIDList[u8WidCnt].type = WID_CHAR;
strWIDList[u8WidCnt].size = sizeof(char);
-   hif_drv->cfg_values.auth_type = 
(u8)strHostIFCfgParamAttr->cfg_attr_info.auth_type;
+   hif_drv->cfg_values.auth_type = 
(u8)cfg_param_attr->cfg_attr_info.auth_type;
} else {
PRINT_ER("Impossible value \n");
result = -EINVAL;
@@ -557,13 +559,14 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv,
}
u8WidCnt++;
}
-   if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTHEN_TIMEOUT) {
-   if (strHostIFCfgParamAttr->cfg_attr_info.auth_timeout > 0 && 
strHostIFCfgParamAttr->cfg_attr_info.auth_timeout < 65536) {
+   if (cfg_param_attr->cfg_attr_info.flag & AUTHEN_TIMEOUT) {
+   if (cfg_param_attr->cfg_attr_info.auth_timeout > 0 &&
+   cfg_param_attr->cfg_attr_info.auth_timeout < 65536) {
strWIDList[u8WidCnt].id = WID_AUTH_TIMEOUT;
-   strWIDList[u8WidCnt].val = (s8 
*)&strHostIFCfgParamAttr->cfg_attr_info.auth_timeout;
+   strWIDList[u8WidCnt].val = (s8 
*)&cfg_param_attr->cfg_attr_info.auth_timeout;
strWIDList[u8WidCnt].type = WID_SHORT;
strWIDList[u8WidCnt].size = sizeof(u16);
-   hif_drv->cfg_values.auth_timeout = 
strHostIFCfgParamAttr->cfg_attr_info.auth_timeout;
+   hif_drv->cfg_values.auth_timeout = 
cfg_param_attr->cfg_attr_info.auth_timeout;
} else {
PRINT_ER("Range(1 ~ 65535) over\n");
result = -EINVAL;
@@ -571,13 +574,13 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv,
}
u8WidCnt++;
}
-   if (strHostIFCfgParamAttr->cfg_attr_info.flag & POWER_MANAGEMENT) {
-   if (strHostIFCfgParamAttr->cfg_attr_i

[PATCH RESEND 08/38] staging: wilc1000: rename gau8MulticastMacAddrList variable

2015-11-04 Thread Glen Lee
From: Leo Kim 

This patch renames gau8MulticastMacAddrList variable to multicast_mac_addr_list
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c |  5 +++--
 drivers/staging/wilc1000/linux_wlan.c | 11 ---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 8494a032..d0e4039 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -243,7 +243,7 @@ static struct semaphore hif_sema_wait_response;
 static struct semaphore hif_sema_deinit;
 static struct timer_list periodic_rssi;
 
-u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+u8 multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
 
 static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE];
 
@@ -2713,7 +2713,8 @@ static void Handle_SetMulticastFilter(struct host_if_drv 
*hif_drv,
*pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 24) & 0xFF);
 
if ((strHostIfSetMulti->cnt) > 0)
-   memcpy(pu8CurrByte, gau8MulticastMacAddrList, 
((strHostIfSetMulti->cnt) * ETH_ALEN));
+   memcpy(pu8CurrByte, multicast_mac_addr_list,
+  ((strHostIfSetMulti->cnt) * ETH_ALEN));
 
result = send_config_pkt(SET_CFG, &wid, 1,
 get_id_from_handler(hif_drv));
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 09ddba2..1e14e97 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -46,7 +46,7 @@
 
 extern bool g_obtainingIP;
 extern void resolve_disconnect_aberration(void *drvHandler);
-extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+extern u8 multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
 extern struct timer_list hDuringIpTimer;
 
 static int linux_wlan_device_power(int on_off)
@@ -1343,9 +1343,14 @@ static void wilc_set_multicast_list(struct net_device 
*dev)
/* Store all of the multicast addresses in the hardware filter */
netdev_for_each_mc_addr(ha, dev)
{
-   memcpy(gau8MulticastMacAddrList[i], ha->addr, ETH_ALEN);
+   memcpy(multicast_mac_addr_list[i], ha->addr, ETH_ALEN);
PRINT_D(INIT_DBG, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i,
-   gau8MulticastMacAddrList[i][0], 
gau8MulticastMacAddrList[i][1], gau8MulticastMacAddrList[i][2], 
gau8MulticastMacAddrList[i][3], gau8MulticastMacAddrList[i][4], 
gau8MulticastMacAddrList[i][5]);
+   multicast_mac_addr_list[i][0],
+   multicast_mac_addr_list[i][1],
+   multicast_mac_addr_list[i][2],
+   multicast_mac_addr_list[i][3],
+   multicast_mac_addr_list[i][4],
+   multicast_mac_addr_list[i][5]);
i++;
}
 
-- 
1.9.1

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


[PATCH RESEND 09/38] staging: wilc1000: replace explicit NULL comparisons with !

2015-11-04 Thread Glen Lee
From: Leo Kim 

This patch replace explicit NULL comparison with ! or unmark
operator to simplify code.
Reported by checkpatch.pl for comparison to NULL could be written "!XXX" or 
"XXX".

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 45 ++-
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 1e14e97..d50f0d6 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -136,7 +136,7 @@ static int dev_state_ev_handler(struct notifier_block 
*this, unsigned long event
u8 null_ip[4] = {0};
char wlan_dev_name[5] = "wlan0";
 
-   if (dev_iface == NULL || dev_iface->ifa_dev == NULL || 
dev_iface->ifa_dev->dev == NULL) {
+   if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev) {
PRINT_D(GENERIC_DBG, "dev_iface = NULL\n");
return NOTIFY_DONE;
}
@@ -147,18 +147,18 @@ static int dev_state_ev_handler(struct notifier_block 
*this, unsigned long event
}
 
dev  = (struct net_device *)dev_iface->ifa_dev->dev;
-   if (dev->ieee80211_ptr == NULL || dev->ieee80211_ptr->wiphy == NULL) {
+   if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) {
PRINT_D(GENERIC_DBG, "No Wireless registerd\n");
return NOTIFY_DONE;
}
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
-   if (priv == NULL) {
+   if (!priv) {
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
return NOTIFY_DONE;
}
pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
nic = netdev_priv(dev);
-   if (nic == NULL || pstrWFIDrv == NULL) {
+   if (!nic || !pstrWFIDrv) {
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
return NOTIFY_DONE;
}
@@ -339,7 +339,7 @@ int linux_wlan_lock_timeout(void *vp, u32 timeout)
int error = -1;
 
PRINT_D(LOCK_DBG, "Locking %p\n", vp);
-   if (vp != NULL)
+   if (vp)
error = down_timeout((struct semaphore *)vp, 
msecs_to_jiffies(timeout));
else
PRINT_ER("Failed, mutex is NULL\n");
@@ -538,12 +538,12 @@ int linux_wlan_get_firmware(struct net_device *dev)
firmware = P2P_CONCURRENCY_FIRMWARE;
}
 
-   if (nic == NULL) {
+   if (!nic) {
PRINT_ER("NIC is NULL\n");
goto _fail_;
}
 
-   if (&nic->wilc_netdev->dev == NULL) {
+   if (!(&nic->wilc_netdev->dev)) {
PRINT_ER("&nic->wilc_netdev->dev  is NULL\n");
goto _fail_;
}
@@ -925,7 +925,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
disable_sdio_interrupt();
mutex_unlock(&wl->hif_cs);
 #endif
-   if (&wl->txq_event != NULL)
+   if (&wl->txq_event)
up(&wl->txq_event);
 
PRINT_D(INIT_DBG, "Deinitializing Threads\n");
@@ -998,10 +998,10 @@ static int wlan_deinit_locks(struct net_device *dev)
 
PRINT_D(INIT_DBG, "De-Initializing Locks\n");
 
-   if (&wilc->hif_cs != NULL)
+   if (&wilc->hif_cs)
mutex_destroy(&wilc->hif_cs);
 
-   if (&wilc->rxq_cs != NULL)
+   if (&wilc->rxq_cs)
mutex_destroy(&wilc->rxq_cs);
 
return 0;
@@ -1074,10 +1074,10 @@ static void wlan_deinitialize_threads(struct net_device 
*dev)
wl->close = 1;
PRINT_D(INIT_DBG, "Deinitializing Threads\n");
 
-   if (&wl->txq_event != NULL)
+   if (&wl->txq_event)
up(&wl->txq_event);
 
-   if (wl->txq_thread != NULL) {
+   if (wl->txq_thread) {
kthread_stop(wl->txq_thread);
wl->txq_thread = NULL;
}
@@ -1396,7 +1396,7 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
}
 
tx_data = kmalloc(sizeof(struct tx_complete_data), GFP_ATOMIC);
-   if (tx_data == NULL) {
+   if (!tx_data) {
PRINT_ER("Failed to allocate memory for tx_data structure\n");
dev_kfree_skb(skb);
netif_wake_queue(ndev);
@@ -1450,7 +1450,8 @@ int mac_close(struct net_device *ndev)
 
nic = netdev_priv(ndev);
 
-   if ((nic == NULL) || (nic->wilc_netdev == NULL) || 
(nic->wilc_netdev->ieee80211_ptr == NULL) || 
(nic->wilc_netdev->ieee80211_ptr->wiphy == NULL)) {
+   if (!nic || !nic->wilc_netdev || !nic->wilc_netdev->ieee80211_ptr ||
+   !nic->wilc_netdev->ieee80211_ptr->wiphy) {
PRINT_ER("nic = NULL\n");
return 0;
}
@@ -1458,7 +1459,7 @@ int mac_close(struct net_device *ndev)
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
wl = nic->wilc;
 
-   if (priv == NULL) {
+   if (!priv) {
PRINT_ER("priv = NUL

  1   2   >