Re: [PATCH]staging:iio:ad2s1200 fix missing parenthesis in a for statment.

2014-04-26 Thread Jonathan Cameron

On 25/04/14 03:52, Jimmy Li wrote:

Signed-off-by: Jimmy Li 


Applied to the fixes-togreg branch of iio.git

Thanks,

---
  drivers/staging/iio/resolver/ad2s1200.c |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c 
b/drivers/staging/iio/resolver/ad2s1200.c
index e2b4820..017d2f8 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -107,7 +107,7 @@ static int ad2s1200_probe(struct spi_device *spi)
int pn, ret = 0;
unsigned short *pins = spi->dev.platform_data;

-   for (pn = 0; pn < AD2S1200_PN; pn++)
+   for (pn = 0; pn < AD2S1200_PN; pn++) {
ret = devm_gpio_request_one(&spi->dev, pins[pn], GPIOF_DIR_OUT,
DRV_NAME);
if (ret) {
@@ -115,6 +115,7 @@ static int ad2s1200_probe(struct spi_device *spi)
pins[pn]);
return ret;
}
+   }
indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
if (!indio_dev)
return -ENOMEM;



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


[PATCH] staging: cxt1e1: Avoid using 0 instead of NULL

2014-04-26 Thread Thomas Vegas
Fixed the following sparse warnings:

drivers/staging/cxt1e1/hwprobe.c:162:38:
warning: Using plain integer as NULL pointer
drivers/staging/cxt1e1/hwprobe.c:163:38:
warning: Using plain integer as NULL pointer
drivers/staging/cxt1e1/hwprobe.c:179:46:
warning: Using plain integer as NULL pointer
drivers/staging/cxt1e1/hwprobe.c:184:46:
warning: Using plain integer as NULL pointer

Signed-off-by: Thomas Vegas 
---
 drivers/staging/cxt1e1/hwprobe.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/cxt1e1/hwprobe.c b/drivers/staging/cxt1e1/hwprobe.c
index cc2151e..4fa27c8 100644
--- a/drivers/staging/cxt1e1/hwprobe.c
+++ b/drivers/staging/cxt1e1/hwprobe.c
@@ -159,8 +159,8 @@ prep_hdw_info(void)
hi->ndev = NULL;
hi->addr[0] = 0L;
hi->addr[1] = 0L;
-   hi->addr_mapped[0] = 0L;
-   hi->addr_mapped[1] = 0L;
+   hi->addr_mapped[0] = NULL;
+   hi->addr_mapped[1] = NULL;
}
 }
 
@@ -176,12 +176,12 @@ cleanup_ioremap(void)
if (hi->addr_mapped[0]) {
iounmap(hi->addr_mapped[0]);
release_mem_region((long) hi->addr[0], hi->len[0]);
-   hi->addr_mapped[0] = 0;
+   hi->addr_mapped[0] = NULL;
}
if (hi->addr_mapped[1]) {
iounmap(hi->addr_mapped[1]);
release_mem_region((long) hi->addr[1], hi->len[1]);
-   hi->addr_mapped[1] = 0;
+   hi->addr_mapped[1] = NULL;
}
}
 }
-- 
1.8.3.2

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


[PATCH] staging: comedi: remove duplicate pointer assignments in attach functions

2014-04-26 Thread Christian Engelmayer
Some board pointer are assigned twice via comedi_board() in the comedi low
level driver attach functions. Remove the duplicate assignment from the
variable definition where the pointer is not used anyway until assigned later
in the function when dev->board_ptr, that comedi_board() relies on, is setup
correctly.

