Re: [Suggestion] drivers: staging: dgrp: dgrp_net_ops.c: 'buf' is used without initialized.

2013-12-10 Thread Dan Carpenter
On Tue, Dec 10, 2013 at 01:07:58PM +0800, Chen Gang wrote:
> Hello Maintainers:
> 
> The compiler help me find a warning about it, please help check thanks.
> 
> The related git commit: "b73db54 Staging: dgrp: Refactor the function
> dgrp_receive() in drrp_net_ops.c"
> 

There are a couple other wrong things with this patch as well.

1) There should be a call to handle_data_in_packet() in case 9.
2) This code doesn't make sense:

+   dlen = plen - remain;
+   b = buf;
+
+   b[0] = 0x90 + n1;
+   put_unaligned_be16(dlen, b + 1);
+
+   remain = 3;
+   if (remain > 0 && b != buf)

The first conditition is always true and the second condition is always
false.

+   memcpy(buf, b, remain);

regards,
dan carpenter

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


Re: [Suggestion] drivers: staging: dgrp: dgrp_net_ops.c: 'buf' is used without initialized.

2013-12-10 Thread Chen Gang
On 12/10/2013 05:10 PM, Dan Carpenter wrote:
> On Tue, Dec 10, 2013 at 01:07:58PM +0800, Chen Gang wrote:
>> Hello Maintainers:
>>
>> The compiler help me find a warning about it, please help check thanks.
>>
>> The related git commit: "b73db54 Staging: dgrp: Refactor the function
>> dgrp_receive() in drrp_net_ops.c"
>>
> 
> There are a couple other wrong things with this patch as well.
> 
> 1) There should be a call to handle_data_in_packet() in case 9.
> 2) This code doesn't make sense:
> 
> +   dlen = plen - remain;
> +   b = buf;
> +
> +   b[0] = 0x90 + n1;
> +   put_unaligned_be16(dlen, b + 1);
> +
> +   remain = 3;
> +   if (remain > 0 && b != buf)
> 
> The first conditition is always true and the second condition is always
> false.
> 
> +   memcpy(buf, b, remain);
> 

Yeah, for me, the code in handle_data_in_packet() needs re-construction
by related maintainers, it is not quite easy to improve these code by
other members.


Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water and life which God blessed
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Suggestion] drivers: staging: dgrp: dgrp_net_ops.c: 'buf' is used without initialized.

2013-12-10 Thread Rashika Kheria
Hello all,

I tried to refactor this function.

On Tue, Dec 10, 2013 at 3:07 PM, Chen Gang  wrote:
> On 12/10/2013 05:10 PM, Dan Carpenter wrote:
>> On Tue, Dec 10, 2013 at 01:07:58PM +0800, Chen Gang wrote:
>>> Hello Maintainers:
>>>
>>> The compiler help me find a warning about it, please help check thanks.
>>>
>>> The related git commit: "b73db54 Staging: dgrp: Refactor the function
>>> dgrp_receive() in drrp_net_ops.c"
>>>
>>
>> There are a couple other wrong things with this patch as well.
>>
>> 1) There should be a call to handle_data_in_packet() in case 9.

I checked this part of the code and agree that a call to
handle_data_in_packet() must be present in case 9. Sorry for
previously overlooking it.

>> 2) This code doesn't make sense:
>>
>> +   dlen = plen - remain;
>> +   b = buf;
>> +
>> +   b[0] = 0x90 + n1;
>> +   put_unaligned_be16(dlen, b + 1);
>> +
>> +   remain = 3;
>> +   if (remain > 0 && b != buf)
>>
>> The first conditition is always true and the second condition is always
>> false.
>>
>> +   memcpy(buf, b, remain);
>>

I will check for this part of the code.

>
> Yeah, for me, the code in handle_data_in_packet() needs re-construction
> by related maintainers, it is not quite easy to improve these code by
> other members.
>
>

Should I attempt to rectify the code in handle_data_in_packet() ?


Thanks and regards,
-- 
Rashika Kheria
B.Tech CSE
IIIT Hyderabad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Suggestion] drivers: staging: dgrp: dgrp_net_ops.c: 'buf' is used without initialized.

2013-12-10 Thread Dan Carpenter
On Tue, Dec 10, 2013 at 03:27:55PM +0530, Rashika Kheria wrote:
> Should I attempt to rectify the code in handle_data_in_packet() ?

Yes, please.

So, one thing that I notice is that people freak out when they introduce
a bug and send a string of panicked buggy patches to try fix it.
Ideally, you could write a fix by some time tomorrow or the next day.
If not, then we could just revert the original patch which relieves the
pressure so you don't have a hard deadline and can take your time with
the fix.  It's not the end of the world if we have to do that.

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


Re: [Suggestion] drivers: staging: dgrp: dgrp_net_ops.c: 'buf' is used without initialized.

2013-12-10 Thread Chen Gang
On 12/10/2013 06:05 PM, Dan Carpenter wrote:
> On Tue, Dec 10, 2013 at 03:27:55PM +0530, Rashika Kheria wrote:
>> Should I attempt to rectify the code in handle_data_in_packet() ?
> 
> Yes, please.
> 
> So, one thing that I notice is that people freak out when they introduce
> a bug and send a string of panicked buggy patches to try fix it.
> Ideally, you could write a fix by some time tomorrow or the next day.
> If not, then we could just revert the original patch which relieves the
> pressure so you don't have a hard deadline and can take your time with
> the fix.  It's not the end of the world if we have to do that.
> 

Yeah, please help to try, when you have free time (in fact, I often make
some common sense mistakes... so just feel free). :-)


Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water and life which God blessed
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 09/48] staging: comedi: pcmmio: move ai shadow data to device private data

2013-12-10 Thread Ian Abbott

On 2013-12-09 22:30, H Hartley Sweeten wrote:

There is only one ai subdevice in this driver so there is no reason
to hold the last sample written to each channel in the subdevice
private data. Move the data into the device private data,

This gets some of the data out of the subdevice private data union
and removes some of the uses of the ugly 'subpriv' macro.


The patch title and description are wrong as this is the AO subdevice, 
but apart from that it's fine!




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

diff --git a/drivers/staging/comedi/drivers/pcmmio.c 
b/drivers/staging/comedi/drivers/pcmmio.c
index 704911c..f889e0f 100644
--- a/drivers/staging/comedi/drivers/pcmmio.c
+++ b/drivers/staging/comedi/drivers/pcmmio.c
@@ -231,10 +231,6 @@ struct pcmmio_subdev_private {
spinlock_t spinlock;
} intr;
} dio;
-   struct {
-   /* the last unsigned int data written */
-   unsigned int shadow_samples[8];
-   } ao;
};
  };

@@ -256,6 +252,7 @@ struct pcmmio_private {
spinlock_t spinlock;
} asics[MAX_ASICS];
struct pcmmio_subdev_private *sprivs;
+   unsigned int ao_readback[8];
  };

  #define subpriv ((struct pcmmio_subdev_private *)s->private)
