[PATCH] Staging: fbtft: Fix iomem dereference

2015-08-17 Thread Ronit Halder
This patch fixes the warning generated by sparse
"cast removes address space of expression" by using ioread16
function insted of directly dereferencing I/O memory.

Signed-off-by: Ronit halder 
---
 drivers/staging/fbtft/fb_agm1264k-fl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c 
b/drivers/staging/fbtft/fb_agm1264k-fl.c
index 94dd49c..59826a4 100644
--- a/drivers/staging/fbtft/fb_agm1264k-fl.c
+++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
@@ -273,7 +273,7 @@ construct_line_bitmap(struct fbtft_par *par, u8 *dest, 
signed short *src,
 
 static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
 {
-   u16 *vmem16 = (u16 *)par->info->screen_base;
+   void __iomem *vmem16 = (u16 __iomem *)par->info->screen_base;
u8 *buf = par->txbuf.buf;
int x, y;
int ret = 0;
@@ -290,7 +290,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, 
size_t len)
/* converting to grayscale16 */
for (x = 0; x < par->info->var.xres; ++x)
for (y = 0; y < par->info->var.yres; ++y) {
-   u16 pixel = vmem16[y *  par->info->var.xres + x];
+   u16 pixel = ioread16(vmem16 +
+   y * par->info->var.xres + x);
u16 b = pixel & 0x1f;
u16 g = (pixel & (0x3f << 5)) >> 5;
u16 r = (pixel & (0x1f << (5 + 6))) >> (5 + 6);
-- 
2.4.0.GIT

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


Re: [PATCH 02/20] staging: rtl8192u: r8192U_core: fix consistent spacing code style error

2015-08-17 Thread Sudip Mukherjee
On Tue, Aug 18, 2015 at 02:02:49AM -0400, Raphaël Beamonte wrote:
> 2015-08-18 1:44 GMT-04:00 Sudip Mukherjee :
> > I think that will be better, since you are sending the patch for
> > consistent spacing.
> 
> Actually, going through the bunch of patches, it seems that the
> whitespace neatening one is taking care of that. That one patch was
> mostly about taking care of the checkpatch "consistent spacing"
> warning.
> Two solutions here:
> (1) I can merge both patches and make a general whitespace neatening
> one, taking care of that too.
> (2) I can clarify the commit messages of each patches to explain the
> aim of each.
> Of course, in (1) too I'd take care of explaining the whole point of
> the commit. What do you think would be the best approach at this
> point?
If both the patches are doing the same change then it will be better to
combine them in one. Just remember two things while sending patches:
1) your commit message should describe the change you are doing and
incase of big changes mention why you are doing it.
2) You should not do more than one type of change in a patch.

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


Re: [PATCHv3] staging: wilc1000: use netdev_* instead of printk

2015-08-17 Thread Sudip Mukherjee
On Tue, Aug 18, 2015 at 01:27:31AM -0400, Raphaël Beamonte wrote:
> 2015-08-18 0:24 GMT-04:00 Sudip Mukherjee :
> >> + netdev_err("[Sendconfigpkt]Get Timed out\n");
> > This will not compile. you can not just replace printk with
> > netdev_*, you need to mention a net_device.
> 
> You're right! I'm making a lot of mistakes. It seems I called the make
> command in the wrong git tree... Thanks for catching that, and taking
> time to review!
> I just saw there isn't any netdev_debug available. Do you know the
> reason for that? Is there a replacement besides pr_debug?
netdev_dbg
> Also, it seems that in all the functions where it's another netdev
> that's available that I could use, I don't have access to the
> net_device struct. Is there a general way to get that device
> information? I saw an old lkml post talking about dev_*() functions to
> do that? Would you have some hint on the matter?
If the function is not having the net_device try to see if you can
pass it the struct as an argument. if not possible then in any way then
no other way but to use pr_*

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


Re: [PATCH 02/20] staging: rtl8192u: r8192U_core: fix consistent spacing code style error

2015-08-17 Thread Raphaël Beamonte
2015-08-18 1:44 GMT-04:00 Sudip Mukherjee :
> I think that will be better, since you are sending the patch for
> consistent spacing.

Actually, going through the bunch of patches, it seems that the
whitespace neatening one is taking care of that. That one patch was
mostly about taking care of the checkpatch "consistent spacing"
warning.
Two solutions here:
(1) I can merge both patches and make a general whitespace neatening
one, taking care of that too.
(2) I can clarify the commit messages of each patches to explain the
aim of each.
Of course, in (1) too I'd take care of explaining the whole point of
the commit. What do you think would be the best approach at this
point?

> And some of your patches are not having any commit message. Greg will
> not accept such patches. So while you are sending take care of that
> also.

Ok!

Thanks again!
Raphaël
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 02/20] staging: rtl8192u: r8192U_core: fix consistent spacing code style error

2015-08-17 Thread Sudip Mukherjee
On Tue, Aug 18, 2015 at 01:38:21AM -0400, Raphaël Beamonte wrote:
> 2015-08-18 1:02 GMT-04:00 Sudip Mukherjee :
> > since you are modifying these lines for consistent spacing, it will be
> > better to have:
> > (priv->ShortRetryLimit << TCR_SRL_OFFSET) |   // Short retry limit
> 
> > This should be:
> > priv->eeprom_CustomerID = eprom_read(dev, (EEPROM_Customer_ID>>1)) >> 8;
> 
> Are you talking about spacing around the << and >> ?
> If so, shouldn't that last line be:
> priv->eeprom_CustomerID = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8;
yeah.. I missed that >>1 , i only noticed >>8 as you have changed that.
> 
> And should I thus apply that to the whole file?
I think that will be better, since you are sending the patch for
consistent spacing.
And some of your patches are not having any commit message. Greg will
not accept such patches. So while you are sending take care of that
also.

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


Re: [PATCH 12/20] staging: rtl8192u: r8192U_core: fix externs in .c file code style issue

2015-08-17 Thread Raphaël Beamonte
2015-08-18 1:30 GMT-04:00 Sudip Mukherjee :
> These are not externs. These are forward declarations.

I copied the message from checkpatch. Will edit that to make it more accurate!

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


Re: [PATCH 02/20] staging: rtl8192u: r8192U_core: fix consistent spacing code style error

2015-08-17 Thread Raphaël Beamonte
2015-08-18 1:02 GMT-04:00 Sudip Mukherjee :
> since you are modifying these lines for consistent spacing, it will be
> better to have:
> (priv->ShortRetryLimit << TCR_SRL_OFFSET) |   // Short retry limit

> This should be:
> priv->eeprom_CustomerID = eprom_read(dev, (EEPROM_Customer_ID>>1)) >> 8;

Are you talking about spacing around the << and >> ?
If so, shouldn't that last line be:
priv->eeprom_CustomerID = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8;

And should I thus apply that to the whole file?

Thanks!
Raphaël
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 12/20] staging: rtl8192u: r8192U_core: fix externs in .c file code style issue

2015-08-17 Thread Sudip Mukherjee
On Sat, Aug 15, 2015 at 09:34:08PM -0400, Raphaël Beamonte wrote:
> Externs should be avoided in .c files. These one were not useful and
> are thus removed.
These are not externs. These are forward declarations.

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


Re: [PATCHv3] staging: wilc1000: use netdev_* instead of printk

2015-08-17 Thread Raphaël Beamonte
2015-08-18 0:24 GMT-04:00 Sudip Mukherjee :
>> + netdev_err("[Sendconfigpkt]Get Timed out\n");
> This will not compile. you can not just replace printk with
> netdev_*, you need to mention a net_device.

You're right! I'm making a lot of mistakes. It seems I called the make
command in the wrong git tree... Thanks for catching that, and taking
time to review!
I just saw there isn't any netdev_debug available. Do you know the
reason for that? Is there a replacement besides pr_debug?
Also, it seems that in all the functions where it's another netdev
that's available that I could use, I don't have access to the
net_device struct. Is there a general way to get that device
information? I saw an old lkml post talking about dev_*() functions to
do that? Would you have some hint on the matter?

Thanks a lot!
Raphaël
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 07/20] staging: rtl8192u: r8192_core: whitespace neatening

2015-08-17 Thread Sudip Mukherjee
On Sat, Aug 15, 2015 at 09:34:03PM -0400, Raphaël Beamonte wrote:
> Signed-off-by: Raphaël Beamonte 
> ---