Signed-off-by: Christian Engelmayer 
---
Compile tested and applies against v3.15-rc2 as well as branch staging-next
of tree git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
---
 drivers/staging/comedi/drivers/das1800.c | 2 +-
 drivers/staging/comedi/drivers/das800.c  | 2 +-
 drivers/staging/comedi/drivers/dt2801.c  | 2 +-
 drivers/staging/comedi/drivers/ni_at_a2150.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index d581029..0335a70 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1479,7 +1479,7 @@ static int das1800_probe(struct comedi_device *dev)
 static int das1800_attach(struct comedi_device *dev,
  struct comedi_devconfig *it)
 {
-   const struct das1800_board *thisboard = comedi_board(dev);
+   const struct das1800_board *thisboard;
struct das1800_private *devpriv;
struct comedi_subdevice *s;
unsigned int irq = it->options[1];
diff --git a/drivers/staging/comedi/drivers/das800.c 
b/drivers/staging/comedi/drivers/das800.c
index b23a12c..e2dc43d 100644
--- a/drivers/staging/comedi/drivers/das800.c
+++ b/drivers/staging/comedi/drivers/das800.c
@@ -683,7 +683,7 @@ static int das800_probe(struct comedi_device *dev)
 
 static int das800_attach(struct comedi_device *dev, struct comedi_devconfig 
*it)
 {
-   const struct das800_board *thisboard = comedi_board(dev);
+   const struct das800_board *thisboard;
struct das800_private *devpriv;
struct comedi_subdevice *s;
unsigned int irq = it->options[1];
diff --git a/drivers/staging/comedi/drivers/dt2801.c 
b/drivers/staging/comedi/drivers/dt2801.c
index d4d4e4b..4263014 100644
--- a/drivers/staging/comedi/drivers/dt2801.c
+++ b/drivers/staging/comedi/drivers/dt2801.c
@@ -545,7 +545,7 @@ static int dt2801_dio_insn_config(struct comedi_device *dev,
 */
 static int dt2801_attach(struct comedi_device *dev, struct comedi_devconfig 
*it)
 {
-   const struct dt2801_board *board = comedi_board(dev);
+   const struct dt2801_board *board;
struct dt2801_private *devpriv;
struct comedi_subdevice *s;
int board_code, type;
diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c 
b/drivers/staging/comedi/drivers/ni_at_a2150.c
index afbf251..fefd97e 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -695,7 +695,7 @@ static int a2150_probe(struct comedi_device *dev)
 
 static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
-   const struct a2150_board *thisboard = comedi_board(dev);
+   const struct a2150_board *thisboard;
struct a2150_private *devpriv;
struct comedi_subdevice *s;
unsigned int irq = it->options[1];
-- 
1.9.1


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


[PATCH/V2] staging: rtl8192e: Fix typo in rtl8192e

2014-04-26 Thread Masanari Iida
Fix spelling typo in comments within rtl8192e.

Signed-off-by: Masanari Iida 
Reviewed-by: James Cameron 

---
 drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c | 2 +-
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c| 2 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c| 2 +-
 drivers/staging/rtl8192e/rtl819x_TSProc.c | 2 +-
 drivers/staging/rtl8192e/rtllib_rx.c  | 2 +-
 drivers/staging/rtl8192e/rtllib_softmac.c | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c 
b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
index 5f10e40..79d86b9 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
@@ -373,7 +373,7 @@ u32 cmpk_message_handle_rx(struct net_device *dev,
default:
 
RT_TRACE(COMP_CMDPKT, ">cmpk_message_handle_rx():"
-"unknow CMD Element\n");
+"unknown CMD Element\n");
return 1;
}
 
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c 
b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index 5d6d304..b4bfafe 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -1555,7 +1555,7 @@ static bool SetRFPowerState8190(struct net_device *dev,
 
default:
bResult = false;
-   RT_TRACE(COMP_ERR, "SetRFPowerState8190(): unknow state"
+   RT_TRACE(COMP_ERR, "SetRFPowerState8190(): unknown 
state"
 " to set: 0x%X!!!\n", eRFPowerState);
break;
}
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c 
b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 498995d..091dfe7 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -1213,7 +1213,7 @@ static iw_handler r8192_wx_handlers[] = {
 };
 
 /*
- * the following rule need to be follwing,
+ * the followed rules need to be following,
  * Odd : get (world access),
  * even : set (root access)
  * */
diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c 
b/drivers/staging/rtl8192e/rtl819x_TSProc.c
index 29608e5..52b2977 100644
--- a/drivers/staging/rtl8192e/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c
@@ -79,7 +79,7 @@ static void RxPktPendingTimeout(unsigned long data)
 
if (index > REORDER_WIN_SIZE) {
RTLLIB_DEBUG(RTLLIB_DL_ERR, "RxReorderIndicatePacket():"
-" Rx Reorer struct buffer full!!\n");
+" Rx Reorder struct buffer full!!\n");
spin_unlock_irqrestore(&(ieee->reorder_spinlock),
   flags);
return;
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c 
b/drivers/staging/rtl8192e/rtllib_rx.c
index 6c8a8e1..7413816 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -712,7 +712,7 @@ static void RxReorderIndicatePacket(struct rtllib_device 
*ieee,
 
if (index > REORDER_WIN_SIZE) {
RTLLIB_DEBUG(RTLLIB_DL_ERR, "RxReorderIndicatePacket():"
-" Rx Reorer struct buffer full!!\n");
+" Rx Reorder struct buffer full!!\n");
spin_unlock_irqrestore(&(ieee->reorder_spinlock),
   flags);
return;
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c 
b/drivers/staging/rtl8192e/rtllib_softmac.c
index 4bf72bc..d65cba4 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -543,7 +543,7 @@ void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, 
u8 is_mesh)
goto out; /* scan completed */
} while (!ieee->active_channel_map[ch]);
 
-   /* this fuction can be called in two situations
+   /* this function can be called in two situations
 * 1- We have switched to ad-hoc mode and we are
 *performing a complete syncro scan before conclude
 *there are no interesting cell and to create a
-- 
2.0.0.rc1

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


[PATCH] staging: dgnc: redundant NULL checks before kfree()

2014-04-26 Thread Vitaly Osipov
Removed redundant NULL checks before calling kfree()

Signed-off-by: Vitaly Osipov 
---
 drivers/staging/dgnc/dgnc_driver.c |   13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index b1a39b2..e2c8fc7 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -451,20 +451,15 @@ static void dgnc_cleanup_board(struct dgnc_board *brd)
/* Free all allocated channels structs */
for (i = 0; i < MAXPORTS ; i++) {
if (brd->channels[i]) {
-   if (brd->channels[i]->ch_rqueue)
-   kfree(brd->channels[i]->ch_rqueue);
-   if (brd->channels[i]->ch_equeue)
-   kfree(brd->channels[i]->ch_equeue);
-   if (brd->channels[i]->ch_wqueue)
-   kfree(brd->channels[i]->ch_wqueue);
-
+   kfree(brd->channels[i]->ch_rqueue);
+   kfree(brd->channels[i]->ch_equeue);
+   kfree(brd->channels[i]->ch_wqueue);
kfree(brd->channels[i]);
brd->channels[i] = NULL;
}
}
 
-   if (brd->flipbuf)
-   kfree(brd->flipbuf);
+   kfree(brd->flipbuf);
 
dgnc_Board[brd->boardnum] = NULL;
 
-- 
1.7.9.5

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


[PATCH] staging: lustre: return -EFAULT instead of bytes remaining

2014-04-26 Thread Vitaly Osipov
return -EFAULT instead of the value returned by copy_from_user()

Signed-off-by: Vitaly Osipov 
---
 .../lustre/lustre/libcfs/linux/linux-module.c  |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
index e6eae06..9777d1c 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
@@ -44,14 +44,12 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg)
 {
struct libcfs_ioctl_hdr   *hdr;
struct libcfs_ioctl_data  *data;
-   int err;
 
hdr = (struct libcfs_ioctl_hdr *)buf;
data = (struct libcfs_ioctl_data *)buf;
 
-   err = copy_from_user(buf, (void *)arg, sizeof(*hdr));
-   if (err)
-   return err;
+   if (copy_from_user(buf, (void *)arg, sizeof(*hdr)))
+   return -EFAULT;
 
if (hdr->ioc_version != LIBCFS_IOCTL_VERSION) {
CERROR("PORTALS: version mismatch kernel vs application\n");
@@ -69,9 +67,8 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg)
return -EINVAL;
}
 
-   err = copy_from_user(buf, (void *)arg, hdr->ioc_len);
-   if (err)
-   return err;
+   if (copy_from_user(buf, (void *)arg, hdr->ioc_len))
+   return -EFAULT;
 
if (libcfs_ioctl_is_invalid(data)) {
CERROR("PORTALS: ioctl not correctly formatted\n");
-- 
1.7.9.5

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


[PATCH] staging: lustre: check for integer overflow

2014-04-26 Thread Vitaly Osipov
In ll_ioctl_fiemap(), a user-supplied value is used to calculate a
length of a buffer which is later allocated with user data.

Signed-off-by: Vitaly Osipov 
---
 drivers/staging/lustre/lustre/llite/file.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 3efda25..e923978 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -1745,6 +1745,10 @@ static int ll_ioctl_fiemap(struct inode *inode, unsigned 
long arg)
if (get_user(extent_count,
&((struct ll_user_fiemap __user *)arg)->fm_extent_count))
return -EFAULT;
+
+   if (extent_count >=
+   (SIZE_MAX - sizeof(*fiemap_s)) / sizeof(struct ll_fiemap_extent))
+   return -EINVAL;
num_bytes = sizeof(*fiemap_s) + (extent_count *
 sizeof(struct ll_fiemap_extent));
 
-- 
1.7.9.5

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


[PATCH next-20140424] staging/cxt1e1: hwprobe.c sparse warning corrections

2014-04-26 Thread Sami Laine
From: Sami Laine 

Sparse warning corrections:
 - declarations made static where they should be such
 - changed NULL-pointers as NULL instead of static 0's
 - added __force to a few casts seemingly safe enough

Signed-off-by: Sami Laine 
---
diff --git a/drivers/staging/cxt1e1/hwprobe.c b/drivers/staging/cxt1e1/hwprobe.c
index cc2151e..d1c0493 100644
--- a/drivers/staging/cxt1e1/hwprobe.c
+++ b/drivers/staging/cxt1e1/hwprobe.c
@@ -40,10 +40,10 @@ struct net_device * __init c4_add_dev(hdw_info_t *, int, 
unsigned long,
  unsigned long, int, int);
 
 
-struct s_hdw_info hdw_info[MAX_BOARDS];
+static struct s_hdw_info hdw_info[MAX_BOARDS];
 
 
-void __init
+static void __init
 show_two(hdw_info_t *hi, int brdno)
 {
ci_t   *ci;
@@ -88,13 +88,13 @@ show_two(hdw_info_t *hi, int brdno)
 }
 
 
-void __init
+static void __init
 hdw_sn_get(hdw_info_t *hi, int brdno)
 {
/* obtain hardware EEPROM information */
-   longaddr;
+   long addr;
 
-   addr = (long) hi->addr_mapped[1] + EEPROM_OFFSET;
+   addr = (long __force)hi->addr_mapped[1] + EEPROM_OFFSET;
 
/* read EEPROM with largest known format size... */
pmc_eeprom_read_buffer(addr, 0, (char *)hi->mfg_info.data,
@@ -145,7 +145,7 @@ hdw_sn_get(hdw_info_t *hi, int brdno)
 }
 
 
-   void __init
+static void __init
 prep_hdw_info(void)
 {
hdw_info_t *hi;
@@ -159,12 +159,12 @@ prep_hdw_info(void)
hi->ndev = NULL;
hi->addr[0] = 0L;
hi->addr[1] = 0L;
-   hi->addr_mapped[0] = 0L;
-   hi->addr_mapped[1] = 0L;
+   hi->addr_mapped[0] = NULL;
+   hi->addr_mapped[1] = NULL;
}
 }
 
-void
+static void
 cleanup_ioremap(void)
 {
hdw_info_t *hi;
@@ -176,18 +176,18 @@ cleanup_ioremap(void)
if (hi->addr_mapped[0]) {
iounmap(hi->addr_mapped[0]);
release_mem_region((long) hi->addr[0], hi->len[0]);
-   hi->addr_mapped[0] = 0;
+   hi->addr_mapped[0] = NULL;
}
if (hi->addr_mapped[1]) {
iounmap(hi->addr_mapped[1]);
release_mem_region((long) hi->addr[1], hi->len[1]);
-   hi->addr_mapped[1] = 0;
+   hi->addr_mapped[1] = NULL;
}
}
 }
 
 
-void
+static void
 cleanup_devs(void)
 {
hdw_info_t *hi;
@@ -287,7 +287,7 @@ c4_hdw_init(struct pci_dev *pdev, int found)
return 1;
 }
 
-status_t __init
+static status_t __init
 c4hw_attach_all(void)
 {
hdw_info_t *hi;
@@ -361,10 +361,11 @@ c4hw_attach_all(void)
}
pci_set_master(hi->pdev[0]);
pci_set_master(hi->pdev[1]);
-   hi->ndev = c4_add_dev(hi, i, (long) hi->addr_mapped[0],
- (long) hi->addr_mapped[1],
- hi->pdev[0]->irq,
- hi->pdev[1]->irq);
+   hi->ndev = c4_add_dev(hi, i,
+   (unsigned long __force) hi->addr_mapped[0],
+   (unsigned long __force) hi->addr_mapped[1],
+   hi->pdev[0]->irq,
+   hi->pdev[1]->irq);
if (!hi->ndev) {
drvr_state = SBE_DRVR_DOWN;
cleanup_ioremap();
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH next-20140424] staging/cxt1e1: hwprobe.c sparse warning corrections

2014-04-26 Thread Greg KH
On Sat, Apr 26, 2014 at 06:30:33PM +0300, Sami Laine wrote:
> From: Sami Laine 
> 
> Sparse warning corrections:
>  - declarations made static where they should be such
>  - changed NULL-pointers as NULL instead of static 0's
>  - added __force to a few casts seemingly safe enough

You did 3 different things here, can you split this up into 3 different
patches?  Especially as someone already sent in the NULL pointer
patch...

thanks,

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


[PATCH next-20140424] staging/cxt1e1: sparse warning corrections

2014-04-26 Thread Sami Laine
From: Sami Laine 

Corrected sparse static declaration warnings.

Signed-off-by: Sami Laine 
---
diff --git a/drivers/staging/cxt1e1/hwprobe.c b/drivers/staging/cxt1e1/hwprobe.c
index cc2151e..2899258 100644
--- a/drivers/staging/cxt1e1/hwprobe.c
+++ b/drivers/staging/cxt1e1/hwprobe.c
@@ -40,10 +40,10 @@ struct net_device * __init c4_add_dev(hdw_info_t *, int, 
unsigned long,
  unsigned long, int, int);
 
 
-struct s_hdw_info hdw_info[MAX_BOARDS];
+static struct s_hdw_info hdw_info[MAX_BOARDS];
 
 
-void __init
+static void __init
 show_two(hdw_info_t *hi, int brdno)
 {
ci_t   *ci;
@@ -88,7 +88,7 @@ show_two(hdw_info_t *hi, int brdno)
 }
 
 
-void __init
+static void __init
 hdw_sn_get(hdw_info_t *hi, int brdno)
 {
/* obtain hardware EEPROM information */
@@ -145,7 +145,7 @@ hdw_sn_get(hdw_info_t *hi, int brdno)
 }
 
 
-   void __init
+static void __init
 prep_hdw_info(void)
 {
hdw_info_t *hi;
@@ -164,7 +164,7 @@ prep_hdw_info(void)
}
 }
 
-void
+static void
 cleanup_ioremap(void)
 {
hdw_info_t *hi;
@@ -187,7 +187,7 @@ cleanup_ioremap(void)
 }
 
 
-void
+static void
 cleanup_devs(void)
 {
hdw_info_t *hi;
@@ -287,7 +287,7 @@ c4_hdw_init(struct pci_dev *pdev, int found)
return 1;
 }
 
-status_t __init
+static status_t __init
 c4hw_attach_all(void)
 {
hdw_info_t *hi;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: comedi: remove duplicate pointer assignments in attach functions

2014-04-26 Thread Ian Abbott

On 26/04/14 15:04, Christian Engelmayer wrote:

Some board pointer are assigned twice via comedi_board() in the comedi low
level driver attach functions. Remove the duplicate assignment from the
variable definition where the pointer is not used anyway until assigned later
in the function when dev->board_ptr, that comedi_board() relies on, is setup
correctly.

Signed-off-by: Christian Engelmayer 
---
Compile tested and applies against v3.15-rc2 as well as branch staging-next
of tree git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git


Looks good!

Reviewed-by: Ian Abbott 

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


[PATCH] staging: rtl8188eu: Use USB subsystem functions to check endpoint type

2014-04-26 Thread navin patidar
Use inline functions provided by USB subsystem to check endpoint type,
instead of macros implemented by driver to do the same.

Unnecessary debugging messages are also removed.

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c |   92 ---
 1 file changed, 14 insertions(+), 78 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index 49a4ce4..2960602 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -80,46 +80,6 @@ static struct rtw_usb_drv rtl8188e_usb_drv = {
 
 static struct rtw_usb_drv *usb_drv = &rtl8188e_usb_drv;
 
-static inline int RT_usb_endpoint_dir_in(const struct usb_endpoint_descriptor 
*epd)
-{
-   return (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN;
-}
-
-static inline int RT_usb_endpoint_dir_out(const struct usb_endpoint_descriptor 
*epd)
-{
-   return (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT;
-}
-
-static inline int RT_usb_endpoint_xfer_int(const struct 
usb_endpoint_descriptor *epd)
-{
-   return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 
USB_ENDPOINT_XFER_INT;
-}
-
-static inline int RT_usb_endpoint_xfer_bulk(const struct 
usb_endpoint_descriptor *epd)
-{
-   return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 
USB_ENDPOINT_XFER_BULK;
-}
-
-static inline int RT_usb_endpoint_is_bulk_in(const struct 
usb_endpoint_descriptor *epd)
-{
-   return RT_usb_endpoint_xfer_bulk(epd) && RT_usb_endpoint_dir_in(epd);
-}
-
-static inline int RT_usb_endpoint_is_bulk_out(const struct 
usb_endpoint_descriptor *epd)
-{
-   return RT_usb_endpoint_xfer_bulk(epd) && RT_usb_endpoint_dir_out(epd);
-}
-
-static inline int usb_endpoint_is_int(const struct usb_endpoint_descriptor 
*epd)
-{
-   return RT_usb_endpoint_xfer_int(epd) && RT_usb_endpoint_dir_in(epd);
-}
-
-static inline int RT_usb_endpoint_num(const struct usb_endpoint_descriptor 
*epd)
-{
-   return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
-}
-
 static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj)
 {
u8 rst = _SUCCESS;
@@ -183,60 +143,36 @@ static struct dvobj_priv *usb_dvobj_init(struct 
usb_interface *usb_intf)
pdvobjpriv->nr_endpoint = piface_desc->bNumEndpoints;
 
for (i = 0; i < pdvobjpriv->nr_endpoint; i++) {
+
+   int ep_num;
phost_endp = phost_iface->endpoint + i;
+
if (phost_endp) {
pendp_desc = &phost_endp->desc;
+   ep_num = usb_endpoint_num(pendp_desc);
 
-   DBG_88E("\nusb_endpoint_descriptor(%d):\n", i);
-   DBG_88E("bLength=%x\n", pendp_desc->bLength);
-   DBG_88E("bDescriptorType=%x\n",
-   pendp_desc->bDescriptorType);
-   DBG_88E("bEndpointAddress=%x\n",
-   pendp_desc->bEndpointAddress);
-   DBG_88E("wMaxPacketSize=%d\n",
-   le16_to_cpu(pendp_desc->wMaxPacketSize));
-   DBG_88E("bInterval=%x\n", pendp_desc->bInterval);
-
-   if (RT_usb_endpoint_is_bulk_in(pendp_desc)) {
-   DBG_88E("RT_usb_endpoint_is_bulk_in = %x\n",
-   RT_usb_endpoint_num(pendp_desc));
-   pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] 
= RT_usb_endpoint_num(pendp_desc);
+   if (usb_endpoint_is_bulk_in(pendp_desc)) {
+   pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] 
= ep_num;
pdvobjpriv->RtNumInPipes++;
-   } else if (usb_endpoint_is_int(pendp_desc)) {
-   DBG_88E("usb_endpoint_is_int = %x, Interval = 
%x\n",
-   RT_usb_endpoint_num(pendp_desc),
-   pendp_desc->bInterval);
-   pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] 
= RT_usb_endpoint_num(pendp_desc);
+   } else if (usb_endpoint_is_int_in(pendp_desc)) {
+   pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] 
= ep_num;
pdvobjpriv->RtNumInPipes++;
-   } else if (RT_usb_endpoint_is_bulk_out(pendp_desc)) {
-   DBG_88E("RT_usb_endpoint_is_bulk_out = %x\n",
-   RT_usb_endpoint_num(pendp_desc));
-   
pdvobjpriv->RtOutPipe[pdvobjpriv->RtNumOutPipes] = 
RT_usb_endpoint_num(pendp_desc);
+   } else if (usb_endpoint_is_bulk_out(pendp_desc)) {
+   
pdvobjpriv->RtOutPipe[pdvobjpriv->RtNumOutPipes] = ep_num;
pdvobjpriv->RtNumOutPipes++;

[PATCH] staging: line6: fix possible overrun

2014-04-26 Thread Laurent Navet
The strcpy operation may write past the end of the fixed-size destination
buffer if the source buffer is too large.

Found by coverity scan : CID 144979

Signed-off-by: Laurent Navet 
---
build tested only

 drivers/staging/line6/audio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/line6/audio.c b/drivers/staging/line6/audio.c
index 171d80c..65f5cd4 100644
--- a/drivers/staging/line6/audio.c
+++ b/drivers/staging/line6/audio.c
@@ -32,9 +32,10 @@ int line6_init_audio(struct usb_line6 *line6)
 
line6->card = card;
 
-   strcpy(card->id, line6->properties->id);
+   strncpy(card->id, line6->properties->id, (sizeof(card->id)-1));
strcpy(card->driver, DRIVER_NAME);
-   strcpy(card->shortname, line6->properties->name);
+   strncpy(card->shortname, line6->properties->name,
+   (sizeof(card->shortname)-1));
/* longname is 80 chars - see asound.h */
sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,
dev_name(line6->ifcdev));
-- 
1.9.1

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


Re: [PATCH/V2] staging: rtl8192e: Fix typo in rtl8192e

2014-04-26 Thread Randy Dunlap
On 04/26/14 07:35, Masanari Iida wrote:
> Fix spelling typo in comments within rtl8192e.
> 
> Signed-off-by: Masanari Iida 
> Reviewed-by: James Cameron 
> 
> ---
>  drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c | 2 +-
>  drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c| 2 +-
>  drivers/staging/rtl8192e/rtl8192e/rtl_wx.c| 2 +-
>  drivers/staging/rtl8192e/rtl819x_TSProc.c | 2 +-
>  drivers/staging/rtl8192e/rtllib_rx.c  | 2 +-
>  drivers/staging/rtl8192e/rtllib_softmac.c | 2 +-
>  6 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c 
> b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
> index 5f10e40..79d86b9 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
> @@ -373,7 +373,7 @@ u32 cmpk_message_handle_rx(struct net_device *dev,
>   default:
>  
>   RT_TRACE(COMP_CMDPKT, ">cmpk_message_handle_rx():"
> -  "unknow CMD Element\n");
> +  "unknown CMD Element\n");
>   return 1;
>   }
>  
> diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c 
> b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> index 5d6d304..b4bfafe 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> @@ -1555,7 +1555,7 @@ static bool SetRFPowerState8190(struct net_device *dev,
>  
>   default:
>   bResult = false;
> - RT_TRACE(COMP_ERR, "SetRFPowerState8190(): unknow state"
> + RT_TRACE(COMP_ERR, "SetRFPowerState8190(): unknown 
> state"
>" to set: 0x%X!!!\n", eRFPowerState);
>   break;
>   }
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c 
> b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> index 498995d..091dfe7 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> @@ -1213,7 +1213,7 @@ static iw_handler r8192_wx_handlers[] = {
>  };
>  
>  /*
> - * the following rule need to be follwing,
> + * the followed rules need to be following,

  the following rules need to be followed:
or
  these listed rules need to be followed:
or
  this list of rules should be used:

etc.

>   * Odd : get (world access),
>   * even : set (root access)
>   * */
> diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c 
> b/drivers/staging/rtl8192e/rtl819x_TSProc.c
> index 29608e5..52b2977 100644
> --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c
> +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c
> @@ -79,7 +79,7 @@ static void RxPktPendingTimeout(unsigned long data)
>  
>   if (index > REORDER_WIN_SIZE) {
>   RTLLIB_DEBUG(RTLLIB_DL_ERR, "RxReorderIndicatePacket():"
> -  " Rx Reorer struct buffer full!!\n");
> +  " Rx Reorder struct buffer full!!\n");
>   spin_unlock_irqrestore(&(ieee->reorder_spinlock),
>  flags);
>   return;
> diff --git a/drivers/staging/rtl8192e/rtllib_rx.c 
> b/drivers/staging/rtl8192e/rtllib_rx.c
> index 6c8a8e1..7413816 100644
> --- a/drivers/staging/rtl8192e/rtllib_rx.c
> +++ b/drivers/staging/rtl8192e/rtllib_rx.c
> @@ -712,7 +712,7 @@ static void RxReorderIndicatePacket(struct rtllib_device 
> *ieee,
>  
>   if (index > REORDER_WIN_SIZE) {
>   RTLLIB_DEBUG(RTLLIB_DL_ERR, "RxReorderIndicatePacket():"
> -  " Rx Reorer struct buffer full!!\n");
> +  " Rx Reorder struct buffer full!!\n");
>   spin_unlock_irqrestore(&(ieee->reorder_spinlock),
>  flags);
>   return;
> diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c 
> b/drivers/staging/rtl8192e/rtllib_softmac.c
> index 4bf72bc..d65cba4 100644
> --- a/drivers/staging/rtl8192e/rtllib_softmac.c
> +++ b/drivers/staging/rtl8192e/rtllib_softmac.c
> @@ -543,7 +543,7 @@ void rtllib_softmac_scan_syncro(struct rtllib_device 
> *ieee, u8 is_mesh)
>   goto out; /* scan completed */
>   } while (!ieee->active_channel_map[ch]);
>  
> - /* this fuction can be called in two situations
> + /* this function can be called in two situations
>* 1- We have switched to ad-hoc mode and we are
>*performing a complete syncro scan before conclude
>*there are no interesting cell and to create a
> 


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

Re: [PATCH] staging: dgap: implement error handling in dgap_tty_register()

2014-04-26 Thread Dan Carpenter
On Sat, Apr 26, 2014 at 11:39:38AM +0900, DaeSeok Youn wrote:
> Hi,
> 
> please check below my comments.
> 
> 2014-04-25 23:41 GMT+09:00 Mark Hounschell :
> > On 04/25/2014 08:59 AM, Dan Carpenter wrote:
> >> On Fri, Apr 25, 2014 at 08:29:41AM -0400, Mark Hounschell wrote:
> >>> On 04/25/2014 07:02 AM, DaeSeok Youn wrote:
>  Hi, Dan.
> 
>  2014-04-25 18:26 GMT+09:00 Dan Carpenter :
> > Mark, maybe you should add yourself to the MAINTAINERS entry for this
> > driver?
> >
> >>>
> >>> I'll look into this. I am clueless on what that would actually mean.
> >>>
> >>
> >> Just add your name with Lidza in the MAINTAINERS file so that people
> >> will CC you on all the patches.
> >>
> >> DIGI EPCA PCI PRODUCTS
> >> M:  Lidza Louina 
> >> L:  driverdev-devel@linuxdriverproject.org
> >> S:  Maintained
> >> F:  drivers/staging/dgap/
> >>
> >> You don't have to do it if you don't want to, but you seem to be working
> >> on this driver and I'm going to refer questions to you either way.  :P
> >>
> > On Fri, Apr 25, 2014 at 04:04:59PM +0900, Daeseok Youn wrote:
> >> @@ -1263,7 +1277,8 @@ static int dgap_tty_register(struct board_t *brd)
> >>   /* Register tty devices */
> >>   rc = tty_register_driver(brd->SerialDriver);
> >>   if (rc < 0)
> >> - return rc;
> >> + goto free_print_ttys;
> >> +
> >>   brd->dgap_Major_Serial_Registered = TRUE;
> >>   dgap_BoardsByMajor[brd->SerialDriver->major] = brd;
> >>   brd->dgap_Serial_Major = brd->SerialDriver->major;
> >> @@ -1273,13 +1288,29 @@ static int dgap_tty_register(struct board_t 
> >> *brd)
> >>   /* Register Transparent Print devices */
> >>   rc = tty_register_driver(brd->PrintDriver);
> >>   if (rc < 0)
> >> - return rc;
> >> + goto unregister_serial_drv;
> >> +
> >>   brd->dgap_Major_TransparentPrint_Registered = TRUE;
> >>   dgap_BoardsByMajor[brd->PrintDriver->major] = brd;
> >>   brd->dgap_TransparentPrint_Major = 
> >> brd->PrintDriver->major;
> >>   }
> >>
> >>   return rc;
> >> +
> >> +unregister_serial_drv:
> >> + tty_unregister_driver(brd->SerialDriver);
> >
> > We only register the ->SerialDriver if someone else hasn't registered it
> > first?  So this should be:
> >
> > if (we_were_the_ones_who_registered_the_serial_driver)
> > tty_unregister_driver(brd->SerialDriver);
> >
> > I haven't followed looked at this.  Who else is registering the serial
> > driver?  You have looked at this, what do you think?  Or Mark.
> 
> >>>
> >>> registering the brd->XDriver is only done when a board is detected
> >>> and only during the firmware_load process. If we fail to
> >>> tty_register_driver do we _need_ to tty_unregister_driver? Isn't that
> >>> like freeing after an alloc failure?
> >>
> >> The allocation is conditional so the free should be conditional.  If we
> >> didn't allocate it, then we shouldn't free it.
> >>
> >> It wouldn't have even been a question except I'm not sure the allocation
> >> is *really* conditional because brd->dgap_Major_Serial_Registered might
> >> always be "false" like you guys seem to be saying.
> >>
> >>>
>  I think brd struct is from dgap_Board array as global static variable
>  when this function is
>  called. So brd->dgap_Major_Serial_Registered is always "false".
>  If dgap_NumBoards is less than MAXBOARDS, brd->SerialDriver should be
>  registered.
> 
>  I'm not sure..
> 
> >>>
> >>> I don't see any check for (dgap_NumBoards <  MAXBOARDS), which I think I
> >>> probably should, but I do see we are calling dgap_tty_register, which
> >>> can fail, without actually checking the return value. Also, yes,
> >>> dgap_Major_Xxxx_Registered seems to be always "false" until registered,
> >>> and it looks like dgap_Major_X_Registered flags could be removed
> >>> because the only places we can unregister is at module_cleanup or
> >>> "after" it is already registered.
> >>>
> >>> What is the driver _supposed_ to do if we fail something on the second
> >>> or later board? Is the driver supposed to cleanup and exit or are we
> >>> supposed to stay loaded for the board/boards that are usable?
> >>
> >> Stay loaded.
> >>
> >
> > Then these tests on brd->dgap_Major_Serial_Registered need to stay in
> > there. If I have 3 boards and the second fails in some way, if I rmmod
> > the driver they will protect from unregistering a never registered one.
> > At least in the unregister code path. There is probably no need for them
> > in the register code path. I'll work up a patch for this.
> 
> Should I update my patch?
> 
> I think "if (!brd->dgap_Major_XXX_Registered)" l

Re: [rfc PATCH] checkpatch: allow multiple const * types

2014-04-26 Thread Dan Carpenter
On Fri, Apr 25, 2014 at 08:29:59PM -0700, Joe Perches wrote:
> On Fri, 2014-04-25 at 10:50 +0300, Dan Carpenter wrote:
> > On Fri, Apr 25, 2014 at 01:06:44AM -0300, Nicolas Del Piano wrote:
> > > diff --git a/drivers/staging/comedi/drivers.c 
> > > b/drivers/staging/comedi/drivers.c
> []
> > > @@ -439,6 +439,7 @@ static void *comedi_recognize(struct comedi_driver 
> > > *driv, const char *name)
> > >  static void comedi_report_boards(struct comedi_driver *driv)
> > >  {
> > >   unsigned int i;
> > > +
> > >   const char *const *name_ptr;
> > 
> > The original code was correct.  This is a bug in checkpatch.pl.  The
> > missing line check should count any lines starting with "const" or
> > "static" as declarations.
> 
> Right, thanks for the report.
> 
> I'm not around for a couple weeks.
> I'll fix it properly later.

No stress.  These are not a big deal.  These false positives are rare,
there is no way we would have applied the patch and even if we did then
the extra blank line is harmless.

regards,
dan carpenter

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


[PATCH] staging: rtl8723au: Remove unused pointer in rtw_wdev_free()

2014-04-26 Thread Christian Engelmayer
Pointer 'pwdev_priv' in function rtw_wdev_free() is unused - thus remove it.

Signed-off-by: Christian Engelmayer 
---
Compile tested and applies against v3.15-rc2 as well as branch staging-next
of tree git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
---
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index ca100dc..be89741 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -3576,15 +3576,11 @@ exit:
 
 void rtw_wdev_free(struct wireless_dev *wdev)
 {
-   struct rtw_wdev_priv *pwdev_priv;
-
DBG_8723A("%s(wdev =%p)\n", __func__, wdev);
 
if (!wdev)
return;
 
-   pwdev_priv = wdev_to_priv(wdev);
-
kfree(wdev->wiphy->bands[IEEE80211_BAND_2GHZ]);
kfree(wdev->wiphy->bands[IEEE80211_BAND_5GHZ]);
 
-- 
1.9.1


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


[PATCH] staging: silicom: Remove unused pointer in bypass_init_module()

2014-04-26 Thread Christian Engelmayer
Pointer 'pbpctl_dev_c' in function bypass_init_module() is unused.
Thus remove it.

Signed-off-by: Christian Engelmayer 
---
Compile tested and applies against v3.15-rc2 as well as branch staging-next
of tree git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
---
 drivers/staging/silicom/bpctl_mod.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/silicom/bpctl_mod.c 
b/drivers/staging/silicom/bpctl_mod.c
index 7f3d884..2bf8964 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -6372,13 +6372,10 @@ static int __init bypass_init_module(void)
sema_init(&bpctl_sema, 1);
spin_lock_init(&bpvm_lock);
{
-
-   struct bpctl_dev *pbpctl_dev_c = NULL;
for (idx_dev = 0, dev = bpctl_dev_arr;
 idx_dev < device_num && dev->pdev;
 idx_dev++, dev++) {
if (dev->bp_10g9) {
-   pbpctl_dev_c = get_status_port_fn(dev);
if (is_bypass_fn(dev)) {
printk(KERN_INFO "%s found, ",
   dev->name);
-- 
1.9.1


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


[PATCH] staging: silicom: Remove needless calls of get_status_port_fn()

2014-04-26 Thread Christian Engelmayer
Remove a needless pointer initialisation and call to get_status_port_fn()
in functions remove_bypass_tpl_auto() and set_tpl_fn(). Variable
'pbpctl_dev_b' is set correctly later in the function before first use.

Signed-off-by: Christian Engelmayer 
---
Compile tested and applies against v3.15-rc2 as well as branch staging-next
of tree git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
---
 drivers/staging/silicom/bpctl_mod.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/silicom/bpctl_mod.c 
b/drivers/staging/silicom/bpctl_mod.c
index 2bf8964..fd2adf4 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -4735,10 +4735,9 @@ static void bp_tpl_timer_fn(unsigned long param)
 
 static void remove_bypass_tpl_auto(struct bpctl_dev *pbpctl_dev)
 {
-   struct bpctl_dev *pbpctl_dev_b = NULL;
+   struct bpctl_dev *pbpctl_dev_b;
if (!pbpctl_dev)
return;
-   pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
 
if (pbpctl_dev->bp_caps & TPL_CAP) {
del_timer_sync(&pbpctl_dev->bp_tpl_timer);
@@ -4785,12 +4784,10 @@ static int set_bypass_tpl_auto(struct bpctl_dev 
*pbpctl_dev, unsigned int param)
 static int set_tpl_fn(struct bpctl_dev *pbpctl_dev, int tpl_mode)
 {
 
-   struct bpctl_dev *pbpctl_dev_b = NULL;
+   struct bpctl_dev *pbpctl_dev_b;
if (!pbpctl_dev)
return -1;
 
-   pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
-
if (pbpctl_dev->bp_caps & TPL_CAP) {
if (tpl_mode) {
pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
-- 
1.9.1


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


Re: [PATCH] staging: line6: fix possible overrun

2014-04-26 Thread Mateusz Guzik
On Sat, Apr 26, 2014 at 07:09:22PM +0200, Laurent Navet wrote:
> The strcpy operation may write past the end of the fixed-size destination
> buffer if the source buffer is too large.
> 
> Found by coverity scan : CID 144979
> 
> Signed-off-by: Laurent Navet 
> ---
> build tested only
> 
>  drivers/staging/line6/audio.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/line6/audio.c b/drivers/staging/line6/audio.c
> index 171d80c..65f5cd4 100644
> --- a/drivers/staging/line6/audio.c
> +++ b/drivers/staging/line6/audio.c
> @@ -32,9 +32,10 @@ int line6_init_audio(struct usb_line6 *line6)
>  
>   line6->card = card;
>  
> - strcpy(card->id, line6->properties->id);
> + strncpy(card->id, line6->properties->id, (sizeof(card->id)-1));
>   strcpy(card->driver, DRIVER_NAME);
> - strcpy(card->shortname, line6->properties->name);
> + strncpy(card->shortname, line6->properties->name,
> + (sizeof(card->shortname)-1));
>   /* longname is 80 chars - see asound.h */
>   sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,
>   dev_name(line6->ifcdev));

Would not it be better to return -EINVAL (or some other error) instead?

Now you will possibly truncate the name.

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


Re: [PATCH] staging: line6: fix possible overrun

2014-04-26 Thread Dan Carpenter
On Sat, Apr 26, 2014 at 10:47:05PM +0200, Mateusz Guzik wrote:
> On Sat, Apr 26, 2014 at 07:09:22PM +0200, Laurent Navet wrote:
> > The strcpy operation may write past the end of the fixed-size destination
> > buffer if the source buffer is too large.
> > 
> > Found by coverity scan : CID 144979
> > 
> > Signed-off-by: Laurent Navet 
> > ---
> > build tested only
> > 
> >  drivers/staging/line6/audio.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/line6/audio.c b/drivers/staging/line6/audio.c
> > index 171d80c..65f5cd4 100644
> > --- a/drivers/staging/line6/audio.c
> > +++ b/drivers/staging/line6/audio.c
> > @@ -32,9 +32,10 @@ int line6_init_audio(struct usb_line6 *line6)
> >  
> > line6->card = card;
> >  
> > -   strcpy(card->id, line6->properties->id);
> > +   strncpy(card->id, line6->properties->id, (sizeof(card->id)-1));
> > strcpy(card->driver, DRIVER_NAME);
> > -   strcpy(card->shortname, line6->properties->name);
> > +   strncpy(card->shortname, line6->properties->name,
> > +   (sizeof(card->shortname)-1));
> > /* longname is 80 chars - see asound.h */
> > sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,
> > dev_name(line6->ifcdev));
> 
> Would not it be better to return -EINVAL (or some other error) instead?
> 
> Now you will possibly truncate the name.
> 

These don't come from the user, they come from the kernel.

drivers/staging/line6/driver.c
59  
60  #define L6PROP(dev_bit, dev_id, dev_name, dev_cap)\
61  {.device_bit = LINE6_BIT_##dev_bit, .id = dev_id,\
62   .name = dev_name, .capabilities = LINE6_BIT_##dev_cap}
63  
64  /* *INDENT-OFF* */
65  static const struct line6_properties line6_properties_table[] = {
66  L6PROP(BASSPODXT, "BassPODxt", "BassPODxt",
CTRL_PCM_HW),
67  L6PROP(BASSPODXTLIVE, "BassPODxtLive", "BassPODxt Live",   
CTRL_PCM_HW),
68  L6PROP(BASSPODXTPRO,  "BassPODxtPro",  "BassPODxt Pro",
CTRL_PCM_HW),
69  L6PROP(GUITARPORT,"GuitarPort","GuitarPort",   PCM),
70  L6PROP(POCKETPOD, "PocketPOD", "Pocket POD",   
CONTROL),
71  L6PROP(PODHD300,  "PODHD300",  "POD HD300",
CTRL_PCM_HW),
72  L6PROP(PODHD400,  "PODHD400",  "POD HD400",
CTRL_PCM_HW),
73  L6PROP(PODHD500,  "PODHD500",  "POD HD500",
CTRL_PCM_HW),
74  L6PROP(PODSTUDIO_GX,  "PODStudioGX",   "POD Studio GX",PCM),
75  L6PROP(PODSTUDIO_UX1, "PODStudioUX1",  "POD Studio UX1",   PCM),
76  L6PROP(PODSTUDIO_UX2, "PODStudioUX2",  "POD Studio UX2",   PCM),
77  L6PROP(PODX3, "PODX3", "POD X3",   PCM),
78  L6PROP(PODX3LIVE, "PODX3Live", "POD X3 Live",  PCM),
79  L6PROP(PODXT, "PODxt", "PODxt",
CTRL_PCM_HW),
80  L6PROP(PODXTLIVE, "PODxtLive", "PODxt Live",   
CTRL_PCM_HW),
81  L6PROP(PODXTPRO,  "PODxtPro",  "PODxt Pro",
CTRL_PCM_HW),
82  L6PROP(TONEPORT_GX,   "TonePortGX","TonePort GX",  PCM),
83  L6PROP(TONEPORT_UX1,  "TonePortUX1",   "TonePort UX1", PCM),
84  L6PROP(TONEPORT_UX2,  "TonePortUX2",   "TonePort UX2", PCM),
85  L6PROP(VARIAX,"Variax","Variax Workbench", 
CONTROL),
86  };
87  /* *INDENT-ON* */
88  

And sadly enough some of those ->id strings are more than 15 characters
and a NUL which will fit in card->id.  So this overflow is real.  The
card->shortname is a 32 char array so none of those overflow.

If we want to sovle the truncation issue then we need to think of
shorter names for BassPODxtLive, BassPODxtPro, PODStudioUX1, and
PODStudioUX2.

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


Re: [PATCH] staging: line6: fix possible overrun

2014-04-26 Thread Mateusz Guzik
On Sun, Apr 27, 2014 at 12:36:21AM +0300, Dan Carpenter wrote:
> On Sat, Apr 26, 2014 at 10:47:05PM +0200, Mateusz Guzik wrote:
> > On Sat, Apr 26, 2014 at 07:09:22PM +0200, Laurent Navet wrote:
> > > The strcpy operation may write past the end of the fixed-size destination
> > > buffer if the source buffer is too large.
> > > 
> > > Found by coverity scan : CID 144979
> > > 
> > > Signed-off-by: Laurent Navet 
> > > ---
> > > build tested only
> > > 
> > >  drivers/staging/line6/audio.c | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/staging/line6/audio.c b/drivers/staging/line6/audio.c
> > > index 171d80c..65f5cd4 100644
> > > --- a/drivers/staging/line6/audio.c
> > > +++ b/drivers/staging/line6/audio.c
> > > @@ -32,9 +32,10 @@ int line6_init_audio(struct usb_line6 *line6)
> > >  
> > >   line6->card = card;
> > >  
> > > - strcpy(card->id, line6->properties->id);
> > > + strncpy(card->id, line6->properties->id, (sizeof(card->id)-1));
> > >   strcpy(card->driver, DRIVER_NAME);
> > > - strcpy(card->shortname, line6->properties->name);
> > > + strncpy(card->shortname, line6->properties->name,
> > > + (sizeof(card->shortname)-1));
> > >   /* longname is 80 chars - see asound.h */
> > >   sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,
> > >   dev_name(line6->ifcdev));
> > 
> > Would not it be better to return -EINVAL (or some other error) instead?
> > 
> > Now you will possibly truncate the name.
> > 
> 
> These don't come from the user, they come from the kernel.
> 
> drivers/staging/line6/driver.c
> 59  
> 60  #define L6PROP(dev_bit, dev_id, dev_name, dev_cap)\
> 61  {.device_bit = LINE6_BIT_##dev_bit, .id = dev_id,\
> 62   .name = dev_name, .capabilities = LINE6_BIT_##dev_cap}
> 63  
> 64  /* *INDENT-OFF* */
> 65  static const struct line6_properties line6_properties_table[] = {
> 66  L6PROP(BASSPODXT, "BassPODxt", "BassPODxt",
> CTRL_PCM_HW),
> 67  L6PROP(BASSPODXTLIVE, "BassPODxtLive", "BassPODxt Live",   
> CTRL_PCM_HW),
> 68  L6PROP(BASSPODXTPRO,  "BassPODxtPro",  "BassPODxt Pro",
> CTRL_PCM_HW),
> 69  L6PROP(GUITARPORT,"GuitarPort","GuitarPort",   
> PCM),
> 70  L6PROP(POCKETPOD, "PocketPOD", "Pocket POD",   
> CONTROL),
> 71  L6PROP(PODHD300,  "PODHD300",  "POD HD300",
> CTRL_PCM_HW),
> 72  L6PROP(PODHD400,  "PODHD400",  "POD HD400",
> CTRL_PCM_HW),
> 73  L6PROP(PODHD500,  "PODHD500",  "POD HD500",
> CTRL_PCM_HW),
> 74  L6PROP(PODSTUDIO_GX,  "PODStudioGX",   "POD Studio GX",
> PCM),
> 75  L6PROP(PODSTUDIO_UX1, "PODStudioUX1",  "POD Studio UX1",   
> PCM),
> 76  L6PROP(PODSTUDIO_UX2, "PODStudioUX2",  "POD Studio UX2",   
> PCM),
> 77  L6PROP(PODX3, "PODX3", "POD X3",   
> PCM),
> 78  L6PROP(PODX3LIVE, "PODX3Live", "POD X3 Live",  
> PCM),
> 79  L6PROP(PODXT, "PODxt", "PODxt",
> CTRL_PCM_HW),
> 80  L6PROP(PODXTLIVE, "PODxtLive", "PODxt Live",   
> CTRL_PCM_HW),
> 81  L6PROP(PODXTPRO,  "PODxtPro",  "PODxt Pro",
> CTRL_PCM_HW),
> 82  L6PROP(TONEPORT_GX,   "TonePortGX","TonePort GX",  
> PCM),
> 83  L6PROP(TONEPORT_UX1,  "TonePortUX1",   "TonePort UX1", 
> PCM),
> 84  L6PROP(TONEPORT_UX2,  "TonePortUX2",   "TonePort UX2", 
> PCM),
> 85  L6PROP(VARIAX,"Variax","Variax Workbench", 
> CONTROL),
> 86  };
> 87  /* *INDENT-ON* */
> 88  
> 
> And sadly enough some of those ->id strings are more than 15 characters
> and a NUL which will fit in card->id.  So this overflow is real.  The
> card->shortname is a 32 char array so none of those overflow.
> 
> If we want to sovle the truncation issue then we need to think of
> shorter names for BassPODxtLive, BassPODxtPro, PODStudioUX1, and
> PODStudioUX2.
> 

In that case I suggest compile time assertions that ids and names fit and
a WARN_ON + -EINVAL in line6_init_audio to catch future offenders.

As a side note I'm not sure if pod_try_init from drivers/staging/line6/pod.c
cleans up properly after failed line6_init_audio.

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


[RFC PATCH 0/8] component helper improvements

2014-04-26 Thread Russell King - ARM Linux
A while back, Laurent raised some comments about the component helper,
which this patch set starts to address.

The first point it addresses is the repeated parsing inefficiency when
deferred probing occurs.  When DT is used, the structure of the
component helper today means that masters end up parsing the device
tree for each attempt to re-bind the driver.

We remove this inefficiency by creating an array of matching data and
functions, which the component helper can use internally to match up
components to their master.

The second point was the inefficiency of destroying the list of
components each time we saw a failure.  We did this to ensure that
we kept things correctly ordered: component bind order matters.
As we have an array instead, the array is already ordered, so we
use this array to store the component pointers instead of a list,
and remember which are duplicates (and thus should be avoided.)
Avoiding the right duplicates matters as we walk the array in the
opposite direction at tear down.

I would like to see patches 1-5 scheduled for the next merge window,
with 6-8 for the following window - this gives us grace of one kernel
cycle to ensure that any new component helper users are properly
converted.

 drivers/base/component.c   | 248 ++---
 drivers/gpu/drm/msm/msm_drv.c  |  81 +--
 drivers/staging/imx-drm/imx-drm-core.c |  57 +---
 include/linux/component.h  |   8 +-
 4 files changed, 206 insertions(+), 188 deletions(-)

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH RFC 5/8] imx-drm: update to use component match support

2014-04-26 Thread Russell King
Update the imx-drm driver to use the component match support rather than
add_components.

Signed-off-by: Russell King 
---
 drivers/staging/imx-drm/imx-drm-core.c | 57 +++---
 1 file changed, 4 insertions(+), 53 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-drm-core.c 
b/drivers/staging/imx-drm/imx-drm-core.c
index 4144a75e5f71..84cd915bba44 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -577,22 +577,6 @@ static int compare_of(struct device *dev, void *data)
return dev->of_node == np;
 }
 
-static LIST_HEAD(imx_drm_components);
-
-static int imx_drm_add_components(struct device *master, struct master *m)
-{
-   struct imx_drm_component *component;
-   int ret;
-
-   list_for_each_entry(component, &imx_drm_components, list) {
-   ret = component_master_add_child(m, compare_of,
-component->of_node);
-   if (ret)
-   return ret;
-   }
-   return 0;
-}
-
 static int imx_drm_bind(struct device *dev)
 {
return drm_platform_init(&imx_drm_driver, to_platform_device(dev));
@@ -604,43 +588,14 @@ static void imx_drm_unbind(struct device *dev)
 }
 
 static const struct component_master_ops imx_drm_ops = {
-   .add_components = imx_drm_add_components,
.bind = imx_drm_bind,
.unbind = imx_drm_unbind,
 };
 
-static struct imx_drm_component *imx_drm_find_component(struct device *dev,
-   struct device_node *node)
-{
-   struct imx_drm_component *component;
-
-   list_for_each_entry(component, &imx_drm_components, list)
-   if (component->of_node == node)
-   return component;
-
-   return NULL;
-}
-
-static int imx_drm_add_component(struct device *dev, struct device_node *node)
-{
-   struct imx_drm_component *component;
-
-   if (imx_drm_find_component(dev, node))
-   return 0;
-
-   component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL);
-   if (!component)
-   return -ENOMEM;
-
-   component->of_node = node;
-   list_add_tail(&component->list, &imx_drm_components);
-
-   return 0;
-}
-
 static int imx_drm_platform_probe(struct platform_device *pdev)
 {
struct device_node *ep, *port, *remote;
+   struct component_match *match = NULL;
int ret;
int i;
 
@@ -654,9 +609,7 @@ static int imx_drm_platform_probe(struct platform_device 
*pdev)
if (!port)
break;
 
-   ret = imx_drm_add_component(&pdev->dev, port);
-   if (ret < 0)
-   return ret;
+   component_match_add(&pdev->dev, &match, compare_of, port);
}
 
if (i == 0) {
@@ -677,10 +630,8 @@ static int imx_drm_platform_probe(struct platform_device 
*pdev)
continue;
}
 
-   ret = imx_drm_add_component(&pdev->dev, remote);
+   component_match_add(&pdev->dev, &match, compare_of, 
remote);
of_node_put(remote);
-   if (ret < 0)
-   return ret;
}
of_node_put(port);
}
@@ -689,7 +640,7 @@ static int imx_drm_platform_probe(struct platform_device 
*pdev)
if (ret)
return ret;
 
-   return component_master_add(&pdev->dev, &imx_drm_ops);
+   return component_master_add_with_match(&pdev->dev, &imx_drm_ops, match);
 }
 
 static int imx_drm_platform_remove(struct platform_device *pdev)
-- 
1.8.3.1

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


[GIT PULL] Staging driver fixes for 3.15-rc3

2014-04-26 Thread Greg KH
The following changes since commit a798c10faf62a505d24e5f6213fbaf904a39623f:

  Linux 3.15-rc2 (2014-04-20 11:08:50 -0700)

are available in the git repository at:

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

for you to fetch changes up to 2704f807f9498054b8153002bafa3e818079e9a5:

  staging: comedi: usbdux: bug fix for accessing 'ao_chanlist' in private data 
(2014-04-23 16:20:15 -0700)


Staging / IIO driver fixes for 3.15-rc3

Here are some small staging and IIO driver fixes for 3.15-rc3.

Nothing major at all, just some assorted issues that people have reported.

Signed-off-by: Greg Kroah-Hartman 


Alec Berg (1):
  iio: querying buffer scan_mask should return 0/1

Alexandre Belloni (5):
  iio: adc: at91_adc: Repair broken platform_data support
  ARM: at91: at91sam9g45: change at91_adc name
  ARM: at91: at91sam9260: change at91_adc name
  iio: adc: at91_adc: correct default shtim value
  iio: adc: mxs-lradc: fix warning when buidling on avr32

Beomho Seo (1):
  iio: cm32181: Fix read integration time function

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

H Hartley Sweeten (1):
  staging: comedi: usbdux: bug fix for accessing 'ao_chanlist' in private 
data

Jimmy Li (1):
  staging:iio:ad2s1200 fix a missing break

Krzysztof Kozlowski (1):
  iio: cm36651: Fix i2c client leak and possible NULL pointer dereference

 arch/arm/mach-at91/at91sam9260_devices.c |  2 +-
 arch/arm/mach-at91/at91sam9g45_devices.c |  2 +-
 drivers/iio/adc/at91_adc.c   | 33 ++--
 drivers/iio/industrialio-buffer.c|  6 --
 drivers/iio/light/cm32181.c  |  1 +
 drivers/iio/light/cm36651.c  | 22 +++--
 drivers/staging/comedi/drivers/usbdux.c  |  9 +++--
 drivers/staging/iio/adc/mxs-lradc.c  |  2 +-
 drivers/staging/iio/resolver/ad2s1200.c  |  1 +
 9 files changed, 59 insertions(+), 19 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/6] staging: comedi: addi_apci_1564: remove eeprom support code

2014-04-26 Thread Chase Southwood
Reading the eeprom on this board is not necessary.  All information
required is in the boardinfo.

Remove the eeprom support code which is not really useful here.

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

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 5f6d3b5..df8833b 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -7,7 +7,6 @@
 
 #include "addi-data/addi_common.h"
 
-#include "addi-data/addi_eeprom.c"
 #include "addi-data/hwdrv_apci1564.c"
 
 static const struct addi_board apci1564_boardtypes[] = {
@@ -33,23 +32,6 @@ static const struct addi_board apci1564_boardtypes[] = {
},
 };
 
-static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev,
-struct comedi_subdevice *s,
-struct comedi_insn *insn,
-unsigned int *data)
-{
-   const struct addi_board *this_board = comedi_board(dev);
-   struct addi_private *devpriv = dev->private;
-   unsigned short w_Address = CR_CHAN(insn->chanspec);
-   unsigned short w_Data;
-
-   w_Data = addi_eeprom_readw(devpriv->i_IobaseAmcc,
-   this_board->pc_EepromChip, 2 * w_Address);
-   data[0] = w_Data;
-
-   return insn->n;
-}
-
 static irqreturn_t v_ADDI_Interrupt(int irq, void *d)
 {
struct comedi_device *dev = d;
@@ -75,7 +57,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
struct addi_private *devpriv;
struct comedi_subdevice *s;
int ret, n_subdevices;
-   unsigned int dw_Dummy;
 
dev->board_name = this_board->pc_DriverName;
 
@@ -120,23 +101,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
dev->irq = pcidev->irq;
}
 
-   /*  Read eepeom and fill addi_board Structure */
-
-   if (this_board->i_PCIEeprom) {
-   if (!(strcmp(this_board->pc_EepromChip, "S5920"))) {
-   /*  Set 3 wait stait */
-   if (!(strcmp(dev->board_name, "apci035")))
-   outl(0x80808082, devpriv->i_IobaseAmcc + 0x60);
-   else
-   outl(0x83838383, devpriv->i_IobaseAmcc + 0x60);
-
-   /*  Enable the interrupt for the controller */
-   dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38);
-   outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38);
-   }
-   addi_eeprom_read_info(dev, pci_resource_start(pcidev, 0));
-   }
-
n_subdevices = 7;
ret = comedi_alloc_subdevices(dev, n_subdevices);
if (ret)
@@ -212,15 +176,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 
/* EEPROM */
s = &dev->subdevices[6];
-   if (this_board->i_PCIEeprom) {
-   s->type = COMEDI_SUBD_MEMORY;
-   s->subdev_flags = SDF_READABLE | SDF_INTERNAL;
-   s->n_chan = 256;
-   s->maxdata = 0x;
-   s->insn_read = i_ADDIDATA_InsnReadEeprom;
-   } else {
-   s->type = COMEDI_SUBD_UNUSED;
-   }
+   s->type = COMEDI_SUBD_UNUSED;
 
i_ADDI_Reset(dev);
return 0;
-- 
1.9.0

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


[PATCH 3/6] staging: comedi: addi_apci_1032: board has 32 digital inputs

2014-04-26 Thread Chase Southwood
This board always has 32 digital inputs. Remove the test when
initializing the subdevice.

Also, since this board is the only one supported by this driver,
remove the boardinfo about the digital inputs and just use the
data directly in the subdevice init.

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

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index c84e17c..fe42f9d 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -20,8 +20,6 @@ static const struct addi_board apci1564_boardtypes[] = {
.i_Timer= 1,
.interrupt  = apci1564_interrupt,
.reset  = apci1564_reset,
-   .di_config  = apci1564_di_config,
-   .di_bits= apci1564_di_insn_bits,
.do_config  = apci1564_do_config,
.do_bits= apci1564_do_insn_bits,
.do_read= apci1564_do_read,
@@ -115,21 +113,15 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 
/*  Allocate and Initialise DI Subdevice Structures */
s = &dev->subdevices[2];
-   if (devpriv->s_EeParameters.i_NbrDiChannel) {
-   s->type = COMEDI_SUBD_DI;
-   s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON;
-   s->n_chan = devpriv->s_EeParameters.i_NbrDiChannel;
-   s->maxdata = 1;
-   s->len_chanlist =
-   devpriv->s_EeParameters.i_NbrDiChannel;
-   s->range_table = &range_digital;
-   s->insn_config = this_board->di_config;
-   s->insn_read = this_board->di_read;
-   s->insn_write = this_board->di_write;
-   s->insn_bits = this_board->di_bits;
-   } else {
-   s->type = COMEDI_SUBD_UNUSED;
-   }
+   s->type = COMEDI_SUBD_DI;
+   s->subdev_flags = SDF_READABLE;
+   s->n_chan = 32;
+   s->maxdata = 1;
+   s->len_chanlist = 32;
+   s->range_table = &range_digital;
+   s->insn_config = apci1564_di_config;
+   s->insn_bits = apci1564_di_insn_bits;
+
/*  Allocate and Initialise DO Subdevice Structures */
s = &dev->subdevices[3];
if (devpriv->s_EeParameters.i_NbrDoChannel) {
-- 
1.9.0

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


[PATCH 2/6] staging: comedi: addi_apci_1564: remove unnecessary include

2014-04-26 Thread Chase Southwood
This include is no longer needed.

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

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index df8833b..c84e17c 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -3,7 +3,6 @@
 
 #include "../comedidev.h"
 #include "comedi_fc.h"
-#include "amcc_s5933.h"
 
 #include "addi-data/addi_common.h"
 
-- 
1.9.0

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


[PATCH 4/6] staging: comedi: addi_apci_1564: simplify the PCI bar reading and don't read the unused bars

2014-04-26 Thread Chase Southwood
This driver only uses PCI bar 1 (devpriv->i_IobaseAmcc), and PCI bar 2
(dev->iobase) doon't bother reading the unused PCI bars.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---

Hartley,

As far as I can tell from reading the I/O Mapping you sent me, these bar
numbers are correct, but it seems a bit odd, so please offer correction
if I am interpreting the document incorrectly.

Thanks,
Chase

 drivers/staging/comedi/drivers/addi_apci_1564.c | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index fe42f9d..7e42d47 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -65,15 +65,8 @@ static int apci1564_auto_attach(struct comedi_device *dev,
if (ret)
return ret;
 
-   if (this_board->i_IorangeBase1)
-   dev->iobase = pci_resource_start(pcidev, 1);
-   else
-   dev->iobase = pci_resource_start(pcidev, 0);
-
-   devpriv->iobase = dev->iobase;
-   devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0);
-   devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2);
-   devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3);
+   dev->iobase = pci_resource_start(pcidev, 2);
+   devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 1);
 
/* Initialize parameters that can be overridden in EEPROM */
devpriv->s_EeParameters.i_NbrAiChannel = this_board->i_NbrAiChannel;
-- 
1.9.0

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


[PATCH 6/6] staging: comedi: addi_apci_2032: remove use of devpriv->s_EeParameters

2014-04-26 Thread Chase Southwood
This driver no longer reads the eeprom to find the board specific data,
all the necessary data is in the boardinfo. Use the boardinfo directly
instead of passing through devpriv->s_EeParameters.

Signed-off-by: Chase Southwood 
Cc: Ian Abbott 
Cc: H Hartley Sweeten 
---
Ian and Hartley,

The auto_attach() function is starting to look much better now.  My next 
patchset
will be geared towards only allocating subdevices which are actually used.

Thanks,
Chase

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

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index d5be8d3..b34ae34 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -65,22 +65,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
dev->iobase = pci_resource_start(pcidev, 2);
devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 1);
 
-   /* Initialize parameters that can be overridden in EEPROM */
-   devpriv->s_EeParameters.i_NbrAiChannel = this_board->i_NbrAiChannel;
-   devpriv->s_EeParameters.i_NbrAoChannel = this_board->i_NbrAoChannel;
-   devpriv->s_EeParameters.i_AiMaxdata = this_board->i_AiMaxdata;
-   devpriv->s_EeParameters.i_AoMaxdata = this_board->i_AoMaxdata;
-   devpriv->s_EeParameters.i_NbrDiChannel = this_board->i_NbrDiChannel;
-   devpriv->s_EeParameters.i_NbrDoChannel = this_board->i_NbrDoChannel;
-   devpriv->s_EeParameters.i_DoMaxdata = this_board->i_DoMaxdata;
-   devpriv->s_EeParameters.i_Timer = this_board->i_Timer;
-   devpriv->s_EeParameters.ui_MinAcquisitiontimeNs =
-   this_board->ui_MinAcquisitiontimeNs;
-   devpriv->s_EeParameters.ui_MinDelaytimeNs =
-   this_board->ui_MinDelaytimeNs;
-
-   /* ## */
-
if (pcidev->irq > 0) {
ret = request_irq(pcidev->irq, v_ADDI_Interrupt, IRQF_SHARED,
  dev->board_name, dev);
@@ -114,14 +98,13 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 
/*  Allocate and Initialise DO Subdevice Structures */
s = &dev->subdevices[3];
-   if (devpriv->s_EeParameters.i_NbrDoChannel) {
+   if (this_board->i_NbrDoChannel) {
s->type = COMEDI_SUBD_DO;
s->subdev_flags =
SDF_READABLE | SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
-   s->n_chan = devpriv->s_EeParameters.i_NbrDoChannel;
-   s->maxdata = devpriv->s_EeParameters.i_DoMaxdata;
-   s->len_chanlist =
-   devpriv->s_EeParameters.i_NbrDoChannel;
+   s->n_chan = this_board->i_NbrDoChannel;
+   s->maxdata = this_board->i_DoMaxdata;
+   s->len_chanlist = this_board->i_NbrDoChannel;
s->range_table = &range_digital;
 
/* insn_config - for digital output memory */
@@ -135,7 +118,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 
/*  Allocate and Initialise Timer Subdevice Structures */
s = &dev->subdevices[4];
-   if (devpriv->s_EeParameters.i_Timer) {
+   if (this_board->i_Timer) {
s->type = COMEDI_SUBD_TIMER;
s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
s->n_chan = 1;
-- 
1.9.0

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


[PATCH 5/6] staging: comedi: addi_apci_2032: remove unnecessary info from boardinfo

2014-04-26 Thread Chase Southwood
The i_IorangeBase1, i_PCIEeprom, and pc_EepromChip data in the boardinfo
was only needed to work out the usage of the PCI bars.  Now that that is
squared away, this info is no longer needed and can be removed.

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

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 7e42d47..d5be8d3 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -11,9 +11,6 @@
 static const struct addi_board apci1564_boardtypes[] = {
{
.pc_DriverName  = "apci1564",
-   .i_IorangeBase1 = APCI1564_ADDRESS_RANGE,
-   .i_PCIEeprom= ADDIDATA_EEPROM,
-   .pc_EepromChip  = ADDIDATA_93C76,
.i_NbrDiChannel = 32,
.i_NbrDoChannel = 32,
.i_DoMaxdata= 0x,
-- 
1.9.0

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