@@ -857,11 +854,13 @@ static int pcmmio_ai_insn_read(struct comedi_device *dev,
  static int ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
  {
+   struct pcmmio_private *devpriv = dev->private;
int n;
+
for (n = 0; n < insn->n; n++) {
unsigned chan = CR_CHAN(insn->chanspec);
if (chan < s->n_chan)
-   data[n] = subpriv->ao.shadow_samples[chan];
+   data[n] = devpriv->ao_readback[chan];
}
return n;
  }
@@ -887,6 +886,7 @@ static int wait_dac_ready(unsigned long iobase)
  static int ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
  {
+   struct pcmmio_private *devpriv = dev->private;
int n;
unsigned iobase = subpriv->iobase, iooffset = 0;

@@ -925,7 +925,7 @@ static int ao_winsn(struct comedi_device *dev, struct 
comedi_subdevice *s,
wait_dac_ready(iobase + iooffset);

/* save to shadow register for ao_rinsn */
-   subpriv->ao.shadow_samples[chan] = data[n];
+   devpriv->ao_readback[chan] = data[n];
}
}
return n;




--
-=( 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 0/7] Staging: bcm: DDRInit: Fixed issues in coding style.

2013-12-10 Thread Gary Rookard
This patchset is an attempt to fix the coding style
issues found in the file DDRInit.c

Gary Rookard (7):
  Staging: bcm: DDRinit: fixed indentation coding style issues
  Staging: bcm: DDRInit: fixed spacing coding style issues
  Staging: bcm: DDRInit: fixed brace coding style issues
  Staging: bcm: DDRInit: fixed parentheses coding style issues
  Staging: bcm: DDRInit: fixed comment coding style issues
  Staging: bcm: DDRInit: fixed semicolon coding style issues
  Staging: bcm: DDRInit: fixed a space coding style issue

 drivers/staging/bcm/DDRInit.c | 2115 -
 1 file changed, 1013 insertions(+), 1102 deletions(-)

-- 
1.8.4

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


[PATCH 3/7] Staging: bcm: DDRInit: fixed brace coding style issues

2013-12-10 Thread Gary Rookard
Fixed coding style issues

Signed-off-by: Gary Alan Rookard chip_id)
-   {
+   switch (Adapter->chip_id) {
case 0xbece3200:
-   switch (Adapter->DDRSetting)
-   {
+   switch (Adapter->DDRSetting) {
case DDR_80_MHZ:
psDDRSetting = asT3LP_DDRSetting80MHz;
RegCount = (sizeof(asT3LP_DDRSetting80MHz)/
@@ -801,13 +799,9 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
RegCount = (sizeof(asT3LP_DDRSetting133MHz)/
sizeof(struct bcm_ddr_setting));
if(Adapter->bMipsConfig == MIPS_200_MHZ)
-   {
uiClockSetting = 0x03F13652;
-   }
else
-   {
uiClockSetting = 0x03F1365B;
-   }
break;
default:
return -EINVAL;
@@ -824,8 +818,7 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
 */
if( (Adapter->chip_id !=  BCS220_2) &&
(Adapter->chip_id !=  BCS220_2BC) &&
-   (Adapter->chip_id != BCS220_3) )
-   {
+   (Adapter->chip_id != BCS220_3) ) {
retval = rdmalt(Adapter, (UINT)0x0f000830, 
&uiResetValue, sizeof(uiResetValue));
if(retval < 0) {
BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, 
DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__);
@@ -837,12 +830,8 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, 
DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__);
return retval;
}
-   }
-   switch(Adapter->DDRSetting)
-   {
-
-
-
+   }
+   switch(Adapter->DDRSetting) {
case DDR_80_MHZ:
psDDRSetting = asT3LPB_DDRSetting80MHz;
RegCount = (sizeof(asT3B_DDRSetting80MHz)/
@@ -859,13 +848,9 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
sizeof(struct bcm_ddr_setting));
 
if(Adapter->bMipsConfig == MIPS_200_MHZ)
-   {
-   uiClockSetting = 0x03F13652;
-   }
+   uiClockSetting = 0x03F13652;
else
-   {
uiClockSetting = 0x03F1365B;
-   }
break;
 
case DDR_160_MHZ:
@@ -873,14 +858,10 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
RegCount = 
sizeof(asT3LPB_DDRSetting160MHz)/sizeof(struct bcm_ddr_setting);
 
if(Adapter->bMipsConfig == MIPS_200_MHZ)
-   {
uiClockSetting = 0x03F137D2;
-   }
else
-   {
uiClockSetting = 0x03F137DB;
-   }
-   }
+   }
break;
 
case 0xbece0110:
@@ -889,8 +870,7 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
case 0xbece0130:
case 0xbece0300:
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, 
"DDR Setting: %x\n", Adapter->DDRSetting);
-   switch (Adapter->DDRSetting)
-   {
+   switch (Adapter->DDRSetting) {
case DDR_80_MHZ:
psDDRSetting = asT3_DDRSetting80MHz;
RegCount = (sizeof(asT3_DDRSetting80MHz)/
@@ -910,9 +890,8 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
return -EINVAL;
}
case 0xbece0310:
-   {
-   switch (Adapter->DDRSetting)
-   {
+
+   switch (Adapter->DDRSetting) {
case DDR_80_MHZ:
psDDRSetting = asT3B_DDRSetting80MHz;
RegCount = (sizeof(asT3B_DDRSetting80MHz)/
@@ -925,51 +904,42 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
break;
case DDR_133_MHZ:
 
-   if(Adapter->bDPLLConfig == PLL_266_MHZ)//266Mhz PLL 
selected.
-   {
+   if(Adapter->bDPLLConfig == PLL_266_MHZ) {//266Mhz PLL 
selected.
+   
memcpy(asT3B_DDRSetting133MHz, asDPLL_266MHZ,
sizeof(asDPLL_266MHZ));
psDDRSetting = asT3B_DDRSetting

[PATCH 4/7] Staging: bcm: DDRInit: fixed parentheses coding style issues

2013-12-10 Thread Gary Rookard
Fixed coding style issues

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

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index a177cfe..8408640 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -798,7 +798,7 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
psDDRSetting = asT3LP_DDRSetting133MHz;
RegCount = (sizeof(asT3LP_DDRSetting133MHz)/
sizeof(struct bcm_ddr_setting));
-   if(Adapter->bMipsConfig == MIPS_200_MHZ)
+   if (Adapter->bMipsConfig == MIPS_200_MHZ)
uiClockSetting = 0x03F13652;
else
uiClockSetting = 0x03F1365B;
@@ -816,22 +816,22 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
/* Set bit 2 and bit 6 to 1 for BBIC 2mA drive
 * (please check current value and additionally set these bits)
 */
-   if( (Adapter->chip_id !=  BCS220_2) &&
+   if ((Adapter->chip_id !=  BCS220_2) &&
(Adapter->chip_id !=  BCS220_2BC) &&
-   (Adapter->chip_id != BCS220_3) ) {
+   (Adapter->chip_id != BCS220_3)) {
retval = rdmalt(Adapter, (UINT)0x0f000830, 
&uiResetValue, sizeof(uiResetValue));
-   if(retval < 0) {
+   if (retval < 0) {
BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, 
DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__);
return retval;
}
uiResetValue |= 0x44;
retval = wrmalt(Adapter, (UINT)0x0f000830, 
&uiResetValue, sizeof(uiResetValue));
-   if(retval < 0) {
+   if (retval < 0) {
BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, 
DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__);
return retval;
}
}
-   switch(Adapter->DDRSetting) {
+   switch (Adapter->DDRSetting) {
case DDR_80_MHZ:
psDDRSetting = asT3LPB_DDRSetting80MHz;
RegCount = (sizeof(asT3B_DDRSetting80MHz)/
@@ -847,7 +847,7 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
RegCount = (sizeof(asT3B_DDRSetting133MHz)/
sizeof(struct bcm_ddr_setting));
 
-   if(Adapter->bMipsConfig == MIPS_200_MHZ)
+   if (Adapter->bMipsConfig == MIPS_200_MHZ)
uiClockSetting = 0x03F13652;
else
uiClockSetting = 0x03F1365B;
@@ -857,7 +857,7 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
psDDRSetting = asT3LPB_DDRSetting160MHz;
RegCount = 
sizeof(asT3LPB_DDRSetting160MHz)/sizeof(struct bcm_ddr_setting);
 
-   if(Adapter->bMipsConfig == MIPS_200_MHZ)
+   if (Adapter->bMipsConfig == MIPS_200_MHZ)
uiClockSetting = 0x03F137D2;
else
uiClockSetting = 0x03F137DB;
@@ -902,10 +902,9 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
RegCount = (sizeof(asT3B_DDRSetting100MHz)/
sizeof(struct bcm_ddr_setting));
break;
-   case DDR_133_MHZ:
+   case DDR_133_MHZ:
 
-   if(Adapter->bDPLLConfig == PLL_266_MHZ) {//266Mhz PLL 
selected.
-   
+   if (Adapter->bDPLLConfig == PLL_266_MHZ) {  //266Mhz 
PLL selected.
memcpy(asT3B_DDRSetting133MHz, asDPLL_266MHZ,
sizeof(asDPLL_266MHZ));
psDDRSetting = asT3B_DDRSetting133MHz;
@@ -915,7 +914,7 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
psDDRSetting = asT3B_DDRSetting133MHz;
RegCount = (sizeof(asT3B_DDRSetting133MHz)/
sizeof(struct bcm_ddr_setting));
-   if(Adapter->bMipsConfig == MIPS_200_MHZ) 
+   if (Adapter->bMipsConfig == MIPS_200_MHZ)
uiClockSetting = 0x07F13652;
else
uiClockSetting = 0x07F1365B;
@@ -926,22 +925,22 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
}
b

[PATCH 6/7] Staging: bcm: DDRInit: fixed semicolon coding style issues

2013-12-10 Thread Gary Rookard
Fixed coding style issues.

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

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index 53f7191..100ddf9 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -1037,20 +1037,20 @@ int download_ddr_settings(struct bcm_mini_adapter 
*Adapter)
case DDR_80_MHZ:
psDDRSetting = asT3LP_DDRSetting80MHz;
RegCount = ARRAY_SIZE(asT3LP_DDRSetting80MHz);
-   RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
+   RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
break;
case DDR_100_MHZ:
psDDRSetting = asT3LP_DDRSetting100MHz;
RegCount = ARRAY_SIZE(asT3LP_DDRSetting100MHz);
-   RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
+   RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
break;
case DDR_133_MHZ:
bOverrideSelfRefresh = TRUE;
psDDRSetting = asT3LP_DDRSetting133MHz;
RegCount = ARRAY_SIZE(asT3LP_DDRSetting133MHz);
-   RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
+   RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
break;
default:
@@ -1067,20 +1067,20 @@ int download_ddr_settings(struct bcm_mini_adapter 
*Adapter)
case DDR_80_MHZ:
psDDRSetting = asT3LPB_DDRSetting80MHz;
RegCount = ARRAY_SIZE(asT3LPB_DDRSetting80MHz);
-   RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
+   RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
break;
case DDR_100_MHZ:
psDDRSetting = asT3LPB_DDRSetting100MHz;
RegCount = ARRAY_SIZE(asT3LPB_DDRSetting100MHz);
-   RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
+   RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
break;
case DDR_133_MHZ:
bOverrideSelfRefresh = TRUE;
psDDRSetting = asT3LPB_DDRSetting133MHz;
RegCount = ARRAY_SIZE(asT3LPB_DDRSetting133MHz);
-   RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
+   RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
break;
 
@@ -1101,20 +1101,20 @@ int download_ddr_settings(struct bcm_mini_adapter 
*Adapter)
case DDR_80_MHZ:
psDDRSetting = asT3_DDRSetting80MHz;
RegCount = ARRAY_SIZE(asT3_DDRSetting80MHz);
-   RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
+   RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
break;
case DDR_100_MHZ:
psDDRSetting = asT3_DDRSetting100MHz;
RegCount = ARRAY_SIZE(asT3_DDRSetting100MHz);
-   RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
+   RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
break;
case DDR_133_MHZ:
psDDRSetting = asT3_DDRSetting133MHz;
RegCount = ARRAY_SIZE(asT3_DDRSetting133MHz);
-   RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
-   psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
+   RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
+   psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
break;
default:
return -EINVAL;
@@ -1126,20 +1126,20 @@ int download_ddr_settings(struct bcm_mini_adapter 
*Adapter)
case DDR_80_MHZ:
psDDRSetting = asT3B_DDRSetting80MHz;
RegCount = ARRAY_SIZE(asT3B_DDRSetting80MHz);
-   RegCount -= T3B_SKI

[PATCH 5/7] Staging: bcm: DDRInit: fixed comment coding style issues

2013-12-10 Thread Gary Rookard
Fixed coding style issues.

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

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

Re: [PATCH 00/48] staging: comedi: pcmmio: cleanup driver

2013-12-10 Thread Ian Abbott

On 2013-12-09 22:30, H Hartley Sweeten wrote:

This driver is actually fairly simple but it's a bit confusing with all
the subdevice private data usage.

Clean the driver up and remove all the cruft.

H Hartley Sweeten (48):
   staging: comedi: pcmmio: remove unused {lock,unlock}_port()
   staging: comedi: pcmmio: tidy up switch_page()
   staging: comedi: pcmmio: cleanup comedi_lrange tables
   staging: comedi: pcmmio: use core helpers to munge bipolar ai data
   staging: comedi: pcmmio: cleanup ai_rinsn()
   staging: comedi: pcmmio: return error if ai conversion times out
   staging: comedi: pcmmio: define the offset to the 2nd ADC device
   staging: comedi: pcmmio: tidy up the ai subdevice init
   staging: comedi: pcmmio: move ai shadow data to device private data
   staging: comedi: pcmmio: remove 'iobase' from subdevice private data
   staging: comedi: pcmmio: cleanup ao_winsn()
   staging: comedi: pcmmio: return error if ao conversion times out
   staging: comedi: pcmmio: tidy up ao_rinsn()
   staging: comedi: pcmmio: tidy up the ao subdevice init
   staging: comedi: pcmmio: tidy up the irq request
   staging: comedi: pcmmio: remove unused members in private data
   staging: comedi: pcmmio: there is only one asic
   staging: comedi: pcmmio: remove 'asic' parameter from switch_page()
   staging: comedi: pcmmio: tidy up init_asics()
   staging: comedi: pcmmio: cleanup the digital i/o register defines
   staging: comedi: pcmmio: remove 'subpriv' macro
   staging: comedi: pcmmio: rename 'spinlock' in the private data
   staging: comedi: pcmmio: introduce pcmmio_dio_write()
   staging: comedi: pcmmio: simplify pcmmio_dio_insn_config()
   staging: comedi: pcmmio: simplify pcmmio_dio_insn_bits()
   staging: comedi: pcmmio: remove 'iobases' from the subdevice private data
   staging: comedi: pcmmio: simplify pcmmio_stop_intr()
   staging: comedi: pcmmio: unwind the digital i/o subdevice init
   staging: comedi: pcmmio: remove unnecessary for () loop and sanity check
   staging: comedi: pcmmio: remove 'asic' member from subdevice private data
   staging: comedi: pcmmio: remove 'first_chan' from subdevice private data
   staging: comedi: pcmmio: remove 'asic_chan' from subdevice private data
   staging: comedi: pcmmio: remove 'num_asic_chans' from subdevice private data
   staging: comedi: pcmmio: remove subdevice private data
   staging: comedi: pcmmio: use comedi_legacy_detach() for (*detach)
   staging: comedi: pcmmio: cleanup indent levels in interrupt_pcmmio()
   staging: comedi: pcmmio: use pcmmio_dio_{read,write}() in interrupt_pcmmio()
   staging: comedi: pcmmio: factor the trigger handling out of 
interrupt_pcmmio()
   staging: comedi: pcmmio: tidy up pcmmio_handle_dio_intr()
   staging: comedi: pcmmio: only hook up async command support if irq is 
available
   staging: comedi: pcmmio: setup irq routing during (*attach)
   staging: comedi: pcmmio: tidy up pcmmio_start_intr()
   staging: comedi: pcmmio: remove unused defines
   staging: comedi: pcmmio: cleanup the private data
   staging: comedi: pcmmio: return '0' after successful attach
   staging: comedi: pcmmio: update the MODULE_DESCRIPTION
   staging: comedi: pcmmio: tidy up the multi-line comments
   staging: comedi: pcmmio: fix final checkpatch warning

  drivers/staging/comedi/drivers/pcmmio.c | 1450 +--
  1 file changed, 582 insertions(+), 868 deletions(-)



All looks okay apart from the dodgy description of patch 09.

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 7/7] Staging: bcm: DDRInit: fixed a space coding style issue

2013-12-10 Thread Gary Rookard
Fixed a coding style issue.

Signed-off-by: Gary Alan Rookard 
---
On branch staging-next
 drivers/staging/bcm/DDRInit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index 100ddf9..43de518 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -3,7 +3,7 @@
 
 
 #define DDR_DUMP_INTERNAL_DEVICE_MEMORY 0xBFC02B00
-#define MIPS_CLOCK_REG 0x0f000820
+#define MIPS_CLOCK_REG 0x0f000820
 
 /* DDR INIT-133Mhz */
 #define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12  /*index for 0x0F007000 */
-- 
1.8.4

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


staging: comedi: USB devs not working / some comedi core reorganization

2013-12-10 Thread Bernd Porr

Hi all,

I've just checked out after a while the newest RC kernel and the 
usb-auto config/attach is broken. Seems so that the driver specific usb 
attach is no longer called and no firmware is loaded. Hartly, can you 
point me to the code bits which should call the driver spcific attach or 
give a short summary how that should work? I had a look at the git logs 
but there are quite lot of subsequent changes. Can you give me some 
guidance because it has changed a lot since I had a look at it the last 
time. I don't have much time this week but can crack on next week re 
that and test that thoroughly. Just now none of my DUX boards work at 
all. They all have the same problem that there are zero subdevices and 
the firmware is not loaded so I assume that the driver specific attach 
is not called.


/Bernd
--
www:http://www.berndporr.me.uk/
http://www.linux-usb-daq.co.uk/
http://www.imdb.com/name/nm3293421/
Mobile: +44 (0)7840 340069
Work:   +44 (0)141 330 5237
University of Glasgow
School of Engineering
Rankine Building, Oakfield Avenue,
Glasgow, G12 8LT
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/31] staging: comedi: tidy up all the comedi_lrange tables

2013-12-10 Thread Ian Abbott

On 2013-12-10 00:30, H Hartley Sweeten wrote:

This series cleans up all the comedi_lrange tables to make it easier to
spot common code that could be reduced.

The series is just to make it easier to review. If needed I can repost this
as a single patch.

H Hartley Sweeten (31):
   staging: comedi: pcl812: tidy up comedi_lrange tables
   staging: comedi: ni_mio_common: tidy up comedi_lrange tables
   staging: comedi: cb_pcidas64: tidy up comedi_lrange tables
   staging: comedi: pcl818: tidy up comedi_lrange tables
   staging: comedi: adv_pci1710: tidy up comedi_lrange tables
   staging: comedi: das08: tidy up comedi_lrange tables
   staging: comedi: dt2801: tidy up comedi_lrange tables
   staging: comedi: cb_pcidas: tidy up comedi_lrange tables
   staging: comedi: ni_atmio16d: tidy up comedi_lrange tables
   staging: comedi: dt2811: tidy up comedi_lrange tables
   staging: comedi: dt282x: tidy up comedi_lrange tables
   staging: comedi: das1800: tidy up comedi_lrange tables
   staging: comedi: adl_pci9118: tidy up comedi_lrange tables
   staging: comedi: amplc_pci224: tidy up comedi_lrange tables
   staging: comedi: ni_pcimio: tidy up comedi_lrange tables
   staging: comedi: amplc_pci230: tidy up comedi_lrange tables
   staging: comedi: dmm32at: tidy up comedi_lrange tables
   staging: comedi: adq12b: tidy up comedi_lrange tables
   staging: comedi: das16m1: tidy up comedi_lrange tables
   staging: comedi: fl512: tidy up comedi_lrange tables
   staging: comedi: pcl816: tidy up comedi_lrange tables
   staging: comedi: aio_aio12_8: tidy up comedi_lrange tables
   staging: comedi: icp_multi: tidy up comedi_lrange tables
   staging: comedi: me4000: tidy up comedi_lrange tables
   staging: comedi: dyna_pci10xx: tidy up comedi_lrange tables
   staging: comedi: comedi_test: tidy up comedi_lrange tables
   staging: comedi: ni_at_a2150: tidy up comedi_lrange tables
   staging: comedi: usbduxfast: tidy up comedi_lrange tables
   staging: comedi: adv_pci1724: tidy up comedi_lrange tables
   staging: comedi: adl_pci9111: tidy up comedi_lrange tables
   staging: comedi: s626: tidy up comedi_lrange table

  drivers/staging/comedi/drivers/adl_pci9111.c   |   3 +-
  drivers/staging/comedi/drivers/adl_pci9118.c   |  42 +++--
  drivers/staging/comedi/drivers/adq12b.c|  27 +--
  drivers/staging/comedi/drivers/adv_pci1710.c   |  89 -
  drivers/staging/comedi/drivers/adv_pci1724.c   |   4 +-
  drivers/staging/comedi/drivers/aio_aio12_8.c   |  13 +-
  drivers/staging/comedi/drivers/amplc_pci224.c  |  44 ++---
  drivers/staging/comedi/drivers/amplc_pci230.c  |  28 +--
  drivers/staging/comedi/drivers/cb_pcidas.c |  55 +++---
  drivers/staging/comedi/drivers/cb_pcidas64.c   | 142 +++---
  drivers/staging/comedi/drivers/comedi_test.c   |   9 +-
  drivers/staging/comedi/drivers/das08.c |  75 
  drivers/staging/comedi/drivers/das16m1.c   |  24 +--
  drivers/staging/comedi/drivers/das1800.c   |  49 +++--
  drivers/staging/comedi/drivers/dmm32at.c   |  26 ++-
  drivers/staging/comedi/drivers/dt2801.c|  72 +++
  drivers/staging/comedi/drivers/dt2811.c|  48 ++---
  drivers/staging/comedi/drivers/dt282x.c|  48 ++---
  drivers/staging/comedi/drivers/dyna_pci10xx.c  |  11 +-
  drivers/staging/comedi/drivers/fl512.c |  19 +-
  drivers/staging/comedi/drivers/icp_multi.c |  13 +-
  drivers/staging/comedi/drivers/me4000.c|  13 +-
  drivers/staging/comedi/drivers/ni_at_a2150.c   |   7 +-
  drivers/staging/comedi/drivers/ni_atmio16d.c   |  51 +++--
  drivers/staging/comedi/drivers/ni_mio_common.c | 180 +-
  drivers/staging/comedi/drivers/ni_pcimio.c |  34 ++--
  drivers/staging/comedi/drivers/pcl812.c| 248 +
  drivers/staging/comedi/drivers/pcl816.c|  21 ++-
  drivers/staging/comedi/drivers/pcl818.c| 104 +++
  drivers/staging/comedi/drivers/s626.c  |   2 +-
  drivers/staging/comedi/drivers/usbduxfast.c|   5 +-
  31 files changed, 757 insertions(+), 749 deletions(-)



All pretty trivial changes, so I can't imagine it doing any harm!

Reviewed-by: Ian Abbott 

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


RE: staging: comedi: USB devs not working / some comedi core reorganization

2013-12-10 Thread Hartley Sweeten
On Tuesday, December 10, 2013 4:48 AM, Bernd Porr wrote:
> I've just checked out after a while the newest RC kernel and the 
> usb-auto config/attach is broken. Seems so that the driver specific usb 
> attach is no longer called and no firmware is loaded. Hartly, can you 
> point me to the code bits which should call the driver spcific attach or 
> give a short summary how that should work? I had a look at the git logs 
> but there are quite lot of subsequent changes. Can you give me some 
> guidance because it has changed a lot since I had a look at it the last 
> time. I don't have much time this week but can crack on next week re 
> that and test that thoroughly. Just now none of my DUX boards work at 
> all. They all have the same problem that there are zero subdevices and 
> the firmware is not loaded so I assume that the driver specific attach 
> is not called.

Hello Bernd,

I'm not sure why the usbdux drivers are not auto attaching correctly.
Sorry about the problems.

What version of the kernel are you testing with?

Are the USB_DEVICE() id's correct in the driver?

The comedi USB drivers should auto attach when the device is detected.
The USB driver (*probe) will call comedi_usb_auto_config() which then
calls the comedi driver (*auto_attach).

All of the usbdux drivers do the initial USB setup, buffer allocation etc., then
call comedi_load_firmware() to request and load the firmware for the device.
After that the subdevices are allocated and initialized.

Try putting a couple printk debug messages in the usb (*probe) and comedi 
(*auto_attach) functions in the drivers. You might also put a printk in the
callback functions that actually upload the firmware to the device.

Please let me know what you find. Hopefully this is a minor bug and we can
resolve it quickly.

Thanks,
Hartley

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


Re: staging: comedi: USB devs not working / some comedi core reorganization

2013-12-10 Thread Bernd Porr

Hi all,

here is the patch to fix the original bug. That was easier than I 
expected. That's against the latest RC kernel.


However there are a couple other issues now.

There seems to be an issue with comedi generic timed and the commands 
correcting the TRIG bit. It ANDs the right bit values first in the 
"comedi_get_cmd_generic_timed" but then "comedi_command_test" gets just 
0 and then cmd fails:


[ 9525.967397] usbcore: registered new interface driver usbduxsigma
[ 9539.981072] cfc_check_trigger_src: orig_src=, *src=82
[ 9539.981079] TRIG_NOW | TRIG_INT err=-22, cmd->start_src=82
[ 9539.981082] cfc_check_trigger_src: orig_src=, *src=10
[ 9539.981085] TRIG_TIMER err=-22, cmd->scan_begin_src=10
[ 9539.981088] cfc_check_trigger_src: orig_src=, *src=2
[ 9539.981091] TRIG_NOW err=-22, cmd->convert_src=2
[ 9539.981094] cfc_check_trigger_src: orig_src=, *src=20
[ 9539.981096] TRIG_COUNT err=-22, cmd->scan_end_src=20
[ 9539.981099] cfc_check_trigger_src: orig_src=, *src=21
[ 9539.981102] TRIG_COUNT | TRIG_NONE err=-22, cmd->stop_src=21
[ 9539.981104] Wrong TRIG source
[ 9539.981167] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981171] TRIG_NOW | TRIG_INT err=-22, cmd->start_src=0
[ 9539.981173] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981176] TRIG_TIMER err=-22, cmd->scan_begin_src=0
[ 9539.981178] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981181] TRIG_NOW err=-22, cmd->convert_src=0
[ 9539.981183] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981185] TRIG_COUNT err=-22, cmd->scan_end_src=0
[ 9539.981187] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981190] TRIG_COUNT | TRIG_NONE err=-22, cmd->stop_src=0
[ 9539.981192] Wrong TRIG source
[ 9539.981196] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981199] TRIG_NOW | TRIG_INT err=-22, cmd->start_src=0
[ 9539.981201] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981203] TRIG_TIMER err=-22, cmd->scan_begin_src=0
[ 9539.981205] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981208] TRIG_NOW err=-22, cmd->convert_src=0
[ 9539.981210] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981212] TRIG_COUNT err=-22, cmd->scan_end_src=0
[ 9539.981214] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981216] TRIG_COUNT | TRIG_NONE err=-22, cmd->stop_src=0
[ 9539.981218] Wrong TRIG source

Userspace program (cmd.c):

ret = comedi_command_test(dev, cmd);
if(ret < 0){
comedi_perror("comedi_command_test");
if(errno == EIO){
fprintf(stderr,"Ummm... this subdevice doesn't 
support commands\n");

}
exit(1);
}
ret = comedi_command_test(dev, cmd);
if(ret < 0){
comedi_perror("comedi_command_test");
exit(1);
}
fprintf(stderr,"second test returned %d (%s)\n", ret,
cmdtest_messages[ret]);
^^ stops here


hacked cfc_check_trigger_src:
-

static inline int cfc_check_trigger_src(unsigned int *src, unsigned int 
flags)

{
unsigned int orig_src = *src;

*src = orig_src & flags;
printk("cfc_check_trigger_src: orig_src=%x, *src=%x 
\n",orig_src,*src );

if (*src == TRIG_INVALID || *src != orig_src)
return -EINVAL;
return 0;
}


Any ideas?


There is another issue which has to the with the subdevices. This 
happens when I unplug the DUX board (all boards cause this):


[ 4972.978379] [ cut here ]
[ 4972.978386] WARNING: CPU: 0 PID: 33 at fs/sysfs/group.c:214 
sysfs_remove_group+0xc6/0xd0()
[ 4972.978389] sysfs group 81caa2e0 not found for kobject 
'comedi0_subd1'
[ 4972.978392] Modules linked in: usbdux(O) usbduxsigma(O) comedi_fc(O) 
comedi(O) radeon bnep rfcomm bluetooth snd_hda_codec_idt snd_hda_intel 
snd_hda_codec parport_pc ppdev rc_hauppauge snd_bt87x ir_kbd_i2c 
snd_hwdep tuner snd_pcm msp3400 snd_page_alloc snd_seq_midi bttv 
snd_seq_midi_event snd_rawmidi pcmcia hid_generic snd_seq pcmcia_core 
ttm usbhid hid drm_kms_helper snd_seq_device drm btcx_risc snd_timer 
tveeprom videobuf_dma_sg rc_core snd v4l2_common psmouse videobuf_core 
gpio_ich videodev dcdbas microcode serio_raw lpc_ich i2c_algo_bit 
soundcore mac_hid lp parport e100 ahci mii libahci [last unloaded: comedi]
[ 4972.978454] CPU: 0 PID: 33 Comm: khubd Tainted: GWC O 
3.13.0-rc3+ #1
[ 4972.978457] Hardware name: Dell Inc. Dimension 9100 
 /0X8582, BIOS A01 05/25/2005
[ 4972.978460]  0009 88005c801a38 81721083 
88005c801a80
[ 4972.978466]  88005c801a70 810645fd  
81caa2e0
[ 4972.978472]  8800560ed810 88005a615000  
88005c801ad0

[ 4972.978478] Call Trace:
[ 4972.978484]  [] dump_stack+0x45/0x56
[ 4972.978489]  [] warn_slowpath_common+0x7d/0xa0
[ 4972.978494]  [] warn_slowpath_fmt+0x4c/0x50
[ 4972.978499]  [] 

Re: staging: comedi: USB devs not working / some comedi core reorganization

2013-12-10 Thread Ian Abbott

On 2013-12-10 21:07, Bernd Porr wrote:

Date: Tue, 10 Dec 2013 19:42:13 +
Subject: [PATCH 1/1] comedi_load_firmware returns the number of transmitted
  bytes to the USB controller. The result is negative on failure. Thus, the ret
  argument needs to be checked if negative.

Signed-off-by: Bernd Porr
---
  drivers/staging/comedi/drivers/usbduxfast.c  | 2 +-
  drivers/staging/comedi/drivers/usbduxsigma.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 9707dd1..4b7f360 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -1092,7 +1092,7 @@ static int usbduxfast_auto_attach(struct comedi_device 
*dev,

ret = comedi_load_firmware(dev, &usb->dev, FIRMWARE,
   usbduxfast_upload_firmware, 0);
-   if (ret)
+   if (ret < 0)
return ret;

return usbduxfast_attach_common(dev);
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index a5363de..4ee6271 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -1596,7 +1596,7 @@ static int usbduxsigma_auto_attach(struct comedi_device 
*dev,

ret = comedi_load_firmware(dev, &usb->dev, FIRMWARE,
   usbduxsigma_firmware_upload, 0);
-   if (ret)
+   if (ret < 0)
return ret;

ret = comedi_alloc_subdevices(dev, (devpriv->high_speed) ? 4 : 3);
-- 1.8.5.1


It might be better just to prevent comedi_load_firmware() returning a 
value greater than zero, since I can't think of any reason why it would 
need to.  That would also work for the usbdux driver.


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


Re: staging: comedi: USB devs not working / some comedi core reorganization

2013-12-10 Thread Ian Abbott

On 2013-12-10 21:07, Bernd Porr wrote:

Hi all,

here is the patch to fix the original bug. That was easier than I
expected. That's against the latest RC kernel.

However there are a couple other issues now.

There seems to be an issue with comedi generic timed and the commands
correcting the TRIG bit. It ANDs the right bit values first in the
"comedi_get_cmd_generic_timed" but then "comedi_command_test" gets just
0 and then cmd fails:

[ 9525.967397] usbcore: registered new interface driver usbduxsigma
[ 9539.981072] cfc_check_trigger_src: orig_src=, *src=82
[ 9539.981079] TRIG_NOW | TRIG_INT err=-22, cmd->start_src=82
[ 9539.981082] cfc_check_trigger_src: orig_src=, *src=10
[ 9539.981085] TRIG_TIMER err=-22, cmd->scan_begin_src=10
[ 9539.981088] cfc_check_trigger_src: orig_src=, *src=2
[ 9539.981091] TRIG_NOW err=-22, cmd->convert_src=2
[ 9539.981094] cfc_check_trigger_src: orig_src=, *src=20
[ 9539.981096] TRIG_COUNT err=-22, cmd->scan_end_src=20
[ 9539.981099] cfc_check_trigger_src: orig_src=, *src=21
[ 9539.981102] TRIG_COUNT | TRIG_NONE err=-22, cmd->stop_src=21
[ 9539.981104] Wrong TRIG source
[ 9539.981167] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981171] TRIG_NOW | TRIG_INT err=-22, cmd->start_src=0
[ 9539.981173] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981176] TRIG_TIMER err=-22, cmd->scan_begin_src=0
[ 9539.981178] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981181] TRIG_NOW err=-22, cmd->convert_src=0
[ 9539.981183] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981185] TRIG_COUNT err=-22, cmd->scan_end_src=0
[ 9539.981187] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981190] TRIG_COUNT | TRIG_NONE err=-22, cmd->stop_src=0
[ 9539.981192] Wrong TRIG source
[ 9539.981196] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981199] TRIG_NOW | TRIG_INT err=-22, cmd->start_src=0
[ 9539.981201] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981203] TRIG_TIMER err=-22, cmd->scan_begin_src=0
[ 9539.981205] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981208] TRIG_NOW err=-22, cmd->convert_src=0
[ 9539.981210] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981212] TRIG_COUNT err=-22, cmd->scan_end_src=0
[ 9539.981214] cfc_check_trigger_src: orig_src=0, *src=0
[ 9539.981216] TRIG_COUNT | TRIG_NONE err=-22, cmd->stop_src=0
[ 9539.981218] Wrong TRIG source