> @@ -2182,30 +2182,30 @@ static void rtl8192_init_priv_variable(struct 
> net_device *dev)
>   priv->EarlyRxThreshold = 7;
>   priv->enable_gpio0 = 0;
>   priv->TransmitConfig =
> - (TCR_MXDMA_2048< Tx DMA Burst, 7: reserved.
> - (priv->ShortRetryLimit< limit
> - (priv->LongRetryLimit< limit
> + (TCR_MXDMA_2048 << TCR_MXDMA_OFFSET) |  // Max DMA Burst Size 
> per Tx DMA Burst, 7: reserved.
> + (priv->ShortRetryLimit << TCR_SRL_OFFSET) |   // Short 
> retry limit
> + (priv->LongRetryLimit << TCR_LRL_OFFSET) |// Long retry 
> limit
>   (false ? TCR_SAT : 0);  // FALSE: HW provides PLCP length and 
> LENGEXT, TRUE: SW provides them
>  #ifdef TO_DO_LIST
>   if (Adapter->bInHctTest)
>   pHalData->ReceiveConfig =   pHalData->CSMethod |
> - RCR_AMF | RCR_ADF | 
> //accept management/data
> + RCR_AMF | RCR_ADF | 
> //accept management/data
>   //guangan200710
> - RCR_ACF |   //accept 
> control frame for SW AP needs PS-poll, 2005.07.07, by rcnjko.
> - RCR_AB | RCR_AM | RCR_APM | 
> //accept BC/MC/UC
> - RCR_AICV | RCR_ACRC32 | 
> //accept ICV/CRC error packet
> - ((u32)7< Max DMA Burst Size per Rx DMA Burst, 7: unlimited.
> - 
> (pHalData->EarlyRxThreshold< Rx threshold.
> + RCR_ACF |   //accept 
> control frame for SW AP needs PS-poll, 2005.07.07, by rcnjko.
> + RCR_AB | RCR_AM | RCR_APM | 
> //accept BC/MC/UC
> + RCR_AICV | RCR_ACRC32 | 
> //accept ICV/CRC error packet
> + ((u32)7 << RCR_MXDMA_OFFSET) | 
> // Max DMA Burst Size per Tx DMA Burst, 7: reserved.
looks like the comment has changed. copy paste error from previous
lines?

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


Re: [PATCH 06/20] staging: rtl8192u: r8192U_core: fix missing struct leading to consistent spacing code style error

2015-08-17 Thread Sudip Mukherjee
On Sat, Aug 15, 2015 at 09:34:02PM -0400, Raphaël Beamonte wrote:
> A missing struct keyword in variable declaration triggered a
> need consistent spacing around '*' code style error.
struct rtl8192_rx_info is typedef as rtl8192_rx_info. This same file is
having few more use of rtl8192_rx_info without struct. maybe you can
change all of them and get rid of the typedef.

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


RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register callbacks to process hvsock connection

2015-08-17 Thread KY Srinivasan


> -Original Message-
> From: Dexuan Cui
> Sent: Friday, August 7, 2015 3:27 AM
> To: KY Srinivasan ; David Miller
> 
> Cc: o...@aepfle.de; gre...@linuxfoundation.org; jasow...@redhat.com;
> driverdev-devel@linuxdriverproject.org; linux-ker...@vger.kernel.org;
> step...@networkplumber.org; stefa...@redhat.com;
> net...@vger.kernel.org; a...@canonical.com; pebo...@tiscali.nl;
> dan.carpen...@oracle.com
> Subject: RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register callbacks
> to process hvsock connection
> 
> > -Original Message-
> > From: KY Srinivasan
> > Sent: Friday, August 7, 2015 2:28
> > To: Dexuan Cui ; David Miller
> 
> > Cc: o...@aepfle.de; gre...@linuxfoundation.org; jasow...@redhat.com;
> > driverdev-devel@linuxdriverproject.org; linux-ker...@vger.kernel.org;
> > step...@networkplumber.org; stefa...@redhat.com;
> net...@vger.kernel.org;
> > a...@canonical.com; pebo...@tiscali.nl; dan.carpen...@oracle.com
> > Subject: RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register
> callbacks to
> > process hvsock connection
> >
> > > -Original Message-
> > > From: Dexuan Cui
> > > Sent: Wednesday, August 5, 2015 9:54 PM
> > > To: David Miller ; KY Srinivasan
> > > 
> > > Cc: o...@aepfle.de; gre...@linuxfoundation.org;
> jasow...@redhat.com;
> > > driverdev-devel@linuxdriverproject.org; linux-ker...@vger.kernel.org;
> > > step...@networkplumber.org; stefa...@redhat.com;
> > > net...@vger.kernel.org; a...@canonical.com; pebo...@tiscali.nl;
> > > dan.carpen...@oracle.com
> > > Subject: RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register
> callbacks
> > > to process hvsock connection
> > >
> > > > From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org]
> On
> > > Behalf
> > > > Of Dexuan Cui
> > > > Sent: Thursday, July 30, 2015 18:20
> > > > To: David Miller ; KY Srinivasan
> > > 
> > > > Cc: o...@aepfle.de; gre...@linuxfoundation.org;
> jasow...@redhat.com;
> > > > driverdev-devel@linuxdriverproject.org; linux-ker...@vger.kernel.org;
> > > > step...@networkplumber.org; stefa...@redhat.com;
> > > net...@vger.kernel.org;
> > > > a...@canonical.com; pebo...@tiscali.nl; dan.carpen...@oracle.com
> > > > Subject: RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register
> > > callbacks to
> > > > process hvsock connection
> > > >
> > > > > From: David Miller
> > > > > Sent: Thursday, July 30, 2015 6:27
> > > > >
> > > > > From: Dexuan Cui
> > > > > Date: Tue, 28 Jul 2015 05:35:11 -0700
> > > > >
> > > > > > With the 2 APIs supplied by the VMBus driver, the coming
> net/hvsock
> > > driver
> > > > > > can register 2 callbacks and can know when a new hvsock
> connection is
> > > > > > offered by the host, and when a hvsock connection is being closed
> by
> > > the
> > > > > > host.
> > > > > >
> > > > > This is an extremely terrible interface.
> > > > >
> > > > > It's an opaque hook that allows on registry, and it's solve purpose
> > > > > is to allow a backdoor call into a foreign driver in another module.
> > > > >
> > > > > These are exactly the things we try to avoid.
> > > >
> > > > Hi David,
> > > > Thanks a lot for your reviewing and the suggestion!
> > > >
> > > > > Why not create a real abstraction where clients register an object,
> > > > > that can be contained as a sub-member inside of their own driver
> > > > > private, that provides the callback registry mechanism.
> > >
> > > Hi David,
> > > Can you please have a look at my below questions?
> > >
> > > I like your idea of a real abstraction. Your answer would definitely
> > > help me to implement that correctly.
> > >
> > > > Please pardon me for my inexperience.
> > > > Can you please be a bit more specific?
> > > > I guess maybe you're referencing a common design pattern in the
> driver
> > > > code, so an example in some existing driver would be the best. :-)
> > > >
> > > > "clients register an object " --
> > > > does the "clients" mean the hvsock driver?
> > > > and the "object" means the 2 callbacks?
> > > >
> > > > IMHO, here the vmbus driver has to synchronously pass the 2 events
> > > > to the hvsock driver, so a "backdoor call into the hvsock driver" is
> > > > inevitable anyway?
> > > >
> > > > e.g., in the path vmbus_process_offer() -> hvsock_process_offer(), the
> > > > return value of the latter is important to the former, because on error
> > > > the former needs to clean up some internal states of the vmbus driver
> > > (that
> > > > is, the "goto err_deq_chan").
> > > >
> > > >
> > > > > That way you can register multiple clients, do things like allow
> > > > > AF_PACKET capturing of vmbus traffic, etc.
> > > >
> > > > I thought AF_PACKET can only capture IP packetsor Ethernet frames.
> > > > Can it be used to capture AF_UNIX packet?
> > > > If yes, I suppose we can consider making it work for AF_HYPERV too,
> > > > if people ask for that.
> > > >
> >
> > Dexuan,
> >
> > The notion of a channel on Hyper-V has been mapped to a device on Linux
> and
> > the mechanism we have

Re: [PATCH 02/20] staging: rtl8192u: r8192U_core: fix consistent spacing code style error

2015-08-17 Thread Sudip Mukherjee
On Sat, Aug 15, 2015 at 09:33:58PM -0400, Raphaël Beamonte wrote:
> Fix multiple occurences of the need consistent spacing code style error
> 
> Signed-off-by: Raphaël Beamonte 
> ---
>  drivers/staging/rtl8192u/r8192U_core.c | 28 ++--
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
> b/drivers/staging/rtl8192u/r8192U_core.c
> index 915493d..c4ab2a8 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -2182,8 +2182,8 @@ static void rtl8192_init_priv_variable(struct 
> net_device *dev)
>   priv->EarlyRxThreshold = 7;
>   priv->enable_gpio0 = 0;
>   priv->TransmitConfig =
> - (TCR_MXDMA_2048< Tx DMA Burst, 7: reserved.
> - (priv->ShortRetryLimit< limit
> + (TCR_MXDMA_2048< Tx DMA Burst, 7: reserved.
> + (priv->ShortRetryLimit< limit
since you are modifying these lines for consistent spacing, it will be
better to have:
(priv->ShortRetryLimit << TCR_SRL_OFFSET) |   // Short retry limit
>  

> @@ -2304,7 +2304,7 @@ static void rtl8192_read_eeprom_info(struct net_device 
> *dev)
>   tmpValue = eprom_read(dev, EEPROM_ChannelPlan>>1);
>   priv->eeprom_ChannelPlan = (tmpValue & 0xff00)>>8;
>   priv->btxpowerdata_readfromEEPORM = true;
> - priv->eeprom_CustomerID = eprom_read(dev, 
> (EEPROM_Customer_ID>>1)) >>8;
> + priv->eeprom_CustomerID = eprom_read(dev, 
> (EEPROM_Customer_ID>>1))>>8;
This should be:
priv->eeprom_CustomerID = eprom_read(dev, (EEPROM_Customer_ID>>1)) >> 8;

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


Re: [PATCHv3] staging: wilc1000: use netdev_* instead of printk

2015-08-17 Thread Sudip Mukherjee
On Mon, Aug 17, 2015 at 07:06:40PM -0400, Raphaël Beamonte wrote:
> Signed-off-by: Raphaël Beamonte 
> ---
>  drivers/staging/wilc1000/coreconfigurator.c  |  4 ++--
>  drivers/staging/wilc1000/linux_wlan.c|  8 
>  drivers/staging/wilc1000/linux_wlan_common.h | 28 
> ++--
>  drivers/staging/wilc1000/linux_wlan_sdio.c   |  2 +-
>  drivers/staging/wilc1000/linux_wlan_spi.c|  2 +-
>  drivers/staging/wilc1000/wilc_debugfs.c  | 16 
>  drivers/staging/wilc1000/wilc_exported_buf.c |  2 --
>  7 files changed, 30 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
> b/drivers/staging/wilc1000/coreconfigurator.c
> index 16a0abc..9a36b78 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -2001,7 +2001,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
>   
> pstrWIDs[counter].u16WIDid,
>   (counter == 
> u32WIDsCount - 1), drvHandler)) {
>   ret = -1;
> - printk("[Sendconfigpkt]Get Timed out\n");
> + netdev_err("[Sendconfigpkt]Get Timed out\n");
This will not compile. you can not just replace printk with
netdev_*, you need to mention a net_device.

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


Re: [PATCH 5/5] staging: wilc1000: use id value as argument

2015-08-17 Thread Johnny Kim

Hello Dan.

On 2015년 08월 13일 23:49, Dan Carpenter wrote:

On Thu, Aug 13, 2015 at 01:41:23PM +0900, Tony Cho wrote:

+static u32 get_id_from_handler(tstrWILC_WFIDrv *handler)
+{
+   u32 id;
+
+   if (!handler)
+   return 0;
+
+   for (id = 0; id < NUM_CONCURRENT_IFC; id++) {
+   if (wfidrv_list[id] == handler) {
+   id += 1;
+   break;
+   }
+   }
+
+   if (id > NUM_CONCURRENT_IFC)
+   return 0;
+   else
+   return id;
+}
+

This still has an off by one bug.  Just use zero offset arrays
throughout.

static int get_id_from_handler(tstrWILC_WFIDrv *handler)
{
int id;

if (!handler)
return -ENOBUFS;

for (id = 0; id < NUM_CONCURRENT_IFC; id++) {
if (wfidrv_list[id] == handler)
return id;
}

return -ENOBUFS;
}

Thanks for your review. The return value of this function has from 0 till 2.
1 and 2 value is real ID value. only 0 value is reserved to remove a 
registered id.
But I also think that error handling should be added about the 
overflowed value

as your opinion.

+static tstrWILC_WFIDrv *get_handler_from_id(u32 id)
+{
+   if (id > 0 && id <= NUM_CONCURRENT_IFC)
+   return wfidrv_list[id - 1];
+   else
+   return NULL;
+}

static tstrWILC_WFIDrv *get_handler_from_id(int id)
{
if (id < 0 || id >= NUM_CONCURRENT_IFC)
return NULL;
return wfidrv_list[id];
}

regards,
dan carpenter



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


[PATCH 18/18] staging: comedi: s526: fix the block comments

2015-08-17 Thread H Hartley Sweeten
Tidy up the block comments to fix the checkpatch.pl warnings.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 43f9c0c..d70c979 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -176,15 +176,17 @@ static int s526_gpct_insn_config(struct comedi_device 
*dev,
unsigned int val;
union cmReg cmReg;
 
-   /*  Check what type of Counter the user requested, data[0] contains */
-   /*  the Application type */
+   /*
+* Check what type of Counter the user requested
+* data[0] contains the Application type
+*/
switch (data[0]) {
case INSN_CONFIG_GPCT_QUADRATURE_ENCODER:
/*
-  data[0]: Application Type
-  data[1]: Counter Mode Register Value
-  data[2]: Pre-load Register Value
-  data[3]: Conter Control Register
+* data[0]: Application Type
+* data[1]: Counter Mode Register Value
+* data[2]: Pre-load Register Value
+* data[3]: Conter Control Register
 */
devpriv->gpct_config[chan] = data[0];
 
@@ -214,11 +216,13 @@ static int s526_gpct_insn_config(struct comedi_device 
*dev,
cmReg.reg.clockSource = 0;
 
/*  When to take into account the indexpulse: */
-   /*if (data[2] == GPCT_IndexPhaseLowLow) {
-   } else if (data[2] == GPCT_IndexPhaseLowHigh) {
-   } else if (data[2] == GPCT_IndexPhaseHighLow) {
-   } else if (data[2] == GPCT_IndexPhaseHighHigh) {
-   }*/
+   /*
+* if (data[2] == GPCT_IndexPhaseLowLow) {
+* } else if (data[2] == GPCT_IndexPhaseLowHigh) {
+* } else if (data[2] == GPCT_IndexPhaseHighLow) {
+* } else if (data[2] == GPCT_IndexPhaseHighHigh) {
+* }
+*/
/*  Take into account the index pulse? */
if (data[3] == GPCT_RESET_COUNTER_ON_INDEX)
/*  Auto load with INDEX^ */
@@ -248,11 +252,11 @@ static int s526_gpct_insn_config(struct comedi_device 
*dev,
 
case INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR:
/*
-  data[0]: Application Type
-  data[1]: Counter Mode Register Value
-  data[2]: Pre-load Register 0 Value
-  data[3]: Pre-load Register 1 Value
-  data[4]: Conter Control Register
+* data[0]: Application Type
+* data[1]: Counter Mode Register Value
+* data[2]: Pre-load Register 0 Value
+* data[3]: Pre-load Register 1 Value
+* data[4]: Conter Control Register
 */
devpriv->gpct_config[chan] = data[0];
 
@@ -281,11 +285,11 @@ static int s526_gpct_insn_config(struct comedi_device 
*dev,
 
case INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR:
/*
-  data[0]: Application Type
-  data[1]: Counter Mode Register Value
-  data[2]: Pre-load Register 0 Value
-  data[3]: Pre-load Register 1 Value
-  data[4]: Conter Control Register
+* data[0]: Application Type
+* data[1]: Counter Mode Register Value
+* data[2]: Pre-load Register 0 Value
+* data[3]: Pre-load Register 1 Value
+* data[4]: Conter Control Register
 */
devpriv->gpct_config[chan] = data[0];
 
@@ -332,11 +336,12 @@ static int s526_gpct_winsn(struct comedi_device *dev,
/*  Check what Application of Counter this channel is configured for */
switch (devpriv->gpct_config[chan]) {
case INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR:
-   /* data[0] contains the PULSE_WIDTH
-  data[1] contains the PULSE_PERIOD
-  @pre PULSE_PERIOD > PULSE_WIDTH > 0
-  The above periods must be expressed as a multiple of the
-  pulse frequency on the selected source
+   /*
+* data[0] contains the PULSE_WIDTH
+* data[1] contains the PULSE_PERIOD
+* @pre PULSE_PERIOD > PULSE_WIDTH > 0
+* The above periods must be expressed as a multiple of the
+* pulse frequency on the selected source
 */
if ((data[1] <= data[0]) || !data[0])
return -EINVAL;
-- 
2.4.3

___
devel mailing list
de...@linuxdriverprojec

[PATCH 16/18] staging: comedi: s526: remove unnecessary defines

2015-08-17 Thread H Hartley Sweeten
Remove a couple unused defines,

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 7cf6250..801413d 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -39,13 +39,9 @@
 #include "../comedidev.h"
 #include 
 
-#define S526_START_AI_CONV 0
-#define S526_AI_READ   0
-
-/* Ports */
-#define S526_NUM_PORTS 27
-
-/* registers */
+/*
+ * Register I/O map
+ */
 #define S526_TIMER_REG 0x00
 #define S526_TIMER_LOAD(x) (((x) & 0xff) << 8)
 #define S526_TIMER_MODE((x) << 1)
-- 
2.4.3

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


[PATCH 17/18] staging: comedi: s526: remove #if 0'ed out code block

2015-08-17 Thread H Hartley Sweeten
This #if 0'ed out code is not necessary. It's actually just a copy
of the psuedo code in the S526 Hardware Manual that shows an example
of a counter application. Remove it.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 801413d..43f9c0c 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -188,35 +188,6 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
 */
devpriv->gpct_config[chan] = data[0];
 
-#if 0
-   /*  Example of Counter Application */
-   /* One-shot (software trigger) */
-   cmReg.reg.coutSource = 0;   /*  out RCAP */
-   cmReg.reg.coutPolarity = 1; /*  Polarity inverted */
-   cmReg.reg.autoLoadResetRcap = 0;/*  Auto load disabled */
-   cmReg.reg.hwCtEnableSource = 3; /*  NOT RCAP */
-   cmReg.reg.ctEnableCtrl = 2; /*  Hardware */
-   cmReg.reg.clockSource = 2;  /*  Internal */
-   cmReg.reg.countDir = 1; /*  Down */
-   cmReg.reg.countDirCtrl = 1; /*  Software */
-   cmReg.reg.outputRegLatchCtrl = 0;   /*  latch on read */
-   cmReg.reg.preloadRegSel = 0;/*  PR0 */
-   cmReg.reg.reserved = 0;
-
-   outw(cmReg.value, dev->iobase + S526_GPCT_MODE_REG(chan));
-
-   s526_gpct_write(dev, chan, 0x0013c68);
-
-   /*  Reset the counter */
-   outw(0x8000, dev->iobase + S526_GPCT_CTRL_REG(chan));
-   /*  Load the counter from PR0 */
-   outw(0x4000, dev->iobase + S526_GPCT_CTRL_REG(chan));
-
-   /*  Reset RCAP (fires one-shot) */
-   outw(0x0008, dev->iobase + S526_GPCT_CTRL_REG(chan));
-
-#endif
-
 #if 1
/*  Set Counter Mode Register */
cmReg.value = data[1] & 0x;
-- 
2.4.3

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


[PATCH 14/18] staging: comedi: s526: tidy up s526_ai_rinsn()

2015-08-17 Thread H Hartley Sweeten
Rename this function to follow the normal naming in comedi drivers.

Use the comedi_offset_munge() helper to munge the hardware two's
complement data to the comedi offset binary format.

Change the final return to insn->n to clarify the return value without
the need for the comment.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 152be95..1a5aa3d 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -434,15 +434,17 @@ static int s526_eoc(struct comedi_device *dev,
return -EBUSY;
 }
 
-static int s526_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
-struct comedi_insn *insn, unsigned int *data)
+static int s526_ai_insn_read(struct comedi_device *dev,
+struct comedi_subdevice *s,
+struct comedi_insn *insn,
+unsigned int *data)
 {
struct s526_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int ctrl;
-   int n;
-   unsigned int d;
+   unsigned int val;
int ret;
+   int i;
 
/*
 * Set configured delay, enable conversion and read for requested
@@ -452,8 +454,7 @@ static int s526_ai_rinsn(struct comedi_device *dev, struct 
comedi_subdevice *s,
   S526_AI_CTRL_CONV(chan) | S526_AI_CTRL_READ(chan) |
   S526_AI_CTRL_START;
 
-   /* convert n samples */
-   for (n = 0; n < insn->n; n++) {
+   for (i = 0; i < insn->n; i++) {
/* trigger conversion */
outw(ctrl, dev->iobase + S526_AI_CTRL_REG);
 
@@ -462,14 +463,11 @@ static int s526_ai_rinsn(struct comedi_device *dev, 
struct comedi_subdevice *s,
if (ret)
return ret;
 
-   d = inw(dev->iobase + S526_AI_REG);
-
-   /* munge data */
-   data[n] = d ^ 0x8000;
+   val = inw(dev->iobase + S526_AI_REG);
+   data[i] = comedi_offset_munge(s, val);
}
 
-   /* return the number of samples read/written */
-   return n;
+   return insn->n;
 }
 
 static int s526_ao_insn_write(struct comedi_device *dev,
@@ -591,7 +589,7 @@ static int s526_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
s->maxdata  = 0x;
s->range_table  = &range_bipolar10;
s->len_chanlist = 16;
-   s->insn_read= s526_ai_rinsn;
+   s->insn_read= s526_ai_insn_read;
s->insn_config  = s526_ai_insn_config;
 
/* Analog Output subdevice */
-- 
2.4.3

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


[PATCH 15/18] staging: comedi: s526: remove s526_ai_insn_config()

2015-08-17 Thread H Hartley Sweeten
This (*insn_config) does not follow the comedi core API. It also
would not work as expected.

It appears to be trying to configure the analog input subdevice so
that the (*insn_read) would read multiple channels (data[0]) and
optionally enable the 15us delay (data[1]) needed for the multiplexor
to change channels between samples.

Unfortunately, the comedi core expects (*insn_read) operations to
return 1 or more samples for a single channel, which is what the
(*insn_read) in this driver does.

The (*insn_config) is also enabling the analog input end-of-conversion
interrupt. This isn't needed, and might be a problem since the driver
does not currently request and interrupt. The enable bit does not
need to be set for the end-of-conversion to occur in the interrupt
status register.

Remove the (*insn_config) and modify the (*insn_read) to automatically
handle the 15us delay when needed.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 1a5aa3d..7cf6250 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -133,7 +133,7 @@ union cmReg {
 
 struct s526_private {
unsigned int gpct_config[4];
-   unsigned short ai_config;
+   unsigned short ai_ctrl;
 };
 
 static void s526_gpct_write(struct comedi_device *dev,
@@ -388,36 +388,6 @@ static int s526_gpct_winsn(struct comedi_device *dev,
return insn->n;
 }
 
-static int s526_ai_insn_config(struct comedi_device *dev,
-  struct comedi_subdevice *s,
-  struct comedi_insn *insn, unsigned int *data)
-{
-   struct s526_private *devpriv = dev->private;
-   int result = -EINVAL;
-
-   if (insn->n < 1)
-   return result;
-
-   result = insn->n;
-
-   /* data[0] : channels was set in relevant bits.
-  data[1] : delay
-*/
-   /* COMMENT: abbotti 2008-07-24: I don't know why you'd want to
-* enable channels here.  The channel should be enabled in the
-* INSN_READ handler. */
-
-   /*  Enable ADC interrupt */
-   outw(S526_INT_AI, dev->iobase + S526_INT_ENA_REG);
-   devpriv->ai_config = (data[0] & 0x3ff) << 5;
-   if (data[1] > 0)
-   devpriv->ai_config |= S526_AI_CTRL_DELAY;/* set the delay */
-
-   devpriv->ai_config |= 0x0001;   /* ADC start bit */
-
-   return result;
-}
-
 static int s526_eoc(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
@@ -446,17 +416,21 @@ static int s526_ai_insn_read(struct comedi_device *dev,
int ret;
int i;
 
-   /*
-* Set configured delay, enable conversion and read for requested
-* channel only, set "ADC start" bit.
-*/
-   ctrl = (devpriv->ai_config & S526_AI_CTRL_DELAY) |
-  S526_AI_CTRL_CONV(chan) | S526_AI_CTRL_READ(chan) |
+   ctrl = S526_AI_CTRL_CONV(chan) | S526_AI_CTRL_READ(chan) |
   S526_AI_CTRL_START;
+   if (ctrl != devpriv->ai_ctrl) {
+   /*
+* The multiplexor needs to change, enable the 15us
+* delay for the first sample.
+*/
+   devpriv->ai_ctrl = ctrl;
+   ctrl |= S526_AI_CTRL_DELAY;
+   }
 
for (i = 0; i < insn->n; i++) {
/* trigger conversion */
outw(ctrl, dev->iobase + S526_AI_CTRL_REG);
+   ctrl &= ~S526_AI_CTRL_DELAY;
 
/* wait for conversion to end */
ret = comedi_timeout(dev, s, insn, s526_eoc, S526_INT_AI);
@@ -590,7 +564,6 @@ static int s526_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
s->range_table  = &range_bipolar10;
s->len_chanlist = 16;
s->insn_read= s526_ai_insn_read;
-   s->insn_config  = s526_ai_insn_config;
 
/* Analog Output subdevice */
s = &dev->subdevices[2];
-- 
2.4.3

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


[PATCH 13/18] staging: comedi: s526: wait for analog output conversions to complete

2015-08-17 Thread H Hartley Sweeten
It's possible for the user to write more than one value to an analog
output channel with the (*insn_write) operation. Use comedi_timeout()
to check the interrupt status register to ensure that each data
conversion is complete before writing the next value.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 242db7d..152be95 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -418,16 +418,19 @@ static int s526_ai_insn_config(struct comedi_device *dev,
return result;
 }
 
-static int s526_ai_eoc(struct comedi_device *dev,
-  struct comedi_subdevice *s,
-  struct comedi_insn *insn,
-  unsigned long context)
+static int s526_eoc(struct comedi_device *dev,
+   struct comedi_subdevice *s,
+   struct comedi_insn *insn,
+   unsigned long context)
 {
unsigned int status;
 
status = inw(dev->iobase + S526_INT_STATUS_REG);
-   if (status & S526_INT_AI)
+   if (status & context) {
+   /* we got our eoc event, clear it */
+   outw(context, dev->iobase + S526_INT_STATUS_REG);
return 0;
+   }
return -EBUSY;
 }
 
@@ -455,12 +458,10 @@ static int s526_ai_rinsn(struct comedi_device *dev, 
struct comedi_subdevice *s,
outw(ctrl, dev->iobase + S526_AI_CTRL_REG);
 
/* wait for conversion to end */
-   ret = comedi_timeout(dev, s, insn, s526_ai_eoc, 0);
+   ret = comedi_timeout(dev, s, insn, s526_eoc, S526_INT_AI);
if (ret)
return ret;
 
-   outw(S526_INT_AI, dev->iobase + S526_INT_STATUS_REG);
-
d = inw(dev->iobase + S526_AI_REG);
 
/* munge data */
@@ -479,6 +480,7 @@ static int s526_ao_insn_write(struct comedi_device *dev,
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int ctrl = S526_AO_CTRL_CHAN(chan);
unsigned int val = s->readback[chan];
+   int ret;
int i;
 
outw(ctrl, dev->iobase + S526_AO_CTRL_REG);
@@ -488,6 +490,11 @@ static int s526_ao_insn_write(struct comedi_device *dev,
val = data[i];
outw(val, dev->iobase + S526_AO_REG);
outw(ctrl, dev->iobase + S526_AO_CTRL_REG);
+
+   /* wait for conversion to end */
+   ret = comedi_timeout(dev, s, insn, s526_eoc, S526_INT_AO);
+   if (ret)
+   return ret;
}
s->readback[chan] = val;
 
-- 
2.4.3

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


[PATCH 12/18] staging: comedi: s526: tidy up subdevice init

2015-08-17 Thread H Hartley Sweeten
For aesthetics, add some whitespace to the subdevice initialization.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 9ed3edd..242db7d 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -561,51 +561,54 @@ static int s526_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
if (ret)
return ret;
 
+   /* General-Purpose Counter/Timer (GPCT) */
s = &dev->subdevices[0];
-   /* GENERAL-PURPOSE COUNTER/TIME (GPCT) */
-   s->type = COMEDI_SUBD_COUNTER;
-   s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL;
-   s->n_chan = 4;
-   s->maxdata = 0x00ff;/* 24 bit counter */
-   s->insn_read = s526_gpct_rinsn;
-   s->insn_config = s526_gpct_insn_config;
-   s->insn_write = s526_gpct_winsn;
+   s->type = COMEDI_SUBD_COUNTER;
+   s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL;
+   s->n_chan   = 4;
+   s->maxdata  = 0x00ff;
+   s->insn_read= s526_gpct_rinsn;
+   s->insn_config  = s526_gpct_insn_config;
+   s->insn_write   = s526_gpct_winsn;
 
+   /*
+* Analog Input subdevice
+* channels 0 to 7 are the regular differential inputs
+* channel 8 is "reference 0" (+10V)
+* channel 9 is "reference 1" (0V)
+*/
s = &dev->subdevices[1];
-   /* analog input subdevice */
-   s->type = COMEDI_SUBD_AI;
-   s->subdev_flags = SDF_READABLE | SDF_DIFF;
-   /* channels 0 to 7 are the regular differential inputs */
-   /* channel 8 is "reference 0" (+10V), channel 9 is "reference 1" (0V) */
-   s->n_chan = 10;
-   s->maxdata = 0x;
-   s->range_table = &range_bipolar10;
-   s->len_chanlist = 16;
-   s->insn_read = s526_ai_rinsn;
-   s->insn_config = s526_ai_insn_config;
-
+   s->type = COMEDI_SUBD_AI;
+   s->subdev_flags = SDF_READABLE | SDF_DIFF;
+   s->n_chan   = 10;
+   s->maxdata  = 0x;
+   s->range_table  = &range_bipolar10;
+   s->len_chanlist = 16;
+   s->insn_read= s526_ai_rinsn;
+   s->insn_config  = s526_ai_insn_config;
+
+   /* Analog Output subdevice */
s = &dev->subdevices[2];
-   /* analog output subdevice */
-   s->type = COMEDI_SUBD_AO;
-   s->subdev_flags = SDF_WRITABLE;
-   s->n_chan = 4;
-   s->maxdata = 0x;
-   s->range_table = &range_bipolar10;
-   s->insn_write = s526_ao_insn_write;
+   s->type = COMEDI_SUBD_AO;
+   s->subdev_flags = SDF_WRITABLE;
+   s->n_chan   = 4;
+   s->maxdata  = 0x;
+   s->range_table  = &range_bipolar10;
+   s->insn_write   = s526_ao_insn_write;
 
ret = comedi_alloc_subdev_readback(s);
if (ret)
return ret;
 
+   /* Digital I/O subdevice */
s = &dev->subdevices[3];
-   /* digital i/o subdevice */
-   s->type = COMEDI_SUBD_DIO;
-   s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
-   s->n_chan = 8;
-   s->maxdata = 1;
-   s->range_table = &range_digital;
-   s->insn_bits = s526_dio_insn_bits;
-   s->insn_config = s526_dio_insn_config;
+   s->type = COMEDI_SUBD_DIO;
+   s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
+   s->n_chan   = 8;
+   s->maxdata  = 1;
+   s->range_table  = &range_digital;
+   s->insn_bits= s526_dio_insn_bits;
+   s->insn_config  = s526_dio_insn_config;
 
return 0;
 }
-- 
2.4.3

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


[PATCH 10/18] staging: comedi: s526: define the miscellaneous register and bits

2015-08-17 Thread H Hartley Sweeten
Define this register and its bits.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 0f56a89..22724a2 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -83,8 +83,8 @@
 #define S526_INT_AIBIT(2)
 #define S526_INT_AOBIT(1)
 #define S526_INT_TIMER BIT(0)
-#define REG_MSC 0x10
-
+#define S526_MISC_REG  0x10
+#define S526_MISC_LED_OFF  BIT(0)
 #define S526_GPCT_LSB_REG(x)   (0x12 + ((x) * 8))
 #define S526_GPCT_MSB_REG(x)   (0x14 + ((x) * 8))
 #define S526_GPCT_MODE_REG(x)  (0x16 + ((x) * 8))
-- 
2.4.3

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


[PATCH 11/18] staging: comedi: s526: define the eeprom data and control registers

2015-08-17 Thread H Hartley Sweeten
Define these registers and their bits.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 22724a2..9ed3edd 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -89,9 +89,12 @@
 #define S526_GPCT_MSB_REG(x)   (0x14 + ((x) * 8))
 #define S526_GPCT_MODE_REG(x)  (0x16 + ((x) * 8))
 #define S526_GPCT_CTRL_REG(x)  (0x18 + ((x) * 8))
-
-#define REG_EED 0x32
-#define REG_EEC 0x34
+#define S526_EEPROM_DATA_REG   0x32
+#define S526_EEPROM_CTRL_REG   0x34
+#define S526_EEPROM_CTRL_ADDR(x) (((x) & 0x3f) << 3)
+#define S526_EEPROM_CTRL(x)(((x) & 0x3) << 1)
+#define S526_EEPROM_CTRL_READ  S526_EEPROM_CTRL(2)
+#define S526_EEPROM_CTRL_START BIT(0)
 
 struct counter_mode_register_t {
 #if defined(__LITTLE_ENDIAN_BITFIELD)
-- 
2.4.3

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


[PATCH 09/18] staging: comedi: s526: define the digtial I/O control register and bits

2015-08-17 Thread H Hartley Sweeten
Define this register and its bits and remove the magic numbers.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 11a661b..0f56a89 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -67,7 +67,14 @@
 #define S526_AI_CTRL_START BIT(0)
 #define S526_AO_REG0x08
 #define S526_AI_REG0x08
-#define REG_DIO 0x0A
+#define S526_DIO_CTRL_REG  0x0a
+#define S526_DIO_CTRL_DIO3_NEG BIT(15) /* irq on DIO3 neg/pos edge */
+#define S526_DIO_CTRL_DIO2_NEG BIT(14) /* irq on DIO2 neg/pos edge */
+#define S526_DIO_CTRL_DIO1_NEG BIT(13) /* irq on DIO1 neg/pos edge */
+#define S526_DIO_CTRL_DIO0_NEG BIT(12) /* irq on DIO0 neg/pos edge */
+#define S526_DIO_CTRL_GRP2_OUT BIT(11)
+#define S526_DIO_CTRL_GRP1_OUT BIT(10)
+#define S526_DIO_CTRL_GRP2_NEG BIT(8)  /* irq on DIO[4-7] neg/pos edge */
 #define S526_INT_ENA_REG   0x0c
 #define S526_INT_STATUS_REG0x0e
 #define S526_INT_DIO(x)BIT(8 + ((x) & 0x7))
@@ -490,9 +497,9 @@ static int s526_dio_insn_bits(struct comedi_device *dev,
  unsigned int *data)
 {
if (comedi_dio_update_state(s, data))
-   outw(s->state, dev->iobase + REG_DIO);
+   outw(s->state, dev->iobase + S526_DIO_CTRL_REG);
 
-   data[1] = inw(dev->iobase + REG_DIO) & 0xff;
+   data[1] = inw(dev->iobase + S526_DIO_CTRL_REG) & 0xff;
 
return insn->n;
 }
@@ -506,6 +513,10 @@ static int s526_dio_insn_config(struct comedi_device *dev,
unsigned int mask;
int ret;
 
+   /*
+* Digital I/O can be configured as inputs or outputs in
+* groups of 4; DIO group 1 (DIO0-3) and DIO group 2 (DIO4-7).
+*/
if (chan < 4)
mask = 0x0f;
else
@@ -515,17 +526,16 @@ static int s526_dio_insn_config(struct comedi_device *dev,
if (ret)
return ret;
 
-   /* bit 10/11 set the group 1/2's mode */
if (s->io_bits & 0x0f)
-   s->state |= (1 << 10);
+   s->state |= S526_DIO_CTRL_GRP1_OUT;
else
-   s->state &= ~(1 << 10);
+   s->state &= ~S526_DIO_CTRL_GRP1_OUT;
if (s->io_bits & 0xf0)
-   s->state |= (1 << 11);
+   s->state |= S526_DIO_CTRL_GRP2_OUT;
else
-   s->state &= ~(1 << 11);
+   s->state &= ~S526_DIO_CTRL_GRP2_OUT;
 
-   outw(s->state, dev->iobase + REG_DIO);
+   outw(s->state, dev->iobase + S526_DIO_CTRL_REG);
 
return insn->n;
 }
-- 
2.4.3

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


[PATCH 07/18] staging: comedi: s526: add defines for the ao/ai data register

2015-08-17 Thread H Hartley Sweeten
The same register is used for analog output and input data. Add defines
for both for added clarity.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index ff576d3..5f8a5d3 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -65,7 +65,8 @@
 #define S526_AI_CTRL_CONV(x)   (1 << (5 + ((x) & 0x9)))
 #define S526_AI_CTRL_READ(x)   (((x) & 0xf) << 1)
 #define S526_AI_CTRL_START BIT(0)
-#define REG_ADD 0x08
+#define S526_AO_REG0x08
+#define S526_AI_REG0x08
 #define REG_DIO 0x0A
 #define REG_IER 0x0C
 #define REG_ISR 0x0E
@@ -445,8 +446,7 @@ static int s526_ai_rinsn(struct comedi_device *dev, struct 
comedi_subdevice *s,
 
outw(ISR_ADC_DONE, dev->iobase + REG_ISR);
 
-   /* read data */
-   d = inw(dev->iobase + REG_ADD);
+   d = inw(dev->iobase + S526_AI_REG);
 
/* munge data */
data[n] = d ^ 0x8000;
@@ -471,7 +471,7 @@ static int s526_ao_insn_write(struct comedi_device *dev,
 
for (i = 0; i < insn->n; i++) {
val = data[i];
-   outw(val, dev->iobase + REG_ADD);
+   outw(val, dev->iobase + S526_AO_REG);
outw(ctrl, dev->iobase + S526_AO_CTRL_REG);
}
s->readback[chan] = val;
-- 
2.4.3

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


[PATCH 08/18] staging: comedi: s526: define the interrupt enable/status registers

2015-08-17 Thread H Hartley Sweeten
These registers use the same bit defines. Define both of them and
the bits.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 5f8a5d3..11a661b 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -68,8 +68,14 @@
 #define S526_AO_REG0x08
 #define S526_AI_REG0x08
 #define REG_DIO 0x0A
-#define REG_IER 0x0C
-#define REG_ISR 0x0E
+#define S526_INT_ENA_REG   0x0c
+#define S526_INT_STATUS_REG0x0e
+#define S526_INT_DIO(x)BIT(8 + ((x) & 0x7))
+#define S526_INT_EEPROMBIT(7)  /* status only */
+#define S526_INT_CNTR(x)   BIT(3 + (3 - ((x) & 0x3)))
+#define S526_INT_AIBIT(2)
+#define S526_INT_AOBIT(1)
+#define S526_INT_TIMER BIT(0)
 #define REG_MSC 0x10
 
 #define S526_GPCT_LSB_REG(x)   (0x12 + ((x) * 8))
@@ -372,7 +378,6 @@ static int s526_gpct_winsn(struct comedi_device *dev,
return insn->n;
 }
 
-#define ISR_ADC_DONE 0x4
 static int s526_ai_insn_config(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn, unsigned int *data)
@@ -393,7 +398,7 @@ static int s526_ai_insn_config(struct comedi_device *dev,
 * INSN_READ handler. */
 
/*  Enable ADC interrupt */
-   outw(ISR_ADC_DONE, dev->iobase + REG_IER);
+   outw(S526_INT_AI, dev->iobase + S526_INT_ENA_REG);
devpriv->ai_config = (data[0] & 0x3ff) << 5;
if (data[1] > 0)
devpriv->ai_config |= S526_AI_CTRL_DELAY;/* set the delay */
@@ -410,8 +415,8 @@ static int s526_ai_eoc(struct comedi_device *dev,
 {
unsigned int status;
 
-   status = inw(dev->iobase + REG_ISR);
-   if (status & ISR_ADC_DONE)
+   status = inw(dev->iobase + S526_INT_STATUS_REG);
+   if (status & S526_INT_AI)
return 0;
return -EBUSY;
 }
@@ -444,7 +449,7 @@ static int s526_ai_rinsn(struct comedi_device *dev, struct 
comedi_subdevice *s,
if (ret)
return ret;
 
-   outw(ISR_ADC_DONE, dev->iobase + REG_ISR);
+   outw(S526_INT_AI, dev->iobase + S526_INT_STATUS_REG);
 
d = inw(dev->iobase + S526_AI_REG);
 
-- 
2.4.3

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


[PATCH 06/18] staging: comedi: s526: define the ADC (analog input) control register and bits

2015-08-17 Thread H Hartley Sweeten
Define this register and its bits and remove the magic numbers.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index e71d850..ff576d3 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -60,7 +60,11 @@
 #define S526_AO_CTRL_RESET BIT(3)
 #define S526_AO_CTRL_CHAN(x)   (((x) & 0x3) << 1)
 #define S526_AO_CTRL_START BIT(0)
-#define REG_ADC 0x06
+#define S526_AI_CTRL_REG   0x06
+#define S526_AI_CTRL_DELAY BIT(15)
+#define S526_AI_CTRL_CONV(x)   (1 << (5 + ((x) & 0x9)))
+#define S526_AI_CTRL_READ(x)   (((x) & 0xf) << 1)
+#define S526_AI_CTRL_START BIT(0)
 #define REG_ADD 0x08
 #define REG_DIO 0x0A
 #define REG_IER 0x0C
@@ -391,7 +395,7 @@ static int s526_ai_insn_config(struct comedi_device *dev,
outw(ISR_ADC_DONE, dev->iobase + REG_IER);
devpriv->ai_config = (data[0] & 0x3ff) << 5;
if (data[1] > 0)
-   devpriv->ai_config |= 0x8000;   /* set the delay */
+   devpriv->ai_config |= S526_AI_CTRL_DELAY;/* set the delay */
 
devpriv->ai_config |= 0x0001;   /* ADC start bit */
 
@@ -416,20 +420,23 @@ static int s526_ai_rinsn(struct comedi_device *dev, 
struct comedi_subdevice *s,
 {
struct s526_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
+   unsigned int ctrl;
int n;
-   unsigned short value;
unsigned int d;
int ret;
 
-   /* Set configured delay, enable channel for this channel only,
-* select "ADC read" channel, set "ADC start" bit. */
-   value = (devpriv->ai_config & 0x8000) |
-   ((1 << 5) << chan) | (chan << 1) | 0x0001;
+   /*
+* Set configured delay, enable conversion and read for requested
+* channel only, set "ADC start" bit.
+*/
+   ctrl = (devpriv->ai_config & S526_AI_CTRL_DELAY) |
+  S526_AI_CTRL_CONV(chan) | S526_AI_CTRL_READ(chan) |
+  S526_AI_CTRL_START;
 
/* convert n samples */
for (n = 0; n < insn->n; n++) {
/* trigger conversion */
-   outw(value, dev->iobase + REG_ADC);
+   outw(ctrl, dev->iobase + S526_AI_CTRL_REG);
 
/* wait for conversion to end */
ret = comedi_timeout(dev, s, insn, s526_ai_eoc, 0);
-- 
2.4.3

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


[PATCH 05/18] staging: comedi: s526: define the DAC (analog output) control register and bits

2015-08-17 Thread H Hartley Sweeten
Define this register and its bits and remove the magic numbers.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index df463a22..e71d850 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -56,7 +56,10 @@
 #define S526_WDOG_INVERTED BIT(4)
 #define S526_WDOG_ENA  BIT(3)
 #define S526_WDOG_INTERVAL(x)  (((x) & 0x7) << 0)
-#define REG_DAC 0x04
+#define S526_AO_CTRL_REG   0x04
+#define S526_AO_CTRL_RESET BIT(3)
+#define S526_AO_CTRL_CHAN(x)   (((x) & 0x3) << 1)
+#define S526_AO_CTRL_START BIT(0)
 #define REG_ADC 0x06
 #define REG_ADD 0x08
 #define REG_DIO 0x0A
@@ -452,16 +455,17 @@ static int s526_ao_insn_write(struct comedi_device *dev,
  unsigned int *data)
 {
unsigned int chan = CR_CHAN(insn->chanspec);
+   unsigned int ctrl = S526_AO_CTRL_CHAN(chan);
unsigned int val = s->readback[chan];
int i;
 
-   outw(chan << 1, dev->iobase + REG_DAC);
+   outw(ctrl, dev->iobase + S526_AO_CTRL_REG);
+   ctrl |= S526_AO_CTRL_START;
 
for (i = 0; i < insn->n; i++) {
val = data[i];
outw(val, dev->iobase + REG_ADD);
-   /* starts the D/A conversion */
-   outw((chan << 1) | 1, dev->iobase + REG_DAC);
+   outw(ctrl, dev->iobase + S526_AO_CTRL_REG);
}
s->readback[chan] = val;
 
-- 
2.4.3

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


[PATCH 04/18] staging: comedi: s526: define the watchdog timer control register and bits

2015-08-17 Thread H Hartley Sweeten
Define this register and it's bits so that we can possibly support
it.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index e329c04..df463a22 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -52,7 +52,10 @@
 #define S526_TIMER_MANUAL  S526_TIMER_MODE(0)
 #define S526_TIMER_AUTOS526_TIMER_MODE(1)
 #define S526_TIMER_RESTART BIT(0)
-#define REG_WDC 0x02
+#define S526_WDOG_REG  0x02
+#define S526_WDOG_INVERTED BIT(4)
+#define S526_WDOG_ENA  BIT(3)
+#define S526_WDOG_INTERVAL(x)  (((x) & 0x7) << 0)
 #define REG_DAC 0x04
 #define REG_ADC 0x06
 #define REG_ADD 0x08
-- 
2.4.3

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


[PATCH 03/18] staging: comedi: s526: define the timer control register and bits

2015-08-17 Thread H Hartley Sweeten
Define this register and it's bits so that we can possibly support
it.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index c011c70..e329c04 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -46,7 +46,12 @@
 #define S526_NUM_PORTS 27
 
 /* registers */
-#define REG_TCR 0x00
+#define S526_TIMER_REG 0x00
+#define S526_TIMER_LOAD(x) (((x) & 0xff) << 8)
+#define S526_TIMER_MODE((x) << 1)
+#define S526_TIMER_MANUAL  S526_TIMER_MODE(0)
+#define S526_TIMER_AUTOS526_TIMER_MODE(1)
+#define S526_TIMER_RESTART BIT(0)
 #define REG_WDC 0x02
 #define REG_DAC 0x04
 #define REG_ADC 0x06
-- 
2.4.3

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


[PATCH 02/18] staging: comedi: s526: refactor gpct registers

2015-08-17 Thread H Hartley Sweeten
The S526 board has 4 general purpose counter/timers. The current
defines used for the registers of these devices do not provide much
clarity in what they are.

Refactor the code to add some clarity.

Replace the current register defines with macros that return the
correct offset based on the counter 'channel'. Introduce a some helper
functions to handle reading/writing the LSB/MSB registers so that
they are always accessed in the correct oreder.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 817ce15..c011c70 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -55,22 +55,12 @@
 #define REG_IER 0x0C
 #define REG_ISR 0x0E
 #define REG_MSC 0x10
-#define REG_C0L 0x12
-#define REG_C0H 0x14
-#define REG_C0M 0x16
-#define REG_C0C 0x18
-#define REG_C1L 0x1A
-#define REG_C1H 0x1C
-#define REG_C1M 0x1E
-#define REG_C1C 0x20
-#define REG_C2L 0x22
-#define REG_C2H 0x24
-#define REG_C2M 0x26
-#define REG_C2C 0x28
-#define REG_C3L 0x2A
-#define REG_C3H 0x2C
-#define REG_C3M 0x2E
-#define REG_C3C 0x30
+
+#define S526_GPCT_LSB_REG(x)   (0x12 + ((x) * 8))
+#define S526_GPCT_MSB_REG(x)   (0x14 + ((x) * 8))
+#define S526_GPCT_MODE_REG(x)  (0x16 + ((x) * 8))
+#define S526_GPCT_CTRL_REG(x)  (0x18 + ((x) * 8))
+
 #define REG_EED 0x32
 #define REG_EEC 0x34
 
@@ -114,24 +104,36 @@ struct s526_private {
unsigned short ai_config;
 };
 
+static void s526_gpct_write(struct comedi_device *dev,
+   unsigned int chan, unsigned int val)
+{
+   /* write high word then low word */
+   outw((val >> 16) & 0x, dev->iobase + S526_GPCT_MSB_REG(chan));
+   outw(val & 0x, dev->iobase + S526_GPCT_LSB_REG(chan));
+}
+
+static unsigned int s526_gpct_read(struct comedi_device *dev,
+  unsigned int chan)
+{
+   unsigned int val;
+
+   /* read the low word then high word */
+   val = inw(dev->iobase + S526_GPCT_LSB_REG(chan)) & 0x;
+   val |= (inw(dev->iobase + S526_GPCT_MSB_REG(chan)) & 0xff) << 16;
+
+   return val;
+}
+
 static int s526_gpct_rinsn(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn,
   unsigned int *data)
 {
unsigned int chan = CR_CHAN(insn->chanspec);
-   unsigned long chan_iobase = dev->iobase + chan * 8;
-   unsigned int lo;
-   unsigned int hi;
int i;
 
-   for (i = 0; i < insn->n; i++) {
-   /* Read the low word first */
-   lo = inw(chan_iobase + REG_C0L) & 0x;
-   hi = inw(chan_iobase + REG_C0H) & 0xff;
-
-   data[i] = (hi << 16) | lo;
-   }
+   for (i = 0; i < insn->n; i++)
+   data[i] = s526_gpct_read(dev, chan);
 
return insn->n;
 }
@@ -143,7 +145,6 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
 {
struct s526_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
-   unsigned long chan_iobase = dev->iobase + chan * 8;
unsigned int val;
union cmReg cmReg;
 
@@ -174,32 +175,31 @@ static int s526_gpct_insn_config(struct comedi_device 
*dev,
cmReg.reg.preloadRegSel = 0;/*  PR0 */
cmReg.reg.reserved = 0;
 
-   outw(cmReg.value, chan_iobase + REG_C0M);
+   outw(cmReg.value, dev->iobase + S526_GPCT_MODE_REG(chan));
 
-   outw(0x0001, chan_iobase + REG_C0H);
-   outw(0x3C68, chan_iobase + REG_C0L);
+   s526_gpct_write(dev, chan, 0x0013c68);
 
/*  Reset the counter */
-   outw(0x8000, chan_iobase + REG_C0C);
+   outw(0x8000, dev->iobase + S526_GPCT_CTRL_REG(chan));
/*  Load the counter from PR0 */
-   outw(0x4000, chan_iobase + REG_C0C);
+   outw(0x4000, dev->iobase + S526_GPCT_CTRL_REG(chan));
 
/*  Reset RCAP (fires one-shot) */
-   outw(0x0008, chan_iobase + REG_C0C);
+   outw(0x0008, dev->iobase + S526_GPCT_CTRL_REG(chan));
 
 #endif
 
 #if 1
/*  Set Counter Mode Register */
cmReg.value = data[1] & 0x;
-   outw(cmReg.value, chan_iobase + REG_C0M);
+   outw(cmReg.value, dev->iobase + S526_GPCT_MODE_REG(chan));
 
/*  Reset the counter if it is software preload */
if (cmReg.reg.autoLoadResetRcap == 0) {
/*  Reset the counter */
-   outw(0x8000, chan_iobase + REG_C0C);
+   outw(0x8000, dev->iobase + S526_GPCT_CTRL_REG(chan));
/* Load the counter fr

[PATCH 01/18] staging: comedi: s526: tidy up multi-line comments

2015-08-17 Thread H Hartley Sweeten
Format the multi-line comments in the kernel CodingStyle.

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 6f3e8a0..817ce15 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -1,40 +1,39 @@
 /*
-comedi/drivers/s526.c
-Sensoray s526 Comedi driver
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 2000 David A. Schleef 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
-/*
-Driver: s526
-Description: Sensoray 526 driver
-Devices: [Sensoray] 526 (s526)
-Author: Richie
-   Everett Wang 
-Updated: Thu, 14 Sep. 2006
-Status: experimental
-
-Encoder works
-Analog input works
-Analog output works
-PWM output works
-Commands are not supported yet.
-
-Configuration Options:
+ * s526.c
+ * Sensoray s526 Comedi driver
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 2000 David A. Schleef 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
-comedi_config /dev/comedi0 s526 0x2C0,0x3
-
-*/
+/*
+ * Driver: s526
+ * Description: Sensoray 526 driver
+ * Devices: [Sensoray] 526 (s526)
+ * Author: Richie
+ *Everett Wang 
+ * Updated: Thu, 14 Sep. 2006
+ * Status: experimental
+ *
+ * Encoder works
+ * Analog input works
+ * Analog output works
+ * PWM output works
+ * Commands are not supported yet.
+ *
+ * Configuration Options:
+ *   [0] - I/O port base address
+ */
 
 #include 
 #include "../comedidev.h"
-- 
2.4.3

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


[PATCH 00/18] staging: comedi: s526: tidy up driver

2015-08-17 Thread H Hartley Sweeten
This series cleans up all of the driver code except for the counter
subdevice. I still need to figure out how that subdevice works, right
now it looks like it might be a bit broken...

H Hartley Sweeten (18):
  staging: comedi: s526: tidy up multi-line comments
  staging: comedi: s526: refactor gpct registers
  staging: comedi: s526: define the timer control register and bits
  staging: comedi: s526: define the watchdog timer control register and bits
  staging: comedi: s526: define the DAC (analog output) control register and 
bits
  staging: comedi: s526: define the ADC (analog input) control register and bits
  staging: comedi: s526: add defines for the ao/ai data register
  staging: comedi: s526: define the interrupt enable/status registers
  staging: comedi: s526: define the digtial I/O control register and bits
  staging: comedi: s526: define the miscellaneous register and bits
  staging: comedi: s526: define the eeprom data and control registers
  staging: comedi: s526: tidy up subdevice init
  staging: comedi: s526: wait for analog output conversions to complete
  staging: comedi: s526: tidy up s526_ai_rinsn()
  staging: comedi: s526: remove s526_ai_insn_config()
  staging: comedi: s526: remove unnecessary defines
  staging: comedi: s526: remove #if 0'ed out code block
  staging: comedi: s526: fix the block comments

 drivers/staging/comedi/drivers/s526.c | 560 --
 1 file changed, 261 insertions(+), 299 deletions(-)

-- 
2.4.3

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


Re: [PATCHv3] staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid possible memory leak

2015-08-17 Thread Dan Carpenter
On Mon, Aug 17, 2015 at 07:12:47PM -0400, Raphaël Beamonte wrote:
> The MALLOC_WILC_BUFFER() macro was using a return statement, and didn't
> take care of possible memory leaks and subsequent bugs when it was failing
> after succeeding some allocations. This patch corrects this behavior.
> 
> Signed-off-by: Raphaël Beamonte 
> ---

Yes.  This looks good now.

regards,
dan carpenter

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


Re: [PATCH] staging: dgnc: take mutex when storing value in dgnc_poll_tick

2015-08-17 Thread Dan Carpenter
On Mon, Aug 17, 2015 at 11:11:05PM +0100, Salah Triki wrote:
> On Mon, Aug 17, 2015 at 09:26:15PM +0300, Dan Carpenter wrote:
> > On Mon, Aug 17, 2015 at 04:19:12PM +0100, Salah Triki wrote:
> > > Since dgnc_poll_trick is a global variable.
> > > 
> > > Signed-off-by: Salah Triki 
> > 
> > Does this changelog even mean?
> > 
> > Why is Mark not on the CC list?  Use scripts/get_maintainer.pl.
> > 
> > I think there probably is a bug here, but access is still racy.  I think
> > we should use dgnc_poll_lock to serialize it.
> > 
> > regards,
> > dan carpenter
> > 
> 
> Sorry for the changelog, I will change it in the next version.
> 
> Mark Hounschell's email (ma...@compro.net) is on the CC.

That's really weird.  The email list removes him from the CC.  Salah
added him and then the mailing list removed him.  I added him back and
the mailing list removed him.

This has happened several times before and I have always just assumed
that people didn't add Mark for whatever reason...  Very strange.

> 
> dgnc_poll_lock is a static variable, may be we should use dgnc_global_lock 
> instead.

Nope.  Make it not static.  The dgnc_poll_lock and the dgnc_global_lock
are different things.

regards,
dan carpenter

> 
> regards,
> salah triki
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv2 5/5] staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid possible memory leak

2015-08-17 Thread Raphaël Beamonte
2015-08-17 15:41 GMT-04:00 Arend van Spriel :
> Probable MACRO_WILC_BUFFER should be MALLOC_WILC_BUFFER here.

Good catch!

> There is really no need to print an error message here. kmalloc will blurb
> enough info when it fails.

Ok!

> So these buffers are globals? So does this driver support multiple devices,
> ie. how are these used when two wilc1000 supported devices are present.

Not sure. I mostly did code refactoring to have a clearer source code
and try to respect the kernel code style. I don't have a compatible
device to try and test it unfortunately.

Thanks for the feedback. I just sent a revised version of the patch
taking your comments into account.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv3] staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid possible memory leak

2015-08-17 Thread Raphaël Beamonte
The MALLOC_WILC_BUFFER() macro was using a return statement, and didn't
take care of possible memory leaks and subsequent bugs when it was failing
after succeeding some allocations. This patch corrects this behavior.

Signed-off-by: Raphaël Beamonte 
---
 drivers/staging/wilc1000/wilc_exported_buf.c | 31 +++-
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c 
b/drivers/staging/wilc1000/wilc_exported_buf.c
index c3f6a0a..ec8d8e5 100644
--- a/drivers/staging/wilc1000/wilc_exported_buf.c
+++ b/drivers/staging/wilc1000/wilc_exported_buf.c
@@ -8,13 +8,6 @@
 #define LINUX_TX_SIZE  (64 * 1024)
 #define WILC1000_FW_SIZE (4 * 1024)
 
-#define MALLOC_WILC_BUFFER(name, size) \
-   exported_ ## name = kmalloc(size, GFP_KERNEL);\
-   if (!exported_ ## name) {   \
-   printk("fail to alloc: %s memory\n", exported_ ## name);  \
-   return -ENOBUFS;\
-   }
-
 #define FREE_WILC_BUFFER(name) \
kfree(exported_ ## name);
 
@@ -49,11 +42,29 @@ static int __init wilc_module_init(void)
/*
 * alloc necessary memory
 */
-   MALLOC_WILC_BUFFER(g_tx_buf, LINUX_TX_SIZE)
-   MALLOC_WILC_BUFFER(g_rx_buf, LINUX_RX_SIZE)
-   MALLOC_WILC_BUFFER(g_fw_buf, WILC1000_FW_SIZE)
+   exported_g_tx_buf = kmalloc(LINUX_TX_SIZE, GFP_KERNEL);
+   if (!exported_g_tx_buf)
+   return -ENOMEM;
+
+   exported_g_rx_buf = kmalloc(LINUX_RX_SIZE, GFP_KERNEL);
+   if (!exported_g_rx_buf)
+   goto free_g_tx_buf;
+
+   exported_g_fw_buf = kmalloc(WILC1000_FW_SIZE, GFP_KERNEL);
+   if (!exported_g_fw_buf)
+   goto free_g_rx_buf;
 
return 0;
+
+free_g_rx_buf:
+   kfree(exported_g_rx_buf);
+   exported_g_rx_buf = NULL;
+
+free_g_tx_buf:
+   kfree(exported_g_tx_buf);
+   exported_g_tx_buf = NULL;
+
+   return -ENOMEM;
 }
 
 static void __exit wilc_module_deinit(void)
-- 
2.1.4

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


[PATCHv3] staging: wilc1000: use netdev_* instead of printk

2015-08-17 Thread Raphaël Beamonte
Signed-off-by: Raphaël Beamonte 
---
 drivers/staging/wilc1000/coreconfigurator.c  |  4 ++--
 drivers/staging/wilc1000/linux_wlan.c|  8 
 drivers/staging/wilc1000/linux_wlan_common.h | 28 ++--
 drivers/staging/wilc1000/linux_wlan_sdio.c   |  2 +-
 drivers/staging/wilc1000/linux_wlan_spi.c|  2 +-
 drivers/staging/wilc1000/wilc_debugfs.c  | 16 
 drivers/staging/wilc1000/wilc_exported_buf.c |  2 --
 7 files changed, 30 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 16a0abc..9a36b78 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -2001,7 +2001,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,

pstrWIDs[counter].u16WIDid,
(counter == 
u32WIDsCount - 1), drvHandler)) {
ret = -1;
-   printk("[Sendconfigpkt]Get Timed out\n");
+   netdev_err("[Sendconfigpkt]Get Timed out\n");
break;
}
}
@@ -2023,7 +2023,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,

pstrWIDs[counter].s32ValueSize,
(counter == 
u32WIDsCount - 1), drvHandler)) {
ret = -1;
-   printk("[Sendconfigpkt]Set Timed out\n");
+   netdev_err("[Sendconfigpkt]Set Timed out\n");
break;
}
}
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index b3cc9f5..7903572 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1306,7 +1306,7 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic)
 
if (g_linux_wlan->wilc1000_initialized) {
 
-   printk("Deinitializing wilc1000  ...\n");
+   netdev_debug("Deinitializing wilc1000  ...\n");
 
if (nic == NULL) {
PRINT_ER("nic is NULL\n");
@@ -2565,8 +2565,8 @@ static int __init init_wilc_driver(void)
}
 #endif
 
-   printk("IN INIT FUNCTION\n");
-   printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
+   netdev_debug("IN INIT FUNCTION\n");
+   netdev_info("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
 
linux_wlan_device_power(1);
msleep(100);
@@ -2662,7 +2662,7 @@ static void __exit exit_wilc_driver(void)
kfree(g_linux_wlan);
g_linux_wlan = NULL;
}
-   printk("Module_exit Done.\n");
+   netdev_debug("Module_exit Done.\n");
 
 #if defined(WILC_DEBUGFS)
wilc_debugfs_remove();
diff --git a/drivers/staging/wilc1000/linux_wlan_common.h 
b/drivers/staging/wilc1000/linux_wlan_common.h
index e6ebf3e..7f53d8c 100644
--- a/drivers/staging/wilc1000/linux_wlan_common.h
+++ b/drivers/staging/wilc1000/linux_wlan_common.h
@@ -63,8 +63,8 @@ extern atomic_t DEBUG_LEVEL;
do {\
if ((atomic_read(&DEBUG_LEVEL) & INFO) &&   \
   ((atomic_read(®ION)) & (region))) {   \
-   printk("INFO [%s]", __func__);  \
-   printk(__VA_ARGS__);\
+   netdev_info("INFO [%s]", __func__); 
\
+   netdev_info(__VA_ARGS__);   
\
}   \
} while (0)
 
@@ -72,16 +72,16 @@ extern atomic_t DEBUG_LEVEL;
do {\
if ((atomic_read(&DEBUG_LEVEL) & WRN) &&\
   ((atomic_read(®ION)) & (region))) {   \
-   printk("WRN [%s: %d]", __func__, __LINE__); \
-   printk(__VA_ARGS__);\
+   netdev_warning("WRN [%s: %d]", __func__, __LINE__); 
\
+   netdev_warning(__VA_ARGS__);
\
}   \
} while (0)
 
 #define PRINT_ER(...)  \
do {\
if ((atomic_read(&DEBUG_LEVEL) & ERR)) {\
-   printk("ERR [%s: %d]", __func__, __LINE__); \
-   print

Re: linux-next: Tree for Aug 17 (staging/hfi1)

2015-08-17 Thread Randy Dunlap
On 08/17/15 03:55, Stephen Rothwell wrote:
> Hi all,
> 
> Changes since 20150813:
> 


Several items:

A:  these and other similar errors:

In file included from ../drivers/staging/hfi1/chip.c:61:0:
../drivers/staging/hfi1/chip.c: In function ‘__hfi1_trace_LINKVERB’:
../drivers/staging/hfi1/trace.h:1357:20: error: function 
‘__hfi1_trace_LINKVERB’ can never be inlined because it uses variable 
argument lists
 static inline void __hfi1_trace_##fn(const char *func, char *fmt, ...) \
^
../drivers/staging/hfi1/chip.c: In function ‘__hfi1_trace_CNTR’:
../drivers/staging/hfi1/trace.h:1357:20: error: function 
‘__hfi1_trace_CNTR’ can never be inlined because it uses variable argument 
lists
 static inline void __hfi1_trace_##fn(const char *func, char *fmt, ...) \
^
../drivers/staging/hfi1/chip.c: In function ‘__hfi1_trace_DC8051’:
../drivers/staging/hfi1/trace.h:1357:20: error: function 
‘__hfi1_trace_DC8051’ can never be inlined because it uses variable 
argument lists
 static inline void __hfi1_trace_##fn(const char *func, char *fmt, ...) \
^
../drivers/staging/hfi1/chip.c: In function ‘__hfi1_trace_RCVCTRL’:
../drivers/staging/hfi1/trace.h:1357:20: error: function 
‘__hfi1_trace_RCVCTRL’ can never be inlined because it uses variable 
argument lists
 static inline void __hfi1_trace_##fn(const char *func, char *fmt, ...) \
^
../drivers/staging/hfi1/chip.c: In function ‘__hfi1_trace_TID’:
../drivers/staging/hfi1/trace.h:1357:20: error: function ‘__hfi1_trace_TID’ 
can never be inlined because it uses variable argument lists
 static inline void __hfi1_trace_##fn(const char *func, char *fmt, ...) \
^

B:  When CONFIG_PCI is not enabled, lots of these errors:

In file included from ../drivers/staging/hfi1/chip.c:60:0:
../drivers/staging/hfi1/hfi.h:508:20: error: field ‘msix’ has incomplete 
type
  struct msix_entry msix;
   ^

../drivers/staging/hfi1/chip.c: In function ‘disable_intx’:
../drivers/staging/hfi1/chip.c:8667:2: error: implicit declaration of function 
‘pci_intx’ [-Werror=implicit-function-declaration]
  pci_intx(pdev, 0);
  ^

so the driver should depend on PCI or maybe even PCI_MSI.

C.  Please provide some contact info, e.g. in a TODO file or the MAINTAINERS 
file.


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


Re: [PATCH] staging: dgnc: take mutex when storing value in dgnc_poll_tick

2015-08-17 Thread Salah Triki
On Mon, Aug 17, 2015 at 09:26:15PM +0300, Dan Carpenter wrote:
> On Mon, Aug 17, 2015 at 04:19:12PM +0100, Salah Triki wrote:
> > Since dgnc_poll_trick is a global variable.
> > 
> > Signed-off-by: Salah Triki 
> 
> Does this changelog even mean?
> 
> Why is Mark not on the CC list?  Use scripts/get_maintainer.pl.
> 
> I think there probably is a bug here, but access is still racy.  I think
> we should use dgnc_poll_lock to serialize it.
> 
> regards,
> dan carpenter
> 

Sorry for the changelog, I will change it in the next version.

Mark Hounschell's email (ma...@compro.net) is on the CC.

dgnc_poll_lock is a static variable, may be we should use dgnc_global_lock 
instead.

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


[PATCH v2 1/3] staging: comedi: serial2002: tidy up multi-line comments

2015-08-17 Thread H Hartley Sweeten
Format the multi-line comments in the kernel CodingStyle.

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

diff --git a/drivers/staging/comedi/drivers/serial2002.c 
b/drivers/staging/comedi/drivers/serial2002.c
index 5f19374..186ddd4 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -1,30 +1,29 @@
 /*
-comedi/drivers/serial2002.c
-Skeleton code for a Comedi driver
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 2002 Anders Blomdell 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
+ * serial2002.c
+ * Comedi driver for serial connected hardware
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 2002 Anders Blomdell 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
 /*
-Driver: serial2002
-Description: Driver for serial connected hardware
-Devices:
-Author: Anders Blomdell
-Updated: Fri,  7 Jun 2002 12:56:45 -0700
-Status: in development
-
-*/
+ * Driver: serial2002
+ * Description: Driver for serial connected hardware
+ * Devices:
+ * Author: Anders Blomdell
+ * Updated: Fri,  7 Jun 2002 12:56:45 -0700
+ * Status: in development
+ */
 
 #include 
 #include "../comedidev.h"
-- 
2.4.3

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


[PATCH v2 3/3] staging: comedi: serial2002: use proper errno

2015-08-17 Thread H Hartley Sweeten
checkpatch.pl reports:
WARNING: ENOSYS means 'invalid syscall nr' and nothing else

Change the error code to -ENOTTY.

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

diff --git a/drivers/staging/comedi/drivers/serial2002.c 
b/drivers/staging/comedi/drivers/serial2002.c
index c6f9855..7a1defc 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -101,7 +101,7 @@ static long serial2002_tty_ioctl(struct file *f, unsigned 
op,
if (f->f_op->unlocked_ioctl)
return f->f_op->unlocked_ioctl(f, op, param);
 
-   return -ENOSYS;
+   return -ENOTTY;
 }
 
 static int serial2002_tty_write(struct file *f, unsigned char *buf, int count)
-- 
2.4.3

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


[PATCH v2 0/3] staging: comedi: serial2002: tidy up

2015-08-17 Thread H Hartley Sweeten
Fix all the remaining checkpatch.pl issues.

v2: change errno in patch 3 to -ENOTTY

H Hartley Sweeten (3):
  staging: comedi: serial2002: tidy up multi-line comments
  staging: comedi: serial2002: usleep_range is preferred over udelay
  staging: comedi: serial2002: use proper errno

 drivers/staging/comedi/drivers/serial2002.c | 51 ++---
 1 file changed, 25 insertions(+), 26 deletions(-)

-- 
2.4.3

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


[PATCH v2 2/3] staging: comedi: serial2002: usleep_range is preferred over udelay

2015-08-17 Thread H Hartley Sweeten
Fix checkpatch issue: "CHECK: usleep_range is preferred over udelay;
see Documentation/timers/timers-howto.txt". Replace the udelay() with
usleep_range() with a reasonable upper limit.

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

diff --git a/drivers/staging/comedi/drivers/serial2002.c 
b/drivers/staging/comedi/drivers/serial2002.c
index 186ddd4..c6f9855 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -175,7 +175,7 @@ static int serial2002_tty_read(struct file *f, int timeout)
result = ch;
break;
}
-   udelay(100);
+   usleep_range(100, 1000);
}
}
set_fs(oldfs);
-- 
2.4.3

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


RE: [PATCH 3/3] staging: comedi: serial2002: use proper errno

2015-08-17 Thread Hartley Sweeten
On Monday, August 17, 2015 4:52 AM, Ian Abbott wrote:
> On 15/08/15 01:31, H Hartley Sweeten wrote:
>> checkpatch.pl reports:
>> WARNING: ENOSYS means 'invalid syscall nr' and nothing else
>>
>> Change the error code to -ENOIOCTLCMD/
>>
>> Signed-off-by: H Hartley Sweeten 
>> Cc: Ian Abbott 
>> Cc: Greg Kroah-Hartman 
>> ---
>>   drivers/staging/comedi/drivers/serial2002.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/comedi/drivers/serial2002.c 
>> b/drivers/staging/comedi/drivers/serial2002.c
>> index c6f9855..60d7d73 100644
>> --- a/drivers/staging/comedi/drivers/serial2002.c
>> +++ b/drivers/staging/comedi/drivers/serial2002.c
>> @@ -101,7 +101,7 @@ static long serial2002_tty_ioctl(struct file *f, 
>> unsigned op,
>>  if (f->f_op->unlocked_ioctl)
>>  return f->f_op->unlocked_ioctl(f, op, param);
>>
>> -return -ENOSYS;
>> +return -ENOIOCTLCMD;
>>   }
> 
> I think ENOIOCTLCMD means something like "try some other ioctl handler" 
> and should get converted to ENOTTY by the code higher up the return path 
> if there is no other ioctl handler.  Still, it might be safer to return 
> -ENOTTY directly here.  Not that it really matters, as the return value 
> from this function is currently ignored.

There are not a lot of f_op->unlocked_ioctl() calls in the kernel. Looking them
over it appears that either -ENOIOCTLCMD or -ENOTTY is returned when the
callback is not setup.

But, in fs/ioctl.c there is this sequence:

int error = -ENOTTY;

if (!filp->f_op->unlocked_ioctl)
goto out;

error = filp->f_op->unlocked_ioctl(filp, cmd, arg);
if (error == -ENOIOCTLCMD)
error = -ENOTTY;
out:
return error;

So it "appears" that -ENOTTY would be a better errno.

Also, I just noticed that comedi_compat32.c also returns -ENOTTY from
translated_ioctl() if the unlocked_ioctl callback is not setup.

I'll redo this patch and repost.

Thanks,
Hartley

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


[PATCH] staging: comedi: unioxx5: remove this flawed driver

2015-08-17 Thread H Hartley Sweeten
I was going to clean up this driver but looking it over it has a
number of serious flaws. Also, Fastwell published an End-Of-Life
notification for the board on 24/Jan/2014 (End-of-sale 30/Jun/2014,
End-of-delivery 30/Dec/2014).

Since the driver has a comedi driver status of "unkown", lets just
remove the driver instead of trying to fix the flaws.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/Kconfig   |   8 -
 drivers/staging/comedi/drivers/Makefile  |   1 -
 drivers/staging/comedi/drivers/unioxx5.c | 506 ---
 3 files changed, 515 deletions(-)
 delete mode 100644 drivers/staging/comedi/drivers/unioxx5.c

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 57e71f9..682987e 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -400,14 +400,6 @@ config COMEDI_DMM32AT
  To compile this driver as a module, choose M here: the module will be
  called dmm32at.
 
-config COMEDI_UNIOXX5
-   tristate "Fastwel UNIOxx-5 analog and digital io board support"
-   ---help---
- Enable support for Fastwel UNIOxx-5 (analog and digital i/o) boards
-
- To compile this driver as a module, choose M here: the module will be
- called unioxx5.
-
 config COMEDI_FL512
tristate "FL512 ISA card support"
---help---
diff --git a/drivers/staging/comedi/drivers/Makefile 
b/drivers/staging/comedi/drivers/Makefile
index 5764dc9..c3b8f2d 100644
--- a/drivers/staging/comedi/drivers/Makefile
+++ b/drivers/staging/comedi/drivers/Makefile
@@ -90,7 +90,6 @@ obj-$(CONFIG_COMEDI_CONTEC_PCI_DIO)   += contec_pci_dio.o
 obj-$(CONFIG_COMEDI_DAS08_PCI) += das08_pci.o
 obj-$(CONFIG_COMEDI_DT3000)+= dt3000.o
 obj-$(CONFIG_COMEDI_DYNA_PCI10XX)  += dyna_pci10xx.o
-obj-$(CONFIG_COMEDI_UNIOXX5)   += unioxx5.o
 obj-$(CONFIG_COMEDI_GSC_HPDI)  += gsc_hpdi.o
 obj-$(CONFIG_COMEDI_ICP_MULTI) += icp_multi.o
 obj-$(CONFIG_COMEDI_DAQBOARD2000)  += daqboard2000.o
diff --git a/drivers/staging/comedi/drivers/unioxx5.c 
b/drivers/staging/comedi/drivers/unioxx5.c
deleted file mode 100644
index 51498b8..000
--- a/drivers/staging/comedi/drivers/unioxx5.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/***
- * *
- *  comedi/drivers/unioxx5.c   *
- *  Driver for Fastwel UNIOxx-5 (analog and digital i/o) boards.   *
- * *
- *  Copyright (C) 2006 Kruchinin Daniil (asgard) [asg...@etersoft.ru]  *
- * *
- *  COMEDI - Linux Control and Measurement Device Interface*
- *  Copyright (C) 1998,2000 David A. Schleef   *
- * *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or  *
- *  (at your option) any later version.*
- * *
- *  This program is distributed in the hope that it will be useful,*
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  *
- *  GNU General Public License for more details.   *
- * *
- ***/
-/*
-
-Driver: unioxx5
-Description: Driver for Fastwel UNIOxx-5 (analog and digital i/o) boards.
-Author: Kruchinin Daniil (asgard) 
-Status: unknown
-Updated: 2006-10-09
-Devices: [Fastwel] UNIOxx-5 (unioxx5),
-
- This card supports digital and analog I/O. It written for g01
- subdevices only.
- channels range: 0 .. 23 dio channels
- and 0 .. 11 analog modules range
- During attaching unioxx5 module displays modules identifiers
- (see dmesg after comedi_config) in format:
- | [module_number] module_id |
-
-*/
-
-#include 
-#include 
-#include "../comedidev.h"
-
-#define UNIOXX5_SIZE 0x10
-#define UNIOXX5_SUBDEV_BASE 0xA000 /* base addr of first subdev */
-#define UNIOXX5_SUBDEV_ODDS 0x400
-
-/* modules types */
-#define MODULE_DIGITAL 0
-#define MODULE_OUTPUT_MASK 0x80/* analog input/output */
-
-/* constants for digital i/o */
-#define UNIOXX5_NUM_OF_CHANS 24
-
-/* constants for analog i/o */
-#define TxBE  0x10 /* transmit buffer enable */
-#define RxCA  0x20 /* 1 receive character available */

Re: [PATCHv2 4/5] staging: wilc1000: remove FREE_WILC_BUFFER()

2015-08-17 Thread Greg Kroah-Hartman
On Mon, Aug 17, 2015 at 03:28:29PM -0400, Raphaël Beamonte wrote:
> It was just a wrapper around kfree(), so call that instead.

Someone else already did this, sorry.

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


Re: [PATCHv2 2/5] staging: wilc1000: use pr_* instead of printk

2015-08-17 Thread Greg Kroah-Hartman
On Mon, Aug 17, 2015 at 03:28:27PM -0400, Raphaël Beamonte wrote:
> Signed-off-by: Raphaël Beamonte 
> ---
>  drivers/staging/wilc1000/coreconfigurator.c  |  4 ++--
>  drivers/staging/wilc1000/linux_wlan.c|  8 
>  drivers/staging/wilc1000/linux_wlan_common.h | 28 
> ++--
>  drivers/staging/wilc1000/linux_wlan_sdio.c   |  2 +-
>  drivers/staging/wilc1000/linux_wlan_spi.c|  2 +-
>  drivers/staging/wilc1000/wilc_debugfs.c  | 16 
>  drivers/staging/wilc1000/wilc_exported_buf.c |  2 --
>  7 files changed, 30 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
> b/drivers/staging/wilc1000/coreconfigurator.c
> index 1a5b165..8a0ebba 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -2005,7 +2005,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
>   
> pstrWIDs[counter].u16WIDid,
>   (counter == 
> u32WIDsCount - 1), drvHandler)) {
>   ret = -1;
> - printk("[Sendconfigpkt]Get Timed out\n");
> + pr_err("[Sendconfigpkt]Get Timed out\n");

This is a network driver, please use the proper logging statement for
such a thing (i.e. netdev_err()).

thanks,

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


Re: [PATCH 4/4] staging: wilc1000: return -EINVAL for invalid argument checking

2015-08-17 Thread Greg KH
On Mon, Aug 17, 2015 at 10:44:31PM +0900, Chaehyun Lim wrote:
> This patch uses -EINVAL for invalid argument checking instead of using
> WILC_ERRORREPORT with WILC_INVALID_ARGUMENT.
> 
> Signed-off-by: Chaehyun Lim 
> ---
>  drivers/staging/wilc1000/wilc_msgqueue.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
> b/drivers/staging/wilc1000/wilc_msgqueue.c
> index dd87448..561ff88 100644
> --- a/drivers/staging/wilc1000/wilc_msgqueue.c
> +++ b/drivers/staging/wilc1000/wilc_msgqueue.c
> @@ -61,7 +61,7 @@ s32 WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
>   Message *pstrMessage = NULL;
>  
>   if ((pHandle == NULL) || (u32SendBufferSize == 0) || (pvSendBuffer == 
> NULL)) {
> - WILC_ERRORREPORT(s32RetStatus, WILC_INVALID_ARGUMENT);
> + return -EINVAL;

Watch out, WILC_ERRORREPORT has a goto in it, so I don't know if you can
always just do a "simple" return like this.

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


Re: [PATCH 1/4] staging: wilc1000: delete wilc_log.h

2015-08-17 Thread Greg KH
On Mon, Aug 17, 2015 at 10:44:28PM +0900, Chaehyun Lim wrote:
> The macros in wilc_log.h are not referenced anywhere, so just delete it.

Oops, I just did this same thing before I saw your email, sorry about
that.

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


Re: [PATCH 2/4] staging: wilc1000: delete wilc_osconfig.h

2015-08-17 Thread Greg KH
On Mon, Aug 17, 2015 at 10:44:29PM +0900, Chaehyun Lim wrote:
> The macros inside wilc_osconfig.h are not referenced anywhere,
> so just delete it.
> 
> Signed-off-by: Chaehyun Lim 

And I did this one also, again, sorry, I hadn't seen your email yet.

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


[PATCHv2 1/5] staging: wilc1000: remove void function return statements that are not useful

2015-08-17 Thread Raphaël Beamonte
Signed-off-by: Raphaël Beamonte 
---
 drivers/staging/wilc1000/host_interface.c| 4 
 drivers/staging/wilc1000/linux_wlan.c| 1 -
 drivers/staging/wilc1000/wilc_exported_buf.c | 4 +---
 drivers/staging/wilc1000/wilc_wlan.c | 3 ---
 drivers/staging/wilc1000/wilc_wlan_cfg.c | 2 --
 5 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c473877..0cfc97d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6782,9 +6782,6 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length)
s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, 
sizeof(tstrHostIFmsg));
if (s32Error)
PRINT_ER("Error in sending network info message queue message 
parameters: Error(%d)\n", s32Error);
-
-
-   return;
 }
 
 /**
@@ -6848,7 +6845,6 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length)
 
/*BugID_5348*/
up(&hSemHostIntDeinit);
-   return;
 }
 
 /**
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 7eacc2f..e6e8a20 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1385,7 +1385,6 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic)
} else {
PRINT_D(INIT_DBG, "wilc1000 is not initialized\n");
}
-   return;
 }
 
 int wlan_init_locks(linux_wlan_t *p_nic)
diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c 
b/drivers/staging/wilc1000/wilc_exported_buf.c
index 5294578..deba6bd 100644
--- a/drivers/staging/wilc1000/wilc_exported_buf.c
+++ b/drivers/staging/wilc1000/wilc_exported_buf.c
@@ -65,12 +65,10 @@ static void __exit wilc_module_deinit(void)
FREE_WILC_BUFFER(g_tx_buf)
FREE_WILC_BUFFER(g_rx_buf)
FREE_WILC_BUFFER(g_fw_buf)
-
-   return;
 }
 
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_AUTHOR("Tony Cho");
 MODULE_DESCRIPTION("WILC1xxx Memory Manager");
 pure_initcall(wilc_module_init);
-module_exit(wilc_module_deinit);
\ No newline at end of file
+module_exit(wilc_module_deinit);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index fac16db..7c53a2b 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -124,8 +124,6 @@ static void wilc_debug(uint32_t flag, char *fmt, ...)
if (g_wlan.os_func.os_debug)
g_wlan.os_func.os_debug(buf);
}
-
-   return;
 }
 
 static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP;
@@ -1325,7 +1323,6 @@ static void wilc_wlan_handle_rxq(void)
 
p->rxq_exit = 1;
PRINT_D(RX_DBG, "THREAD: Exiting RX thread\n");
-   return;
 }
 
 /
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index c10dffe..e2842d3 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -363,8 +363,6 @@ static void wilc_wlan_parse_response_frame(uint8_t *info, 
int size)
size -= (2 + len);
info += (2 + len);
}
-
-   return;
 }
 
 static int wilc_wlan_parse_info_frame(uint8_t *info, int size)
-- 
2.1.4

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


[PATCHv2 3/5] staging: wilc1000: remove DECLARE_WILC_BUFFER()

2015-08-17 Thread Raphaël Beamonte
It was just a wrapper to initialize a variable. Initialize it
directly instead.

Signed-off-by: Raphaël Beamonte 
---
 drivers/staging/wilc1000/wilc_exported_buf.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c 
b/drivers/staging/wilc1000/wilc_exported_buf.c
index 55b6232..148d608 100644
--- a/drivers/staging/wilc1000/wilc_exported_buf.c
+++ b/drivers/staging/wilc1000/wilc_exported_buf.c
@@ -8,9 +8,6 @@
 #define LINUX_TX_SIZE  (64 * 1024)
 #define WILC1000_FW_SIZE (4 * 1024)
 
-#define DECLARE_WILC_BUFFER(name)  \
-   void *exported_ ## name = NULL;
-
 #define MALLOC_WILC_BUFFER(name, size) \
exported_ ## name = kmalloc(size, GFP_KERNEL);\
if (!exported_ ## name) {   \
@@ -24,9 +21,9 @@
 /*
  * Add necessary buffer pointers
  */
-DECLARE_WILC_BUFFER(g_tx_buf)
-DECLARE_WILC_BUFFER(g_rx_buf)
-DECLARE_WILC_BUFFER(g_fw_buf)
+void *exported_g_tx_buf;
+void *exported_g_rx_buf;
+void *exported_g_fw_buf;
 
 void *get_tx_buffer(void)
 {
-- 
2.1.4

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


[PATCHv2 4/5] staging: wilc1000: remove FREE_WILC_BUFFER()

2015-08-17 Thread Raphaël Beamonte
It was just a wrapper around kfree(), so call that instead.

Signed-off-by: Raphaël Beamonte 
---
 drivers/staging/wilc1000/wilc_exported_buf.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c 
b/drivers/staging/wilc1000/wilc_exported_buf.c
index 148d608..c9a5943 100644
--- a/drivers/staging/wilc1000/wilc_exported_buf.c
+++ b/drivers/staging/wilc1000/wilc_exported_buf.c
@@ -15,9 +15,6 @@
return -ENOBUFS;\
}
 
-#define FREE_WILC_BUFFER(name) \
-   kfree(exported_ ## name);
-
 /*
  * Add necessary buffer pointers
  */
@@ -57,9 +54,9 @@ static int __init wilc_module_init(void)
 
 static void __exit wilc_module_deinit(void)
 {
-   FREE_WILC_BUFFER(g_tx_buf)
-   FREE_WILC_BUFFER(g_rx_buf)
-   FREE_WILC_BUFFER(g_fw_buf)
+   kfree(exported_g_tx_buf);
+   kfree(exported_g_rx_buf);
+   kfree(exported_g_fw_buf);
 }
 
 MODULE_LICENSE("Dual BSD/GPL");
-- 
2.1.4

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


[PATCHv2 0/5] staging: wilc1000: code improvements

2015-08-17 Thread Raphaël Beamonte
Hi,

Following comments from Dan Carpenter, please find the following
revised patches.

Raphaël


Raphaël Beamonte (5):
  staging: wilc1000: remove void function return statements that are not
useful
  staging: wilc1000: use pr_* instead of printk
  staging: wilc1000: remove DECLARE_WILC_BUFFER()
  staging: wilc1000: remove FREE_WILC_BUFFER()
  staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid
possible memory leak

 drivers/staging/wilc1000/coreconfigurator.c  |  4 +-
 drivers/staging/wilc1000/host_interface.c|  4 --
 drivers/staging/wilc1000/linux_wlan.c|  9 ++--
 drivers/staging/wilc1000/linux_wlan_common.h | 28 ++---
 drivers/staging/wilc1000/linux_wlan_sdio.c   |  2 +-
 drivers/staging/wilc1000/linux_wlan_spi.c|  2 +-
 drivers/staging/wilc1000/wilc_debugfs.c  | 16 
 drivers/staging/wilc1000/wilc_exported_buf.c | 61 
 drivers/staging/wilc1000/wilc_wlan.c |  3 --
 drivers/staging/wilc1000/wilc_wlan_cfg.c |  2 -
 10 files changed, 64 insertions(+), 67 deletions(-)

-- 
2.1.4

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


[PATCHv2 2/5] staging: wilc1000: use pr_* instead of printk

2015-08-17 Thread Raphaël Beamonte
Signed-off-by: Raphaël Beamonte 
---
 drivers/staging/wilc1000/coreconfigurator.c  |  4 ++--
 drivers/staging/wilc1000/linux_wlan.c|  8 
 drivers/staging/wilc1000/linux_wlan_common.h | 28 ++--
 drivers/staging/wilc1000/linux_wlan_sdio.c   |  2 +-
 drivers/staging/wilc1000/linux_wlan_spi.c|  2 +-
 drivers/staging/wilc1000/wilc_debugfs.c  | 16 
 drivers/staging/wilc1000/wilc_exported_buf.c |  2 --
 7 files changed, 30 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 1a5b165..8a0ebba 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -2005,7 +2005,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,

pstrWIDs[counter].u16WIDid,
(counter == 
u32WIDsCount - 1), drvHandler)) {
ret = -1;
-   printk("[Sendconfigpkt]Get Timed out\n");
+   pr_err("[Sendconfigpkt]Get Timed out\n");
break;
}
}
@@ -2027,7 +2027,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,

pstrWIDs[counter].s32ValueSize,
(counter == 
u32WIDsCount - 1), drvHandler)) {
ret = -1;
-   printk("[Sendconfigpkt]Set Timed out\n");
+   pr_err("[Sendconfigpkt]Set Timed out\n");
break;
}
}
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index e6e8a20..a02be31 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1306,7 +1306,7 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic)
 
if (g_linux_wlan->wilc1000_initialized) {
 
-   printk("Deinitializing wilc1000  ...\n");
+   pr_debug("Deinitializing wilc1000  ...\n");
 
if (nic == NULL) {
PRINT_ER("nic is NULL\n");
@@ -2565,8 +2565,8 @@ static int __init init_wilc_driver(void)
}
 #endif
 
-   printk("IN INIT FUNCTION\n");
-   printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
+   pr_debug("IN INIT FUNCTION\n");
+   pr_info("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
 
linux_wlan_device_power(1);
msleep(100);
@@ -2662,7 +2662,7 @@ static void __exit exit_wilc_driver(void)
kfree(g_linux_wlan);
g_linux_wlan = NULL;
}
-   printk("Module_exit Done.\n");
+   pr_debug("Module_exit Done.\n");
 
 #if defined(WILC_DEBUGFS)
wilc_debugfs_remove();
diff --git a/drivers/staging/wilc1000/linux_wlan_common.h 
b/drivers/staging/wilc1000/linux_wlan_common.h
index e6ebf3e..8f3cc1a 100644
--- a/drivers/staging/wilc1000/linux_wlan_common.h
+++ b/drivers/staging/wilc1000/linux_wlan_common.h
@@ -63,8 +63,8 @@ extern atomic_t DEBUG_LEVEL;
do {\
if ((atomic_read(&DEBUG_LEVEL) & INFO) &&   \
   ((atomic_read(®ION)) & (region))) {   \
-   printk("INFO [%s]", __func__);  \
-   printk(__VA_ARGS__);\
+   pr_info("INFO [%s]", __func__); \
+   pr_info(__VA_ARGS__);   \
}   \
} while (0)
 
@@ -72,16 +72,16 @@ extern atomic_t DEBUG_LEVEL;
do {\
if ((atomic_read(&DEBUG_LEVEL) & WRN) &&\
   ((atomic_read(®ION)) & (region))) {   \
-   printk("WRN [%s: %d]", __func__, __LINE__); \
-   printk(__VA_ARGS__);\
+   pr_warning("WRN [%s: %d]", __func__, __LINE__); \
+   pr_warning(__VA_ARGS__);
\
}   \
} while (0)
 
 #define PRINT_ER(...)  \
do {\
if ((atomic_read(&DEBUG_LEVEL) & ERR)) {\
-   printk("ERR [%s: %d]", __func__, __LINE__); \
-   printk(__VA_ARGS__);\
+ 

[PATCHv2 5/5] staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid possible memory leak

2015-08-17 Thread Raphaël Beamonte
The MACRO_WILC_BUFFER() macro was using a return statement, and didn't
take care of possible memory leaks and subsequent bugs when it was failing
after succeeding some allocations. This patch corrects this behavior.

Signed-off-by: Raphaël Beamonte 
---
 drivers/staging/wilc1000/wilc_exported_buf.c | 37 
 1 file changed, 27 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c 
b/drivers/staging/wilc1000/wilc_exported_buf.c
index c9a5943..0f3bdad 100644
--- a/drivers/staging/wilc1000/wilc_exported_buf.c
+++ b/drivers/staging/wilc1000/wilc_exported_buf.c
@@ -8,13 +8,6 @@
 #define LINUX_TX_SIZE  (64 * 1024)
 #define WILC1000_FW_SIZE (4 * 1024)
 
-#define MALLOC_WILC_BUFFER(name, size) \
-   exported_ ## name = kmalloc(size, GFP_KERNEL);\
-   if (!exported_ ## name) {   \
-   printk("fail to alloc: %s memory\n", exported_ ## name);  \
-   return -ENOBUFS;\
-   }
-
 /*
  * Add necessary buffer pointers
  */
@@ -45,11 +38,35 @@ static int __init wilc_module_init(void)
/*
 * alloc necessary memory
 */
-   MALLOC_WILC_BUFFER(g_tx_buf, LINUX_TX_SIZE)
-   MALLOC_WILC_BUFFER(g_rx_buf, LINUX_RX_SIZE)
-   MALLOC_WILC_BUFFER(g_fw_buf, WILC1000_FW_SIZE)
+   exported_g_tx_buf = kmalloc(LINUX_TX_SIZE, GFP_KERNEL);
+   if (!exported_g_tx_buf) {
+   pr_err("fail to alloc tx buf");
+   return -ENOMEM;
+   }
+
+   exported_g_rx_buf = kmalloc(LINUX_RX_SIZE, GFP_KERNEL);
+   if (!exported_g_rx_buf) {
+   pr_err("fail to alloc rx buf");
+   goto free_g_tx_buf;
+   }
+
+   exported_g_fw_buf = kmalloc(WILC1000_FW_SIZE, GFP_KERNEL);
+   if (!exported_g_fw_buf) {
+   pr_err("fail to alloc fw buf");
+   goto free_g_rx_buf;
+   }
 
return 0;
+
+free_g_rx_buf:
+   kfree(exported_g_rx_buf);
+   exported_g_rx_buf = NULL;
+
+free_g_tx_buf:
+   kfree(exported_g_tx_buf);
+   exported_g_tx_buf = NULL;
+
+   return -ENOMEM;
 }
 
 static void __exit wilc_module_deinit(void)
-- 
2.1.4

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


[PATCH v2 12/13] staging: comedi: usbduxfast: absorb usbduxfast_attach_common()

2015-08-17 Thread H Hartley Sweeten
This function is only called by the (*auto_attach) to do the final
setup of the analog input subdevice.

For aesthetics absorb it into usbduxfast_auto_attach() and reorder
the initialization of the subdevice to better follow the "norm" in
comedi drivers.

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 0770676..8826fa5 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -840,32 +840,6 @@ static int usbduxfast_ai_insn_read(struct comedi_device 
*dev,
return insn->n;
 }
 
-static int usbduxfast_attach_common(struct comedi_device *dev)
-{
-   struct comedi_subdevice *s;
-   int ret;
-
-   ret = comedi_alloc_subdevices(dev, 1);
-   if (ret)
-   return ret;
-
-   /* Analog Input subdevice */
-   s = &dev->subdevices[0];
-   dev->read_subdev = s;
-   s->type = COMEDI_SUBD_AI;
-   s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ;
-   s->n_chan   = 16;
-   s->len_chanlist = 16;
-   s->insn_read= usbduxfast_ai_insn_read;
-   s->do_cmdtest   = usbduxfast_ai_cmdtest;
-   s->do_cmd   = usbduxfast_ai_cmd;
-   s->cancel   = usbduxfast_ai_cancel;
-   s->maxdata  = 0x0fff;
-   s->range_table  = &range_usbduxfast_ai_range;
-
-   return 0;
-}
-
 static int usbduxfast_upload_firmware(struct comedi_device *dev,
  const u8 *data, size_t size,
  unsigned long context)
@@ -943,6 +917,7 @@ static int usbduxfast_auto_attach(struct comedi_device *dev,
struct usb_interface *intf = comedi_to_usb_interface(dev);
struct usb_device *usb = comedi_to_usb_dev(dev);
struct usbduxfast_private *devpriv;
+   struct comedi_subdevice *s;
int ret;
 
if (usb->speed != USB_SPEED_HIGH) {
@@ -985,7 +960,25 @@ static int usbduxfast_auto_attach(struct comedi_device 
*dev,
if (ret)
return ret;
 
-   return usbduxfast_attach_common(dev);
+   ret = comedi_alloc_subdevices(dev, 1);
+   if (ret)
+   return ret;
+
+   /* Analog Input subdevice */
+   s = &dev->subdevices[0];
+   dev->read_subdev = s;
+   s->type = COMEDI_SUBD_AI;
+   s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ;
+   s->n_chan   = 16;
+   s->maxdata  = 0x0fff;
+   s->range_table  = &range_usbduxfast_ai_range;
+   s->insn_read= usbduxfast_ai_insn_read;
+   s->len_chanlist = s->n_chan;
+   s->do_cmdtest   = usbduxfast_ai_cmdtest;
+   s->do_cmd   = usbduxfast_ai_cmd;
+   s->cancel   = usbduxfast_ai_cancel;
+
+   return 0;
 }
 
 static void usbduxfast_detach(struct comedi_device *dev)
-- 
2.4.3

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


[PATCH v2 13/13] staging: comedi: usbduxfast: remove unnecessary clearing of private data

2015-08-17 Thread H Hartley Sweeten
The clearing of the private data members in the (*detatch) is not
necessary. The comedi core is going to kfree the private data as soon
as the (*detach) finishes.

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 8826fa5..78452bf 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -998,16 +998,10 @@ static void usbduxfast_detach(struct comedi_device *dev)
usb_kill_urb(devpriv->urb);
 
kfree(devpriv->inbuf);
-   devpriv->inbuf = NULL;
-
usb_free_urb(devpriv->urb);
-   devpriv->urb = NULL;
}
 
kfree(devpriv->duxbuf);
-   devpriv->duxbuf = NULL;
-
-   devpriv->ai_cmd_running = 0;
 
up(&devpriv->sem);
 }
-- 
2.4.3

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


[PATCH v2 10/13] staging: comedi: usbduxfast: fix analog input 'maxdata'

2015-08-17 Thread H Hartley Sweeten
The analog inputs have 12-bit resoultion. The subdevice 'maxdata' is
a mask value for the resolution. Fix the value.

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 60f1c5e..c8687b0 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -865,7 +865,7 @@ static int usbduxfast_attach_common(struct comedi_device 
*dev)
s->do_cmdtest   = usbduxfast_ai_cmdtest;
s->do_cmd   = usbduxfast_ai_cmd;
s->cancel   = usbduxfast_ai_cancel;
-   s->maxdata  = 0x1000;
+   s->maxdata  = 0x0fff;
s->range_table  = &range_usbduxfast_ai_range;
 
up(&devpriv->sem);
-- 
2.4.3

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


[PATCH v2 11/13] staging: comedi: usbduxfast: remove unnecessary semaphore down/up

2015-08-17 Thread H Hartley Sweeten
The semaphore down/up in usbduxfast_attach_common() is not necessary.
This function is only called as part of the (*auto_attach) and does
not talk to the USB device.

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index c8687b0..0770676 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -842,17 +842,12 @@ static int usbduxfast_ai_insn_read(struct comedi_device 
*dev,
 
 static int usbduxfast_attach_common(struct comedi_device *dev)
 {
-   struct usbduxfast_private *devpriv = dev->private;
struct comedi_subdevice *s;
int ret;
 
-   down(&devpriv->sem);
-
ret = comedi_alloc_subdevices(dev, 1);
-   if (ret) {
-   up(&devpriv->sem);
+   if (ret)
return ret;
-   }
 
/* Analog Input subdevice */
s = &dev->subdevices[0];
@@ -868,8 +863,6 @@ static int usbduxfast_attach_common(struct comedi_device 
*dev)
s->maxdata  = 0x0fff;
s->range_table  = &range_usbduxfast_ai_range;
 
-   up(&devpriv->sem);
-
return 0;
 }
 
-- 
2.4.3

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


[PATCH v2 09/13] staging: comedi: usbduxfast: use a common exit path in ai (*do_cmd)

2015-08-17 Thread H Hartley Sweeten
For aesthetics, use 'goto' and a common exit point in this function so
that the up of the semaphore is not overlooked.

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index ae77596..60f1c5e 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -470,14 +470,12 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
struct comedi_cmd *cmd = &s->async->cmd;
unsigned int rngmask = 0xff;
int j, ret;
-   int result;
long steps, steps_tmp;
 
down(&devpriv->sem);
if (devpriv->ai_cmd_running) {
-   dev_err(dev->class_dev, "ai_cmd not possible\n");
-   up(&devpriv->sem);
-   return -EBUSY;
+   ret = -EBUSY;
+   goto cmd_exit;
}
 
/*
@@ -734,11 +732,9 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
}
 
/* 0 means that the AD commands are sent */
-   result = usbduxfast_send_cmd(dev, SENDADCOMMANDS);
-   if (result < 0) {
-   up(&devpriv->sem);
-   return result;
-   }
+   ret = usbduxfast_send_cmd(dev, SENDADCOMMANDS);
+   if (ret < 0)
+   goto cmd_exit;
 
if ((cmd->start_src == TRIG_NOW) || (cmd->start_src == TRIG_EXT)) {
/* enable this acquisition operation */
@@ -747,16 +743,17 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
if (ret < 0) {
devpriv->ai_cmd_running = 0;
/* fixme: unlink here?? */
-   up(&devpriv->sem);
-   return ret;
+   goto cmd_exit;
}
s->async->inttrig = NULL;
} else {/* TRIG_INT */
s->async->inttrig = usbduxfast_ai_inttrig;
}
+
+cmd_exit:
up(&devpriv->sem);
 
-   return 0;
+   return ret;
 }
 
 /*
-- 
2.4.3

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


[PATCH v2 08/13] staging: comedi: usbduxfast: tidy up the conversion timing validation

2015-08-17 Thread H Hartley Sweeten
Cleanup the validation of the cmd->convert_arg to use the same calculation
in the (*do_cmdtest) and the (*do_cmd).

Remove the, then unnecessary, redundant check in the (*do_cmd).

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index e18b14e..ae77596 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -359,8 +359,8 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev,
 struct comedi_cmd *cmd)
 {
int err = 0;
-   long int steps, tmp;
-   int min_sample_period;
+   unsigned int steps;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -399,21 +399,20 @@ static int usbduxfast_ai_cmdtest(struct comedi_device 
*dev,
err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg,
   cmd->chanlist_len);
 
-   if (cmd->chanlist_len == 1)
-   min_sample_period = 1;
-   else
-   min_sample_period = MIN_SAMPLING_PERIOD;
-
-   steps = cmd->convert_arg * 30;
-   if (steps < (min_sample_period * 1000))
-   steps = min_sample_period * 1000;
-
-   if (steps > (MAX_SAMPLING_PERIOD * 1000))
-   steps = MAX_SAMPLING_PERIOD * 1000;
-
-   /* calc arg again */
-   tmp = steps / 30;
-   err |= comedi_check_trigger_arg_is(&cmd->convert_arg, tmp);
+   /*
+* Validate the conversion timing:
+* for 1 channel the timing in 30MHz "steps" is:
+*  steps <= MAX_SAMPLING_PERIOD
+* for all other chanlist_len it is:
+*  MIN_SAMPLING_PERIOD <= steps <= MAX_SAMPLING_PERIOD
+*/
+   steps = (cmd->convert_arg * 30) / 1000;
+   if (cmd->chanlist_len !=  1)
+   err |= comedi_check_trigger_arg_min(&steps,
+   MIN_SAMPLING_PERIOD);
+   err |= comedi_check_trigger_arg_max(&steps, MAX_SAMPLING_PERIOD);
+   arg = (steps * 1000) / 30;
+   err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg);
 
if (cmd->stop_src == TRIG_COUNT)
err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1);
@@ -489,19 +488,6 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
 
steps = (cmd->convert_arg * 30) / 1000;
 
-   if ((steps < MIN_SAMPLING_PERIOD) && (cmd->chanlist_len != 1)) {
-   dev_err(dev->class_dev,
-   "steps=%ld, scan_begin_arg=%d. Not properly tested by 
cmdtest?\n",
-   steps, cmd->scan_begin_arg);
-   up(&devpriv->sem);
-   return -EINVAL;
-   }
-   if (steps > MAX_SAMPLING_PERIOD) {
-   dev_err(dev->class_dev, "sampling rate too low\n");
-   up(&devpriv->sem);
-   return -EINVAL;
-   }
-
switch (cmd->chanlist_len) {
case 1:
/*
-- 
2.4.3

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


[PATCH v2 07/13] staging: comedi: usbduxfast: TRIG_EXT is only valid for cmd->start_src

2015-08-17 Thread H Hartley Sweeten
According to the code, and verified with the author Bernd Porr, the
TRIG_EXT trigger is only valid for the cmd->start_src. Remove this
trigger from the cmd->scan_begin_src and cmd->convert_src.

The only valid scan_begin_src is then TRIG_FOLLOW  and the convert_src
is only TRIG_TIMER. Remove the redundant unique trigger checks in Step
2b of the (*do_cmdtest) as well as any other unnecessary checks of
those trigger sources.

Also remove the incorrect comment for a cmd->stop_src of TRIG_EXT.

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 1183476..e18b14e 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -366,10 +366,8 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev,
 
err |= comedi_check_trigger_src(&cmd->start_src,
TRIG_NOW | TRIG_EXT | TRIG_INT);
-   err |= comedi_check_trigger_src(&cmd->scan_begin_src,
-   TRIG_FOLLOW | TRIG_EXT);
-   err |= comedi_check_trigger_src(&cmd->convert_src,
-   TRIG_TIMER | TRIG_EXT);
+   err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_FOLLOW);
+   err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER);
err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT);
err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE);
 
@@ -379,16 +377,10 @@ static int usbduxfast_ai_cmdtest(struct comedi_device 
*dev,
/* Step 2a : make sure trigger sources are unique */
 
err |= comedi_check_trigger_is_unique(cmd->start_src);
-   err |= comedi_check_trigger_is_unique(cmd->scan_begin_src);
-   err |= comedi_check_trigger_is_unique(cmd->convert_src);
err |= comedi_check_trigger_is_unique(cmd->stop_src);
 
/* Step 2b : and mutually compatible */
 
-   /* can't have external stop and start triggers at once */
-   if (cmd->start_src == TRIG_EXT && cmd->stop_src == TRIG_EXT)
-   err |= -EINVAL;
-
if (err)
return 2;
 
@@ -412,34 +404,21 @@ static int usbduxfast_ai_cmdtest(struct comedi_device 
*dev,
else
min_sample_period = MIN_SAMPLING_PERIOD;
 
-   if (cmd->convert_src == TRIG_TIMER) {
-   steps = cmd->convert_arg * 30;
-   if (steps < (min_sample_period * 1000))
-   steps = min_sample_period * 1000;
+   steps = cmd->convert_arg * 30;
+   if (steps < (min_sample_period * 1000))
+   steps = min_sample_period * 1000;
 
-   if (steps > (MAX_SAMPLING_PERIOD * 1000))
-   steps = MAX_SAMPLING_PERIOD * 1000;
+   if (steps > (MAX_SAMPLING_PERIOD * 1000))
+   steps = MAX_SAMPLING_PERIOD * 1000;
 
-   /* calc arg again */
-   tmp = steps / 30;
-   err |= comedi_check_trigger_arg_is(&cmd->convert_arg, tmp);
-   }
+   /* calc arg again */
+   tmp = steps / 30;
+   err |= comedi_check_trigger_arg_is(&cmd->convert_arg, tmp);
 
-   /* stop source */
-   switch (cmd->stop_src) {
-   case TRIG_COUNT:
+   if (cmd->stop_src == TRIG_COUNT)
err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1);
-   break;
-   case TRIG_NONE:
+   else/* TRIG_NONE */
err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0);
-   break;
-   /*
-* TRIG_EXT doesn't care since it doesn't trigger
-* off a numbered channel
-*/
-   default:
-   break;
-   }
 
if (err)
return 3;
@@ -508,9 +487,7 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
 */
devpriv->ignore = PACKETS_TO_IGNORE;
 
-   steps = 0;
-   if (cmd->convert_src == TRIG_TIMER)
-   steps = (cmd->convert_arg * 30) / 1000;
+   steps = (cmd->convert_arg * 30) / 1000;
 
if ((steps < MIN_SAMPLING_PERIOD) && (cmd->chanlist_len != 1)) {
dev_err(dev->class_dev,
-- 
2.4.3

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


[PATCH v2 06/13] staging: comedi: usbduxfast: TRIG_EXT only works for 1 or 16 channels

2015-08-17 Thread H Hartley Sweeten
Move this check from the (*do_cmd) to the (*do_cmdtest).

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 90422de8..1183476 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -399,6 +399,11 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev,
if (!cmd->chanlist_len)
err |= -EINVAL;
 
+   /* external start trigger is only valid for 1 or 16 channels */
+   if (cmd->start_src == TRIG_EXT &&
+   cmd->chanlist_len != 1 && cmd->chanlist_len != 16)
+   err |= -EINVAL;
+
err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg,
   cmd->chanlist_len);
 
@@ -519,13 +524,6 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
up(&devpriv->sem);
return -EINVAL;
}
-   if ((cmd->start_src == TRIG_EXT) && (cmd->chanlist_len != 1)
-   && (cmd->chanlist_len != 16)) {
-   dev_err(dev->class_dev,
-   "TRIG_EXT only with 1 or 16 channels possible\n");
-   up(&devpriv->sem);
-   return -EINVAL;
-   }
 
switch (cmd->chanlist_len) {
case 1:
-- 
2.4.3

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


[PATCH v2 04/13] staging: comedi: usbduxfast: use preferred kernel types

2015-08-17 Thread H Hartley Sweeten
As suggested by checkpatch.pl:

CHECK: Prefer kernel type 'u8' over 'uint8_t'
CHECK: Prefer kernel type 's8' over 'int8_t'

For consistency, also change the uint16_t and int16_t types to
u16 and s16.

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index cb221e7..9d889be 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -97,7 +97,7 @@
 /*
  * size of one A/D value
  */
-#define SIZEADIN   (sizeof(int16_t))
+#define SIZEADIN   (sizeof(s16))
 
 /*
  * size of the input-buffer IN BYTES
@@ -156,8 +156,8 @@ static const struct comedi_lrange range_usbduxfast_ai_range 
= {
  */
 struct usbduxfast_private {
struct urb *urb;/* BULK-transfer handling: urb */
-   uint8_t *duxbuf;
-   int8_t *inbuf;
+   u8 *duxbuf;
+   s8 *inbuf;
short int ai_cmd_running;   /* asynchronous command is running */
int ignore; /* counter which ignores the first
   buffers */
@@ -190,8 +190,7 @@ static int usbduxfast_send_cmd(struct comedi_device *dev, 
int cmd_type)
 }
 
 static void usbduxfast_cmd_data(struct comedi_device *dev, int index,
-   uint8_t len, uint8_t op, uint8_t out,
-   uint8_t log)
+   u8 len, u8 op, u8 out, u8 log)
 {
struct usbduxfast_private *devpriv = dev->private;
 
@@ -812,7 +811,7 @@ static int usbduxfast_ai_insn_read(struct comedi_device 
*dev,
struct usbduxfast_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int range = CR_RANGE(insn->chanspec);
-   uint8_t rngmask = range ? (0xff - 0x04) : 0xff;
+   u8 rngmask = range ? (0xff - 0x04) : 0xff;
int i, j, n, actual_length;
int ret;
 
@@ -867,14 +866,14 @@ static int usbduxfast_ai_insn_read(struct comedi_device 
*dev,
up(&devpriv->sem);
return ret;
}
-   n = actual_length / sizeof(uint16_t);
+   n = actual_length / sizeof(u16);
if ((n % 16) != 0) {
dev_err(dev->class_dev, "insn data packet corrupted\n");
up(&devpriv->sem);
return -EINVAL;
}
for (j = chan; (j < n) && (i < insn->n); j = j + 16) {
-   data[i] = ((uint16_t *) (devpriv->inbuf))[j];
+   data[i] = ((u16 *)(devpriv->inbuf))[j];
i++;
}
}
@@ -922,7 +921,7 @@ static int usbduxfast_upload_firmware(struct comedi_device 
*dev,
  unsigned long context)
 {
struct usb_device *usb = comedi_to_usb_dev(dev);
-   uint8_t *buf;
+   u8 *buf;
unsigned char *tmp;
int ret;
 
-- 
2.4.3

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


[PATCH v2 05/13] staging: comedi: usbduxfast: fix multi-line comment

2015-08-17 Thread H Hartley Sweeten
This comment does not need to be multi-line. Fix it to remove the
checkpatch warning.

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 9d889be..90422de8 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -159,8 +159,7 @@ struct usbduxfast_private {
u8 *duxbuf;
s8 *inbuf;
short int ai_cmd_running;   /* asynchronous command is running */
-   int ignore; /* counter which ignores the first
-  buffers */
+   int ignore; /* counter which ignores the first buffers */
struct semaphore sem;
 };
 
-- 
2.4.3

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


[PATCH v2 03/13] staging: comedi: usbduxfast: remove impossible 'if (!devpriv)' checks

2015-08-17 Thread H Hartley Sweeten
The private data 'devpriv' is allocated in the (*auto_attach) before
the subdevices are initialized and the (*auto_attach) has to complete
successfully before the core will call any of the subdevice operations.
Because of this the (!devpriv) checks in the subdevice code can never
fail. Remove them.

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index a8635b1..cb221e7 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -223,9 +223,6 @@ static int usbduxfast_ai_cancel(struct comedi_device *dev,
struct usbduxfast_private *devpriv = dev->private;
int ret;
 
-   if (!devpriv)
-   return -EFAULT;
-
down(&devpriv->sem);
ret = usbduxfast_ai_stop(dev, 1);
up(&devpriv->sem);
@@ -317,9 +314,6 @@ static int usbduxfast_submit_urb(struct comedi_device *dev)
struct usbduxfast_private *devpriv = dev->private;
int ret;
 
-   if (!devpriv)
-   return -EFAULT;
-
usb_fill_bulk_urb(devpriv->urb, usb, usb_rcvbulkpipe(usb, BULKINEP),
  devpriv->inbuf, SIZEINBUF,
  usbduxfast_ai_interrupt, dev);
@@ -466,9 +460,6 @@ static int usbduxfast_ai_inttrig(struct comedi_device *dev,
struct comedi_cmd *cmd = &s->async->cmd;
int ret;
 
-   if (!devpriv)
-   return -EFAULT;
-
if (trig_num != cmd->start_arg)
return -EINVAL;
 
@@ -501,9 +492,6 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
int result;
long steps, steps_tmp;
 
-   if (!devpriv)
-   return -EFAULT;
-
down(&devpriv->sem);
if (devpriv->ai_cmd_running) {
dev_err(dev->class_dev, "ai_cmd not possible\n");
-- 
2.4.3

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


[PATCH v2 02/13] staging: comedi: usbduxfast: only chanlist of 1, 2, 3, or 16 are supported

2015-08-17 Thread H Hartley Sweeten
The analog input (*do_cmd) only supports channel lists of 1, 2, 3, or 16
channels. Add a check for this to usbduxfast_ai_check_chanlist() and remove
the check from usbduxfast_ai_cmd().

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 16b28fa..a8635b1 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -339,6 +339,11 @@ static int usbduxfast_ai_check_chanlist(struct 
comedi_device *dev,
unsigned int gain0 = CR_RANGE(cmd->chanlist[0]);
int i;
 
+   if (cmd->chanlist_len > 3 && cmd->chanlist_len != 16) {
+   dev_err(dev->class_dev, "unsupported combination of 
channels\n");
+   return -EINVAL;
+   }
+
for (i = 0; i < cmd->chanlist_len; ++i) {
unsigned int chan = CR_CHAN(cmd->chanlist[i]);
unsigned int gain = CR_RANGE(cmd->chanlist[i]);
@@ -779,11 +784,6 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
usbduxfast_cmd_data(dev, 4, 0x09, 0x01, rngmask, 0xff);
 
break;
-
-   default:
-   dev_err(dev->class_dev, "unsupported combination of 
channels\n");
-   up(&devpriv->sem);
-   return -EFAULT;
}
 
/* 0 means that the AD commands are sent */
-- 
2.4.3

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


[PATCH v2 00/13] staging: comedi: usbduxfast: tidy up

2015-08-17 Thread H Hartley Sweeten
Fix a couple minor checkpatch.pl issues.

Tidy up the ai (*do_cmdtest) and (*do_cmd) a bit.

v2: Address some issues pointed out by Ian Abbott and add a couple
more patches to remove some cruft.

1) Move the test in patch 6 to Step 3 as requested by Ian Abbott.
2) Add new patch 7 to simplify the TRIG_EXT trigger.
3) Merge old patches 7 and 8 into new patch 8. Cleanup the timing
   validation.
4) Add new patches 10-13.

H Hartley Sweeten (13):
  staging: comedi: usbduxfast: chanlist check is Step 5 of (*do_cmdtest)
  staging: comedi: usbduxfast: only chanlist of 1,2,3, or 16 are supported
  staging: comedi: usbduxfast: remove impossible 'if (!devpriv)' checks
  staging: comedi: usbduxfast: use preferred kernel types
  staging: comedi: usbduxfast: fix multi-line comment
  staging: comedi: usbduxfast: TRIG_EXT only works for 1 or 16 channels
  staging: comedi: usbduxfast: TRIG_EXT is only valid for cmd->start_src
  staging: comedi: usbduxfast: tidy up the conversion timing validation
  staging: comedi: usbduxfast: use a common exit path in ai (*do_cmd)
  staging: comedi: usbduxfast: fix analog input 'maxdata'
  staging: comedi: usbduxfast: remove unnecessary semaphore down/up
  staging: comedi: usbduxfast: absorb usbduxfast_attach_common()
  staging: comedi: usbduxfast: remove unnecessary clearing of private data

 drivers/staging/comedi/drivers/usbduxfast.c | 274 +++-
 1 file changed, 104 insertions(+), 170 deletions(-)

-- 
2.4.3

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


[PATCH v2 01/13] staging: comedi: usbduxfast: chanlist check is Step 5 of (*do_cmdtest)

2015-08-17 Thread H Hartley Sweeten
The channel list should be checked in Step 5 of the (*do_cmdtest) not
as part of the (*do_cmd). Factor the check out of usbduxfast_ai_cmd().

Tidy up the factored out code. The channel number 'i' will never be
greater than NUMCHANNELS due to the subdevice setup and the checks
done in the code. The up/down of the semaphore is also not needed
because the (*do_cmdtest) never actually tries to access the hardware.

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index d90dc59..16b28fa 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -332,6 +332,31 @@ static int usbduxfast_submit_urb(struct comedi_device *dev)
return 0;
 }
 
+static int usbduxfast_ai_check_chanlist(struct comedi_device *dev,
+   struct comedi_subdevice *s,
+   struct comedi_cmd *cmd)
+{
+   unsigned int gain0 = CR_RANGE(cmd->chanlist[0]);
+   int i;
+
+   for (i = 0; i < cmd->chanlist_len; ++i) {
+   unsigned int chan = CR_CHAN(cmd->chanlist[i]);
+   unsigned int gain = CR_RANGE(cmd->chanlist[i]);
+
+   if (chan != i) {
+   dev_err(dev->class_dev,
+   "channels are not consecutive\n");
+   return -EINVAL;
+   }
+   if (gain != gain0 && cmd->chanlist_len > 3) {
+   dev_err(dev->class_dev,
+   "gain must be the same for all channels\n");
+   return -EINVAL;
+   }
+   }
+   return 0;
+}
+
 static int usbduxfast_ai_cmdtest(struct comedi_device *dev,
 struct comedi_subdevice *s,
 struct comedi_cmd *cmd)
@@ -417,7 +442,13 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev,
if (err)
return 3;
 
-   /* step 4: fix up any arguments */
+   /* Step 4: fix up any arguments */
+
+   /* Step 5: check channel list if it exists */
+   if (cmd->chanlist && cmd->chanlist_len > 0)
+   err |= usbduxfast_ai_check_chanlist(dev, s, cmd);
+   if (err)
+   return 5;
 
return 0;
 }
@@ -460,8 +491,8 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
 {
struct usbduxfast_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
-   unsigned int chan, gain, rngmask = 0xff;
-   int i, j, ret;
+   unsigned int rngmask = 0xff;
+   int j, ret;
int result;
long steps, steps_tmp;
 
@@ -481,27 +512,6 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
 */
devpriv->ignore = PACKETS_TO_IGNORE;
 
-   gain = CR_RANGE(cmd->chanlist[0]);
-   for (i = 0; i < cmd->chanlist_len; ++i) {
-   chan = CR_CHAN(cmd->chanlist[i]);
-   if (chan != i) {
-   dev_err(dev->class_dev,
-   "channels are not consecutive\n");
-   up(&devpriv->sem);
-   return -EINVAL;
-   }
-   if ((gain != CR_RANGE(cmd->chanlist[i]))
-   && (cmd->chanlist_len > 3)) {
-   dev_err(dev->class_dev,
-   "gain must be the same for all channels\n");
-   up(&devpriv->sem);
-   return -EINVAL;
-   }
-   if (i >= NUMCHANNELS) {
-   dev_err(dev->class_dev, "chanlist too long\n");
-   break;
-   }
-   }
steps = 0;
if (cmd->convert_src == TRIG_TIMER)
steps = (cmd->convert_arg * 30) / 1000;
-- 
2.4.3

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


Re: [PATCH] staging: dgnc: take mutex when storing value in dgnc_poll_tick

2015-08-17 Thread Dan Carpenter
On Mon, Aug 17, 2015 at 04:19:12PM +0100, Salah Triki wrote:
> Since dgnc_poll_trick is a global variable.
> 
> Signed-off-by: Salah Triki 

Does this changelog even mean?

Why is Mark not on the CC list?  Use scripts/get_maintainer.pl.

I think there probably is a bug here, but access is still racy.  I think
we should use dgnc_poll_lock to serialize it.

regards,
dan carpenter

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


[PATCH -next] staging: most: fix HDM_USB dependencies and build errors

2015-08-17 Thread Randy Dunlap
From: Randy Dunlap 

Fix kconfig dependency warning and build errors.

warning: (HDM_USB) selects AIM_NETWORK which has unmet direct dependencies 
(STAGING && MOST && NET)

drivers/built-in.o: In function `aim_resume_tx_channel':
networking.c:(.text+0xd6f7a2): undefined reference to `netif_tx_wake_queue'
drivers/built-in.o: In function `aim_rx_data':
networking.c:(.text+0xd6f8c5): undefined reference to `__netdev_alloc_skb'
networking.c:(.text+0xd6f99a): undefined reference to `skb_put'
networking.c:(.text+0xd6fa44): undefined reference to `eth_type_trans'
networking.c:(.text+0xd6fa6f): undefined reference to `netif_rx'
drivers/built-in.o: In function `most_nd_setup':
networking.c:(.text+0xd6fad2): undefined reference to `ether_setup'
drivers/built-in.o: In function `most_nd_set_mac_address':
networking.c:(.text+0xd6fb0f): undefined reference to `eth_mac_addr'
drivers/built-in.o: In function `most_nd_open':
networking.c:(.text+0xd6fd37): undefined reference to `netif_tx_wake_queue'
drivers/built-in.o: In function `aim_probe_channel':
networking.c:(.text+0xd6febb): undefined reference to `alloc_netdev_mqs'
networking.c:(.text+0xd6ff18): undefined reference to `register_netdev'
networking.c:(.text+0xd6ff4a): undefined reference to `free_netdev'
drivers/built-in.o: In function `most_net_rm_netdev_safe.isra.0':
networking.c:(.text+0xd6ffcf): undefined reference to `unregister_netdev'
networking.c:(.text+0xd6ffdf): undefined reference to `free_netdev'
drivers/built-in.o: In function `most_nd_start_xmit':
networking.c:(.text+0xd70390): undefined reference to `kfree_skb'
drivers/built-in.o: In function `most_deliver_netinfo':
(.text+0xd70499): undefined reference to `netif_tx_wake_queue'

Signed-off-by: Randy Dunlap 
Cc: Christian Gromm 
Cc: Michael Fabry 
Cc: Christian Gromm 
---
 drivers/staging/most/hdm-usb/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20150817.orig/drivers/staging/most/hdm-usb/Kconfig
+++ linux-next-20150817/drivers/staging/most/hdm-usb/Kconfig
@@ -4,7 +4,7 @@
 
 config HDM_USB
tristate "USB HDM"
-   depends on USB
+   depends on USB && NET
select AIM_NETWORK
---help---
  Say Y here if you want to connect via USB to network tranceiver.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 4/5] staging: wilc1000: use pr_* instead of printk

2015-08-17 Thread Dan Carpenter
On Mon, Aug 17, 2015 at 01:59:44PM -0400, Raphaël Beamonte wrote:
> 2015-08-17 13:47 GMT-04:00 Dan Carpenter :
> >> - printk("[Sendconfigpkt]Get Timed out\n");
> >> + pr_debug("[Sendconfigpkt]Get Timed out\n");
> >
> >
> > Possibly pr_err()?
> 
> Yep. My mistake. I'll do the same for Set Timed Out also!
> 
> >> - printk("DBG [%s: %d]", __func__, __LINE__); \
> >> - printk(__VA_ARGS__);\
> >> + pr_debug("DBG [%s: %d]", __func__, __LINE__);   \
> >> + pr_debug(__VA_ARGS__);  \
> >
> > This is a behavior change, I think.  pr_debug() needs to be turned on?
> 
> Yes... I didn't pay attention to that! pr_debug needs -DDEBUG in the makefile.
> Should I use pr_info here? Or just acknowledge the behavior change for
> the moment,
> as the next aim is probably, as you said, to remove all the local
> debug code? (it is
> actually part of the TODO of this driver... So I could just work on that 
> next.)

I would probably just do the rest and leave this part as-is since you're
planning to redo it all anyway.  I guess just do stuff which is obvious
and hopefully more and more stuff will become obvious as you go along.
This is a lazy answer but I don't want to think about this driver very
hard...  :P

Also always try to order your patches from least controversial to most
controversial.  It makes it easier to redo things or sometimes Greg
applies the first part of a patch series.

regards,
dan carpenter

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


Re: [PATCH 4/5] staging: wilc1000: use pr_* instead of printk

2015-08-17 Thread Raphaël Beamonte
2015-08-17 13:47 GMT-04:00 Dan Carpenter :
>> - printk("[Sendconfigpkt]Get Timed out\n");
>> + pr_debug("[Sendconfigpkt]Get Timed out\n");
>
>
> Possibly pr_err()?

Yep. My mistake. I'll do the same for Set Timed Out also!

>> - printk("DBG [%s: %d]", __func__, __LINE__); \
>> - printk(__VA_ARGS__);\
>> + pr_debug("DBG [%s: %d]", __func__, __LINE__);   \
>> + pr_debug(__VA_ARGS__);  \
>
> This is a behavior change, I think.  pr_debug() needs to be turned on?

Yes... I didn't pay attention to that! pr_debug needs -DDEBUG in the makefile.
Should I use pr_info here? Or just acknowledge the behavior change for
the moment,
as the next aim is probably, as you said, to remove all the local
debug code? (it is
actually part of the TODO of this driver... So I could just work on that next.)

I'll include your other log level advices and send a new version.
Thanks for your
reviewing time!
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: linux-next: Tree for Aug 17 (mshyperv.c)

2015-08-17 Thread KY Srinivasan


> -Original Message-
> From: Randy Dunlap [mailto:rdun...@infradead.org]
> Sent: Monday, August 17, 2015 10:35 AM
> To: Stephen Rothwell ; linux-n...@vger.kernel.org
> Cc: linux-ker...@vger.kernel.org; de...@driverdev.osuosl.org; KY Srinivasan
> ; Haiyang Zhang 
> Subject: Re: linux-next: Tree for Aug 17 (mshyperv.c)
> 
> On 08/17/15 03:55, Stephen Rothwell wrote:
> > Hi all,
> >
> > Changes since 20150813:
> >
> 
> on i386 (for several days now):
> 
> when CONFIG_KEXEC is not enabled:
> 
> 
> arch/x86/built-in.o: In function `hv_machine_crash_shutdown':
> mshyperv.c:(.text+0x2d9d4): undefined reference to
> `native_machine_crash_shutdown'

Vitaly has submitted a patch to fix this.

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


Re: linux-next: Tree for Aug 17 (mshyperv.c)

2015-08-17 Thread Randy Dunlap
On 08/17/15 03:55, Stephen Rothwell wrote:
> Hi all,
> 
> Changes since 20150813:
> 

on i386 (for several days now):

when CONFIG_KEXEC is not enabled:


arch/x86/built-in.o: In function `hv_machine_crash_shutdown':
mshyperv.c:(.text+0x2d9d4): undefined reference to 
`native_machine_crash_shutdown'



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


Re: [PATCH 4/5] staging: wilc1000: use pr_* instead of printk

2015-08-17 Thread Dan Carpenter
On Mon, Aug 17, 2015 at 12:08:36PM -0400, Raphaël Beamonte wrote:
> Signed-off-by: Raphaël Beamonte 
> ---
>  drivers/staging/wilc1000/coreconfigurator.c  |  4 ++--
>  drivers/staging/wilc1000/linux_wlan.c|  8 +++
>  drivers/staging/wilc1000/linux_wlan_common.h | 32 
> ++--
>  drivers/staging/wilc1000/linux_wlan_sdio.c   |  2 +-
>  drivers/staging/wilc1000/linux_wlan_spi.c|  2 +-
>  drivers/staging/wilc1000/wilc_debugfs.c  | 16 +++---
>  drivers/staging/wilc1000/wilc_exported_buf.c |  6 +++---
>  7 files changed, 35 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
> b/drivers/staging/wilc1000/coreconfigurator.c
> index c81c41d..0cbf4a9c 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -2007,7 +2007,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
>   
> pstrWIDs[counter].u16WIDid,
>   (counter == 
> u32WIDsCount - 1), drvHandler)) {
>   ret = -1;
> - printk("[Sendconfigpkt]Get Timed out\n");
> + pr_debug("[Sendconfigpkt]Get Timed out\n");


Possibly pr_err()?


>   break;
>   }
>   }
> @@ -2029,7 +2029,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
>   
> pstrWIDs[counter].s32ValueSize,
>   (counter == 
> u32WIDsCount - 1), drvHandler)) {
>   ret = -1;
> - printk("[Sendconfigpkt]Set Timed out\n");
> + pr_debug("[Sendconfigpkt]Set Timed out\n");
>   break;
>   }
>   }
> diff --git a/drivers/staging/wilc1000/linux_wlan.c 
> b/drivers/staging/wilc1000/linux_wlan.c
> index 040e55d..1f32c36 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -1306,7 +1306,7 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic)
>  
>   if (g_linux_wlan->wilc1000_initialized) {
>  
> - printk("Deinitializing wilc1000  ...\n");
> + pr_info("Deinitializing wilc1000  ...\n");

debug.

>  
>   if (nic == NULL) {
>   PRINT_ER("nic is NULL\n");
> @@ -2565,8 +2565,8 @@ static int __init init_wilc_driver(void)
>   }
>  #endif
>  
> - printk("IN INIT FUNCTION\n");
> - printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
> + pr_info("IN INIT FUNCTION\n");

debug.

> + pr_info("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
>  
>   linux_wlan_device_power(1);
>   msleep(100);
> @@ -2662,7 +2662,7 @@ static void __exit exit_wilc_driver(void)
>   kfree(g_linux_wlan);
>   g_linux_wlan = NULL;
>   }
> - printk("Module_exit Done.\n");
> + pr_info("Module_exit Done.\n");

debug.

>  
>  #if defined(WILC_DEBUGFS)
>   wilc_debugfs_remove();
> diff --git a/drivers/staging/wilc1000/linux_wlan_common.h 
> b/drivers/staging/wilc1000/linux_wlan_common.h
> index e6ebf3e..14743ae 100644
> --- a/drivers/staging/wilc1000/linux_wlan_common.h
> +++ b/drivers/staging/wilc1000/linux_wlan_common.h
> @@ -54,8 +54,8 @@ extern atomic_t DEBUG_LEVEL;
>   do {\
>   if ((atomic_read(&DEBUG_LEVEL) & DEBUG) &&  \
>  ((atomic_read(®ION)) & (region))) {   \
> - printk("DBG [%s: %d]", __func__, __LINE__); \
> - printk(__VA_ARGS__);\
> + pr_debug("DBG [%s: %d]", __func__, __LINE__);   \
> + pr_debug(__VA_ARGS__);  \

This is a behavior change, I think.  pr_debug() needs to be turned on?

>   }   \
>   } while (0)
>  
> @@ -63,8 +63,8 @@ extern atomic_t DEBUG_LEVEL;
>   do {\
>   if ((atomic_read(&DEBUG_LEVEL) & INFO) &&   \
>  ((atomic_read(®ION)) & (region))) {   \
> - printk("INFO [%s]", __func__);  \
> - printk(__VA_ARGS__);\
> + pr_info("INFO [%s]", __func__); \
> + pr_info(__VA_ARGS__);   \
>   }   \
>   } while (0)
>  
> @@ -72,16 +72,16 @@ extern atomic_t DEBUG_LEVEL;
>   do {   

Re: [PATCH 2/5] staging: wilc1000: remove FREE_WILC_BUFFER()

2015-08-17 Thread Dan Carpenter
On Mon, Aug 17, 2015 at 12:08:34PM -0400, Raphaël Beamonte wrote:
> It was just a wrapper around kfree(), so call that instead.
> 
> Signed-off-by: Raphaël Beamonte 
> ---
> + kfree(exported_g_tx_buf);
> + exported_g_tx_buf = NULL;

No need to add these new NULL assignments.  The module is unloading so
no one cat re-use these pointers.  Also as a process rule, you should
write down any behaviour changes in the changelog and why you think they
are needed.

regards,
dan carpenter

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


Re: [PATCH 3/5] staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid possible memory leak

2015-08-17 Thread Dan Carpenter
On Mon, Aug 17, 2015 at 12:08:35PM -0400, Raphaël Beamonte wrote:
> The MACRO_WILC_BUFFER() macro was using a return statement, and didn't
> take care of possible memory leaks and subsequent bugs when it was failing
> after succeeding some allocations. This patch corrects this behavior.
> 
> Signed-off-by: Raphaël Beamonte 
> ---
>  drivers/staging/wilc1000/wilc_exported_buf.c | 39 
> +---
>  1 file changed, 29 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c 
> b/drivers/staging/wilc1000/wilc_exported_buf.c
> index bf392fb..c3aff9a 100644
> --- a/drivers/staging/wilc1000/wilc_exported_buf.c
> +++ b/drivers/staging/wilc1000/wilc_exported_buf.c
> @@ -8,13 +8,6 @@
>  #define LINUX_TX_SIZE(64 * 1024)
>  #define WILC1000_FW_SIZE (4 * 1024)
>  
> -#define MALLOC_WILC_BUFFER(name, size)   \
> - exported_ ## name = kmalloc(size, GFP_KERNEL);\
> - if (!exported_ ## name) {   \
> - printk("fail to alloc: %s memory\n", exported_ ## name);  \
> - return -ENOBUFS;\
> - }
> -
>  /*
>   * Add necessary buffer pointers
>   */
> @@ -40,17 +33,43 @@ void *get_fw_buffer(void)
>  }
>  EXPORT_SYMBOL(get_fw_buffer);
>  
> +static inline int kmalloc_wilc_buffer(void *buf, int size)
> +{
> + buf = kmalloc(size, GFP_KERNEL);
> + if (!buf) {
> + printk("fail to alloc memory\n");
> + return -ENOBUFS;
> + }
> + return 0;
> +}
> +
>  static int __init wilc_module_init(void)
>  {
>   printk("wilc_module_init\n");
>   /*
>* alloc necessary memory
>*/
> - MALLOC_WILC_BUFFER(g_tx_buf, LINUX_TX_SIZE)
> - MALLOC_WILC_BUFFER(g_rx_buf, LINUX_RX_SIZE)
> - MALLOC_WILC_BUFFER(g_fw_buf, WILC1000_FW_SIZE)
> + if (kmalloc_wilc_buffer(exported_g_tx_buf, LINUX_TX_SIZE))
> + goto error_g_tx_buf;

Don't do it this way.  Just do:

exported_g_tx_buf = kmalloc(LINUX_TX_SIZE, GFP_KERNEL);
if (!exported_g_tx_buf)
return -ENOMEM;

exported_g_rx_buf = kmalloc(LINUX_TX_SIZE, GFP_KERNEL);
if (!exported_g_rx_buf)
goto free_tx_buf;

1) Avoid abstraction where possible.
2) The error code should be -ENOMEM
3) This is not a universal rule, but I feel it's better to return
   directly instead of using a do-nothing-goto.  Some people think
   using gotos everywhere forces you to think about error handling so
   it is worth making the code slightly less readable.  Based on my
   static analysis results, I do not believe that it makes people think
   about error handling.
4) Name the label after the where the label is (what it does on the next
   line) instead of basing it on the goto location.
5) Preserve the error codes.  Use ret = kmalloc_wilc_buffer(); if (ret).

regards,
dan carpenter

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


[PATCH 4/5] staging: wilc1000: use pr_* instead of printk

2015-08-17 Thread Raphaël Beamonte
Signed-off-by: Raphaël Beamonte 
---
 drivers/staging/wilc1000/coreconfigurator.c  |  4 ++--
 drivers/staging/wilc1000/linux_wlan.c|  8 +++
 drivers/staging/wilc1000/linux_wlan_common.h | 32 ++--
 drivers/staging/wilc1000/linux_wlan_sdio.c   |  2 +-
 drivers/staging/wilc1000/linux_wlan_spi.c|  2 +-
 drivers/staging/wilc1000/wilc_debugfs.c  | 16 +++---
 drivers/staging/wilc1000/wilc_exported_buf.c |  6 +++---
 7 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index c81c41d..0cbf4a9c 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -2007,7 +2007,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,

pstrWIDs[counter].u16WIDid,
(counter == 
u32WIDsCount - 1), drvHandler)) {
ret = -1;
-   printk("[Sendconfigpkt]Get Timed out\n");
+   pr_debug("[Sendconfigpkt]Get Timed out\n");
break;
}
}
@@ -2029,7 +2029,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,

pstrWIDs[counter].s32ValueSize,
(counter == 
u32WIDsCount - 1), drvHandler)) {
ret = -1;
-   printk("[Sendconfigpkt]Set Timed out\n");
+   pr_debug("[Sendconfigpkt]Set Timed out\n");
break;
}
}
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 040e55d..1f32c36 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1306,7 +1306,7 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic)
 
if (g_linux_wlan->wilc1000_initialized) {
 
-   printk("Deinitializing wilc1000  ...\n");
+   pr_info("Deinitializing wilc1000  ...\n");
 
if (nic == NULL) {
PRINT_ER("nic is NULL\n");
@@ -2565,8 +2565,8 @@ static int __init init_wilc_driver(void)
}
 #endif
 
-   printk("IN INIT FUNCTION\n");
-   printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
+   pr_info("IN INIT FUNCTION\n");
+   pr_info("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
 
linux_wlan_device_power(1);
msleep(100);
@@ -2662,7 +2662,7 @@ static void __exit exit_wilc_driver(void)
kfree(g_linux_wlan);
g_linux_wlan = NULL;
}
-   printk("Module_exit Done.\n");
+   pr_info("Module_exit Done.\n");
 
 #if defined(WILC_DEBUGFS)
wilc_debugfs_remove();
diff --git a/drivers/staging/wilc1000/linux_wlan_common.h 
b/drivers/staging/wilc1000/linux_wlan_common.h
index e6ebf3e..14743ae 100644
--- a/drivers/staging/wilc1000/linux_wlan_common.h
+++ b/drivers/staging/wilc1000/linux_wlan_common.h
@@ -54,8 +54,8 @@ extern atomic_t DEBUG_LEVEL;
do {\
if ((atomic_read(&DEBUG_LEVEL) & DEBUG) &&  \
   ((atomic_read(®ION)) & (region))) {   \
-   printk("DBG [%s: %d]", __func__, __LINE__); \
-   printk(__VA_ARGS__);\
+   pr_debug("DBG [%s: %d]", __func__, __LINE__);   \
+   pr_debug(__VA_ARGS__);  \
}   \
} while (0)
 
@@ -63,8 +63,8 @@ extern atomic_t DEBUG_LEVEL;
do {\
if ((atomic_read(&DEBUG_LEVEL) & INFO) &&   \
   ((atomic_read(®ION)) & (region))) {   \
-   printk("INFO [%s]", __func__);  \
-   printk(__VA_ARGS__);\
+   pr_info("INFO [%s]", __func__); \
+   pr_info(__VA_ARGS__);   \
}   \
} while (0)
 
@@ -72,16 +72,16 @@ extern atomic_t DEBUG_LEVEL;
do {\
if ((atomic_read(&DEBUG_LEVEL) & WRN) &&\
   ((atomic_read(®ION)) & (region))) {   \
-   printk("WRN [%s: %d]", __func__, __LINE__); \
-   printk(__VA_ARGS__

[PATCH 5/5] staging: wilc1000: remove void function return statements that are not useful

2015-08-17 Thread Raphaël Beamonte
Signed-off-by: Raphaël Beamonte 
---
 drivers/staging/wilc1000/host_interface.c| 4 
 drivers/staging/wilc1000/linux_wlan.c| 1 -
 drivers/staging/wilc1000/wilc_exported_buf.c | 2 --
 drivers/staging/wilc1000/wilc_wlan.c | 3 ---
 drivers/staging/wilc1000/wilc_wlan_cfg.c | 2 --
 5 files changed, 12 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 53c4ca9..a000eaf 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6779,9 +6779,6 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length)
s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, 
sizeof(tstrHostIFmsg), NULL);
if (s32Error)
PRINT_ER("Error in sending network info message queue message 
parameters: Error(%d)\n", s32Error);
-
-
-   return;
 }
 
 /**
@@ -6845,7 +6842,6 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length)
 
/*BugID_5348*/
up(&hSemHostIntDeinit);
-   return;
 }
 
 /**
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 1f32c36..507aab6 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1385,7 +1385,6 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic)
} else {
PRINT_D(INIT_DBG, "wilc1000 is not initialized\n");
}
-   return;
 }
 
 int wlan_init_locks(linux_wlan_t *p_nic)
diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c 
b/drivers/staging/wilc1000/wilc_exported_buf.c
index ceacfe2..3f07852 100644
--- a/drivers/staging/wilc1000/wilc_exported_buf.c
+++ b/drivers/staging/wilc1000/wilc_exported_buf.c
@@ -84,8 +84,6 @@ static void __exit wilc_module_deinit(void)
 
kfree(exported_g_fw_buf);
exported_g_fw_buf = NULL;
-
-   return;
 }
 
 MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 4c40955..e9552f8 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -124,8 +124,6 @@ static void wilc_debug(uint32_t flag, char *fmt, ...)
if (g_wlan.os_func.os_debug)
g_wlan.os_func.os_debug(buf);
}
-
-   return;
 }
 
 static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP;
@@ -1325,7 +1323,6 @@ static void wilc_wlan_handle_rxq(void)
 
p->rxq_exit = 1;
PRINT_D(RX_DBG, "THREAD: Exiting RX thread\n");
-   return;
 }
 
 /
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index c10dffe..e2842d3 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -363,8 +363,6 @@ static void wilc_wlan_parse_response_frame(uint8_t *info, 
int size)
size -= (2 + len);
info += (2 + len);
}
-
-   return;
 }
 
 static int wilc_wlan_parse_info_frame(uint8_t *info, int size)
-- 
2.1.4

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


[PATCH 3/5] staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid possible memory leak

2015-08-17 Thread Raphaël Beamonte
The MACRO_WILC_BUFFER() macro was using a return statement, and didn't
take care of possible memory leaks and subsequent bugs when it was failing
after succeeding some allocations. This patch corrects this behavior.

Signed-off-by: Raphaël Beamonte 
---
 drivers/staging/wilc1000/wilc_exported_buf.c | 39 +---
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c 
b/drivers/staging/wilc1000/wilc_exported_buf.c
index bf392fb..c3aff9a 100644
--- a/drivers/staging/wilc1000/wilc_exported_buf.c
+++ b/drivers/staging/wilc1000/wilc_exported_buf.c
@@ -8,13 +8,6 @@
 #define LINUX_TX_SIZE  (64 * 1024)
 #define WILC1000_FW_SIZE (4 * 1024)
 
-#define MALLOC_WILC_BUFFER(name, size) \
-   exported_ ## name = kmalloc(size, GFP_KERNEL);\
-   if (!exported_ ## name) {   \
-   printk("fail to alloc: %s memory\n", exported_ ## name);  \
-   return -ENOBUFS;\
-   }
-
 /*
  * Add necessary buffer pointers
  */
@@ -40,17 +33,43 @@ void *get_fw_buffer(void)
 }
 EXPORT_SYMBOL(get_fw_buffer);
 
+static inline int kmalloc_wilc_buffer(void *buf, int size)
+{
+   buf = kmalloc(size, GFP_KERNEL);
+   if (!buf) {
+   printk("fail to alloc memory\n");
+   return -ENOBUFS;
+   }
+   return 0;
+}
+
 static int __init wilc_module_init(void)
 {
printk("wilc_module_init\n");
/*
 * alloc necessary memory
 */
-   MALLOC_WILC_BUFFER(g_tx_buf, LINUX_TX_SIZE)
-   MALLOC_WILC_BUFFER(g_rx_buf, LINUX_RX_SIZE)
-   MALLOC_WILC_BUFFER(g_fw_buf, WILC1000_FW_SIZE)
+   if (kmalloc_wilc_buffer(exported_g_tx_buf, LINUX_TX_SIZE))
+   goto error_g_tx_buf;
+
+   if (kmalloc_wilc_buffer(exported_g_rx_buf, LINUX_RX_SIZE))
+   goto error_g_rx_buf;
+
+   if (kmalloc_wilc_buffer(exported_g_fw_buf, WILC1000_FW_SIZE))
+   goto error_g_fw_buf;
 
return 0;
+
+error_g_fw_buf:
+   kfree(exported_g_rx_buf);
+   exported_g_rx_buf = NULL;
+
+error_g_rx_buf:
+   kfree(exported_g_tx_buf);
+   exported_g_tx_buf = NULL;
+
+error_g_tx_buf:
+   return -ENOBUFS;
 }
 
 static void __exit wilc_module_deinit(void)
-- 
2.1.4

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


[PATCH 1/5] staging: wilc1000: remove DECLARE_WILC_BUFFER()

2015-08-17 Thread Raphaël Beamonte
It was just a wrapper to initialize a variable. Initialize it
directly instead.

Signed-off-by: Raphaël Beamonte 
---
 drivers/staging/wilc1000/wilc_exported_buf.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c 
b/drivers/staging/wilc1000/wilc_exported_buf.c
index 5294578..985b0e1 100644
--- a/drivers/staging/wilc1000/wilc_exported_buf.c
+++ b/drivers/staging/wilc1000/wilc_exported_buf.c
@@ -8,9 +8,6 @@
 #define LINUX_TX_SIZE  (64 * 1024)
 #define WILC1000_FW_SIZE (4 * 1024)
 
-#define DECLARE_WILC_BUFFER(name)  \
-   void *exported_ ## name = NULL;
-
 #define MALLOC_WILC_BUFFER(name, size) \
exported_ ## name = kmalloc(size, GFP_KERNEL);\
if (!exported_ ## name) {   \
@@ -24,9 +21,9 @@
 /*
  * Add necessary buffer pointers
  */
-DECLARE_WILC_BUFFER(g_tx_buf)
-DECLARE_WILC_BUFFER(g_rx_buf)
-DECLARE_WILC_BUFFER(g_fw_buf)
+void *exported_g_tx_buf;
+void *exported_g_rx_buf;
+void *exported_g_fw_buf;
 
 void *get_tx_buffer(void)
 {
@@ -73,4 +70,4 @@ MODULE_LICENSE("Dual BSD/GPL");
 MODULE_AUTHOR("Tony Cho");
 MODULE_DESCRIPTION("WILC1xxx Memory Manager");
 pure_initcall(wilc_module_init);
-module_exit(wilc_module_deinit);
\ No newline at end of file
+module_exit(wilc_module_deinit);
-- 
2.1.4

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


[PATCH 2/5] staging: wilc1000: remove FREE_WILC_BUFFER()

2015-08-17 Thread Raphaël Beamonte
It was just a wrapper around kfree(), so call that instead.

Signed-off-by: Raphaël Beamonte 
---
 drivers/staging/wilc1000/wilc_exported_buf.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c 
b/drivers/staging/wilc1000/wilc_exported_buf.c
index 985b0e1..bf392fb 100644
--- a/drivers/staging/wilc1000/wilc_exported_buf.c
+++ b/drivers/staging/wilc1000/wilc_exported_buf.c
@@ -15,9 +15,6 @@
return -ENOBUFS;\
}
 
-#define FREE_WILC_BUFFER(name) \
-   kfree(exported_ ## name);
-
 /*
  * Add necessary buffer pointers
  */
@@ -59,9 +56,15 @@ static int __init wilc_module_init(void)
 static void __exit wilc_module_deinit(void)
 {
printk("wilc_module_deinit\n");
-   FREE_WILC_BUFFER(g_tx_buf)
-   FREE_WILC_BUFFER(g_rx_buf)
-   FREE_WILC_BUFFER(g_fw_buf)
+
+   kfree(exported_g_tx_buf);
+   exported_g_tx_buf = NULL;
+
+   kfree(exported_g_rx_buf);
+   exported_g_rx_buf = NULL;
+
+   kfree(exported_g_fw_buf);
+   exported_g_fw_buf = NULL;
 
return;
 }
-- 
2.1.4

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


[PATCH 0/5] staging: wilc1000: code improvements

2015-08-17 Thread Raphaël Beamonte
Hi,

The first 3 patches of the following 5 are aimed to simplify the
wilc_exported_buf.c macros as well as correct a potential memory
leak from the use of the MALLOC_WILC_BUFFER one.

The next 2 patches are correcting two kind of checkpatch warning
reports in different files of the wilc1000 driver.

Raphaël


Raphaël Beamonte (5):
  staging: wilc1000: remove DECLARE_WILC_BUFFER()
  staging: wilc1000: remove FREE_WILC_BUFFER()
  staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid
possible memory leak
  staging: wilc1000: use pr_* instead of printk
  staging: wilc1000: remove void function return statements that are not
useful

 drivers/staging/wilc1000/coreconfigurator.c  |  4 +-
 drivers/staging/wilc1000/host_interface.c|  4 --
 drivers/staging/wilc1000/linux_wlan.c|  9 ++--
 drivers/staging/wilc1000/linux_wlan_common.h | 32 ++---
 drivers/staging/wilc1000/linux_wlan_sdio.c   |  2 +-
 drivers/staging/wilc1000/linux_wlan_spi.c|  2 +-
 drivers/staging/wilc1000/wilc_debugfs.c  | 16 +++
 drivers/staging/wilc1000/wilc_exported_buf.c | 69 +---
 drivers/staging/wilc1000/wilc_wlan.c |  3 --
 drivers/staging/wilc1000/wilc_wlan_cfg.c |  2 -
 10 files changed, 75 insertions(+), 68 deletions(-)

-- 
2.1.4

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


RE: [PATCH v2 4/4] staging: comedi: usbduxsigma: use comedi_offset_munge()

2015-08-17 Thread Hartley Sweeten
On Sunday, August 16, 2015 11:16 PM, Sudip Mukherjee wrote:
> On Fri, Aug 14, 2015 at 11:34:07AM -0700, H Hartley Sweeten wrote:
>> +data[i] = comedi_offset_munge(s, val);;
> This introduces new checkpatch warning about double semicolon.

Yeah. I spotted that right after I posted the v2 series. It was followed up
by a v3 series that fixed it.

Sorry about the noise.

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


[PATCH] staging: dgnc: take mutex when storing value in dgnc_poll_tick

2015-08-17 Thread Salah Triki
Since dgnc_poll_trick is a global variable.

Signed-off-by: Salah Triki 
---
 drivers/staging/dgnc/dgnc_sysfs.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
b/drivers/staging/dgnc/dgnc_sysfs.c
index 44db870..fe14b7a 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -26,6 +26,7 @@
 #include "dgnc_driver.h"
 #include "dgnc_mgmt.h"
 
+#DEFINE_MUTEX(mut);
 
 static ssize_t dgnc_driver_version_show(struct device_driver *ddp, char *buf)
 {
@@ -58,10 +59,20 @@ static ssize_t dgnc_driver_pollrate_store(struct 
device_driver *ddp,
 {
int ret;
 
+   ret = mutex_lock_interruptible(&mut);
+
+   if (ret)
+   return -ERESTARTSYS;
+
ret = sscanf(buf, "%d\n", &dgnc_poll_tick);
if (ret != 1)
-   return -EINVAL;
-   return count;
+   ret = -EINVAL;
+   else
+   ret = count;
+
+   mutex_unlock(&mut);
+
+   return ret;
 }
 static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgnc_driver_pollrate_show,
   dgnc_driver_pollrate_store);
-- 
1.9.1

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


[PATCH] staging: unisys: documentation and TODO tweaks

2015-08-17 Thread Benjamin Romer
From: Tim Sell 

Update documentation (including TODO) to reflect the current state of
the drivers.

Signed-off-by: Tim Sell 
Signed-off-by: Benjamin Romer 
---
 .../Documentation/ABI/sysfs-platform-visorchipset  |   2 +
 drivers/staging/unisys/Documentation/overview.txt  | 458 ++---
 drivers/staging/unisys/TODO|  25 +-
 3 files changed, 332 insertions(+), 153 deletions(-)

diff --git 
a/drivers/staging/unisys/Documentation/ABI/sysfs-platform-visorchipset 
b/drivers/staging/unisys/Documentation/ABI/sysfs-platform-visorchipset
index 28f8f12..b0498ff 100644
--- a/drivers/staging/unisys/Documentation/ABI/sysfs-platform-visorchipset
+++ b/drivers/staging/unisys/Documentation/ABI/sysfs-platform-visorchipset
@@ -1,3 +1,5 @@
+This file describes sysfs entries beneath /devices/platform/visorchipset.
+
 What:  install/error
 Date:  7/18/2014
 KernelVersion: TBD
diff --git a/drivers/staging/unisys/Documentation/overview.txt 
b/drivers/staging/unisys/Documentation/overview.txt
index 8d078e4..25f93f2 100644
--- a/drivers/staging/unisys/Documentation/overview.txt
+++ b/drivers/staging/unisys/Documentation/overview.txt
@@ -1,76 +1,282 @@
+1. Overview
+---
 
-Overview
-
-This document describes the driver set for Unisys Secure Partitioning 
(s-Par??).
+This document describes the driver set for Unisys Secure Partitioning
+(s-Par(R)).
 
 s-Par is firmware that provides hardware partitioning capabilities for
 splitting large-scale Intel x86 servers into multiple isolated
 partitions. s-Par provides a set of para-virtualized device drivers to
 allow guest partitions on the same server to share devices that would
-normally be unsharable; specifically, PCI network interfaces and host
-bus adapters that do not support shared access via SR-IOV. The shared
-device is owned and managed by a small, single-purpose service
-partition, which communicates with each guest partition sharing that
-device through an area of shared memory called a channel. Additional
-drivers provide support interfaces for communicating with s-Par
-services, logging and diagnostics, and accessing the Linux console
-from the s-Par user interface.
-
-The driver stack consists of a set of support modules, a set of bus
-modules, and a set of device driver modules. The support modules
-handle a number of common functions across each of the other
-drivers. The bus modules provide organization for the device driver
-modules, which provide the shared device functionality.
-
-These drivers are for the Unisys virtual PCI hardware model where the
-hypervisor need not intervene (other than normal interrupt handling)
-in the interactions between the client drivers and the virtual adapter
-firmware in the adapter service partition.
-
-Driver Descriptions
-
-Device Modules
-
-The modules in this section handle shared devices and the virtual
-buses required to support them. These modules use functions in and
-depend on the modules described in the support modules section.
-
-visorchipset
-
-The visorchipset module receives device creation and destruction
-events from the Command service partition of s-Par, as well as
-controlling registration of shared device drivers with the s-Par
-driver core. The events received are used to populate other s-Par
-modules with their assigned shared devices. Visorchipset is required
-for shared device drivers to function properly. Visorchipset also
-stores information for handling dump disk device creation during
-kdump.
-
-In operation, the visorchipset module processes device creation and
-destruction messages sent by s-Par's Command service partition through
-a channel. These messages result in creation (or destruction) of each
-virtual bus and virtual device. Each bus and device is also associated
-with a communication channel, which is used to communicate with one or
-more IO service partitions to perform device IO on behalf of the
-guest.
-
-virthba
-
-The virthba module provides access to a shared SCSI host bus adapter
-and one or more disk devices, by proxying SCSI commands between the
-guest and the service partition that owns the shared SCSI adapter,
-using a channel between the guest and the service partition. The disks
-that appear on the shared bus are defined by the s-Par configuration
-and enforced by the service partition, while the guest driver handles
-sending commands and handling responses. Each disk is shared as a
-whole to a guest. Sharing the bus adapter in this way provides
-resiliency; should the device encounter an error, only the service
+normally be unsharable, specifically:
+
+* visornic - network interface
+* visorhba - scsi disk adapter
+* visorhid - keyboard and mouse
+
+These drivers conform to the standard Linux bus/device model described
+within Documentation/driver-model/, and utilize a driver named visorbus to
+present the virtual busses involved. Drivers in the 'visor*' driver set are
+commonly referred to as "guest drivers" or "c

Re: [PATCH 1/3] staging: wilc1000: code style: fix macro with multiple statements

2015-08-17 Thread Raphaël Beamonte
2015-08-17 5:08 GMT-04:00 Dan Carpenter :
> Pull it in one indent level...  But actually this macro has a return in
> the middle of it, so it just introduces bugs all over the place like
> eating cookies in bed.  We should just delete it instead.

You're right!
I'll clean those macro up and send a new set of patches to replace this one.

Thanks for the feedback!
Raphaël
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: staging: ft1000-pcmcia: remove support for v5 firmware

2015-08-17 Thread Dan Carpenter
On Fri, Aug 14, 2015 at 09:14:05PM +0200, Ondrej Zary wrote:
> Most probably yes.
> 
> However, the driver will be useless soon as the Flash OFDM network is being 
> decommissioned here in Slovakia. AFAIK, this technology is not used anywhere 
> else in the world (the 2nd country was Finland). The ft1000 devices will be 
> left with no signal.

Wikipedia says they are still used on some German trains [citation
needed] and parts of Dublin and few other places possibly...

https://en.wikipedia.org/wiki/Orthogonal_frequency-division_multiplexing#FLASH-OFDM

That page seems to be have been written about eight years ago.

regards,
dan carpenter

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


Re: [PATCH 3/4] staging: wilc1000: remove WILC_ErrNo

2015-08-17 Thread Dan Carpenter
On Mon, Aug 17, 2015 at 10:44:30PM +0900, Chaehyun Lim wrote:
> WILC_ErrNo is replaced by s32, then WILC_ErrNo typedef is removed.
> 

s32 is a weirdo type.  You should only specify the number of bit when it
is something required by the hardware.  Just use int.

regards,
dan carpenter

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


[PATCH 4/4] staging: wilc1000: return -EINVAL for invalid argument checking

2015-08-17 Thread Chaehyun Lim
This patch uses -EINVAL for invalid argument checking instead of using
WILC_ERRORREPORT with WILC_INVALID_ARGUMENT.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index dd87448..561ff88 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -61,7 +61,7 @@ s32 WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
Message *pstrMessage = NULL;
 
if ((pHandle == NULL) || (u32SendBufferSize == 0) || (pvSendBuffer == 
NULL)) {
-   WILC_ERRORREPORT(s32RetStatus, WILC_INVALID_ARGUMENT);
+   return -EINVAL;
}
 
if (pHandle->bExiting == true) {
@@ -128,7 +128,7 @@ s32 WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
unsigned long flags;
if ((pHandle == NULL) || (u32RecvBufferSize == 0)
|| (pvRecvBuffer == NULL) || (pu32ReceivedLength == NULL)) {
-   WILC_ERRORREPORT(s32RetStatus, WILC_INVALID_ARGUMENT);
+   return -EINVAL;
}
 
if (pHandle->bExiting == true) {
-- 
1.9.1

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


[PATCH 1/4] staging: wilc1000: delete wilc_log.h

2015-08-17 Thread Chaehyun Lim
The macros in wilc_log.h are not referenced anywhere, so just delete it.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/wilc_log.h   | 47 ---
 drivers/staging/wilc1000/wilc_oswrapper.h |  2 --
 2 files changed, 49 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_log.h

diff --git a/drivers/staging/wilc1000/wilc_log.h 
b/drivers/staging/wilc1000/wilc_log.h
deleted file mode 100644
index 2269ebd..000
--- a/drivers/staging/wilc1000/wilc_log.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef __WILC_LOG_H__
-#define __WILC_LOG_H__
-
-/* Errors will always get printed */
-#define WILC_ERROR(...) do {  WILC_PRINTF("(ERR)(%s:%d) ", __WILC_FUNCTION__, 
__WILC_LINE__); \
- WILC_PRINTF(__VA_ARGS__); \
-   } while (0)
-
-/* Wraning only printed if verbosity is 1 or more */
-#if (WILC_LOG_VERBOSITY_LEVEL > 0)
-#define WILC_WARN(...) do { WILC_PRINTF("(WRN)"); \
-   WILC_PRINTF(__VA_ARGS__); \
-   } while (0)
-#else
-#define WILC_WARN(...) (0)
-#endif
-
-/* Info only printed if verbosity is 2 or more */
-#if (WILC_LOG_VERBOSITY_LEVEL > 1)
-#define WILC_INFO(...) do {  WILC_PRINTF("(INF)"); \
-WILC_PRINTF(__VA_ARGS__); \
-   } while (0)
-#else
-#define WILC_INFO(...) (0)
-#endif
-
-/* Debug is only printed if verbosity is 3 or more */
-#if (WILC_LOG_VERBOSITY_LEVEL > 2)
-#define WILC_DBG(...) do { WILC_PRINTF("(DBG)(%s:%d) ", __WILC_FUNCTION__, 
__WILC_LINE__); \
-  WILC_PRINTF(__VA_ARGS__); \
-   } while (0)
-
-#else
-#define WILC_DBG(...) (0)
-#endif
-
-/* Function In/Out is only printed if verbosity is 4 or more */
-#if (WILC_LOG_VERBOSITY_LEVEL > 3)
-#define WILC_FN_IN do { WILC_PRINTF("(FIN) (%s:%d) \n", __WILC_FUNCTION__, 
__WILC_LINE__);  } while (0)
-#define WILC_FN_OUT(ret) do { WILC_PRINTF("(FOUT) (%s:%d) %d.\n", 
__WILC_FUNCTION__, __WILC_LINE__, (ret));  } while (0)
-#else
-#define WILC_FN_IN (0)
-#define WILC_FN_OUT(ret) (0)
-#endif
-
-
-#endif
\ No newline at end of file
diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h 
b/drivers/staging/wilc1000/wilc_oswrapper.h
index 374e33b..68e091f 100644
--- a/drivers/staging/wilc1000/wilc_oswrapper.h
+++ b/drivers/staging/wilc1000/wilc_oswrapper.h
@@ -17,8 +17,6 @@
 #include "wilc_osconfig.h"
 #include "wilc_platform.h"
 
-/* Logging Functions */
-#include "wilc_log.h"
 
 /* Error reporting and handling support */
 #include "wilc_errorsupport.h"
-- 
1.9.1

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


[PATCH 2/4] staging: wilc1000: delete wilc_osconfig.h

2015-08-17 Thread Chaehyun Lim
The macros inside wilc_osconfig.h are not referenced anywhere,
so just delete it.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/wilc_osconfig.h  | 9 -
 drivers/staging/wilc1000/wilc_oswrapper.h | 1 -
 2 files changed, 10 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_osconfig.h

diff --git a/drivers/staging/wilc1000/wilc_osconfig.h 
b/drivers/staging/wilc1000/wilc_osconfig.h
deleted file mode 100644
index f9c2514..000
--- a/drivers/staging/wilc1000/wilc_osconfig.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Logs options */
-#define WILC_LOGS_NOTHING  0
-#define WILC_LOGS_WARN 1
-#define WILC_LOGS_WARN_INFO2
-#define WILC_LOGS_WARN_INFO_DBG3
-#define WILC_LOGS_WARN_INFO_DBG_FN 4
-#define WILC_LOGS_ALL  5
-
-#define WILC_LOG_VERBOSITY_LEVEL WILC_LOGS_ALL
diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h 
b/drivers/staging/wilc1000/wilc_oswrapper.h
index 68e091f..45df626 100644
--- a/drivers/staging/wilc1000/wilc_oswrapper.h
+++ b/drivers/staging/wilc1000/wilc_oswrapper.h
@@ -14,7 +14,6 @@
 #define WILC_OSW_INTERFACE_VER 2
 
 /* Os Configuration File */
-#include "wilc_osconfig.h"
 #include "wilc_platform.h"
 
 
-- 
1.9.1

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


[PATCH 3/4] staging: wilc1000: remove WILC_ErrNo

2015-08-17 Thread Chaehyun Lim
WILC_ErrNo is replaced by s32, then WILC_ErrNo typedef is removed.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/wilc_errorsupport.h |  2 --
 drivers/staging/wilc1000/wilc_msgqueue.c | 12 ++--
 drivers/staging/wilc1000/wilc_msgqueue.h |  8 
 drivers/staging/wilc1000/wilc_timer.c|  4 ++--
 drivers/staging/wilc1000/wilc_timer.h|  4 ++--
 5 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_errorsupport.h 
b/drivers/staging/wilc1000/wilc_errorsupport.h
index b9517dc..6012ec4 100644
--- a/drivers/staging/wilc1000/wilc_errorsupport.h
+++ b/drivers/staging/wilc1000/wilc_errorsupport.h
@@ -36,8 +36,6 @@
 #define WILC_FILE_EOF  -116
 
 
-/* Error type */
-typedef s32 WILC_ErrNo;
 
 #define WILC_IS_ERR(__status__) (__status__ < WILC_SUCCESS)
 
diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index 9783c15..dd87448 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -8,7 +8,7 @@
  *  @note  copied from FLO glue implementatuion
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle,
+s32 WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle,
   tstrWILC_MsgQueueAttrs *pstrAttrs)
 {
spin_lock_init(&pHandle->strCriticalSection);
@@ -25,7 +25,7 @@ WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle,
  *  @note  copied from FLO glue implementatuion
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle,
+s32 WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle,
tstrWILC_MsgQueueAttrs *pstrAttrs)
 {
 
@@ -52,11 +52,11 @@ WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle 
*pHandle,
  *  @note  copied from FLO glue implementatuion
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
+s32 WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
 const void *pvSendBuffer, u32 u32SendBufferSize,
 tstrWILC_MsgQueueAttrs *pstrAttrs)
 {
-   WILC_ErrNo s32RetStatus = WILC_SUCCESS;
+   s32 s32RetStatus = WILC_SUCCESS;
unsigned long flags;
Message *pstrMessage = NULL;
 
@@ -117,14 +117,14 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
  *  @note  copied from FLO glue implementatuion
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
+s32 WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
 void *pvRecvBuffer, u32 u32RecvBufferSize,
 u32 *pu32ReceivedLength,
 tstrWILC_MsgQueueAttrs *pstrAttrs)
 {
 
Message *pstrMessage;
-   WILC_ErrNo s32RetStatus = WILC_SUCCESS;
+   s32 s32RetStatus = WILC_SUCCESS;
unsigned long flags;
if ((pHandle == NULL) || (u32RecvBufferSize == 0)
|| (pvRecvBuffer == NULL) || (pu32ReceivedLength == NULL)) {
diff --git a/drivers/staging/wilc1000/wilc_msgqueue.h 
b/drivers/staging/wilc1000/wilc_msgqueue.h
index de374ac..70c1148 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.h
+++ b/drivers/staging/wilc1000/wilc_msgqueue.h
@@ -41,7 +41,7 @@ typedef struct {
  *  @date  30 Aug 2010
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle,
+s32 WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle,
   tstrWILC_MsgQueueAttrs *pstrAttrs);
 
 
@@ -61,7 +61,7 @@ WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle,
  *  @date  30 Aug 2010
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
+s32 WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
 const void *pvSendBuffer, u32 u32SendBufferSize,
 tstrWILC_MsgQueueAttrs *pstrAttrs);
 
@@ -83,7 +83,7 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
  *  @date  30 Aug 2010
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
+s32 WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
 void *pvRecvBuffer, u32 u32RecvBufferSize,
 u32 *pu32ReceivedLength,
 tstrWILC_MsgQueueAttrs *pstrAttrs);
@@ -99,7 +99,7 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
  *  @date  30 Aug 2010
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle,
+s32 WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle,
tstrWILC_MsgQueueAttrs *pstrAttrs);
 
 
diff --git a/drivers/staging/wilc1000/wilc_timer.c 
b/drivers/staging/wilc1000/wilc_timer.c
index 775e38b..447c8bd 100644
--- a/drivers/staging/w

Re: [PATCH v10 5/8] staging: usage documentation for simple fpga bus

2015-08-17 Thread Pavel Machek
On Thu 2015-08-13 12:37:29, at...@opensource.altera.com wrote:
> From: Alan Tull 
> 
> Add a document spelling out usage of the simple fpga bus.
> 
> Signed-off-by: Alan Tull 

Acked-by: Pavel Machek 

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v10 3/8] add fpga manager core

2015-08-17 Thread Pavel Machek
On Thu 2015-08-13 12:37:27, at...@opensource.altera.com wrote:
> From: Alan Tull 
> 
> API to support programming FPGA.

I'd do s/fpga/FPGA/ in the comments, too. Otherwise looks ok to me.


Acked-by: Pavel Machek 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v10 8/8] staging: add simple-fpga-bus

2015-08-17 Thread Pavel Machek
On Thu 2015-08-13 12:37:32, at...@opensource.altera.com wrote:
> From: Alan Tull 
> 
> Add simple fpga bus.  This is a bus that configures an fpga and its
> bridges before populating the devices below it.  This is intended
> for use with device tree overlays.
> 
> Note that FPGA bridges are seen as reset controllers so no special
> framework for FPGA bridges will need to be added.
> 
> This supports fpga use where hardware blocks on a fpga will need
> drivers (as opposed to fpga used as an acceleration without drivers.)
> 
> Signed-off-by: Alan Tull 

7,8: Acked-by: Pavel Machek 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


  1   2   >