Userspace program (cmd.c):

  ret = comedi_command_test(dev, cmd);
  if(ret < 0){
  comedi_perror("comedi_command_test");
  if(errno == EIO){
  fprintf(stderr,"Ummm... this subdevice doesn't
support commands\n");
  }
  exit(1);
  }
  ret = comedi_command_test(dev, cmd);
  if(ret < 0){
  comedi_perror("comedi_command_test");
  exit(1);
  }
  fprintf(stderr,"second test returned %d (%s)\n", ret,
  cmdtest_messages[ret]);
^^ stops here


hacked cfc_check_trigger_src:
-

static inline int cfc_check_trigger_src(unsigned int *src, unsigned int
flags)
{
  unsigned int orig_src = *src;

  *src = orig_src & flags;
  printk("cfc_check_trigger_src: orig_src=%x, *src=%x
\n",orig_src,*src );
  if (*src == TRIG_INVALID || *src != orig_src)
  return -EINVAL;
  return 0;
}


Any ideas?


I don't know off-hand, but I'll take a look when I get the chance.



There is another issue which has to the with the subdevices. This
happens when I unplug the DUX board (all boards cause this):

[ 4972.978379] [ cut here ]
[ 4972.978386] WARNING: CPU: 0 PID: 33 at fs/sysfs/group.c:214
sysfs_remove_group+0xc6/0xd0()
[ 4972.978389] sysfs group 81caa2e0 not found for kobject
'comedi0_subd1'
[ 4972.978392] Modules linked in: usbdux(O) usbduxsigma(O) comedi_fc(O)
comedi(O) radeon bnep rfcomm bluetooth snd_hda_codec_idt snd_hda_intel
snd_hda_codec parport_pc ppdev rc_hauppauge snd_bt87x ir_kbd_i2c
snd_hwdep tuner snd_pcm msp3400 snd_page_alloc snd_seq_midi bttv
snd_seq_midi_event snd_rawmidi pcmcia hid_generic snd_seq pcmcia_core
ttm usbhid hid drm_kms_helper snd_seq_device drm btcx_risc snd_timer
tveeprom videobuf_dma_sg rc_core snd v4l2_common psmouse videobuf_core
gpio_ich videodev dcdbas microcode serio_raw lpc_ich i2c_algo_bit
soundcore mac_hid lp parport e100 ahci mii libahci [last unloaded: comedi]
[ 4972.978454] CPU: 0 PID: 33 Comm: khubd Tainted: GWC O
3.13.0-rc3+ #1
[ 4972.978457] Hardware name: Dell Inc. Dimension 9100
   /0X8582, BIOS A01 05/25/2005
[ 4972.978460]  0009 88005c801a38 81721083
88005c801a80
[ 4972.978466]  88005c801a70 810645fd 
81caa2e0
[ 4972.978472]  8800560ed810 88005a615000 
88005c801ad0
[ 4972.978478] Call Trace:
[ 4972.978484]  [] dump_stack+0x

[PATCH v3] Staging: TIDSPBRIDGE: Remove UUID helper

2013-12-10 Thread Ivaylo DImitrov
From: Ivaylo Dimitrov 

Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't
need to be exported. It can also be made way simpler by using sscanf.

Signed-off-by: Ivaylo Dimitrov 
---
 drivers/staging/tidspbridge/Makefile   |2 +-
 drivers/staging/tidspbridge/gen/uuidutil.c |   85 ---
 .../tidspbridge/include/dspbridge/uuidutil.h   |   18 
 drivers/staging/tidspbridge/rmgr/dbdcd.c   |  108 +++-
 4 files changed, 81 insertions(+), 132 deletions(-)
 delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c

diff --git a/drivers/staging/tidspbridge/Makefile 
b/drivers/staging/tidspbridge/Makefile
index 230e3e6..2e77734 100644
--- a/drivers/staging/tidspbridge/Makefile
+++ b/drivers/staging/tidspbridge/Makefile
@@ -1,6 +1,6 @@
 obj-$(CONFIG_TIDSPBRIDGE)  += tidspbridge.o
 
-libgen = gen/gh.o gen/uuidutil.o
+libgen = gen/gh.o
 libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \
core/tiomap3430_pwr.o core/tiomap_io.o \
core/ue_deh.o core/wdt.o core/dsp-clock.o core/sync.o
diff --git a/drivers/staging/tidspbridge/gen/uuidutil.c 
b/drivers/staging/tidspbridge/gen/uuidutil.c
deleted file mode 100644
index b7d8313..000
--- a/drivers/staging/tidspbridge/gen/uuidutil.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * uuidutil.c
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * This file contains the implementation of UUID helper functions.
- *
- * Copyright (C) 2005-2006 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-#include 
-
-/*  --- Host OS */
-#include 
-
-/*  --- DSP/BIOS Bridge */
-#include 
-
-/*  --- This */
-#include 
-
-static s32 uuid_hex_to_bin(char *buf, s32 len)
-{
-   s32 i;
-   s32 result = 0;
-   int value;
-
-   for (i = 0; i < len; i++) {
-   value = hex_to_bin(*buf++);
-   result *= 16;
-   if (value > 0)
-   result += value;
-   }
-
-   return result;
-}
-
-/*
- *   uuid_uuid_from_string 
- *  Purpose:
- *  Converts a string to a struct dsp_uuid.
- */
-void uuid_uuid_from_string(char *sz_uuid, struct dsp_uuid *uuid_obj)
-{
-   s32 j;
-
-   uuid_obj->data1 = uuid_hex_to_bin(sz_uuid, 8);
-   sz_uuid += 8;
-
-   /* Step over underscore */
-   sz_uuid++;
-
-   uuid_obj->data2 = (u16) uuid_hex_to_bin(sz_uuid, 4);
-   sz_uuid += 4;
-
-   /* Step over underscore */
-   sz_uuid++;
-
-   uuid_obj->data3 = (u16) uuid_hex_to_bin(sz_uuid, 4);
-   sz_uuid += 4;
-
-   /* Step over underscore */
-   sz_uuid++;
-
-   uuid_obj->data4 = (u8) uuid_hex_to_bin(sz_uuid, 2);
-   sz_uuid += 2;
-
-   uuid_obj->data5 = (u8) uuid_hex_to_bin(sz_uuid, 2);
-   sz_uuid += 2;
-
-   /* Step over underscore */
-   sz_uuid++;
-
-   for (j = 0; j < 6; j++) {
-   uuid_obj->data6[j] = (u8) uuid_hex_to_bin(sz_uuid, 2);
-   sz_uuid += 2;
-   }
-}
diff --git a/drivers/staging/tidspbridge/include/dspbridge/uuidutil.h 
b/drivers/staging/tidspbridge/include/dspbridge/uuidutil.h
index 414bf71..b4951a1 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/uuidutil.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/uuidutil.h
@@ -21,22 +21,4 @@
 
 #define MAXUUIDLEN  37
 
-/*
- *   uuid_uuid_from_string 
- *  Purpose:
- *  Converts an ANSI string to a dsp_uuid.
- *  Parameters:
- *  sz_uuid:Pointer to a string that represents a dsp_uuid object.
- *  uuid_obj:  Pointer to a dsp_uuid object.
- *  Returns:
- *  Requires:
- *  uuid_obj & sz_uuid are non-NULL values.
- *  Ensures:
- *  Details:
- *  We assume the string representation of a UUID has the following format:
- *  "12345678_1234_1234_1234_123456789abc".
- */
-extern void uuid_uuid_from_string(char *sz_uuid,
- struct dsp_uuid *uuid_obj);
-
 #endif /* UUIDUTIL_ */
diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c 
b/drivers/staging/tidspbridge/rmgr/dbdcd.c
index 3d2a26f..190ca3f 100644
--- a/drivers/staging/tidspbridge/rmgr/dbdcd.c
+++ b/drivers/staging/tidspbridge/rmgr/dbdcd.c
@@ -74,6 +74,47 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr,
   enum nldr_phase phase);
 
 /*
+ *   dcd_uuid_from_string 
+ *  Purpose:
+ *  Converts an ANSI string to a dsp_uuid.
+ *  Parameters:
+ *  sz_uuid

Re: staging: comedi: USB devs not working / some comedi core reorganization

2013-12-10 Thread Bernd Porr
Good point. Nobody cares really how many bytes the firmware uploader 
sends to the DUX-board.


/Bernd

On 10/12/13 21:30, Ian Abbott wrote:

On 2013-12-10 21:07, Bernd Porr wrote:

Date: Tue, 10 Dec 2013 19:42:13 +
Subject: [PATCH 1/1] comedi_load_firmware returns the number of
transmitted
  bytes to the USB controller. The result is negative on failure.
Thus, the ret
  argument needs to be checked if negative.

Signed-off-by: Bernd Porr
---
  drivers/staging/comedi/drivers/usbduxfast.c  | 2 +-
  drivers/staging/comedi/drivers/usbduxsigma.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c
b/drivers/staging/comedi/drivers/usbduxfast.c
index 9707dd1..4b7f360 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -1092,7 +1092,7 @@ static int usbduxfast_auto_attach(struct
comedi_device *dev,

  ret = comedi_load_firmware(dev, &usb->dev, FIRMWARE,
 usbduxfast_upload_firmware, 0);
-if (ret)
+if (ret < 0)
  return ret;

  return usbduxfast_attach_common(dev);
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c
b/drivers/staging/comedi/drivers/usbduxsigma.c
index a5363de..4ee6271 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -1596,7 +1596,7 @@ static int usbduxsigma_auto_attach(struct
comedi_device *dev,

  ret = comedi_load_firmware(dev, &usb->dev, FIRMWARE,
 usbduxsigma_firmware_upload, 0);
-if (ret)
+if (ret < 0)
  return ret;

  ret = comedi_alloc_subdevices(dev, (devpriv->high_speed) ? 4 : 3);
-- 1.8.5.1


It might be better just to prevent comedi_load_firmware() returning a
value greater than zero, since I can't think of any reason why it would
need to.  That would also work for the usbdux driver.



--
www:http://www.berndporr.me.uk/
http://www.linux-usb-daq.co.uk/
http://www.imdb.com/name/nm3293421/
Mobile: +44 (0)7840 340069
Work:   +44 (0)141 330 5237
University of Glasgow
School of Engineering
Rankine Building, Oakfield Avenue,
Glasgow, G12 8LT
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: staging: comedi: USB devs not working / some comedi core reorganization

2013-12-10 Thread Dan Carpenter
On Tue, Dec 10, 2013 at 09:30:43PM +, Ian Abbott wrote:
> 
> It might be better just to prevent comedi_load_firmware() returning
> a value greater than zero, since I can't think of any reason why it
> would need to.  That would also work for the usbdux driver.
> 

Yeah.  It looks like it's usbduxfast_upload_firmware() which has the
problem.  Does this fix your problem?  This bug was introduced in
161f440c8d91 ('staging: comedi: drivers: usbduxfast.c: fix for DMA
buffers on stack')

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 9707dd1239c4..f2d8d7fb7aab 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -1040,6 +1040,7 @@ static int usbduxfast_upload_firmware(struct 
comedi_device *dev,
  EZTIMEOUT);
if (ret < 0)
dev_err(dev->class_dev, "can not start firmware\n");
+   ret = 0;
 
 done:
kfree(tmp);
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: staging: comedi: USB devs not working / some comedi core reorganization

2013-12-10 Thread Hartley Sweeten
On Tuesday, December 10, 2013 3:28 PM, Dan Carpenter wrote:
> On Tue, Dec 10, 2013 at 09:30:43PM +, Ian Abbott wrote:
>> 
>> It might be better just to prevent comedi_load_firmware() returning
>> a value greater than zero, since I can't think of any reason why it
>> would need to.  That would also work for the usbdux driver.
>> 
>
> Yeah.  It looks like it's usbduxfast_upload_firmware() which has the
 >problem.  Does this fix your problem?  This bug was introduced in
> 161f440c8d91 ('staging: comedi: drivers: usbduxfast.c: fix for DMA
> buffers on stack')

Actually I think I broke it when I introduced the comedi_upload_firmware()
helper and converted the usbdux drivers to use it.

> diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
> b/drivers/staging/comedi/drivers/usbduxfast.c
> index 9707dd1239c4..f2d8d7fb7aab 100644
> --- a/drivers/staging/comedi/drivers/usbduxfast.c
> +++ b/drivers/staging/comedi/drivers/usbduxfast.c
> @@ -1040,6 +1040,7 @@ static int usbduxfast_upload_firmware(struct 
> comedi_device *dev,
> EZTIMEOUT);
>   if (ret < 0)
>   dev_err(dev->class_dev, "can not start firmware\n");
> + ret = 0;
>  
>  done:
>   kfree(tmp);

This would only fix the usbduxfast driver.

I think Ian's comment about fixing comedi_load_firmware() is the correct
one.  This should do it:


>From dcb9cae663fb7489e235569de20ac5757450953d Mon Sep 17 00:00:00 2001
From: H Hartley Sweeten 
Date: Tue, 18 Jun 2013 13:21:13 -0700
Subject: [PATCH] staging: comedi: drivers: fix return value of
 comedi_load_firmware()

Some of the callback functions that upload the firmware in the comedi
drivers return a positive value indicating the number of bytes sent
to the device. Detect this condition and just return '0' to indicate
a successful upload.

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

diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index a5d03b9..9d71b4d 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -451,7 +451,7 @@ int comedi_load_firmware(struct comedi_device *dev,
release_firmware(fw);
}
 
-   return ret;
+   return ret < 0 ? ret : 0;
 }
 EXPORT_SYMBOL_GPL(comedi_load_firmware);
 
-- 
1.8.4.4


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


RE: staging: comedi: USB devs not working / some comedi core reorganization

2013-12-10 Thread Hartley Sweeten
On Tuesday, December 10, 2013 4:29 PM, Bernd Porr wrote:
>
> Agree with your comments. Let's just do the
>
> return ret < 0 ? ret : 0;
>
> and it's sorted. Thanks for the quick reply.

Ok. I'll post this as a proper patch in a sec.

Hartley

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


[PATCH] staging: comedi: drivers: fix return value of comedi_load_firmware()

2013-12-10 Thread H Hartley Sweeten
Some of the callback functions that upload the firmware in the comedi
drivers return a positive value indicating the number of bytes sent
to the device. Detect this condition and just return '0' to indicate
a successful upload.

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

diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index a5d03b9..9d71b4d 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -451,7 +451,7 @@ int comedi_load_firmware(struct comedi_device *dev,
release_firmware(fw);
}
 
-   return ret;
+   return ret < 0 ? ret : 0;
 }
 EXPORT_SYMBOL_GPL(comedi_load_firmware);
 
-- 
1.8.4.4

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


Re: staging: comedi: USB devs not working / some comedi core reorganization

2013-12-10 Thread Bernd Porr

Agree with your comments. Let's just do the

return ret < 0 ? ret : 0;

and it's sorted. Thanks for the quick reply.

/Bernd

On 10/12/13 23:24, Hartley Sweeten wrote:

On Tuesday, December 10, 2013 3:28 PM, Dan Carpenter wrote:

On Tue, Dec 10, 2013 at 09:30:43PM +, Ian Abbott wrote:


It might be better just to prevent comedi_load_firmware() returning
a value greater than zero, since I can't think of any reason why it
would need to.  That would also work for the usbdux driver.



Yeah.  It looks like it's usbduxfast_upload_firmware() which has the

  >problem.  Does this fix your problem?  This bug was introduced in

161f440c8d91 ('staging: comedi: drivers: usbduxfast.c: fix for DMA
buffers on stack')


Actually I think I broke it when I introduced the comedi_upload_firmware()
helper and converted the usbdux drivers to use it.


diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 9707dd1239c4..f2d8d7fb7aab 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -1040,6 +1040,7 @@ static int usbduxfast_upload_firmware(struct 
comedi_device *dev,
  EZTIMEOUT);
if (ret < 0)
dev_err(dev->class_dev, "can not start firmware\n");
+   ret = 0;

  done:
kfree(tmp);


This would only fix the usbduxfast driver.

I think Ian's comment about fixing comedi_load_firmware() is the correct
one.  This should do it:


 From dcb9cae663fb7489e235569de20ac5757450953d Mon Sep 17 00:00:00 2001
From: H Hartley Sweeten 
Date: Tue, 18 Jun 2013 13:21:13 -0700
Subject: [PATCH] staging: comedi: drivers: fix return value of
  comedi_load_firmware()

Some of the callback functions that upload the firmware in the comedi
drivers return a positive value indicating the number of bytes sent
to the device. Detect this condition and just return '0' to indicate
a successful upload.

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

diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index a5d03b9..9d71b4d 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -451,7 +451,7 @@ int comedi_load_firmware(struct comedi_device *dev,
release_firmware(fw);
}

-   return ret;
+   return ret < 0 ? ret : 0;
  }
  EXPORT_SYMBOL_GPL(comedi_load_firmware);




--
www:http://www.berndporr.me.uk/
http://www.linux-usb-daq.co.uk/
http://www.imdb.com/name/nm3293421/
Mobile: +44 (0)7840 340069
Work:   +44 (0)141 330 5237
University of Glasgow
School of Engineering
Rankine Building, Oakfield Avenue,
Glasgow, G12 8LT
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: staging: comedi: USB devs not working / some comedi core reorganization

2013-12-10 Thread Bernd Porr



hacked cfc_check_trigger_src:
-

static inline int cfc_check_trigger_src(unsigned int *src, unsigned int
flags)
{
  unsigned int orig_src = *src;

  *src = orig_src & flags;
  printk("cfc_check_trigger_src: orig_src=%x, *src=%x
\n",orig_src,*src );
  if (*src == TRIG_INVALID || *src != orig_src)
  return -EINVAL;
  return 0;
}


Any ideas?


I don't know off-hand, but I'll take a look when I get the chance.
This is the first time comedi_command_test is called in generic_timed 
(in comedilib / userspace). That assumes that the subdevice is 
initialised, in particular the cmd_mask. Can it be that this sometimes 
won't happen? The behaviour is pretty random so it might be an 
uninitialised struct. Return value of generic_timed is -1 just now but 
had also 1 in the past.


/Bernd

EXPORT_ALIAS_DEFAULT(_comedi_get_cmd_src_mask,comedi_get_cmd_src_mask,0.7.18);
int _comedi_get_cmd_src_mask(comedi_t *it,unsigned int subd,comedi_cmd *cmd)
{
subdevice *s;
int ret;

if(!valid_subd(it,subd))return -1;

s=it->subdevices+subd;

if(s->cmd_mask_errno){
errno = s->cmd_mask_errno;
return -1;
}

if(!s->cmd_mask){
comedi_cmd *mask;

mask = malloc(sizeof(comedi_cmd));

memset(mask,0,sizeof(*cmd));

mask->subdev = subd;
mask->flags = 0;
mask->start_src = TRIG_ANY;
mask->scan_begin_src = TRIG_ANY;
mask->convert_src = TRIG_ANY;
mask->scan_end_src = TRIG_ANY;
mask->stop_src = TRIG_ANY;

s->cmd_mask = mask;

ret = comedi_command_test(it,mask);
if(ret<0){
s->cmd_mask_errno = errno;
return -1;
}


static int __generic_timed(comedi_t *it, unsigned s,
comedi_cmd *cmd, unsigned chanlist_len, unsigned scan_period_ns)
{
int ret;
unsigned convert_period_ns;

if(chanlist_len < 1) return -EINVAL;
ret = comedi_get_cmd_src_mask(it,s,cmd);
if(ret<0)return ret;

__comedi_errno = ENOTSUPPORTED;

if(cmd->start_src&TRIG_NOW){
cmd->start_src=TRIG_NOW;
cmd->start_arg=0;
}else if(cmd->start_src&TRIG_INT){
cmd->start_src=TRIG_INT;
cmd->start_arg=0;
}else{
COMEDILIB_DEBUG(3,"can't find good start_src\n");
return -1;
}

convert_period_ns = (scan_period_ns + chanlist_len / 2) / 
chanlist_len;

if((cmd->convert_src & TRIG_TIMER) &&
(cmd->scan_begin_src & TRIG_FOLLOW))
{
cmd->convert_src = TRIG_TIMER;
cmd->convert_arg = convert_period_ns;
cmd->scan_begin_src = TRIG_FOLLOW;
cmd->scan_begin_arg = 0;
}else if((cmd->convert_src & TRIG_NOW) &&
(cmd->scan_begin_src & TRIG_TIMER))
{

--
www:http://www.berndporr.me.uk/
http://www.linux-usb-daq.co.uk/
http://www.imdb.com/name/nm3293421/
Mobile: +44 (0)7840 340069
Work:   +44 (0)141 330 5237
University of Glasgow
School of Engineering
Rankine Building, Oakfield Avenue,
Glasgow, G12 8LT
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v1 9/9] staging: android: binder: Add binder compat layer

2013-12-10 Thread Arve Hjønnevåg
On Mon, Dec 9, 2013 at 7:01 PM, Octavian Purdila  wrote:
> On Thu, Dec 5, 2013 at 4:02 AM, Arve Hjønnevåg  wrote:
>> On Wed, Dec 4, 2013 at 2:02 PM, Greg KH  wrote:
>>> On Wed, Dec 04, 2013 at 01:55:34PM -0800, Colin Cross wrote:
 On Wed, Dec 4, 2013 at 1:43 PM, Greg KH  wrote:
 > On Wed, Dec 04, 2013 at 12:46:42PM -0800, Colin Cross wrote:
 >> On Wed, Dec 4, 2013 at 10:35 AM, Greg KH  
 >> wrote:
 >> 
 >>
 >> > And finally, is this all really needed?  Why not just fix the 
 >> > structures
 >> > to be "correct", and then fix userspace to use the correct structures 
 >> > as
 >> > well, thereby not needing a compat layer at all?
 >>
 >> Some of the binder ioctls take userspace pointers.  Are you suggesting
 >> storing those pointers in a __u64 to avoid having to have a
 >> compat_ioctl?
 >
 > Yes, that's the best way to solve the issue, right?

 It's the least code, but in exchange you lose all the type safety and
 warnings when copying in and out of the pointers, as well as sparse
 checking on the __user attribute.
>>>
>>> Not if you make the cast right at the beginning, when you first "touch"
>>> the data, but yes, it does take some of the type saftey away, at the
>>> expense of simpler code to mess up :)
>>>
 That doesn't seem like a good tradeoff to me.  In addition it requires
 modifying the existing heavily used 32 bit api, which means a
 mostly-equivalent compat layer added in libbinder to support old
 kernels.
>>>
>>> Wait, I thought that libbinder would have to be changed anyway here, to
>>> handle 64bit kernels (in both 32 and 64bit userspace).  Since you are
>>> already changing it, why not just "do it correctly"?
>>>
>>
>> Yes libbinder will have to be changed to support calls between 32 bit
>> and 64 bit processes, so I don't see much value in a patchset that
>> only supports all 32 bit or all 64 bit processes. If user space is
>> fixed to use 64 bit pointers on a 64 bit system, then much of the code
>> added in this patchset becomes useless (and probably harmful as it
>> appears to prevent 32 bit processes from communicating with 64 bit
>> processes).
>>
>
> Hi,
>
> Coincidentally, I have been working on a compat layer myself lately.
> It is implemented in the binder driver with no changes in libbinder
> and it includes support for mixed mode.
>
> Unless you think that the kernel compat layer is a dead end, I can
> post the patches here for review. IMO the kernel compat layer gives
> you greater flexibility because it keeps the 32bit ABI unchanged. Of
> course it comes with the price of increased complexity.
>
> Thanks,
> Tavi

Assuming you are talking about a kernel compat layer that translates
the flat_binder_object structs as they pass between 32 bit and 64 bit
processes, that will not always work. The data portion of the message
sometimes contain size values that are invisible to the kernel, but
these values will be wrong if the kernel move data to make room for a
different size flat_binder_object.

-- 
Arve Hjønnevåg
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/7] Staging: bcm: DDRinit: fixed indentation coding style issues

2013-12-10 Thread Greg KH
On Tue, Dec 10, 2013 at 06:05:29AM -0500, Gary Rookard wrote:
> Fixed coding style issues.

Which issues?

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

This patch doesn't apply at all to my staging-next branch, what went
wrong?  Can you try this again?

thanks,

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


Re: [PATCH] staging: comedi: drivers: fix return value of comedi_load_firmware()

2013-12-10 Thread Dan Carpenter
On Tue, Dec 10, 2013 at 04:31:25PM -0700, H Hartley Sweeten wrote:
> Some of the callback functions that upload the firmware in the comedi
> drivers return a positive value indicating the number of bytes sent
> to the device. Detect this condition and just return '0' to indicate
> a successful upload.
> 

Acked-by: Dan Carpenter 

regards,
dan carpenter

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


Re: [PATCH] Staging: TIDSPBRIDGE: Use vm_iomap_memory for mmap-ing instead of remap_pfn_range

2013-12-10 Thread Ivajlo Dimitrov


On 08.12.2013 01:49, Steven Luo wrote:

This patch causes problems with DSP codecs on OMAP3 devices running
Android -- specifically, when the decoder is cleaning up after itself,
munmap() of the mapped area fails, leading to a memory leak which
eventually crashes the system.

As far as I can tell, the code with this patch applied reduces to
(ignoring checks and such)

remap_pfn_range(vma, vma->vm_start,
(pdata->phys_mempool_base >> PAGE_SHIFT) + vma->vm_pgoff,
vma->vm_end - vma->vm_start,
vma->vm_page_prot);

whereas the original was


-   status = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
-vma->vm_end - vma->vm_start,
-vma->vm_page_prot);

We're subtracting (pdata->phys_mempool_base >> PAGE_SHIFT) from
vma->vm_pgoff before calling vm_iomap_memory() to address the issue --
if that's satisfactory to everyone involved, I can submit the following
patch.



Hi,

I can pick your changes and re-send the original patch with them 
incorporated if there are no objections. Are you fine with that?


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