Re: [PATCH v5 1/6] mfd: rtsx: add func to split u32 into register

2015-01-20 Thread Lee Jones
On Tue, 20 Jan 2015, Ulf Hansson wrote:

> On 20 January 2015 at 15:47, Lee Jones  wrote:
> > On Tue, 23 Dec 2014, micky_ch...@realsil.com.cn wrote:
> >
> >> From: Micky Ching 
> >>
> >> Add helper function to write u32 to registers, if we want to put u32
> >> value to 4 continuous register, this can help us reduce tedious work.
> >>
> >> Signed-off-by: Micky Ching 
> >> Acked-by: Lee Jones 
> >> ---
> >>  include/linux/mfd/rtsx_pci.h | 9 +
> >>  1 file changed, 9 insertions(+)
> >
> > Applied, thanks.
> 
> This one has already been queued by you, for 3.19, and it's in Linus tree. :-)
> 
> For your reference, I have queued the mmc patches which depends on
> $subject patch for 3.20.

I discovered this myself when I attempted to apply it. :)

Thanks for the heads-up though.

> >> diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
> >> index 74346d5..9234449 100644
> >> --- a/include/linux/mfd/rtsx_pci.h
> >> +++ b/include/linux/mfd/rtsx_pci.h
> >> @@ -558,6 +558,7 @@
> >>  #define SD_SAMPLE_POINT_CTL  0xFDA7
> >>  #define SD_PUSH_POINT_CTL0xFDA8
> >>  #define SD_CMD0  0xFDA9
> >> +#define   SD_CMD_START   0x40
> >>  #define SD_CMD1  0xFDAA
> >>  #define SD_CMD2  0xFDAB
> >>  #define SD_CMD3  0xFDAC
> >> @@ -967,4 +968,12 @@ static inline u8 *rtsx_pci_get_cmd_data(struct 
> >> rtsx_pcr *pcr)
> >>   return (u8 *)(pcr->host_cmds_ptr);
> >>  }
> >>
> >> +static inline void rtsx_pci_write_be32(struct rtsx_pcr *pcr, u16 reg, u32 
> >> val)
> >> +{
> >> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg, 0xFF, val >> 24);
> >> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 1, 0xFF, val >> 16);
> >> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 2, 0xFF, val >> 8);
> >> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 3, 0xFF, val);
> >> +}
> >> +
> >>  #endif
> >

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] mfd: rtsx_usb: Fix runtime PM deadlock

2015-01-20 Thread Lee Jones
On Wed, 21 Jan 2015, Roger Tseng wrote:

> On Tue, 2015-01-20 at 16:07 +, Lee Jones wrote:
> > On Tue, 20 Jan 2015, Roger Tseng wrote:
> > 
> > > On Mon, 2015-01-19 at 09:45 +, Lee Jones wrote:
> > > > On Thu, 15 Jan 2015, Roger Tseng wrote:
> > > > 
> > > > > sd_set_power_mode() in derived module 
> > > > > drivers/mmc/host/rtsx_usb_sdmmc.c
> > > > > acquires dev_mutex and then calls pm_runtime_get_sync() to make sure 
> > > > > the
> > > > > device is awake while initializing a newly inserted card. Once it is
> > > > > called during suspending state and explicitly before 
> > > > > rtsx_usb_suspend()
> > > > > acquires the same dev_mutex, both routine deadlock and further hang 
> > > > > the
> > > > > driver because pm_runtime_get_sync() waits the pending PM operations.
> > > > > 
> > > > > Fix this by using an empty suspend method. mmc_core always turns the
> > > > > LED off after a request is done and thus it is ok to remove the only
> > > > > rtsx_usb_turn_off_led() here.
> > > > > 
> > > > > Cc:  # v3.16+
> > > > > Fixes: 730876be2566 ("mfd: Add realtek USB card reader driver")
> > > > > Signed-off-by: Roger Tseng 
> > > > > ---
> > > > >  drivers/mfd/rtsx_usb.c | 9 -
> > > > >  1 file changed, 9 deletions(-)
> > > > 
> > > > Applied, thanks.
> > > > 
> > > I'm sorry but build bot from Intel just reported me that I forgot to
> > > delete an unused variable "ucr" between two commits. My bad.
> > > 
> > > Do I have a chance to send v2?
> > 
> > You're lucky I'm in a good mood. ;)
> > 
> > I fixed it already.
> > 
> That's great, thanks! And thus patch 2/2 also needs to be changed
> accordingly.
> 
> By the way, the build bot reported again about an undefined variable
> build error in 2/2(I'm sorry for this again). I put the overall updated
> content of 2/2 here for you if you're going to fix it, or I can also
> re-send it individually.

Please re-send this patch and prefix it with [OVERWRITE].

In future make sure you test your submission thoroughly prior to
sending, as my time is very limited and with all due respect I could
make better use of it than this.

> diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
> index 210d1f85679e..ede50244f265 100644
> --- a/drivers/mfd/rtsx_usb.c
> +++ b/drivers/mfd/rtsx_usb.c
> @@ -681,9 +681,27 @@ static void rtsx_usb_disconnect(struct
> usb_interface *intf)
>  #ifdef CONFIG_PM
>  static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t
> message)
>  {
> + struct rtsx_ucr *ucr =
> + (struct rtsx_ucr *)usb_get_intfdata(intf);
> + u16 val = 0;
> +
>   dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n",
>   __func__, message.event);
>  
> + if (PMSG_IS_AUTO(message)) {
> + if (mutex_trylock(&ucr->dev_mutex)) {
> + rtsx_usb_get_card_status(ucr, &val);
> + mutex_unlock(&ucr->dev_mutex);
> +
> + /* Defer the autosuspend if card exists */
> + if (val & (SD_CD | MS_CD))
> + return -EAGAIN;
> + } else {
> + /* There is an ongoing operation*/
> + return -EAGAIN;
> + }
> + }
> +
>   return 0;
>  }
> 
> 
> 
> > > > > diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
> > > > > index dbdd0faeb6ce..076694126e5d 100644
> > > > > --- a/drivers/mfd/rtsx_usb.c
> > > > > +++ b/drivers/mfd/rtsx_usb.c
> > > > > @@ -687,15 +687,6 @@ static int rtsx_usb_suspend(struct usb_interface 
> > > > > *intf, pm_message_t message)
> > > > >   dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n",
> > > > >   __func__, message.event);
> > > > >  
> > > > > - /*
> > > > > -  * Call to make sure LED is off during suspend to save more 
> > > > > power.
> > > > > -  * It is NOT a permanent state and could be turned on anytime 
> > > > > later.
> > > > > -  * Thus no need to call turn_on when resunming.
> > > > > -  */
> > > > > - mutex_lock(&ucr->dev_mutex);
> > > > > - rtsx_usb_turn_off_led(ucr);
> > > > > - mutex_unlock(&ucr->dev_mutex);
> > > > > -
> > > > >   return 0;
> > > > >  }
> > > > >  
> > > > 
> > > 
> > 
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] mfd: rtsx_usb: Fix runtime PM deadlock

2015-01-20 Thread Roger Tseng
On Tue, 2015-01-20 at 16:07 +, Lee Jones wrote:
> On Tue, 20 Jan 2015, Roger Tseng wrote:
> 
> > On Mon, 2015-01-19 at 09:45 +, Lee Jones wrote:
> > > On Thu, 15 Jan 2015, Roger Tseng wrote:
> > > 
> > > > sd_set_power_mode() in derived module drivers/mmc/host/rtsx_usb_sdmmc.c
> > > > acquires dev_mutex and then calls pm_runtime_get_sync() to make sure the
> > > > device is awake while initializing a newly inserted card. Once it is
> > > > called during suspending state and explicitly before rtsx_usb_suspend()
> > > > acquires the same dev_mutex, both routine deadlock and further hang the
> > > > driver because pm_runtime_get_sync() waits the pending PM operations.
> > > > 
> > > > Fix this by using an empty suspend method. mmc_core always turns the
> > > > LED off after a request is done and thus it is ok to remove the only
> > > > rtsx_usb_turn_off_led() here.
> > > > 
> > > > Cc:  # v3.16+
> > > > Fixes: 730876be2566 ("mfd: Add realtek USB card reader driver")
> > > > Signed-off-by: Roger Tseng 
> > > > ---
> > > >  drivers/mfd/rtsx_usb.c | 9 -
> > > >  1 file changed, 9 deletions(-)
> > > 
> > > Applied, thanks.
> > > 
> > I'm sorry but build bot from Intel just reported me that I forgot to
> > delete an unused variable "ucr" between two commits. My bad.
> > 
> > Do I have a chance to send v2?
> 
> You're lucky I'm in a good mood. ;)
> 
> I fixed it already.
> 
That's great, thanks! And thus patch 2/2 also needs to be changed
accordingly.

By the way, the build bot reported again about an undefined variable
build error in 2/2(I'm sorry for this again). I put the overall updated
content of 2/2 here for you if you're going to fix it, or I can also
re-send it individually.

diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
index 210d1f85679e..ede50244f265 100644
--- a/drivers/mfd/rtsx_usb.c
+++ b/drivers/mfd/rtsx_usb.c
@@ -681,9 +681,27 @@ static void rtsx_usb_disconnect(struct
usb_interface *intf)
 #ifdef CONFIG_PM
 static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t
message)
 {
+   struct rtsx_ucr *ucr =
+   (struct rtsx_ucr *)usb_get_intfdata(intf);
+   u16 val = 0;
+
dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n",
__func__, message.event);
 
+   if (PMSG_IS_AUTO(message)) {
+   if (mutex_trylock(&ucr->dev_mutex)) {
+   rtsx_usb_get_card_status(ucr, &val);
+   mutex_unlock(&ucr->dev_mutex);
+
+   /* Defer the autosuspend if card exists */
+   if (val & (SD_CD | MS_CD))
+   return -EAGAIN;
+   } else {
+   /* There is an ongoing operation*/
+   return -EAGAIN;
+   }
+   }
+
return 0;
 }



> > > > diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
> > > > index dbdd0faeb6ce..076694126e5d 100644
> > > > --- a/drivers/mfd/rtsx_usb.c
> > > > +++ b/drivers/mfd/rtsx_usb.c
> > > > @@ -687,15 +687,6 @@ static int rtsx_usb_suspend(struct usb_interface 
> > > > *intf, pm_message_t message)
> > > > dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n",
> > > > __func__, message.event);
> > > >  
> > > > -   /*
> > > > -* Call to make sure LED is off during suspend to save more 
> > > > power.
> > > > -* It is NOT a permanent state and could be turned on anytime 
> > > > later.
> > > > -* Thus no need to call turn_on when resunming.
> > > > -*/
> > > > -   mutex_lock(&ucr->dev_mutex);
> > > > -   rtsx_usb_turn_off_led(ucr);
> > > > -   mutex_unlock(&ucr->dev_mutex);
> > > > -
> > > > return 0;
> > > >  }
> > > >  
> > > 
> > 
> 

-- 
Best regards,
Roger Tseng
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 3/3] Drivers: hv: vmbus: serialize Offer and Rescind offer

2015-01-20 Thread Jason Wang



On Tue, Jan 20, 2015 at 11:45 PM, Vitaly Kuznetsov 
 wrote:

Commit 4b2f9abea52a ("staging: hv: convert channel_mgmt.c to not call
osd_schedule_callback")' was written under an assumption that we 
never receive
Rescind offer while we're still processing the initial Offer request. 
However,
the issue we fixed in 04a258c162a8 could be caused by this assumption 
not

always being true.

In particular, we need to protect against the following:
1) Receiving a Rescind offer after we do queue_work() for processing 
an Offer
   request and before we actually enter vmbus_process_offer(). 
work.func points
   to vmbus_process_offer() at this moment and in 
vmbus_onoffer_rescind() we do
   another queue_work() without a check so we'll enter 
vmbus_process_offer()

   twice.
2) Receiving a Rescind offer after we enter vmbus_process_offer() and
   especially after we set >state = CHANNEL_OPEN_STATE. Many things 
can go
   wrong in that case, e.g. we can call free_channel() while we're 
still using

   it.

Implement the required protection by changing work->func at the very 
end of
vmbus_process_offer() and checking work->func in 
vmbus_onoffer_rescind(). In
case we receive rescind offer during or before vmbus_process_offer() 
is done
we set rescind flag to true and we check it at the end of 
vmbus_process_offer()

so such offer will not get lost.

Suggested-by: Radim Krčmář 
Signed-off-by: Vitaly Kuznetsov 
---


Acked-by: Jason Wang 


 drivers/hv/channel_mgmt.c | 30 ++
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index c6fdd74..877a944 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -279,9 +279,6 @@ static void vmbus_process_offer(struct 
work_struct *work)

int ret;
unsigned long flags;
 
-	/* The next possible work is rescind handling */

-   INIT_WORK(&newchannel->work, vmbus_process_rescind_offer);
-
/* Make sure this is a new offer */
spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
 
@@ -341,7 +338,7 @@ static void vmbus_process_offer(struct 
work_struct *work)

if (channel->sc_creation_callback != NULL)
channel->sc_creation_callback(newchannel);
 
-			goto out;

+   goto done_init_rescind;
}
 
 		goto err_free_chan;
@@ -382,7 +379,14 @@ static void vmbus_process_offer(struct 
work_struct *work)

kfree(newchannel->device_obj);
goto err_free_chan;
}
-out:
+done_init_rescind:
+   spin_lock_irqsave(&newchannel->lock, flags);
+   /* The next possible work is rescind handling */
+   INIT_WORK(&newchannel->work, vmbus_process_rescind_offer);
+   /* Check if rescind offer was already received */
+   if (newchannel->rescind)
+   queue_work(newchannel->controlwq, &newchannel->work);
+   spin_unlock_irqrestore(&newchannel->lock, flags);
return;
 err_free_chan:
free_channel(newchannel);
@@ -520,6 +524,7 @@ static void vmbus_onoffer_rescind(struct 
vmbus_channel_message_header *hdr)

 {
struct vmbus_channel_rescind_offer *rescind;
struct vmbus_channel *channel;
+   unsigned long flags;
 
 	rescind = (struct vmbus_channel_rescind_offer *)hdr;

channel = relid2channel(rescind->child_relid);
@@ -528,11 +533,20 @@ static void vmbus_onoffer_rescind(struct 
vmbus_channel_message_header *hdr)

/* Just return here, no channel found */
return;
 
+	spin_lock_irqsave(&channel->lock, flags);

channel->rescind = true;
+   /*
+	 * channel->work.func != vmbus_process_rescind_offer means we are 
still
+	 * processing offer request and the rescind offer processing should 
be
+	 * postponed. It will be done at the very end of 
vmbus_process_offer()

+* as rescind flag is being checked there.
+*/
+   if (channel->work.func == vmbus_process_rescind_offer)
+   /* work is initialized for vmbus_process_rescind_offer() from
+* vmbus_process_offer() where the channel got created */
+   queue_work(channel->controlwq, &channel->work);
 
-	/* work is initialized for vmbus_process_rescind_offer() from

-* vmbus_process_offer() where the channel got created */
-   queue_work(channel->controlwq, &channel->work);
+   spin_unlock_irqrestore(&channel->lock, flags);
 }
 
 /*

--
1.9.3



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


Re: [PATCH v3 2/3] Drivers: hv: rename sc_lock to the more generic lock

2015-01-20 Thread Jason Wang



On Tue, Jan 20, 2015 at 11:45 PM, Vitaly Kuznetsov 
 wrote:
sc_lock spinlock in struct vmbus_channel is being used to not only 
protect the
sc_list field, e.g. vmbus_open() function uses it to implement 
test-and-set
access to the state field. Rename it to the more generic 'lock' and 
add the

description.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/channel.c  |  6 +++---
 drivers/hv/channel_mgmt.c | 10 +-
 include/linux/hyperv.h|  7 ++-
 3 files changed, 14 insertions(+), 9 deletions(-)


Acked-by: Jason Wang 


diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 433f72a..8608ed1 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -73,14 +73,14 @@ int vmbus_open(struct vmbus_channel *newchannel, 
u32 send_ringbuffer_size,

unsigned long flags;
int ret, t, err = 0;
 
-	spin_lock_irqsave(&newchannel->sc_lock, flags);

+   spin_lock_irqsave(&newchannel->lock, flags);
if (newchannel->state == CHANNEL_OPEN_STATE) {
newchannel->state = CHANNEL_OPENING_STATE;
} else {
-   spin_unlock_irqrestore(&newchannel->sc_lock, flags);
+   spin_unlock_irqrestore(&newchannel->lock, flags);
return -EINVAL;
}
-   spin_unlock_irqrestore(&newchannel->sc_lock, flags);
+   spin_unlock_irqrestore(&newchannel->lock, flags);
 
 	newchannel->onchannel_callback = onchannelcallback;

newchannel->channel_callback_context = context;
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 01f2c2b..c6fdd74 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -146,7 +146,7 @@ static struct vmbus_channel *alloc_channel(void)
return NULL;
 
 	spin_lock_init(&channel->inbound_lock);

-   spin_lock_init(&channel->sc_lock);
+   spin_lock_init(&channel->lock);
 
 	INIT_LIST_HEAD(&channel->sc_list);

INIT_LIST_HEAD(&channel->percpu_list);
@@ -246,9 +246,9 @@ static void vmbus_process_rescind_offer(struct 
work_struct *work)

spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
} else {
primary_channel = channel->primary_channel;
-   spin_lock_irqsave(&primary_channel->sc_lock, flags);
+   spin_lock_irqsave(&primary_channel->lock, flags);
list_del(&channel->sc_list);
-   spin_unlock_irqrestore(&primary_channel->sc_lock, flags);
+   spin_unlock_irqrestore(&primary_channel->lock, flags);
}
free_channel(channel);
 }
@@ -323,9 +323,9 @@ static void vmbus_process_offer(struct 
work_struct *work)

 * Process the sub-channel.
 */
newchannel->primary_channel = channel;
-   spin_lock_irqsave(&channel->sc_lock, flags);
+   spin_lock_irqsave(&channel->lock, flags);
list_add_tail(&newchannel->sc_list, &channel->sc_list);
-   spin_unlock_irqrestore(&channel->sc_lock, flags);
+   spin_unlock_irqrestore(&channel->lock, flags);
 
 			if (newchannel->target_cpu != get_cpu()) {

put_cpu();
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 476c685..02dd978 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -722,7 +722,12 @@ struct vmbus_channel {
 */
void (*sc_creation_callback)(struct vmbus_channel *new_sc);
 
-	spinlock_t sc_lock;

+   /*
+	 * The spinlock to protect the structure. It is being used to 
protect
+	 * test-and-set access to various attributes of the structure as 
well

+* as all sc_list operations.
+*/
+   spinlock_t lock;
/*
 * All Sub-channels of a primary channel are linked here.
 */
--
1.9.3



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


Re: [PATCH v3 1/3] Drivers: hv: check vmbus_device_create() return value in vmbus_process_offer()

2015-01-20 Thread Jason Wang



On Tue, Jan 20, 2015 at 11:45 PM, Vitaly Kuznetsov 
 wrote:
vmbus_device_create() result is not being checked in 
vmbus_process_offer() and
it can fail if kzalloc() fails. Add the check and do minor cleanup to 
avoid

additional duplication of "free_channel(); return;" block.

Reported-by: Jason Wang 
Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/channel_mgmt.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)


Acked-by: Jason Wang 


diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 2c59f03..01f2c2b 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -341,11 +341,10 @@ static void vmbus_process_offer(struct 
work_struct *work)

if (channel->sc_creation_callback != NULL)
channel->sc_creation_callback(newchannel);
 
-			return;

+   goto out;
}
 
-		free_channel(newchannel);

-   return;
+   goto err_free_chan;
}
 
 	/*
@@ -364,6 +363,8 @@ static void vmbus_process_offer(struct 
work_struct *work)

&newchannel->offermsg.offer.if_type,
&newchannel->offermsg.offer.if_instance,
newchannel);
+   if (!newchannel->device_obj)
+   goto err_free_chan;
 
 	/*

 * Add the new device to the bus. This will kick off device-driver
@@ -379,9 +380,12 @@ static void vmbus_process_offer(struct 
work_struct *work)

list_del(&newchannel->listentry);
spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
kfree(newchannel->device_obj);
-
-   free_channel(newchannel);
+   goto err_free_chan;
}
+out:
+   return;
+err_free_chan:
+   free_channel(newchannel);
 }
 
 enum {

--
1.9.3



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


[PATCH 1/1] drivers:hv:vmbus Allow for use of all MMIO ranges

2015-01-20 Thread Jake Oshins
This set of changes finds the _CRS object in the ACPI namespace
that contains memory address space descriptors, intended to convey
to VMBus which ranges of memory-mapped I/O space are available for
child devices, and then builds a resource list that contains all
those ranges.  Without this change, only some of the memory-mapped
I/O space will be available for child devices, and only in some
virtual BIOS configurations (Generation 2 VMs).

Signed-off-by: Jake Oshins 
---
 drivers/hv/vmbus_drv.c  | 97 ++---
 drivers/video/fbdev/hyperv_fb.c |  2 +-
 include/linux/hyperv.h  |  2 +-
 3 files changed, 84 insertions(+), 17 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 4d6b269..b4c4b92 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -43,10 +43,7 @@ static struct tasklet_struct msg_dpc;
 static struct completion probe_event;
 static int irq;
 
-struct resource hyperv_mmio = {
-   .name  = "hyperv mmio",
-   .flags = IORESOURCE_MEM,
-};
+struct resource *hyperv_mmio;
 EXPORT_SYMBOL_GPL(hyperv_mmio);
 
 static int vmbus_exists(void)
@@ -849,30 +846,96 @@ void vmbus_device_unregister(struct hv_device *device_obj)
 
 
 /*
- * VMBUS is an acpi enumerated device. Get the the information we
- * need from DSDT.
+ * VMBUS is an acpi enumerated device. Get the
+ * information we need from DSDT.
  */
 
 static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
 {
+   resource_size_t start = 0;
+   resource_size_t end = 0;
+   struct resource *new_res;
+   struct resource **old_res = &hyperv_mmio;
+
switch (res->type) {
case ACPI_RESOURCE_TYPE_IRQ:
irq = res->data.irq.interrupts[0];
+   return AE_OK;
+
+   /*
+* "Address" descriptors are for bus windows. Ignore
+* "memory" descriptors, which are for registers on
+* devices.
+*/
+   case ACPI_RESOURCE_TYPE_ADDRESS32:
+   start = res->data.address32.minimum;
+   end = res->data.address32.maximum;
break;
 
case ACPI_RESOURCE_TYPE_ADDRESS64:
-   hyperv_mmio.start = res->data.address64.minimum;
-   hyperv_mmio.end = res->data.address64.maximum;
+   start = res->data.address64.minimum;
+   end = res->data.address64.maximum;
break;
+
+   default:
+   /* Unused resource type */
+   return AE_OK;
}
 
+   /*
+* Ignore ranges that are below 1MB, as they're not
+* necessary or useful here.
+*/
+   if (end < 0x10)
+   return AE_OK;
+
+   new_res = kzalloc(sizeof(*new_res), GFP_ATOMIC);
+   if (!new_res)
+   return AE_NO_MEMORY;
+
+   new_res->name = "hyperv mmio";
+   new_res->flags = IORESOURCE_MEM;
+   new_res->start = start;
+   new_res->end = end;
+
+   do {
+   if (!*old_res) {
+   *old_res = new_res;
+   break;
+   }
+
+   if ((*old_res)->start > new_res->end) {
+   new_res->sibling = *old_res;
+   *old_res = new_res;
+   break;
+   }
+
+   old_res = &(*old_res)->sibling;
+
+   } while (1);
+
return AE_OK;
 }
 
+static void vmbus_release_resources(void)
+{
+   struct resource *cur_res;
+   struct resource *next_res;
+
+   if (hyperv_mmio) {
+   release_resource(hyperv_mmio);
+   for (cur_res = hyperv_mmio; cur_res; cur_res = next_res) {
+   next_res = cur_res->sibling;
+   kfree(cur_res);
+   }
+   }
+}
+
 static int vmbus_acpi_add(struct acpi_device *device)
 {
acpi_status result;
int ret_val = -ENODEV;
+   struct acpi_device *ancestor;
 
hv_acpi_dev = device;
 
@@ -882,23 +945,26 @@ static int vmbus_acpi_add(struct acpi_device *device)
if (ACPI_FAILURE(result))
goto acpi_walk_err;
/*
-* The parent of the vmbus acpi device (Gen2 firmware) is the VMOD that
-* has the mmio ranges. Get that.
+* Some ancestor of the vmbus acpi device (Gen1 or Gen2
+* firmware) is the VMOD that has the mmio ranges. Get that.
 */
-   if (device->parent) {
-   result = acpi_walk_resources(device->parent->handle,
+   for (ancestor = device->parent; ancestor; ancestor = ancestor->parent) {
+   result = acpi_walk_resources(ancestor->handle,
METHOD_NAME__CRS,
vmbus_walk_resources, NULL);
 
if (ACPI_FAILURE(result))
-   goto acpi_walk_err;
-   if (hyperv_mmio.start && hyperv_mmio.end)
-   request_resource(&iomem_res

[PATCH] staging: fbtft: remove ARCH_BCM2708 optimization

2015-01-20 Thread Noralf Trønnes
ARCH_BCM2708 is not present in mainline so remove optimization.

Signed-off-by: Noralf Trønnes 
---
 drivers/staging/fbtft/fbtft-io.c | 170 ---
 1 file changed, 170 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-io.c b/drivers/staging/fbtft/fbtft-io.c
index dfa2c46..32155a7 100644
--- a/drivers/staging/fbtft/fbtft-io.c
+++ b/drivers/staging/fbtft/fbtft-io.c
@@ -2,9 +2,6 @@
 #include 
 #include 
 #include 
-#ifdef CONFIG_ARCH_BCM2708
-#include 
-#endif
 #include "fbtft.h"
 
 int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len)
@@ -129,171 +126,6 @@ int fbtft_read_spi(struct fbtft_par *par, void *buf, 
size_t len)
 }
 EXPORT_SYMBOL(fbtft_read_spi);
 
-
-#ifdef CONFIG_ARCH_BCM2708
-
-/*
- *  Raspberry Pi
- *  -  writing directly to the registers is 40-50% faster than
- * optimized use of gpiolib
- */
-
-#define GPIOSET(no, ishigh)   \
-do {  \
-   if (ishigh)   \
-   set |= (1 << (no));   \
-   else  \
-   reset |= (1 << (no)); \
-} while (0)
-
-int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len)
-{
-   unsigned int set = 0;
-   unsigned int reset = 0;
-   u8 data;
-
-   fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len,
-   "%s(len=%d): ", __func__, len);
-
-   while (len--) {
-   data = *(u8 *) buf;
-   buf++;
-
-   /* Set data */
-   GPIOSET(par->gpio.db[0], (data&0x01));
-   GPIOSET(par->gpio.db[1], (data&0x02));
-   GPIOSET(par->gpio.db[2], (data&0x04));
-   GPIOSET(par->gpio.db[3], (data&0x08));
-   GPIOSET(par->gpio.db[4], (data&0x10));
-   GPIOSET(par->gpio.db[5], (data&0x20));
-   GPIOSET(par->gpio.db[6], (data&0x40));
-   GPIOSET(par->gpio.db[7], (data&0x80));
-   writel(set, __io_address(GPIO_BASE+0x1C));
-   writel(reset, __io_address(GPIO_BASE+0x28));
-
-   /* Pulse /WR low */
-   writel((1info->device, u8, buf, len,
-   "%s(len=%d): ", __func__, len);
-
-   while (len) {
-   len -= 2;
-   data = *(u16 *) buf;
-   buf += 2;
-
-   /* Start writing by pulling down /WR */
-   gpio_set_value(par->gpio.wr, 0);
-
-   /* Set data */
-   GPIOSET(par->gpio.db[0],  (data&0x0001));
-   GPIOSET(par->gpio.db[1],  (data&0x0002));
-   GPIOSET(par->gpio.db[2],  (data&0x0004));
-   GPIOSET(par->gpio.db[3],  (data&0x0008));
-   GPIOSET(par->gpio.db[4],  (data&0x0010));
-   GPIOSET(par->gpio.db[5],  (data&0x0020));
-   GPIOSET(par->gpio.db[6],  (data&0x0040));
-   GPIOSET(par->gpio.db[7],  (data&0x0080));
-
-   GPIOSET(par->gpio.db[8],  (data&0x0100));
-   GPIOSET(par->gpio.db[9],  (data&0x0200));
-   GPIOSET(par->gpio.db[10], (data&0x0400));
-   GPIOSET(par->gpio.db[11], (data&0x0800));
-   GPIOSET(par->gpio.db[12], (data&0x1000));
-   GPIOSET(par->gpio.db[13], (data&0x2000));
-   GPIOSET(par->gpio.db[14], (data&0x4000));
-   GPIOSET(par->gpio.db[15], (data&0x8000));
-
-   writel(set, __io_address(GPIO_BASE+0x1C));
-   writel(reset, __io_address(GPIO_BASE+0x28));
-
-   /* Pullup /WR */
-   gpio_set_value(par->gpio.wr, 1);
-
-   set = 0;
-   reset = 0;
-   }
-
-   return 0;
-}
-EXPORT_SYMBOL(fbtft_write_gpio16_wr);
-
-int fbtft_write_gpio16_wr_latched(struct fbtft_par *par, void *buf, size_t len)
-{
-   unsigned int set = 0;
-   unsigned int reset = 0;
-   u16 data;
-
-   fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len,
-   "%s(len=%d): ", __func__, len);
-
-   while (len) {
-   len -= 2;
-   data = *(u16 *) buf;
-   buf += 2;
-
-   /* Start writing by pulling down /WR */
-   gpio_set_value(par->gpio.wr, 0);
-
-   /* Low byte */
-   GPIOSET(par->gpio.db[0],  (data&0x0001));
-   GPIOSET(par->gpio.db[1],  (data&0x0002));
-   GPIOSET(par->gpio.db[2],  (data&0x0004));
-   

[PATCH] staging: nvec: specify a platform-device base id

2015-01-20 Thread Marc Dietrich
commit 6e3f62f079 (mfd: core: Fix platform-device id generation) modified
the computation of the mfd cell id. Negative numbers forbit the specification
of cell ids as we do. Fix this for now by specifying a base of 0 instead. In
the long run, this may be changed to automatic cell ids (base -2).

Reported-by: Misha Komarovskiy 
Signed-off-by: Marc Dietrich 
---
 drivers/staging/nvec/nvec.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 093535c..120b70d 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -85,23 +85,20 @@ static struct nvec_chip *nvec_power_handle;
 static const struct mfd_cell nvec_devices[] = {
{
.name = "nvec-kbd",
-   .id = 1,
},
{
.name = "nvec-mouse",
-   .id = 1,
},
{
.name = "nvec-power",
-   .id = 1,
+   .id = 0,
},
{
.name = "nvec-power",
-   .id = 2,
+   .id = 1,
},
{
.name = "nvec-paz00",
-   .id = 1,
},
 };
 
@@ -891,7 +888,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
nvec_msg_free(nvec, msg);
}
 
-   ret = mfd_add_devices(nvec->dev, -1, nvec_devices,
+   ret = mfd_add_devices(nvec->dev, 0, nvec_devices,
  ARRAY_SIZE(nvec_devices), NULL, 0, NULL);
if (ret)
dev_err(nvec->dev, "error adding subdevices\n");
-- 
1.9.1

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


[PATCH 11/28] staging: comedi: adv_pci1710: tidy up pci1720_insn_write_ao()

2015-01-20 Thread H Hartley Sweeten
For aesthetics, rename this function and tidy it up.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index ab11819..dca1bf2 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -636,35 +636,34 @@ static int pci171x_insn_counter_config(struct 
comedi_device *dev,
return 1;
 }
 
-/*
-==
-*/
-static int pci1720_insn_write_ao(struct comedi_device *dev,
+static int pci1720_ao_insn_write(struct comedi_device *dev,
 struct comedi_subdevice *s,
-struct comedi_insn *insn, unsigned int *data)
+struct comedi_insn *insn,
+unsigned int *data)
 {
struct pci1710_private *devpriv = dev->private;
+   unsigned int chan = CR_CHAN(insn->chanspec);
+   unsigned int range = CR_RANGE(insn->chanspec);
unsigned int val;
-   int n, rangereg, chan;
+   int i;
 
-   chan = CR_CHAN(insn->chanspec);
-   rangereg = devpriv->da_ranges & (~(0x03 << (chan << 1)));
-   rangereg |= (CR_RANGE(insn->chanspec) << (chan << 1));
-   if (rangereg != devpriv->da_ranges) {
-   outb(rangereg, dev->iobase + PCI1720_RANGE);
-   devpriv->da_ranges = rangereg;
+   val = devpriv->da_ranges & (~(0x03 << (chan << 1)));
+   val |= (range << (chan << 1));
+   if (val != devpriv->da_ranges) {
+   outb(val, dev->iobase + PCI1720_RANGE);
+   devpriv->da_ranges = val;
}
-   val = s->readback[chan];
 
-   for (n = 0; n < insn->n; n++) {
-   val = data[n];
+   val = s->readback[chan];
+   for (i = 0; i < insn->n; i++) {
+   val = data[i];
outw(val, dev->iobase + PCI1720_DA0 + (chan << 1));
-   outb(0, dev->iobase + PCI1720_SYNCOUT); /*  update outputs */
+   outb(0, dev->iobase + PCI1720_SYNCOUT); /* update outputs */
}
 
s->readback[chan] = val;
 
-   return n;
+   return insn->n;
 }
 
 /*
@@ -1118,7 +1117,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
switch (this_board->cardtype) {
case TYPE_PCI1720:
s->n_chan = 4;
-   s->insn_write = pci1720_insn_write_ao;
+   s->insn_write = pci1720_ao_insn_write;
break;
default:
s->n_chan = 2;
-- 
2.0.3

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


[PATCH 09/28] staging: comedi: adv_pci1710: change boardinfo 'n_aochan' to 'has_ao'

2015-01-20 Thread H Hartley Sweeten
Some of the boards supported by this driver have analog outputs. The pci1720
board has 4 analog output channels and the others have 2.

For aesthetics, change the 'n_aochan' member to a bit-field flag 'has_ao' and
refactor the board attach accordingly. Remove the unnecessary initialization
of the subdevice 'len_chanlist'. That member is only used by subdevices that
support async commands.

Also, remove the unnecessary 'number of channels' check in pci171x_reset().
The boards that used this function, and have analog outputs, always have 2
channels.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 14aaa1e..ced13e9 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -193,13 +193,13 @@ struct boardtype {
const char *name;   /*  board name */
char cardtype;  /*  0=1710& co. 2=1713, ... */
int n_aichan;   /*  num of A/D chans */
-   int n_aochan;   /*  num of D/A chans */
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
const char *rangecode_ai;   /*  range codes for programming */
const struct comedi_lrange *rangelist_ao;   /*  rangelist for D/A */
unsigned int has_irq:1;
unsigned int has_large_fifo:1;  /* 4K or 1K FIFO */
unsigned int has_diff_ai:1;
+   unsigned int has_ao:1;
unsigned int has_di_do:1;
unsigned int has_counter:1;
 };
@@ -209,13 +209,13 @@ static const struct boardtype boardtypes[] = {
.name   = "pci1710",
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
-   .n_aochan   = 2,
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
.rangelist_ao   = &range_pci171x_da,
.has_irq= 1,
.has_large_fifo = 1,
.has_diff_ai= 1,
+   .has_ao = 1,
.has_di_do  = 1,
.has_counter= 1,
},
@@ -223,13 +223,13 @@ static const struct boardtype boardtypes[] = {
.name   = "pci1710hg",
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
-   .n_aochan   = 2,
.rangelist_ai   = &range_pci1710hg,
.rangecode_ai   = range_codes_pci1710hg,
.rangelist_ao   = &range_pci171x_da,
.has_irq= 1,
.has_large_fifo = 1,
.has_diff_ai= 1,
+   .has_ao = 1,
.has_di_do  = 1,
.has_counter= 1,
},
@@ -237,11 +237,11 @@ static const struct boardtype boardtypes[] = {
.name   = "pci1711",
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
-   .n_aochan   = 2,
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
.rangelist_ao   = &range_pci171x_da,
.has_irq= 1,
+   .has_ao = 1,
.has_di_do  = 1,
.has_counter= 1,
},
@@ -258,8 +258,8 @@ static const struct boardtype boardtypes[] = {
[BOARD_PCI1720] = {
.name   = "pci1720",
.cardtype   = TYPE_PCI1720,
-   .n_aochan   = 4,
.rangelist_ao   = &range_pci1720,
+   .has_ao = 1,
},
[BOARD_PCI1731] = {
.name   = "pci1731",
@@ -1008,15 +1008,13 @@ static int pci171x_reset(struct comedi_device *dev)
outb(0, dev->iobase + PCI171x_CLRINT);  /*  clear INT request */
pci171x_start_pacer(dev, false);
devpriv->da_ranges = 0;
-   if (this_board->n_aochan) {
+   if (this_board->has_ao) {
/* set DACs to 0..5V */
outb(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);
outw(0, dev->iobase + PCI171x_DA1); /* set DA outputs to 0V */
devpriv->ao_data[0] = 0x;
-   if (this_board->n_aochan > 1) {
-   outw(0, dev->iobase + PCI171x_DA2);
-   devpriv->ao_data[1] = 0x;
-   }
+   outw(0, dev->iobase + PCI171x_DA2);
+   devpriv->ao_data[1] = 0x;
}
outw(0, dev->iobase + PCI171x_DO);  /*  digital outputs to 0 */
outb(0, dev->iobase + PCI171x_CLRFIFO); /*  clear FIFO */
@@ -1091,7 +1089,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,

[PATCH 28/28] staging: comedi: adv_pci1710: absorb move_block_from_fifo()

2015-01-20 Thread H Hartley Sweeten
This function is only called by pci1710_handle_fifo(). Absorb it and clean up
pci1710_handle_fifo().

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 76075db..9800c01 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -696,55 +696,49 @@ static void pci1710_handle_every_sample(struct 
comedi_device *dev,
outb(0, dev->iobase + PCI171x_CLRINT);  /*  clear our INT request */
 }
 
-static int move_block_from_fifo(struct comedi_device *dev,
-   struct comedi_subdevice *s, int n)
-{
-   unsigned int val;
-   int ret;
-   int i;
-
-   for (i = 0; i < n; i++) {
-   ret = pci171x_ai_read_sample(dev, s, s->async->cur_chan, &val);
-   if (ret) {
-   s->async->events |= COMEDI_CB_ERROR;
-   return ret;
-   }
-
-   comedi_buf_write_samples(s, &val, 1);
-   }
-   return 0;
-}
-
 static void pci1710_handle_fifo(struct comedi_device *dev,
struct comedi_subdevice *s)
 {
struct pci1710_private *devpriv = dev->private;
-   struct comedi_cmd *cmd = &s->async->cmd;
-   unsigned int m;
+   struct comedi_async *async = s->async;
+   struct comedi_cmd *cmd = &async->cmd;
+   unsigned int status;
+   int i;
 
-   m = inw(dev->iobase + PCI171x_STATUS);
-   if (!(m & Status_FH)) {
-   dev_dbg(dev->class_dev, "A/D FIFO not half full! (%4x)\n", m);
-   s->async->events |= COMEDI_CB_ERROR;
+   status = inw(dev->iobase + PCI171x_STATUS);
+   if (!(status & Status_FH)) {
+   dev_dbg(dev->class_dev, "A/D FIFO not half full!\n");
+   async->events |= COMEDI_CB_ERROR;
return;
}
-   if (m & Status_FF) {
+   if (status & Status_FF) {
dev_dbg(dev->class_dev,
-   "A/D FIFO Full status (Fatal Error!) (%4x)\n", m);
-   s->async->events |= COMEDI_CB_ERROR;
+   "A/D FIFO Full status (Fatal Error!)\n");
+   async->events |= COMEDI_CB_ERROR;
return;
}
 
-   if (move_block_from_fifo(dev, s, devpriv->max_samples))
-   return;
+   for (i = 0; i < devpriv->max_samples; i++) {
+   unsigned int val;
+   int ret;
 
-   if (cmd->stop_src == TRIG_COUNT &&
-   s->async->scans_done >= cmd->stop_arg) {
-   s->async->events |= COMEDI_CB_EOA;
-   return;
+   ret = pci171x_ai_read_sample(dev, s, s->async->cur_chan, &val);
+   if (ret) {
+   s->async->events |= COMEDI_CB_ERROR;
+   break;
+   }
+
+   if (!comedi_buf_write_samples(s, &val, 1))
+   break;
+
+   if (cmd->stop_src == TRIG_COUNT &&
+   async->scans_done >= cmd->stop_arg) {
+   async->events |= COMEDI_CB_EOA;
+   break;
+   }
}
-   outb(0, dev->iobase + PCI171x_CLRINT);  /*  clear our INT request */
 
+   outb(0, dev->iobase + PCI171x_CLRINT);  /*  clear our INT request */
 }
 
 static irqreturn_t interrupt_service_pci1710(int irq, void *d)
-- 
2.0.3

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


[PATCH 27/28] staging: comedi: adv_pci1710: transfer all ai samples in one step

2015-01-20 Thread H Hartley Sweeten
The two step process to transfer the ai samples in pci1710_handle_fifo() doesn't
make any sense. If the async buffer does not have enough room for the samples 
the
core will set the async event COMEDI_CB_OVERFLOW which will cause the async 
command
to cancel. Splitting the transfer doesn't add any value.

Transfer all the samples in one step to simplify the code.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 0a50053..76075db 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -720,7 +720,6 @@ static void pci1710_handle_fifo(struct comedi_device *dev,
 {
struct pci1710_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
-   unsigned int nsamples;
unsigned int m;
 
m = inw(dev->iobase + PCI171x_STATUS);
@@ -736,18 +735,8 @@ static void pci1710_handle_fifo(struct comedi_device *dev,
return;
}
 
-   nsamples = devpriv->max_samples;
-   if (comedi_samples_to_bytes(s, nsamples) >= s->async->prealloc_bufsz) {
-   m = comedi_bytes_to_samples(s, s->async->prealloc_bufsz);
-   if (move_block_from_fifo(dev, s, m))
-   return;
-   nsamples -= m;
-   }
-
-   if (nsamples) {
-   if (move_block_from_fifo(dev, s, nsamples))
-   return;
-   }
+   if (move_block_from_fifo(dev, s, devpriv->max_samples))
+   return;
 
if (cmd->stop_src == TRIG_COUNT &&
s->async->scans_done >= cmd->stop_arg) {
-- 
2.0.3

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


[PATCH 05/28] staging: comedi: adv_pci1710: remove boardinfo 'ao_maxdata'

2015-01-20 Thread H Hartley Sweeten
The analog output resolution is always 12-bits in this driver. Remove the
unnecessary boardinfo.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index fb5ad60..395a2dd 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -195,7 +195,6 @@ struct boardtype {
int n_aichan;   /*  num of A/D chans */
int n_aichand;  /*  num of A/D chans in diff mode */
int n_aochan;   /*  num of D/A chans */
-   int ao_maxdata; /*  resolution of D/A */
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
const char *rangecode_ai;   /*  range codes for programming */
const struct comedi_lrange *rangelist_ao;   /*  rangelist for D/A */
@@ -213,7 +212,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.n_aichand  = 8,
.n_aochan   = 2,
-   .ao_maxdata = 0x0fff,
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
.rangelist_ao   = &range_pci171x_da,
@@ -229,7 +227,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.n_aichand  = 8,
.n_aochan   = 2,
-   .ao_maxdata = 0x0fff,
.rangelist_ai   = &range_pci1710hg,
.rangecode_ai   = range_codes_pci1710hg,
.rangelist_ao   = &range_pci171x_da,
@@ -244,7 +241,6 @@ static const struct boardtype boardtypes[] = {
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
.n_aochan   = 2,
-   .ao_maxdata = 0x0fff,
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
.rangelist_ao   = &range_pci171x_da,
@@ -269,7 +265,6 @@ static const struct boardtype boardtypes[] = {
.name   = "pci1720",
.cardtype   = TYPE_PCI1720,
.n_aochan   = 4,
-   .ao_maxdata = 0x0fff,
.rangelist_ao   = &range_pci1720,
},
[BOARD_PCI1731] = {
@@ -1153,7 +1148,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
s->n_chan = this_board->n_aochan;
-   s->maxdata = this_board->ao_maxdata;
+   s->maxdata = 0x0fff;
s->len_chanlist = this_board->n_aochan;
s->range_table = this_board->rangelist_ao;
switch (this_board->cardtype) {
-- 
2.0.3

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


[PATCH 25/28] staging: comedi: adv_pci1710: do comedi_handle_events() in common code patch

2015-01-20 Thread H Hartley Sweeten
The pci1710_handle_every_sample() and pci1710_handle_fifo() helpers, called by
the interrupt handler, both have multiple comedi_handle_events() calls. Remove
these and just do a single comedi_handle_events() at the end of the interrupt
handler.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 6068f40..7ad59ab 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -666,14 +666,12 @@ static void pci1710_handle_every_sample(struct 
comedi_device *dev,
if (status & Status_FE) {
dev_dbg(dev->class_dev, "A/D FIFO empty (%4x)\n", status);
s->async->events |= COMEDI_CB_ERROR;
-   comedi_handle_events(dev, s);
return;
}
if (status & Status_FF) {
dev_dbg(dev->class_dev,
"A/D FIFO Full status (Fatal Error!) (%4x)\n", status);
s->async->events |= COMEDI_CB_ERROR;
-   comedi_handle_events(dev, s);
return;
}
 
@@ -696,8 +694,6 @@ static void pci1710_handle_every_sample(struct 
comedi_device *dev,
}
 
outb(0, dev->iobase + PCI171x_CLRINT);  /*  clear our INT request */
-
-   comedi_handle_events(dev, s);
 }
 
 static int move_block_from_fifo(struct comedi_device *dev,
@@ -731,14 +727,12 @@ static void pci1710_handle_fifo(struct comedi_device *dev,
if (!(m & Status_FH)) {
dev_dbg(dev->class_dev, "A/D FIFO not half full! (%4x)\n", m);
s->async->events |= COMEDI_CB_ERROR;
-   comedi_handle_events(dev, s);
return;
}
if (m & Status_FF) {
dev_dbg(dev->class_dev,
"A/D FIFO Full status (Fatal Error!) (%4x)\n", m);
s->async->events |= COMEDI_CB_ERROR;
-   comedi_handle_events(dev, s);
return;
}
 
@@ -758,12 +752,10 @@ static void pci1710_handle_fifo(struct comedi_device *dev,
if (cmd->stop_src == TRIG_COUNT &&
s->async->scans_done >= cmd->stop_arg) {
s->async->events |= COMEDI_CB_EOA;
-   comedi_handle_events(dev, s);
return;
}
outb(0, dev->iobase + PCI171x_CLRINT);  /*  clear our INT request */
 
-   comedi_handle_events(dev, s);
 }
 
 static irqreturn_t interrupt_service_pci1710(int irq, void *d)
@@ -802,6 +794,8 @@ static irqreturn_t interrupt_service_pci1710(int irq, void 
*d)
else
pci1710_handle_fifo(dev, s);
 
+   comedi_handle_events(dev, s);
+
return IRQ_HANDLED;
 }
 
-- 
2.0.3

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


[PATCH 14/28] staging: comedi: adv_pci1710: tidy up digital input and output subdevice init

2015-01-20 Thread H Hartley Sweeten
For aesthetics, add some whitespace to the digital input and output subdevice
init and rename the support functions. Also remove the unnecessary comment.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 4b0735a..297a560 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -492,19 +492,17 @@ static int pci171x_ao_insn_write(struct comedi_device 
*dev,
return insn->n;
 }
 
-/*
-==
-*/
-static int pci171x_insn_bits_di(struct comedi_device *dev,
+static int pci171x_di_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
-   struct comedi_insn *insn, unsigned int *data)
+   struct comedi_insn *insn,
+   unsigned int *data)
 {
data[1] = inw(dev->iobase + PCI171x_DI);
 
return insn->n;
 }
 
-static int pci171x_insn_bits_do(struct comedi_device *dev,
+static int pci171x_do_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
@@ -1122,21 +1120,21 @@ static int pci1710_auto_attach(struct comedi_device 
*dev,
 
if (this_board->has_di_do) {
s = &dev->subdevices[subdev];
-   s->type = COMEDI_SUBD_DI;
-   s->subdev_flags = SDF_READABLE;
-   s->n_chan = 16;
-   s->maxdata = 1;
-   s->range_table = &range_digital;
-   s->insn_bits = pci171x_insn_bits_di;
+   s->type = COMEDI_SUBD_DI;
+   s->subdev_flags = SDF_READABLE;
+   s->n_chan   = 16;
+   s->maxdata  = 1;
+   s->range_table  = &range_digital;
+   s->insn_bits= pci171x_di_insn_bits;
subdev++;
 
s = &dev->subdevices[subdev];
-   s->type = COMEDI_SUBD_DO;
-   s->subdev_flags = SDF_WRITABLE;
-   s->n_chan = 16;
-   s->maxdata = 1;
-   s->range_table = &range_digital;
-   s->insn_bits = pci171x_insn_bits_do;
+   s->type = COMEDI_SUBD_DO;
+   s->subdev_flags = SDF_WRITABLE;
+   s->n_chan   = 16;
+   s->maxdata  = 1;
+   s->range_table  = &range_digital;
+   s->insn_bits= pci171x_do_insn_bits;
subdev++;
}
 
-- 
2.0.3

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


[PATCH 08/28] staging: comedi: adv_pci1710: change boardinfo 'fifo_half_size' to 'has_large_fifo'

2015-01-20 Thread H Hartley Sweeten
The boards supported by this driver have a 4K or 1K FIFO that is used when 
reading
analog input samples when running an async command. The maximum number of 
samples
in the FIFO is half the FIFO size due to the 2 bytes/sample (12-bit resolution).

For aesthetics, change the 'fifo_half_size' member to a bit-field flag 
'has_large_fifo'
and add a new member to the private data to hold the 'max_samples' available in 
the
FIFO. Refactor the board attach and pci1710_handle_fifo() accordingly.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 634b2a0..14aaa1e 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -197,8 +197,8 @@ struct boardtype {
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
const char *rangecode_ai;   /*  range codes for programming */
const struct comedi_lrange *rangelist_ao;   /*  rangelist for D/A */
-   unsigned int fifo_half_size;/*  size of FIFO/2 */
unsigned int has_irq:1;
+   unsigned int has_large_fifo:1;  /* 4K or 1K FIFO */
unsigned int has_diff_ai:1;
unsigned int has_di_do:1;
unsigned int has_counter:1;
@@ -213,8 +213,8 @@ static const struct boardtype boardtypes[] = {
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
.rangelist_ao   = &range_pci171x_da,
-   .fifo_half_size = 2048,
.has_irq= 1,
+   .has_large_fifo = 1,
.has_diff_ai= 1,
.has_di_do  = 1,
.has_counter= 1,
@@ -227,8 +227,8 @@ static const struct boardtype boardtypes[] = {
.rangelist_ai   = &range_pci1710hg,
.rangecode_ai   = range_codes_pci1710hg,
.rangelist_ao   = &range_pci171x_da,
-   .fifo_half_size = 2048,
.has_irq= 1,
+   .has_large_fifo = 1,
.has_diff_ai= 1,
.has_di_do  = 1,
.has_counter= 1,
@@ -241,7 +241,6 @@ static const struct boardtype boardtypes[] = {
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
.rangelist_ao   = &range_pci171x_da,
-   .fifo_half_size = 512,
.has_irq= 1,
.has_di_do  = 1,
.has_counter= 1,
@@ -252,8 +251,8 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 32,
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
-   .fifo_half_size = 2048,
.has_irq= 1,
+   .has_large_fifo = 1,
.has_diff_ai= 1,
},
[BOARD_PCI1720] = {
@@ -268,13 +267,13 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
-   .fifo_half_size = 512,
.has_irq= 1,
.has_di_do  = 1,
},
 };
 
 struct pci1710_private {
+   unsigned int max_samples;
unsigned int CntrlReg;  /*  Control register */
unsigned char ai_et;
unsigned int ai_et_CntrlReg;
@@ -786,7 +785,7 @@ static int move_block_from_fifo(struct comedi_device *dev,
 static void pci1710_handle_fifo(struct comedi_device *dev,
struct comedi_subdevice *s)
 {
-   const struct boardtype *this_board = dev->board_ptr;
+   struct pci1710_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
unsigned int nsamples;
unsigned int m;
@@ -806,7 +805,7 @@ static void pci1710_handle_fifo(struct comedi_device *dev,
return;
}
 
-   nsamples = this_board->fifo_half_size;
+   nsamples = devpriv->max_samples;
if (comedi_samples_to_bytes(s, nsamples) >= s->async->prealloc_bufsz) {
m = comedi_bytes_to_samples(s, s->async->prealloc_bufsz);
if (move_block_from_fifo(dev, s, m, 0))
@@ -1188,6 +1187,9 @@ static int pci1710_auto_attach(struct comedi_device *dev,
subdev++;
}
 
+   /* max_samples is half the FIFO size (2 bytes/sample) */
+   devpriv->max_samples = (this_board->has_large_fifo) ? 2048 : 512;
+
return 0;
 }
 
-- 
2.0.3

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


[PATCH 10/28] staging: comedi: adv_pci1710: use comedi_subdevice 'readback'

2015-01-20 Thread H Hartley Sweeten
Use the new comedi_subdevice 'readback' member and the core provided
(*insn_read) for the readback of the analog output subdevice channels.

The board is "reset" prior to the subdevice init. Part of this reset
sets all the analog output channels to 0V. Move the initialization of
the 'readback' values after the 'readback' member has been allocated.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index ced13e9..ab11819 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -285,7 +285,6 @@ struct pci1710_private {
unsigned int act_chanlist[32];  /*  list of scanned channel */
unsigned char saved_seglen; /* len of the non-repeating chanlist */
unsigned char da_ranges;/*  copy of D/A outpit range register */
-   unsigned short ao_data[4];  /*  data output buffer */
unsigned int cnt0_write_wait;   /* after a write, wait for update of the
 * internal state */
 };
@@ -491,14 +490,14 @@ static int pci171x_insn_write_ao(struct comedi_device 
*dev,
outw(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);
ofs = PCI171x_DA1;
}
-   val = devpriv->ao_data[chan];
+   val = s->readback[chan];
 
for (n = 0; n < insn->n; n++) {
val = data[n];
outw(val, dev->iobase + ofs);
}
 
-   devpriv->ao_data[chan] = val;
+   s->readback[chan] = val;
 
return n;
 
@@ -507,23 +506,6 @@ static int pci171x_insn_write_ao(struct comedi_device *dev,
 /*
 ==
 */
-static int pci171x_insn_read_ao(struct comedi_device *dev,
-   struct comedi_subdevice *s,
-   struct comedi_insn *insn, unsigned int *data)
-{
-   struct pci1710_private *devpriv = dev->private;
-   int n, chan;
-
-   chan = CR_CHAN(insn->chanspec);
-   for (n = 0; n < insn->n; n++)
-   data[n] = devpriv->ao_data[chan];
-
-   return n;
-}
-
-/*
-==
-*/
 static int pci171x_insn_bits_di(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
@@ -672,7 +654,7 @@ static int pci1720_insn_write_ao(struct comedi_device *dev,
outb(rangereg, dev->iobase + PCI1720_RANGE);
devpriv->da_ranges = rangereg;
}
-   val = devpriv->ao_data[chan];
+   val = s->readback[chan];
 
for (n = 0; n < insn->n; n++) {
val = data[n];
@@ -680,7 +662,7 @@ static int pci1720_insn_write_ao(struct comedi_device *dev,
outb(0, dev->iobase + PCI1720_SYNCOUT); /*  update outputs */
}
 
-   devpriv->ao_data[chan] = val;
+   s->readback[chan] = val;
 
return n;
 }
@@ -1012,9 +994,7 @@ static int pci171x_reset(struct comedi_device *dev)
/* set DACs to 0..5V */
outb(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);
outw(0, dev->iobase + PCI171x_DA1); /* set DA outputs to 0V */
-   devpriv->ao_data[0] = 0x;
outw(0, dev->iobase + PCI171x_DA2);
-   devpriv->ao_data[1] = 0x;
}
outw(0, dev->iobase + PCI171x_DO);  /*  digital outputs to 0 */
outb(0, dev->iobase + PCI171x_CLRFIFO); /*  clear FIFO */
@@ -1039,10 +1019,7 @@ static int pci1720_reset(struct comedi_device *dev)
outw(0x0800, dev->iobase + PCI1720_DA2);
outw(0x0800, dev->iobase + PCI1720_DA3);
outb(0, dev->iobase + PCI1720_SYNCOUT); /*  update outputs */
-   devpriv->ao_data[0] = 0x0800;
-   devpriv->ao_data[1] = 0x0800;
-   devpriv->ao_data[2] = 0x0800;
-   devpriv->ao_data[3] = 0x0800;
+
return 0;
 }
 
@@ -1148,7 +1125,19 @@ static int pci1710_auto_attach(struct comedi_device *dev,
s->insn_write = pci171x_insn_write_ao;
break;
}
-   s->insn_read = pci171x_insn_read_ao;
+
+   ret = comedi_alloc_subdev_readback(s);
+   if (ret)
+   return ret;
+
+   /* initialize the readback values to match the board reset */
+   if (this_board->cardtype == TYPE_PCI1720) {
+   int i;
+
+   for (i = 0; i < s->n_chan; i++)
+   s->readback[i] = 0x0800;
+   }
+
subdev++;
}
 
-- 
2.0.3

_

[PATCH 21/28] staging: comedi: adv_pci1710: refactor boardinfo 'cardtype'

2015-01-20 Thread H Hartley Sweeten
The 'cardtype' in the boardinfo is only used to:

 1) determine if the board is a pci1720 during the attach of the driver
and when reseting the board
 2) determine is the board is not a pci1713 when checking for analog input
data dropout

There is also an unnecessary use of the 'cardtype' when canceling an analog
input async command.

Remove the 'cardtype' member and add two bit-field flags, 'is_pci1713' and
'is_pci1720'. Refactor the driver to use the new flags.

Remove the unnecessary cardtype handling in pci171x_ai_cancel().

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 62c2a51..9bbdef8 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -51,11 +51,6 @@ Configuration options:
 #include "8253.h"
 #include "amcc_s5933.h"
 
-/* hardware types of the cards */
-#define TYPE_PCI171X   0
-#define TYPE_PCI1713   2
-#define TYPE_PCI1720   3
-
 #define PCI171x_AD_DATA 0  /* R:   A/D data */
 #define PCI171x_SOFTTRG 0  /* W:   soft trigger for A/D */
 #define PCI171x_RANGE   2  /* W:   A/D gain/range register */
@@ -191,10 +186,11 @@ enum pci1710_boardid {
 
 struct boardtype {
const char *name;   /*  board name */
-   char cardtype;  /*  0=1710& co. 2=1713, ... */
int n_aichan;   /*  num of A/D chans */
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
const char *rangecode_ai;   /*  range codes for programming */
+   unsigned int is_pci1713:1;
+   unsigned int is_pci1720:1;
unsigned int has_irq:1;
unsigned int has_large_fifo:1;  /* 4K or 1K FIFO */
unsigned int has_diff_ai:1;
@@ -206,7 +202,6 @@ struct boardtype {
 static const struct boardtype boardtypes[] = {
[BOARD_PCI1710] = {
.name   = "pci1710",
-   .cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
@@ -219,7 +214,6 @@ static const struct boardtype boardtypes[] = {
},
[BOARD_PCI1710HG] = {
.name   = "pci1710hg",
-   .cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
.rangelist_ai   = &range_pci1710hg,
.rangecode_ai   = range_codes_pci1710hg,
@@ -232,7 +226,6 @@ static const struct boardtype boardtypes[] = {
},
[BOARD_PCI1711] = {
.name   = "pci1711",
-   .cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
@@ -243,22 +236,21 @@ static const struct boardtype boardtypes[] = {
},
[BOARD_PCI1713] = {
.name   = "pci1713",
-   .cardtype   = TYPE_PCI1713,
.n_aichan   = 32,
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
+   .is_pci1713 = 1,
.has_irq= 1,
.has_large_fifo = 1,
.has_diff_ai= 1,
},
[BOARD_PCI1720] = {
.name   = "pci1720",
-   .cardtype   = TYPE_PCI1720,
+   .is_pci1720 = 1,
.has_ao = 1,
},
[BOARD_PCI1731] = {
.name   = "pci1731",
-   .cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
@@ -300,7 +292,7 @@ static int pci171x_ai_dropout(struct comedi_device *dev,
const struct boardtype *board = dev->board_ptr;
struct pci1710_private *devpriv = dev->private;
 
-   if (board->cardtype != TYPE_PCI1713) {
+   if (!board->is_pci1713) {
if ((val & 0xf000) != devpriv->act_chanlist[chan]) {
dev_err(dev->class_dev,
"A/D data droput: received from channel %d, 
expected %d\n",
@@ -643,20 +635,15 @@ static int pci1720_ao_insn_write(struct comedi_device 
*dev,
 static int pci171x_ai_cancel(struct comedi_device *dev,
 struct comedi_subdevice *s)
 {
-   const struct boardtype *board = dev->board_ptr;
struct pci1710_private *devpriv = dev->private;
 
-   switch (board->cardtype) {
-   default:
-   devpriv->CntrlReg &= Control_CNT0;
-   devpriv->CntrlReg |= Control_SW;
-   /* reset any operations */
-

[PATCH 12/28] staging: comedi: adv_pci1710: tidy up pci171x_insn_write_ao()

2015-01-20 Thread H Hartley Sweeten
For aesthetics, rename this function and tidy it up.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index dca1bf2..ce91cec 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -466,41 +466,30 @@ static int pci171x_insn_read_ai(struct comedi_device *dev,
return ret ? ret : insn->n;
 }
 
-/*
-==
-*/
-static int pci171x_insn_write_ao(struct comedi_device *dev,
+static int pci171x_ao_insn_write(struct comedi_device *dev,
 struct comedi_subdevice *s,
-struct comedi_insn *insn, unsigned int *data)
+struct comedi_insn *insn,
+unsigned int *data)
 {
struct pci1710_private *devpriv = dev->private;
-   unsigned int val;
-   int n, chan, range, ofs;
-
-   chan = CR_CHAN(insn->chanspec);
-   range = CR_RANGE(insn->chanspec);
-   if (chan) {
-   devpriv->da_ranges &= 0xfb;
-   devpriv->da_ranges |= (range << 2);
-   outw(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);
-   ofs = PCI171x_DA2;
-   } else {
-   devpriv->da_ranges &= 0xfe;
-   devpriv->da_ranges |= range;
-   outw(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);
-   ofs = PCI171x_DA1;
-   }
-   val = s->readback[chan];
+   unsigned int chan = CR_CHAN(insn->chanspec);
+   unsigned int range = CR_RANGE(insn->chanspec);
+   unsigned int reg = chan ? PCI171x_DA2 : PCI171x_DA1;
+   unsigned int val = s->readback[chan];
+   int i;
+
+   devpriv->da_ranges &= ~(1 << (chan << 1));
+   devpriv->da_ranges |= (range << (chan << 1));
+   outw(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);
 
-   for (n = 0; n < insn->n; n++) {
-   val = data[n];
-   outw(val, dev->iobase + ofs);
+   for (i = 0; i < insn->n; i++) {
+   val = data[i];
+   outw(val, dev->iobase + reg);
}
 
s->readback[chan] = val;
 
-   return n;
-
+   return insn->n;
 }
 
 /*
@@ -1121,7 +1110,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
break;
default:
s->n_chan = 2;
-   s->insn_write = pci171x_insn_write_ao;
+   s->insn_write = pci171x_ao_insn_write;
break;
}
 
-- 
2.0.3

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


[PATCH 01/28] staging: comedi: adv_pci1710: change boardinfo 'n_counter' to 'has_counter'

2015-01-20 Thread H Hartley Sweeten
The 'n_counter' member of the boardinfo is actually a flag indicating that the
board exposes a single channel counter subdevice.

For aesthetics, change the 'n_counter' member to a bit-field flag 'has_counter'
and refactor the board attach accordingly.

Remove the unnecessary initialization of the subdevice 'len_chanlist'. That
member is only used by subdevices that support async commands.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 1b8715b..9f88cfb 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -198,7 +198,6 @@ struct boardtype {
int n_aochan;   /*  num of D/A chans */
int n_dichan;   /*  num of DI chans */
int n_dochan;   /*  num of DO chans */
-   int n_counter;  /*  num of counters */
int ai_maxdata; /*  resolution of A/D */
int ao_maxdata; /*  resolution of D/A */
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
@@ -206,6 +205,7 @@ struct boardtype {
const struct comedi_lrange *rangelist_ao;   /*  rangelist for D/A */
unsigned int ai_ns_min; /*  max sample speed of card v ns */
unsigned int fifo_half_size;/*  size of FIFO/2 */
+   unsigned int has_counter:1;
 };
 
 static const struct boardtype boardtypes[] = {
@@ -218,7 +218,6 @@ static const struct boardtype boardtypes[] = {
.n_aochan   = 2,
.n_dichan   = 16,
.n_dochan   = 16,
-   .n_counter  = 1,
.ai_maxdata = 0x0fff,
.ao_maxdata = 0x0fff,
.rangelist_ai   = &range_pci1710_3,
@@ -226,6 +225,7 @@ static const struct boardtype boardtypes[] = {
.rangelist_ao   = &range_pci171x_da,
.ai_ns_min  = 1,
.fifo_half_size = 2048,
+   .has_counter= 1,
},
[BOARD_PCI1710HG] = {
.name   = "pci1710hg",
@@ -236,7 +236,6 @@ static const struct boardtype boardtypes[] = {
.n_aochan   = 2,
.n_dichan   = 16,
.n_dochan   = 16,
-   .n_counter  = 1,
.ai_maxdata = 0x0fff,
.ao_maxdata = 0x0fff,
.rangelist_ai   = &range_pci1710hg,
@@ -244,6 +243,7 @@ static const struct boardtype boardtypes[] = {
.rangelist_ao   = &range_pci171x_da,
.ai_ns_min  = 1,
.fifo_half_size = 2048,
+   .has_counter= 1,
},
[BOARD_PCI1711] = {
.name   = "pci1711",
@@ -253,7 +253,6 @@ static const struct boardtype boardtypes[] = {
.n_aochan   = 2,
.n_dichan   = 16,
.n_dochan   = 16,
-   .n_counter  = 1,
.ai_maxdata = 0x0fff,
.ao_maxdata = 0x0fff,
.rangelist_ai   = &range_pci17x1,
@@ -261,6 +260,7 @@ static const struct boardtype boardtypes[] = {
.rangelist_ao   = &range_pci171x_da,
.ai_ns_min  = 1,
.fifo_half_size = 512,
+   .has_counter= 1,
},
[BOARD_PCI1713] = {
.name   = "pci1713",
@@ -1122,7 +1122,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
n_subdevices++;
if (this_board->n_dochan)
n_subdevices++;
-   if (this_board->n_counter)
+   if (this_board->has_counter)
n_subdevices++;
 
ret = comedi_alloc_subdevices(dev, n_subdevices);
@@ -1205,12 +1205,11 @@ static int pci1710_auto_attach(struct comedi_device 
*dev,
subdev++;
}
 
-   if (this_board->n_counter) {
+   if (this_board->has_counter) {
s = &dev->subdevices[subdev];
s->type = COMEDI_SUBD_COUNTER;
s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
-   s->n_chan = this_board->n_counter;
-   s->len_chanlist = this_board->n_counter;
+   s->n_chan = 1;
s->maxdata = 0x;
s->range_table = &range_unknown;
s->insn_read = pci171x_insn_counter_read;
-- 
2.0.3

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


[PATCH 13/28] staging: comedi: adv_pci1710: tidy up counter subdevice init

2015-01-20 Thread H Hartley Sweeten
For aesthetics, add some whitespace to the counter subdevice init and
rename the support functions. Also remove the unnecessary comments.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index ce91cec..4b0735a 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -532,10 +532,7 @@ static void pci171x_start_pacer(struct comedi_device *dev,
}
 }
 
-/*
-==
-*/
-static int pci171x_insn_counter_read(struct comedi_device *dev,
+static int pci171x_counter_insn_read(struct comedi_device *dev,
 struct comedi_subdevice *s,
 struct comedi_insn *insn,
 unsigned int *data)
@@ -556,10 +553,7 @@ static int pci171x_insn_counter_read(struct comedi_device 
*dev,
return insn->n;
 }
 
-/*
-==
-*/
-static int pci171x_insn_counter_write(struct comedi_device *dev,
+static int pci171x_counter_insn_write(struct comedi_device *dev,
  struct comedi_subdevice *s,
  struct comedi_insn *insn,
  unsigned int *data)
@@ -586,10 +580,7 @@ static int pci171x_insn_counter_write(struct comedi_device 
*dev,
return insn->n;
 }
 
-/*
-==
-*/
-static int pci171x_insn_counter_config(struct comedi_device *dev,
+static int pci171x_counter_insn_config(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn,
   unsigned int *data)
@@ -1151,14 +1142,14 @@ static int pci1710_auto_attach(struct comedi_device 
*dev,
 
if (this_board->has_counter) {
s = &dev->subdevices[subdev];
-   s->type = COMEDI_SUBD_COUNTER;
-   s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
-   s->n_chan = 1;
-   s->maxdata = 0x;
-   s->range_table = &range_unknown;
-   s->insn_read = pci171x_insn_counter_read;
-   s->insn_write = pci171x_insn_counter_write;
-   s->insn_config = pci171x_insn_counter_config;
+   s->type = COMEDI_SUBD_COUNTER;
+   s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
+   s->n_chan   = 1;
+   s->maxdata  = 0x;
+   s->range_table  = &range_unknown;
+   s->insn_read= pci171x_counter_insn_read;
+   s->insn_write   = pci171x_counter_insn_write;
+   s->insn_config  = pci171x_counter_insn_config;
subdev++;
}
 
-- 
2.0.3

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


[PATCH 23/28] staging: comedi: adv_pci1710: tidy up setup_channel_list()

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

Tidy up the code to clarify the function. Remove the unnecessary static const
array muxonechan[].

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 0927bbe..719497c 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -276,14 +276,6 @@ struct pci1710_private {
 * internal state */
 };
 
-/*  used for gain list programming */
-static const unsigned int muxonechan[] = {
-   0x, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, 0x0606, 0x0707,
-   0x0808, 0x0909, 0x0a0a, 0x0b0b, 0x0c0c, 0x0d0d, 0x0e0e, 0x0f0f,
-   0x1010, 0x, 0x1212, 0x1313, 0x1414, 0x1515, 0x1616, 0x1717,
-   0x1818, 0x1919, 0x1a1a, 0x1b1b, 0x1c1c, 0x1d1d, 0x1e1e, 0x1f1f
-};
-
 static int pci171x_ai_dropout(struct comedi_device *dev,
  struct comedi_subdevice *s,
  unsigned int chan,
@@ -375,30 +367,39 @@ static int pci171x_ai_check_chanlist(struct comedi_device 
*dev,
return 0;
 }
 
-static void setup_channel_list(struct comedi_device *dev,
-  struct comedi_subdevice *s,
-  unsigned int *chanlist, unsigned int n_chan,
-  unsigned int seglen)
+static void pci171x_ai_setup_chanlist(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int *chanlist,
+ unsigned int n_chan,
+ unsigned int seglen)
 {
const struct boardtype *board = dev->board_ptr;
struct pci1710_private *devpriv = dev->private;
-   unsigned int i, range, chanprog;
+   unsigned int first_chan = CR_CHAN(chanlist[0]);
+   unsigned int last_chan = CR_CHAN(chanlist[seglen - 1]);
+   unsigned int i;
 
for (i = 0; i < seglen; i++) {  /*  store range list to card */
-   chanprog = muxonechan[CR_CHAN(chanlist[i])];
-   outw(chanprog, dev->iobase + PCI171x_MUX); /* select channel */
-   range = board->rangecode_ai[CR_RANGE(chanlist[i])];
-   if (CR_AREF(chanlist[i]) == AREF_DIFF)
-   range |= 0x0020;
-   outw(range, dev->iobase + PCI171x_RANGE); /* select gain */
-   devpriv->act_chanlist[i] = CR_CHAN(chanlist[i]);
+   unsigned int chan = CR_CHAN(chanlist[i]);
+   unsigned int range = CR_RANGE(chanlist[i]);
+   unsigned int aref = CR_AREF(chanlist[i]);
+   unsigned int rangeval;
+
+   rangeval = board->rangecode_ai[range];
+   if (aref == AREF_DIFF)
+   rangeval |= 0x0020;
+
+   /* select channel and set range */
+   outw(chan | (chan << 8), dev->iobase + PCI171x_MUX);
+   outw(rangeval, dev->iobase + PCI171x_RANGE);
+
+   devpriv->act_chanlist[i] = chan;
}
for ( ; i < n_chan; i++)/* store remainder of channel list */
devpriv->act_chanlist[i] = CR_CHAN(chanlist[i]);
 
-   devpriv->ai_et_MuxVal =
-   CR_CHAN(chanlist[0]) | (CR_CHAN(chanlist[seglen - 1]) << 8);
/* select channel interval to scan */
+   devpriv->ai_et_MuxVal = first_chan | (last_chan << 8);
outw(devpriv->ai_et_MuxVal, dev->iobase + PCI171x_MUX);
 }
 
@@ -431,7 +432,7 @@ static int pci171x_ai_insn_read(struct comedi_device *dev,
outb(0, dev->iobase + PCI171x_CLRFIFO);
outb(0, dev->iobase + PCI171x_CLRINT);
 
-   setup_channel_list(dev, s, &insn->chanspec, 1, 1);
+   pci171x_ai_setup_chanlist(dev, s, &insn->chanspec, 1, 1);
 
for (i = 0; i < insn->n; i++) {
unsigned int val;
@@ -813,8 +814,8 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
 
pci171x_start_pacer(dev, false);
 
-   setup_channel_list(dev, s, cmd->chanlist, cmd->chanlist_len,
-  devpriv->saved_seglen);
+   pci171x_ai_setup_chanlist(dev, s, cmd->chanlist, cmd->chanlist_len,
+ devpriv->saved_seglen);
 
outb(0, dev->iobase + PCI171x_CLRFIFO);
outb(0, dev->iobase + PCI171x_CLRINT);
-- 
2.0.3

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


[PATCH 18/28] staging: comedi: adv_pci1710: remove function separation comments

2015-01-20 Thread H Hartley Sweeten
Remove the remaining, unnecessary, function separation comments.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 4fdf041..200be09 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -714,9 +714,6 @@ static void pci1710_handle_every_sample(struct 
comedi_device *dev,
comedi_handle_events(dev, s);
 }
 
-/*
-==
-*/
 static int move_block_from_fifo(struct comedi_device *dev,
struct comedi_subdevice *s, int n, int turn)
 {
@@ -786,9 +783,6 @@ static void pci1710_handle_fifo(struct comedi_device *dev,
comedi_handle_events(dev, s);
 }
 
-/*
-==
-*/
 static irqreturn_t interrupt_service_pci1710(int irq, void *d)
 {
struct comedi_device *dev = d;
@@ -945,9 +939,6 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev,
return 0;
 }
 
-/*
-==
-*/
 static int pci171x_reset(struct comedi_device *dev)
 {
const struct boardtype *board = dev->board_ptr;
@@ -975,9 +966,6 @@ static int pci171x_reset(struct comedi_device *dev)
return 0;
 }
 
-/*
-==
-*/
 static int pci1720_reset(struct comedi_device *dev)
 {
struct pci1710_private *devpriv = dev->private;
@@ -995,9 +983,6 @@ static int pci1720_reset(struct comedi_device *dev)
return 0;
 }
 
-/*
-==
-*/
 static int pci1710_reset(struct comedi_device *dev)
 {
const struct boardtype *board = dev->board_ptr;
-- 
2.0.3

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


[PATCH 15/28] staging: comedi: adv_pci1710: tidy up analog output subdevice init

2015-01-20 Thread H Hartley Sweeten
For aesthetics, add some whitespace to the analog output subdevice init.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 297a560..ba34a26 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -1088,18 +1088,18 @@ static int pci1710_auto_attach(struct comedi_device 
*dev,
 
if (this_board->has_ao) {
s = &dev->subdevices[subdev];
-   s->type = COMEDI_SUBD_AO;
-   s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
-   s->maxdata = 0x0fff;
-   s->range_table = this_board->rangelist_ao;
+   s->type = COMEDI_SUBD_AO;
+   s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
+   s->maxdata  = 0x0fff;
+   s->range_table  = this_board->rangelist_ao;
switch (this_board->cardtype) {
case TYPE_PCI1720:
-   s->n_chan = 4;
-   s->insn_write = pci1720_ao_insn_write;
+   s->n_chan   = 4;
+   s->insn_write   = pci1720_ao_insn_write;
break;
default:
-   s->n_chan = 2;
-   s->insn_write = pci171x_ao_insn_write;
+   s->n_chan   = 2;
+   s->insn_write   = pci171x_ao_insn_write;
break;
}
 
-- 
2.0.3

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


[PATCH 17/28] staging: comedi: adv_pci1710: rename 'this_board' local variables

2015-01-20 Thread H Hartley Sweeten
For aesthetics, rename all the 'this_board' local variables to simply
'board'. That's more common in comed drivers.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 4c638a0..4fdf041 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -388,14 +388,14 @@ static void setup_channel_list(struct comedi_device *dev,
   unsigned int *chanlist, unsigned int n_chan,
   unsigned int seglen)
 {
-   const struct boardtype *this_board = dev->board_ptr;
+   const struct boardtype *board = dev->board_ptr;
struct pci1710_private *devpriv = dev->private;
unsigned int i, range, chanprog;
 
for (i = 0; i < seglen; i++) {  /*  store range list to card */
chanprog = muxonechan[CR_CHAN(chanlist[i])];
outw(chanprog, dev->iobase + PCI171x_MUX); /* select channel */
-   range = this_board->rangecode_ai[CR_RANGE(chanlist[i])];
+   range = board->rangecode_ai[CR_RANGE(chanlist[i])];
if (CR_AREF(chanlist[i]) == AREF_DIFF)
range |= 0x0020;
outw(range, dev->iobase + PCI171x_RANGE); /* select gain */
@@ -648,10 +648,10 @@ static int pci1720_ao_insn_write(struct comedi_device 
*dev,
 static int pci171x_ai_cancel(struct comedi_device *dev,
 struct comedi_subdevice *s)
 {
-   const struct boardtype *this_board = dev->board_ptr;
+   const struct boardtype *board = dev->board_ptr;
struct pci1710_private *devpriv = dev->private;
 
-   switch (this_board->cardtype) {
+   switch (board->cardtype) {
default:
devpriv->CntrlReg &= Control_CNT0;
devpriv->CntrlReg |= Control_SW;
@@ -950,7 +950,7 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev,
 */
 static int pci171x_reset(struct comedi_device *dev)
 {
-   const struct boardtype *this_board = dev->board_ptr;
+   const struct boardtype *board = dev->board_ptr;
struct pci1710_private *devpriv = dev->private;
 
outw(0x30, dev->iobase + PCI171x_CNTCTRL);
@@ -962,7 +962,7 @@ static int pci171x_reset(struct comedi_device *dev)
outb(0, dev->iobase + PCI171x_CLRINT);  /*  clear INT request */
pci171x_start_pacer(dev, false);
devpriv->da_ranges = 0;
-   if (this_board->has_ao) {
+   if (board->has_ao) {
/* set DACs to 0..5V */
outb(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);
outw(0, dev->iobase + PCI171x_DA1); /* set DA outputs to 0V */
@@ -1000,9 +1000,9 @@ static int pci1720_reset(struct comedi_device *dev)
 */
 static int pci1710_reset(struct comedi_device *dev)
 {
-   const struct boardtype *this_board = dev->board_ptr;
+   const struct boardtype *board = dev->board_ptr;
 
-   switch (this_board->cardtype) {
+   switch (board->cardtype) {
case TYPE_PCI1720:
return pci1720_reset(dev);
default:
@@ -1014,17 +1014,17 @@ static int pci1710_auto_attach(struct comedi_device 
*dev,
   unsigned long context)
 {
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-   const struct boardtype *this_board = NULL;
+   const struct boardtype *board = NULL;
struct pci1710_private *devpriv;
struct comedi_subdevice *s;
int ret, subdev, n_subdevices;
 
if (context < ARRAY_SIZE(boardtypes))
-   this_board = &boardtypes[context];
-   if (!this_board)
+   board = &boardtypes[context];
+   if (!board)
return -ENODEV;
-   dev->board_ptr = this_board;
-   dev->board_name = this_board->name;
+   dev->board_ptr = board;
+   dev->board_name = board->name;
 
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
if (!devpriv)
@@ -1036,13 +1036,13 @@ static int pci1710_auto_attach(struct comedi_device 
*dev,
dev->iobase = pci_resource_start(pcidev, 2);
 
n_subdevices = 0;
-   if (this_board->n_aichan)
+   if (board->n_aichan)
n_subdevices++;
-   if (this_board->has_ao)
+   if (board->has_ao)
n_subdevices++;
-   if (this_board->has_di_do)
+   if (board->has_di_do)
n_subdevices += 2;
-   if (this_board->has_counter)
+   if (board->has_counter)
n_subdevices++;
 
ret = comedi_alloc_subdevices(dev, n_subdevices);
@@ -1051,7 +1051,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
 
pci1710_reset(dev);
 
-   if (this_board->has_irq && pcidev->irq) {
+   if (board->ha

[PATCH 02/28] staging: comedi: adv_pci1710: simplify digital input and output boardinfo

2015-01-20 Thread H Hartley Sweeten
The boards that have digital inputs and outputs always have 16 input channels 
and
16 output channels.

Replace the 'n_dichan' and 'n_dochan' members of the boardinfo with the 
fit-field
flag 'has_di_do' and refactor the board attach accordingly.

Remove the unnecessary initialization of the subdevice 'len_chanlist'. That
member is only used by subdevices that support async commands.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 9f88cfb..667900f 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -196,8 +196,6 @@ struct boardtype {
int n_aichan;   /*  num of A/D chans */
int n_aichand;  /*  num of A/D chans in diff mode */
int n_aochan;   /*  num of D/A chans */
-   int n_dichan;   /*  num of DI chans */
-   int n_dochan;   /*  num of DO chans */
int ai_maxdata; /*  resolution of A/D */
int ao_maxdata; /*  resolution of D/A */
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
@@ -205,6 +203,7 @@ struct boardtype {
const struct comedi_lrange *rangelist_ao;   /*  rangelist for D/A */
unsigned int ai_ns_min; /*  max sample speed of card v ns */
unsigned int fifo_half_size;/*  size of FIFO/2 */
+   unsigned int has_di_do:1;
unsigned int has_counter:1;
 };
 
@@ -216,8 +215,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.n_aichand  = 8,
.n_aochan   = 2,
-   .n_dichan   = 16,
-   .n_dochan   = 16,
.ai_maxdata = 0x0fff,
.ao_maxdata = 0x0fff,
.rangelist_ai   = &range_pci1710_3,
@@ -225,6 +222,7 @@ static const struct boardtype boardtypes[] = {
.rangelist_ao   = &range_pci171x_da,
.ai_ns_min  = 1,
.fifo_half_size = 2048,
+   .has_di_do  = 1,
.has_counter= 1,
},
[BOARD_PCI1710HG] = {
@@ -234,8 +232,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.n_aichand  = 8,
.n_aochan   = 2,
-   .n_dichan   = 16,
-   .n_dochan   = 16,
.ai_maxdata = 0x0fff,
.ao_maxdata = 0x0fff,
.rangelist_ai   = &range_pci1710hg,
@@ -243,6 +239,7 @@ static const struct boardtype boardtypes[] = {
.rangelist_ao   = &range_pci171x_da,
.ai_ns_min  = 1,
.fifo_half_size = 2048,
+   .has_di_do  = 1,
.has_counter= 1,
},
[BOARD_PCI1711] = {
@@ -251,8 +248,6 @@ static const struct boardtype boardtypes[] = {
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
.n_aochan   = 2,
-   .n_dichan   = 16,
-   .n_dochan   = 16,
.ai_maxdata = 0x0fff,
.ao_maxdata = 0x0fff,
.rangelist_ai   = &range_pci17x1,
@@ -260,6 +255,7 @@ static const struct boardtype boardtypes[] = {
.rangelist_ao   = &range_pci171x_da,
.ai_ns_min  = 1,
.fifo_half_size = 512,
+   .has_di_do  = 1,
.has_counter= 1,
},
[BOARD_PCI1713] = {
@@ -286,13 +282,12 @@ static const struct boardtype boardtypes[] = {
.have_irq   = 1,
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
-   .n_dichan   = 16,
-   .n_dochan   = 16,
.ai_maxdata = 0x0fff,
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
.ai_ns_min  = 1,
.fifo_half_size = 512,
+   .has_di_do  = 1,
},
 };
 
@@ -1118,10 +1113,8 @@ static int pci1710_auto_attach(struct comedi_device *dev,
n_subdevices++;
if (this_board->n_aochan)
n_subdevices++;
-   if (this_board->n_dichan)
-   n_subdevices++;
-   if (this_board->n_dochan)
-   n_subdevices++;
+   if (this_board->has_di_do)
+   n_subdevices += 2;
if (this_board->has_counter)
n_subdevices++;
 
@@ -1181,25 +1174,21 @@ static int pci1710_auto_attach(struct comedi_device 
*dev,
subdev++;
}
 
-   if (this_board->n_dichan) {
+   if (this_board->has_

[PATCH 19/28] staging: comedi: adv_pci1710: update the MODULE_DESCRIPTION

2015-01-20 Thread H Hartley Sweeten
Change the MODULE_DESCRIPTION to something more useful than the generic
"Comedi low-level driver".

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 200be09..2017285 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -1227,5 +1227,5 @@ static struct pci_driver adv_pci1710_pci_driver = {
 module_comedi_pci_driver(adv_pci1710_driver, adv_pci1710_pci_driver);
 
 MODULE_AUTHOR("Comedi http://www.comedi.org";);
-MODULE_DESCRIPTION("Comedi low-level driver");
+MODULE_DESCRIPTION("Comedi: Advantech PCI-1710 Series Multifunction DAS 
Cards");
 MODULE_LICENSE("GPL");
-- 
2.0.3

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


[PATCH 26/28] staging: comedi: adv_pci1710: remove 'turn' param from move_block_from_fifo()

2015-01-20 Thread H Hartley Sweeten
This parameter is not used in the function. It was only used in some debug
messages that were previously removed. Remove the parameter.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 7ad59ab..0a50053 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -697,7 +697,7 @@ static void pci1710_handle_every_sample(struct 
comedi_device *dev,
 }
 
 static int move_block_from_fifo(struct comedi_device *dev,
-   struct comedi_subdevice *s, int n, int turn)
+   struct comedi_subdevice *s, int n)
 {
unsigned int val;
int ret;
@@ -739,13 +739,13 @@ static void pci1710_handle_fifo(struct comedi_device *dev,
nsamples = devpriv->max_samples;
if (comedi_samples_to_bytes(s, nsamples) >= s->async->prealloc_bufsz) {
m = comedi_bytes_to_samples(s, s->async->prealloc_bufsz);
-   if (move_block_from_fifo(dev, s, m, 0))
+   if (move_block_from_fifo(dev, s, m))
return;
nsamples -= m;
}
 
if (nsamples) {
-   if (move_block_from_fifo(dev, s, nsamples, 1))
+   if (move_block_from_fifo(dev, s, nsamples))
return;
}
 
-- 
2.0.3

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


[PATCH 16/28] staging: comedi: adv_pci1710: tidy up analog input subdevice init

2015-01-20 Thread H Hartley Sweeten
For aesthetics, add some whitespace to the analog input subdevice init and
rename the (*insn_read) support function. Also remove the unnecessary comments.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index ba34a26..4c638a0 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -426,9 +426,10 @@ static int pci171x_ai_eoc(struct comedi_device *dev,
return -EBUSY;
 }
 
-static int pci171x_insn_read_ai(struct comedi_device *dev,
+static int pci171x_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
-   struct comedi_insn *insn, unsigned int *data)
+   struct comedi_insn *insn,
+   unsigned int *data)
 {
struct pci1710_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
@@ -644,9 +645,6 @@ static int pci1720_ao_insn_write(struct comedi_device *dev,
return insn->n;
 }
 
-/*
-==
-*/
 static int pci171x_ai_cancel(struct comedi_device *dev,
 struct comedi_subdevice *s)
 {
@@ -873,9 +871,6 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
return 0;
 }
 
-/*
-==
-*/
 static int pci171x_ai_cmdtest(struct comedi_device *dev,
  struct comedi_subdevice *s,
  struct comedi_cmd *cmd)
@@ -1067,21 +1062,21 @@ static int pci1710_auto_attach(struct comedi_device 
*dev,
 
if (this_board->n_aichan) {
s = &dev->subdevices[subdev];
-   s->type = COMEDI_SUBD_AI;
-   s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND;
+   s->type = COMEDI_SUBD_AI;
+   s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND;
if (this_board->has_diff_ai)
-   s->subdev_flags |= SDF_DIFF;
-   s->n_chan = this_board->n_aichan;
-   s->maxdata = 0x0fff;
-   s->range_table = this_board->rangelist_ai;
-   s->insn_read = pci171x_insn_read_ai;
+   s->subdev_flags |= SDF_DIFF;
+   s->n_chan   = this_board->n_aichan;
+   s->maxdata  = 0x0fff;
+   s->range_table  = this_board->rangelist_ai;
+   s->insn_read= pci171x_ai_insn_read;
if (dev->irq) {
dev->read_subdev = s;
-   s->subdev_flags |= SDF_CMD_READ;
-   s->len_chanlist = s->n_chan;
-   s->do_cmdtest = pci171x_ai_cmdtest;
-   s->do_cmd = pci171x_ai_cmd;
-   s->cancel = pci171x_ai_cancel;
+   s->subdev_flags |= SDF_CMD_READ;
+   s->len_chanlist = s->n_chan;
+   s->do_cmdtest   = pci171x_ai_cmdtest;
+   s->do_cmd   = pci171x_ai_cmd;
+   s->cancel   = pci171x_ai_cancel;
}
subdev++;
}
-- 
2.0.3

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


[PATCH 03/28] staging: comedi: adv_pci1710: rename boardinfo 'have_irq'

2015-01-20 Thread H Hartley Sweeten
For aesthetics, rename this member of the boardinfo to 'has_irq' and change
it to a bit-field flag.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 667900f..9f415fe 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -191,7 +191,6 @@ enum pci1710_boardid {
 
 struct boardtype {
const char *name;   /*  board name */
-   char have_irq;  /*  1=card support IRQ */
char cardtype;  /*  0=1710& co. 2=1713, ... */
int n_aichan;   /*  num of A/D chans */
int n_aichand;  /*  num of A/D chans in diff mode */
@@ -203,6 +202,7 @@ struct boardtype {
const struct comedi_lrange *rangelist_ao;   /*  rangelist for D/A */
unsigned int ai_ns_min; /*  max sample speed of card v ns */
unsigned int fifo_half_size;/*  size of FIFO/2 */
+   unsigned int has_irq:1;
unsigned int has_di_do:1;
unsigned int has_counter:1;
 };
@@ -210,7 +210,6 @@ struct boardtype {
 static const struct boardtype boardtypes[] = {
[BOARD_PCI1710] = {
.name   = "pci1710",
-   .have_irq   = 1,
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
.n_aichand  = 8,
@@ -222,12 +221,12 @@ static const struct boardtype boardtypes[] = {
.rangelist_ao   = &range_pci171x_da,
.ai_ns_min  = 1,
.fifo_half_size = 2048,
+   .has_irq= 1,
.has_di_do  = 1,
.has_counter= 1,
},
[BOARD_PCI1710HG] = {
.name   = "pci1710hg",
-   .have_irq   = 1,
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
.n_aichand  = 8,
@@ -239,12 +238,12 @@ static const struct boardtype boardtypes[] = {
.rangelist_ao   = &range_pci171x_da,
.ai_ns_min  = 1,
.fifo_half_size = 2048,
+   .has_irq= 1,
.has_di_do  = 1,
.has_counter= 1,
},
[BOARD_PCI1711] = {
.name   = "pci1711",
-   .have_irq   = 1,
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
.n_aochan   = 2,
@@ -255,12 +254,12 @@ static const struct boardtype boardtypes[] = {
.rangelist_ao   = &range_pci171x_da,
.ai_ns_min  = 1,
.fifo_half_size = 512,
+   .has_irq= 1,
.has_di_do  = 1,
.has_counter= 1,
},
[BOARD_PCI1713] = {
.name   = "pci1713",
-   .have_irq   = 1,
.cardtype   = TYPE_PCI1713,
.n_aichan   = 32,
.n_aichand  = 16,
@@ -269,6 +268,7 @@ static const struct boardtype boardtypes[] = {
.rangecode_ai   = range_codes_pci1710_3,
.ai_ns_min  = 1,
.fifo_half_size = 2048,
+   .has_irq= 1,
},
[BOARD_PCI1720] = {
.name   = "pci1720",
@@ -279,7 +279,6 @@ static const struct boardtype boardtypes[] = {
},
[BOARD_PCI1731] = {
.name   = "pci1731",
-   .have_irq   = 1,
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
.ai_maxdata = 0x0fff,
@@ -287,6 +286,7 @@ static const struct boardtype boardtypes[] = {
.rangecode_ai   = range_codes_pci17x1,
.ai_ns_min  = 1,
.fifo_half_size = 512,
+   .has_irq= 1,
.has_di_do  = 1,
},
 };
@@ -1124,7 +1124,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
 
pci1710_reset(dev);
 
-   if (this_board->have_irq && pcidev->irq) {
+   if (this_board->has_irq && pcidev->irq) {
ret = request_irq(pcidev->irq, interrupt_service_pci1710,
  IRQF_SHARED, dev->board_name, dev);
if (ret == 0)
-- 
2.0.3

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


[PATCH 04/28] staging: comedi: adv_pci1710: remove boardinfo 'ai_maxdata'

2015-01-20 Thread H Hartley Sweeten
The analog input resolution is always 12-bits in this driver. Remove the
unnecessary boardinfo.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 9f415fe..fb5ad60 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -195,7 +195,6 @@ struct boardtype {
int n_aichan;   /*  num of A/D chans */
int n_aichand;  /*  num of A/D chans in diff mode */
int n_aochan;   /*  num of D/A chans */
-   int ai_maxdata; /*  resolution of A/D */
int ao_maxdata; /*  resolution of D/A */
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
const char *rangecode_ai;   /*  range codes for programming */
@@ -214,7 +213,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.n_aichand  = 8,
.n_aochan   = 2,
-   .ai_maxdata = 0x0fff,
.ao_maxdata = 0x0fff,
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
@@ -231,7 +229,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.n_aichand  = 8,
.n_aochan   = 2,
-   .ai_maxdata = 0x0fff,
.ao_maxdata = 0x0fff,
.rangelist_ai   = &range_pci1710hg,
.rangecode_ai   = range_codes_pci1710hg,
@@ -247,7 +244,6 @@ static const struct boardtype boardtypes[] = {
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
.n_aochan   = 2,
-   .ai_maxdata = 0x0fff,
.ao_maxdata = 0x0fff,
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
@@ -263,7 +259,6 @@ static const struct boardtype boardtypes[] = {
.cardtype   = TYPE_PCI1713,
.n_aichan   = 32,
.n_aichand  = 16,
-   .ai_maxdata = 0x0fff,
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
.ai_ns_min  = 1,
@@ -281,7 +276,6 @@ static const struct boardtype boardtypes[] = {
.name   = "pci1731",
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
-   .ai_maxdata = 0x0fff,
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
.ai_ns_min  = 1,
@@ -1140,7 +1134,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
if (this_board->n_aichand)
s->subdev_flags |= SDF_DIFF;
s->n_chan = this_board->n_aichan;
-   s->maxdata = this_board->ai_maxdata;
+   s->maxdata = 0x0fff;
s->range_table = this_board->rangelist_ai;
s->insn_read = pci171x_insn_read_ai;
if (dev->irq) {
-- 
2.0.3

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


[PATCH 20/28] staging: comedi: adv_pci1710: remove boardinfo 'rangelist_ao'

2015-01-20 Thread H Hartley Sweeten
This boardinfo is not necessary. All the boards with analog outputs have
the same range options except for the pci1720 board. That board type is
already handled specially during the driver attach.

Remove the boardinfo and add the subdevice range_table initialization in
the cardtype switch.

Rename the range tables to clarify that they are "analog output" ranges.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 2017285..62c2a51 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -164,7 +164,7 @@ static const struct comedi_lrange range_pci17x1 = {
 
 static const char range_codes_pci17x1[] = { 0x00, 0x01, 0x02, 0x03, 0x04 };
 
-static const struct comedi_lrange range_pci1720 = {
+static const struct comedi_lrange pci1720_ao_range = {
4, {
UNI_RANGE(5),
UNI_RANGE(10),
@@ -173,7 +173,7 @@ static const struct comedi_lrange range_pci1720 = {
}
 };
 
-static const struct comedi_lrange range_pci171x_da = {
+static const struct comedi_lrange pci171x_ao_range = {
2, {
UNI_RANGE(5),
UNI_RANGE(10)
@@ -195,7 +195,6 @@ struct boardtype {
int n_aichan;   /*  num of A/D chans */
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
const char *rangecode_ai;   /*  range codes for programming */
-   const struct comedi_lrange *rangelist_ao;   /*  rangelist for D/A */
unsigned int has_irq:1;
unsigned int has_large_fifo:1;  /* 4K or 1K FIFO */
unsigned int has_diff_ai:1;
@@ -211,7 +210,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
-   .rangelist_ao   = &range_pci171x_da,
.has_irq= 1,
.has_large_fifo = 1,
.has_diff_ai= 1,
@@ -225,7 +223,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.rangelist_ai   = &range_pci1710hg,
.rangecode_ai   = range_codes_pci1710hg,
-   .rangelist_ao   = &range_pci171x_da,
.has_irq= 1,
.has_large_fifo = 1,
.has_diff_ai= 1,
@@ -239,7 +236,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
-   .rangelist_ao   = &range_pci171x_da,
.has_irq= 1,
.has_ao = 1,
.has_di_do  = 1,
@@ -258,7 +254,6 @@ static const struct boardtype boardtypes[] = {
[BOARD_PCI1720] = {
.name   = "pci1720",
.cardtype   = TYPE_PCI1720,
-   .rangelist_ao   = &range_pci1720,
.has_ao = 1,
},
[BOARD_PCI1731] = {
@@ -1071,14 +1066,15 @@ static int pci1710_auto_attach(struct comedi_device 
*dev,
s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
s->maxdata  = 0x0fff;
-   s->range_table  = board->rangelist_ao;
switch (board->cardtype) {
case TYPE_PCI1720:
s->n_chan   = 4;
+   s->range_table  = &pci1720_ao_range;
s->insn_write   = pci1720_ao_insn_write;
break;
default:
s->n_chan   = 2;
+   s->range_table  = &pci171x_ao_range;
s->insn_write   = pci171x_ao_insn_write;
break;
}
-- 
2.0.3

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


[PATCH 22/28] staging: comedi: adv_pci1710: clarify the 'act_chanlist'

2015-01-20 Thread H Hartley Sweeten
This driver saves the channel list of a scan in the private data and uses
that list to check analog input samples for data dropout.

Currently the channel numbers are shifted 12 bits so that they match the
channel number in the samples that are read from the board. All of the
shifts make the driver a bit harder to follow.

Store the channel numbers directly to the 'act_chanlist' and shift the
sample value instead when checking for the dropout. Add a comment for
clarity.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 9bbdef8..0927bbe 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -293,11 +293,16 @@ static int pci171x_ai_dropout(struct comedi_device *dev,
struct pci1710_private *devpriv = dev->private;
 
if (!board->is_pci1713) {
-   if ((val & 0xf000) != devpriv->act_chanlist[chan]) {
+   /*
+* The upper 4 bits of the 16-bit sample are the channel number
+* that the sample was acquired from. Verify that this channel
+* number matches the expected channel number.
+*/
+   val >>= 12;
+   if (val != devpriv->act_chanlist[chan]) {
dev_err(dev->class_dev,
"A/D data droput: received from channel %d, 
expected %d\n",
-   (val >> 12) & 0xf,
-   (devpriv->act_chanlist[chan] >> 12) & 0xf);
+   val, devpriv->act_chanlist[chan]);
return -ENODATA;
}
}
@@ -386,13 +391,10 @@ static void setup_channel_list(struct comedi_device *dev,
if (CR_AREF(chanlist[i]) == AREF_DIFF)
range |= 0x0020;
outw(range, dev->iobase + PCI171x_RANGE); /* select gain */
-   devpriv->act_chanlist[i] =
-   (CR_CHAN(chanlist[i]) << 12) & 0xf000;
-   }
-   for ( ; i < n_chan; i++) { /* store remainder of channel list */
-   devpriv->act_chanlist[i] =
-   (CR_CHAN(chanlist[i]) << 12) & 0xf000;
+   devpriv->act_chanlist[i] = CR_CHAN(chanlist[i]);
}
+   for ( ; i < n_chan; i++)/* store remainder of channel list */
+   devpriv->act_chanlist[i] = CR_CHAN(chanlist[i]);
 
devpriv->ai_et_MuxVal =
CR_CHAN(chanlist[0]) | (CR_CHAN(chanlist[seglen - 1]) << 8);
-- 
2.0.3

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


[PATCH 24/28] staging: comedi: adv_pci1710: introduce pci171x_ai_read_sample()

2015-01-20 Thread H Hartley Sweeten
Introduce a helper function to read an analog input sample, check for
channel dropout, and mask the sample to the maxdata of the subdevice.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 719497c..6068f40 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -276,31 +276,6 @@ struct pci1710_private {
 * internal state */
 };
 
-static int pci171x_ai_dropout(struct comedi_device *dev,
- struct comedi_subdevice *s,
- unsigned int chan,
- unsigned int val)
-{
-   const struct boardtype *board = dev->board_ptr;
-   struct pci1710_private *devpriv = dev->private;
-
-   if (!board->is_pci1713) {
-   /*
-* The upper 4 bits of the 16-bit sample are the channel number
-* that the sample was acquired from. Verify that this channel
-* number matches the expected channel number.
-*/
-   val >>= 12;
-   if (val != devpriv->act_chanlist[chan]) {
-   dev_err(dev->class_dev,
-   "A/D data droput: received from channel %d, 
expected %d\n",
-   val, devpriv->act_chanlist[chan]);
-   return -ENODATA;
-   }
-   }
-   return 0;
-}
-
 static int pci171x_ai_check_chanlist(struct comedi_device *dev,
 struct comedi_subdevice *s,
 struct comedi_cmd *cmd)
@@ -416,6 +391,35 @@ static int pci171x_ai_eoc(struct comedi_device *dev,
return -EBUSY;
 }
 
+static int pci171x_ai_read_sample(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int cur_chan,
+ unsigned int *val)
+{
+   const struct boardtype *board = dev->board_ptr;
+   struct pci1710_private *devpriv = dev->private;
+   unsigned int sample;
+   unsigned int chan;
+
+   sample = inw(dev->iobase + PCI171x_AD_DATA);
+   if (!board->is_pci1713) {
+   /*
+* The upper 4 bits of the 16-bit sample are the channel number
+* that the sample was acquired from. Verify that this channel
+* number matches the expected channel number.
+*/
+   chan = sample >> 12;
+   if (chan != devpriv->act_chanlist[cur_chan]) {
+   dev_err(dev->class_dev,
+   "A/D data droput: received from channel %d, 
expected %d\n",
+   chan, devpriv->act_chanlist[cur_chan]);
+   return -ENODATA;
+   }
+   }
+   *val = sample & s->maxdata;
+   return 0;
+}
+
 static int pci171x_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
@@ -443,12 +447,11 @@ static int pci171x_ai_insn_read(struct comedi_device *dev,
if (ret)
break;
 
-   val = inw(dev->iobase + PCI171x_AD_DATA);
-   ret = pci171x_ai_dropout(dev, s, chan, val);
+   ret = pci171x_ai_read_sample(dev, s, chan, &val);
if (ret)
break;
 
-   data[i] = val & s->maxdata;
+   data[i] = val;
}
 
outb(0, dev->iobase + PCI171x_CLRFIFO);
@@ -677,14 +680,12 @@ static void pci1710_handle_every_sample(struct 
comedi_device *dev,
outb(0, dev->iobase + PCI171x_CLRINT);  /*  clear our INT request */
 
for (; !(inw(dev->iobase + PCI171x_STATUS) & Status_FE);) {
-   val = inw(dev->iobase + PCI171x_AD_DATA);
-   ret = pci171x_ai_dropout(dev, s, s->async->cur_chan, val);
+   ret = pci171x_ai_read_sample(dev, s, s->async->cur_chan, &val);
if (ret) {
s->async->events |= COMEDI_CB_ERROR;
break;
}
 
-   val &= s->maxdata;
comedi_buf_write_samples(s, &val, 1);
 
if (cmd->stop_src == TRIG_COUNT &&
@@ -707,15 +708,12 @@ static int move_block_from_fifo(struct comedi_device *dev,
int i;
 
for (i = 0; i < n; i++) {
-   val = inw(dev->iobase + PCI171x_AD_DATA);
-
-   ret = pci171x_ai_dropout(dev, s, s->async->cur_chan, val);
+   ret = pci171x_ai_read_sample(dev, s, s->async->cur_chan, &val);
if (ret)

[PATCH 06/28] staging: comedi: adv_pci1710: change boardinfo 'n_aichand' to 'has_diff_ai'

2015-01-20 Thread H Hartley Sweeten
The 'n_aichand' member of the boardinfo is actually a flag indicating that the
board supports differential analog inputs. The number of channels is always
half the single-ended number of channels.

For aesthetics, change the 'n_aichand' member to a bit-field flag 'has_diff_ai'.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 395a2dd..0664359 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -193,7 +193,6 @@ struct boardtype {
const char *name;   /*  board name */
char cardtype;  /*  0=1710& co. 2=1713, ... */
int n_aichan;   /*  num of A/D chans */
-   int n_aichand;  /*  num of A/D chans in diff mode */
int n_aochan;   /*  num of D/A chans */
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
const char *rangecode_ai;   /*  range codes for programming */
@@ -201,6 +200,7 @@ struct boardtype {
unsigned int ai_ns_min; /*  max sample speed of card v ns */
unsigned int fifo_half_size;/*  size of FIFO/2 */
unsigned int has_irq:1;
+   unsigned int has_diff_ai:1;
unsigned int has_di_do:1;
unsigned int has_counter:1;
 };
@@ -210,7 +210,6 @@ static const struct boardtype boardtypes[] = {
.name   = "pci1710",
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
-   .n_aichand  = 8,
.n_aochan   = 2,
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
@@ -218,6 +217,7 @@ static const struct boardtype boardtypes[] = {
.ai_ns_min  = 1,
.fifo_half_size = 2048,
.has_irq= 1,
+   .has_diff_ai= 1,
.has_di_do  = 1,
.has_counter= 1,
},
@@ -225,7 +225,6 @@ static const struct boardtype boardtypes[] = {
.name   = "pci1710hg",
.cardtype   = TYPE_PCI171X,
.n_aichan   = 16,
-   .n_aichand  = 8,
.n_aochan   = 2,
.rangelist_ai   = &range_pci1710hg,
.rangecode_ai   = range_codes_pci1710hg,
@@ -233,6 +232,7 @@ static const struct boardtype boardtypes[] = {
.ai_ns_min  = 1,
.fifo_half_size = 2048,
.has_irq= 1,
+   .has_diff_ai= 1,
.has_di_do  = 1,
.has_counter= 1,
},
@@ -254,12 +254,12 @@ static const struct boardtype boardtypes[] = {
.name   = "pci1713",
.cardtype   = TYPE_PCI1713,
.n_aichan   = 32,
-   .n_aichand  = 16,
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
.ai_ns_min  = 1,
.fifo_half_size = 2048,
.has_irq= 1,
+   .has_diff_ai= 1,
},
[BOARD_PCI1720] = {
.name   = "pci1720",
@@ -1126,7 +1126,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
s = &dev->subdevices[subdev];
s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND;
-   if (this_board->n_aichand)
+   if (this_board->has_diff_ai)
s->subdev_flags |= SDF_DIFF;
s->n_chan = this_board->n_aichan;
s->maxdata = 0x0fff;
-- 
2.0.3

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


[PATCH 07/28] staging: comedi: adv_pci1710: remove boardinfo 'ai_ns_min'

2015-01-20 Thread H Hartley Sweeten
The minimum analog input conversion time is 1 ns for all board types. Remove
this unnecessary boardinfo.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 0664359..634b2a0 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -197,7 +197,6 @@ struct boardtype {
const struct comedi_lrange *rangelist_ai;   /*  rangelist for A/D */
const char *rangecode_ai;   /*  range codes for programming */
const struct comedi_lrange *rangelist_ao;   /*  rangelist for D/A */
-   unsigned int ai_ns_min; /*  max sample speed of card v ns */
unsigned int fifo_half_size;/*  size of FIFO/2 */
unsigned int has_irq:1;
unsigned int has_diff_ai:1;
@@ -214,7 +213,6 @@ static const struct boardtype boardtypes[] = {
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
.rangelist_ao   = &range_pci171x_da,
-   .ai_ns_min  = 1,
.fifo_half_size = 2048,
.has_irq= 1,
.has_diff_ai= 1,
@@ -229,7 +227,6 @@ static const struct boardtype boardtypes[] = {
.rangelist_ai   = &range_pci1710hg,
.rangecode_ai   = range_codes_pci1710hg,
.rangelist_ao   = &range_pci171x_da,
-   .ai_ns_min  = 1,
.fifo_half_size = 2048,
.has_irq= 1,
.has_diff_ai= 1,
@@ -244,7 +241,6 @@ static const struct boardtype boardtypes[] = {
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
.rangelist_ao   = &range_pci171x_da,
-   .ai_ns_min  = 1,
.fifo_half_size = 512,
.has_irq= 1,
.has_di_do  = 1,
@@ -256,7 +252,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 32,
.rangelist_ai   = &range_pci1710_3,
.rangecode_ai   = range_codes_pci1710_3,
-   .ai_ns_min  = 1,
.fifo_half_size = 2048,
.has_irq= 1,
.has_diff_ai= 1,
@@ -273,7 +268,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan   = 16,
.rangelist_ai   = &range_pci17x1,
.rangecode_ai   = range_codes_pci17x1,
-   .ai_ns_min  = 1,
.fifo_half_size = 512,
.has_irq= 1,
.has_di_do  = 1,
@@ -928,7 +922,6 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev,
  struct comedi_subdevice *s,
  struct comedi_cmd *cmd)
 {
-   const struct boardtype *this_board = dev->board_ptr;
struct pci1710_private *devpriv = dev->private;
int err = 0;
unsigned int arg;
@@ -961,8 +954,7 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev,
err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
 
if (cmd->convert_src == TRIG_TIMER)
-   err |= cfc_check_trigger_arg_min(&cmd->convert_arg,
-this_board->ai_ns_min);
+   err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 1);
else/* TRIG_FOLLOW */
err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0);
 
-- 
2.0.3

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


[PATCH 00/28] staging: comedi: adv_pci1710: driver cleanup

2015-01-20 Thread H Hartley Sweeten
Following is the initial cleanup of the comedi adv_pci1710 driver.

H Hartley Sweeten (28):
  staging: comedi: adv_pci1710: change boardinfo 'n_counter' to 'has_counter'
  staging: comedi: adv_pci1710: simplify digital input and output boardinfo
  staging: comedi: adv_pci1710: rename boardinfo 'have_irq'
  staging: comedi: adv_pci1710: remove boardinfo 'ai_maxdata'
  staging: comedi: adv_pci1710: remove boardinfo 'ao_maxdata'
  staging: comedi: adv_pci1710: change boardinfo 'n_aichand' to 'has_diff_ai'
  staging: comedi: adv_pci1710: remove boardinfo 'ai_ns_min'
  staging: comedi: adv_pci1710: change boardinfo 'fifo_half_size' to 
'has_large_fifo'
  staging: comedi: adv_pci1710: change boardinfo 'n_aochan' to 'has_ao'
  staging: comedi: adv_pci1710: use comedi_subdevice 'readback'
  staging: comedi: adv_pci1710: tidy up pci1720_insn_write_ao()
  staging: comedi: adv_pci1710: tidy up pci171x_insn_write_ao()
  staging: comedi: adv_pci1710: tidy up counter subdevice init
  staging: comedi: adv_pci1710: tidy up digital input and output subdevice init
  staging: comedi: adv_pci1710: tidy up analog output subdevice init
  staging: comedi: adv_pci1710: tidy up analog input subdevice init
  staging: comedi: adv_pci1710: rename 'this_board' local variables
  staging: comedi: adv_pci1710: remove function separation comments
  staging: comedi: adv_pci1710: update the MODULE_DESCRIPTION
  staging: comedi: adv_pci1710: remove boardinfo 'rangelist_ao'
  staging: comedi: adv_pci1710: refactor boardinfo 'cardtype'
  staging: comedi: adv_pci1710: clarify the 'act_chanlist'
  staging: comedi: adv_pci1710: tidy up setup_channel_list()
  staging: comedi: adv_pci1710: introduce pci171x_ai_read_sample()
  staging: comedi: adv_pci1710: do comedi_handle_events() in common code patch
  staging: comedi: adv_pci1710: remove 'turn' param from move_block_from_fifo()
  staging: comedi: adv_pci1710: transfer all ai samples in one step
  staging: comedi: adv_pci1710: absorb move_block_from_fifo()

 drivers/staging/comedi/drivers/adv_pci1710.c | 657 +++
 1 file changed, 264 insertions(+), 393 deletions(-)

-- 
2.0.3

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


Re: [PATCH v5 1/6] mfd: rtsx: add func to split u32 into register

2015-01-20 Thread Ulf Hansson
On 20 January 2015 at 15:47, Lee Jones  wrote:
> On Tue, 23 Dec 2014, micky_ch...@realsil.com.cn wrote:
>
>> From: Micky Ching 
>>
>> Add helper function to write u32 to registers, if we want to put u32
>> value to 4 continuous register, this can help us reduce tedious work.
>>
>> Signed-off-by: Micky Ching 
>> Acked-by: Lee Jones 
>> ---
>>  include/linux/mfd/rtsx_pci.h | 9 +
>>  1 file changed, 9 insertions(+)
>
> Applied, thanks.

This one has already been queued by you, for 3.19, and it's in Linus tree. :-)

For your reference, I have queued the mmc patches which depends on
$subject patch for 3.20.

Kind regards
Uffe


>
>> diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
>> index 74346d5..9234449 100644
>> --- a/include/linux/mfd/rtsx_pci.h
>> +++ b/include/linux/mfd/rtsx_pci.h
>> @@ -558,6 +558,7 @@
>>  #define SD_SAMPLE_POINT_CTL  0xFDA7
>>  #define SD_PUSH_POINT_CTL0xFDA8
>>  #define SD_CMD0  0xFDA9
>> +#define   SD_CMD_START   0x40
>>  #define SD_CMD1  0xFDAA
>>  #define SD_CMD2  0xFDAB
>>  #define SD_CMD3  0xFDAC
>> @@ -967,4 +968,12 @@ static inline u8 *rtsx_pci_get_cmd_data(struct rtsx_pcr 
>> *pcr)
>>   return (u8 *)(pcr->host_cmds_ptr);
>>  }
>>
>> +static inline void rtsx_pci_write_be32(struct rtsx_pcr *pcr, u16 reg, u32 
>> val)
>> +{
>> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg, 0xFF, val >> 24);
>> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 1, 0xFF, val >> 16);
>> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 2, 0xFF, val >> 8);
>> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 3, 0xFF, val);
>> +}
>> +
>>  #endif
>
> --
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: mt29f_spinand: Fix typo in Kconfig

2015-01-20 Thread Greg KH
On Tue, Jan 20, 2015 at 12:34:43PM -0800, Brian Norris wrote:
> On Thu, Jan 15, 2015 at 07:47:24PM +0900, Masanari Iida wrote:
> > This patch fix a spelling typo in Kconfig.
> > 
> > Signed-off-by: Masanari Iida 
> 
> Acked-by: Brian Norris 
> 
> Greg, do you take these patches, or should they go through me?

I can take them directly, and add your ack.  No need for you to do
anything else here, thanks.

> FWIW, we have high hopes to kill and replace this driver soon, as there
> have been some better spi-nand patches floating around linux-mtd.

Wonderful, let me know when you want me to delete these, I like deleting
code :)

thanks,

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


RE: [PATCH 1/1] drivers:hv:vmbus Allow for more than one MMIO range for children.

2015-01-20 Thread KY Srinivasan


> -Original Message-
> From: Jake Oshins [mailto:ja...@microsoft.com]
> Sent: Tuesday, January 20, 2015 2:00 PM
> To: gre...@linuxfoundation.org; KY Srinivasan; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
> a...@canonical.com; vkuzn...@redhat.com
> Cc: Jake Oshins
> Subject: [PATCH 1/1] drivers:hv:vmbus Allow for more than one MMIO range
> for children.

Include a descriptive commit log for this patch.
> 
> Signed-off-by: Jake Oshins 
> ---
>  drivers/hv/vmbus_drv.c  | 85
> +
>  drivers/video/fbdev/hyperv_fb.c |  2 +-
>  include/linux/hyperv.h  |  2 +-
>  3 files changed, 72 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index
> 4d6b269..ba5b7a1 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -43,10 +43,7 @@ static struct tasklet_struct msg_dpc;  static struct
> completion probe_event;  static int irq;
> 
> -struct resource hyperv_mmio = {
> - .name  = "hyperv mmio",
> - .flags = IORESOURCE_MEM,
> -};
> +struct resource *hyperv_mmio;
>  EXPORT_SYMBOL_GPL(hyperv_mmio);
> 
>  static int vmbus_exists(void)
> @@ -849,23 +846,74 @@ void vmbus_device_unregister(struct hv_device
> *device_obj)
> 
> 
>  /*
> - * VMBUS is an acpi enumerated device. Get the the information we
> - * need from DSDT.
> + * VMBUS is an acpi enumerated device. Get the
> + * information we need from DSDT.
>   */
> 
>  static acpi_status vmbus_walk_resources(struct acpi_resource *res, void
> *ctx)  {
> + resource_size_t start = 0;
> + resource_size_t end = 0;
> + struct resource *new_res;
> + struct resource **old_res = &hyperv_mmio;
> +
>   switch (res->type) {
>   case ACPI_RESOURCE_TYPE_IRQ:
>   irq = res->data.irq.interrupts[0];
> + return AE_OK;
> +
> + /*
> +  * "Address" descriptors are for bus windows. Ignore
> +  * "memory" descriptors, which are for registers on
> +  * devices.
> +  */
> + case ACPI_RESOURCE_TYPE_ADDRESS32:
> + start = res->data.address32.minimum;
> + end = res->data.address32.maximum;
>   break;
> 
>   case ACPI_RESOURCE_TYPE_ADDRESS64:
> - hyperv_mmio.start = res->data.address64.minimum;
> - hyperv_mmio.end = res->data.address64.maximum;
> + start = res->data.address64.minimum;
> + end = res->data.address64.maximum;
>   break;
> +
> + default:
> + /* Unused resource type */
> + return AE_OK;
>   }
> 
> + /*
> +  * Ignore ranges that are below 1MB, as they're not
> +  * necessary or useful here.
> +  */
> + if (end < 0x10)
> + return AE_OK;
> +
> + new_res = kzalloc(sizeof(*new_res), GFP_ATOMIC);
> + if (!new_res)
> + return AE_NO_MEMORY;
> +
> + new_res->name = "hyperv mmio";
> + new_res->flags = IORESOURCE_MEM;
> + new_res->start = start;
> + new_res->end = end;
> +
> + do {
> + if (!*old_res) {
> + *old_res = new_res;
> + break;
> + }
> +
> + if ((*old_res)->start > new_res->end) {
> + new_res->sibling = *old_res;
> + *old_res = new_res;
> + break;
> + }
> +
> + old_res = &(*old_res)->sibling;
> +
> + } while (1);
> +
>   return AE_OK;
>  }
> 
> @@ -873,6 +921,7 @@ static int vmbus_acpi_add(struct acpi_device *device)
> {
>   acpi_status result;
>   int ret_val = -ENODEV;
> + struct acpi_device *ancestor;
> 
>   hv_acpi_dev = device;
> 
> @@ -882,18 +931,22 @@ static int vmbus_acpi_add(struct acpi_device
> *device)
>   if (ACPI_FAILURE(result))
>   goto acpi_walk_err;
>   /*
> -  * The parent of the vmbus acpi device (Gen2 firmware) is the VMOD
> that
> -  * has the mmio ranges. Get that.
> +  * Some ancestor of the vmbus acpi device (Gen1 or Gen2
> +  * firmware) is the VMOD that has the mmio ranges. Get that.
>*/
> - if (device->parent) {
> - result = acpi_walk_resources(device->parent->handle,
> + for (ancestor = device->parent;
> + ancestor;
> + ancestor = ancestor->parent) {
> + result = acpi_walk_resources(ancestor->handle,
>   METHOD_NAME__CRS,
>   vmbus_walk_resources, NULL);
> 
>   if (ACPI_FAILURE(result))
> - goto acpi_walk_err;
> - if (hyperv_mmio.start && hyperv_mmio.end)
> - request_resource(&iomem_resource,
> &hyperv_mmio);
> + continue;
> + if (hyperv_mmio) {
> + request_resource(&iomem_resource,
> hyperv_mmio);
> + break;
> + }
>   }
>   

Re: [PATCH 1/1] drivers:hv:vmbus Allow for more than one MMIO range for children.

2015-01-20 Thread Greg KH
On Tue, Jan 20, 2015 at 01:59:40PM -0800, Jake Oshins wrote:
> Signed-off-by: Jake Oshins 

No changelog body explaining why this is needed and what it fixes?

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


[PATCH 1/1] drivers:hv:vmbus Allow for more than one MMIO range for children.

2015-01-20 Thread Jake Oshins
Signed-off-by: Jake Oshins 
---
 drivers/hv/vmbus_drv.c  | 85 +
 drivers/video/fbdev/hyperv_fb.c |  2 +-
 include/linux/hyperv.h  |  2 +-
 3 files changed, 72 insertions(+), 17 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 4d6b269..ba5b7a1 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -43,10 +43,7 @@ static struct tasklet_struct msg_dpc;
 static struct completion probe_event;
 static int irq;
 
-struct resource hyperv_mmio = {
-   .name  = "hyperv mmio",
-   .flags = IORESOURCE_MEM,
-};
+struct resource *hyperv_mmio;
 EXPORT_SYMBOL_GPL(hyperv_mmio);
 
 static int vmbus_exists(void)
@@ -849,23 +846,74 @@ void vmbus_device_unregister(struct hv_device *device_obj)
 
 
 /*
- * VMBUS is an acpi enumerated device. Get the the information we
- * need from DSDT.
+ * VMBUS is an acpi enumerated device. Get the
+ * information we need from DSDT.
  */
 
 static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
 {
+   resource_size_t start = 0;
+   resource_size_t end = 0;
+   struct resource *new_res;
+   struct resource **old_res = &hyperv_mmio;
+
switch (res->type) {
case ACPI_RESOURCE_TYPE_IRQ:
irq = res->data.irq.interrupts[0];
+   return AE_OK;
+
+   /*
+* "Address" descriptors are for bus windows. Ignore
+* "memory" descriptors, which are for registers on
+* devices.
+*/
+   case ACPI_RESOURCE_TYPE_ADDRESS32:
+   start = res->data.address32.minimum;
+   end = res->data.address32.maximum;
break;
 
case ACPI_RESOURCE_TYPE_ADDRESS64:
-   hyperv_mmio.start = res->data.address64.minimum;
-   hyperv_mmio.end = res->data.address64.maximum;
+   start = res->data.address64.minimum;
+   end = res->data.address64.maximum;
break;
+
+   default:
+   /* Unused resource type */
+   return AE_OK;
}
 
+   /*
+* Ignore ranges that are below 1MB, as they're not
+* necessary or useful here.
+*/
+   if (end < 0x10)
+   return AE_OK;
+
+   new_res = kzalloc(sizeof(*new_res), GFP_ATOMIC);
+   if (!new_res)
+   return AE_NO_MEMORY;
+
+   new_res->name = "hyperv mmio";
+   new_res->flags = IORESOURCE_MEM;
+   new_res->start = start;
+   new_res->end = end;
+
+   do {
+   if (!*old_res) {
+   *old_res = new_res;
+   break;
+   }
+
+   if ((*old_res)->start > new_res->end) {
+   new_res->sibling = *old_res;
+   *old_res = new_res;
+   break;
+   }
+
+   old_res = &(*old_res)->sibling;
+
+   } while (1);
+
return AE_OK;
 }
 
@@ -873,6 +921,7 @@ static int vmbus_acpi_add(struct acpi_device *device)
 {
acpi_status result;
int ret_val = -ENODEV;
+   struct acpi_device *ancestor;
 
hv_acpi_dev = device;
 
@@ -882,18 +931,22 @@ static int vmbus_acpi_add(struct acpi_device *device)
if (ACPI_FAILURE(result))
goto acpi_walk_err;
/*
-* The parent of the vmbus acpi device (Gen2 firmware) is the VMOD that
-* has the mmio ranges. Get that.
+* Some ancestor of the vmbus acpi device (Gen1 or Gen2
+* firmware) is the VMOD that has the mmio ranges. Get that.
 */
-   if (device->parent) {
-   result = acpi_walk_resources(device->parent->handle,
+   for (ancestor = device->parent;
+   ancestor;
+   ancestor = ancestor->parent) {
+   result = acpi_walk_resources(ancestor->handle,
METHOD_NAME__CRS,
vmbus_walk_resources, NULL);
 
if (ACPI_FAILURE(result))
-   goto acpi_walk_err;
-   if (hyperv_mmio.start && hyperv_mmio.end)
-   request_resource(&iomem_resource, &hyperv_mmio);
+   continue;
+   if (hyperv_mmio) {
+   request_resource(&iomem_resource, hyperv_mmio);
+   break;
+   }
}
ret_val = 0;
 
@@ -962,6 +1015,8 @@ static void __exit vmbus_exit(void)
hv_remove_vmbus_irq();
vmbus_free_channels();
bus_unregister(&hv_bus);
+   if (hyperv_mmio)
+   release_resource(hyperv_mmio);
hv_cleanup();
acpi_bus_unregister_driver(&vmbus_acpi_driver);
 }
diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index 4254336..003c8f0 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -686,7 +686,7 @@ static int hvfb_getmem(struct

Re: [PATCH] staging: iio: ad5933: fix format string warnings

2015-01-20 Thread Jonathan Cameron
On 20/01/15 08:52, Lars-Peter Clausen wrote:
> On 01/20/2015 08:25 AM, Asaf Vertz wrote:
>> Fixed the following warnings (reported by cppcheck):
>> [drivers/staging/iio/impedance-analyzer/ad5933.c:363]: (warning) %d in 
>> format string (no. 1)
>> requires 'int' but the argument type is 'unsigned int'.
>> [drivers/staging/iio/impedance-analyzer/ad5933.c:367]: (warning) %d in 
>> format string (no. 1)
>> requires 'int' but the argument type is 'unsigned int'.
>> [drivers/staging/iio/impedance-analyzer/ad5933.c:367]: (warning) %d in 
>> format string (no. 2)
>> requires 'int' but the argument type is 'unsigned int'.
>> [drivers/staging/iio/impedance-analyzer/ad5933.c:367]: (warning) %d in 
>> format string (no. 3)
>> requires 'int' but the argument type is 'unsigned int'.
>> [drivers/staging/iio/impedance-analyzer/ad5933.c:367]: (warning) %d in 
>> format string (no. 4)
>> requires 'int' but the argument type is 'unsigned int'.
>>
>> Signed-off-by: Asaf Vertz 
> 
> Acked-by: Lars-Peter Clausen 
Applied to the togreg branch of iio.git. Initially pushed out
as testing.  Thanks,

Jonathan
> 
> Thanks.
> 
>> ---
>>   drivers/staging/iio/impedance-analyzer/ad5933.c |4 ++--
>>   1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c 
>> b/drivers/staging/iio/impedance-analyzer/ad5933.c
>> index b6bd609..4230a43 100644
>> --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
>> +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
>> @@ -360,11 +360,11 @@ static ssize_t ad5933_show(struct device *dev,
>>   mutex_lock(&indio_dev->mlock);
>>   switch ((u32) this_attr->address) {
>>   case AD5933_OUT_RANGE:
>> -len = sprintf(buf, "%d\n",
>> +len = sprintf(buf, "%u\n",
>> st->range_avail[(st->ctrl_hb >> 1) & 0x3]);
>>   break;
>>   case AD5933_OUT_RANGE_AVAIL:
>> -len = sprintf(buf, "%d %d %d %d\n", st->range_avail[0],
>> +len = sprintf(buf, "%u %u %u %u\n", st->range_avail[0],
>> st->range_avail[3], st->range_avail[2],
>> st->range_avail[1]);
>>   break;
>>
> 

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


Re: [PATCH] staging: iio: tsl2583: fix format string warnings

2015-01-20 Thread Jonathan Cameron
On 20/01/15 10:43, Asaf Vertz wrote:
> Fixed the following warnings (reported by cppcheck):
> [drivers/staging/iio/light/tsl2583.c:695]: (warning) %d in format string (no. 
> 1)
> requires 'int' but the argument type is 'unsigned int'.
> [drivers/staging/iio/light/tsl2583.c:695]: (warning) %d in format string (no. 
> 2)
> requires 'int' but the argument type is 'unsigned int'.
> [drivers/staging/iio/light/tsl2583.c:695]: (warning) %d in format string (no. 
> 3)
> requires 'int' but the argument type is 'unsigned int'.
> 
> Signed-off-by: Asaf Vertz 
Applied to the togreg branch of iio.git - initially pushed out
as testing.  Note this branch will almost certainly get rebased
before going upstream.

Jonathan
> ---
>  drivers/staging/iio/light/tsl2583.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c 
> b/drivers/staging/iio/light/tsl2583.c
> index cc4ddcc..8afae8e 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -692,7 +692,7 @@ static ssize_t taos_luxtable_show(struct device *dev,
>   int offset = 0;
>  
>   for (i = 0; i < ARRAY_SIZE(taos_device_lux); i++) {
> - offset += sprintf(buf + offset, "%d,%d,%d,",
> + offset += sprintf(buf + offset, "%u,%u,%u,",
> taos_device_lux[i].ratio,
> taos_device_lux[i].ch0,
> taos_device_lux[i].ch1);
> 

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


Re: [PATCH] staging: mt29f_spinand: Fix typo in Kconfig

2015-01-20 Thread Brian Norris
On Thu, Jan 15, 2015 at 07:47:24PM +0900, Masanari Iida wrote:
> This patch fix a spelling typo in Kconfig.
> 
> Signed-off-by: Masanari Iida 

Acked-by: Brian Norris 

Greg, do you take these patches, or should they go through me?

FWIW, we have high hopes to kill and replace this driver soon, as there
have been some better spi-nand patches floating around linux-mtd.

> ---
>  drivers/staging/mt29f_spinand/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/mt29f_spinand/Kconfig 
> b/drivers/staging/mt29f_spinand/Kconfig
> index 4031748..f3f9cb3 100644
> --- a/drivers/staging/mt29f_spinand/Kconfig
> +++ b/drivers/staging/mt29f_spinand/Kconfig
> @@ -12,5 +12,5 @@ config MTD_SPINAND_ONDIEECC
>   bool "Use SPINAND internal ECC"
>   depends on MTD_SPINAND_MT29F
>   help
> -   Internel ECC.
> +   Internal ECC.
> Enables Hardware ECC support for Micron SPI NAND.

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


[PATCH] staging: lustre: ptlrpc: fix lproc_ptlrpc static declarations

2015-01-20 Thread Jon Bernard
This patch fixes the following sparse warnings:

drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:51:3:warning:
 symbol 'll_rpc_opcode_table' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:142:3: warning:
 symbol 'll_eopcode_table' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:178:12: warning:
 symbol 'll_eopcode2str' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:731:1: warning:
 symbol 'ptlrpc_lprocfs_svc_req_history_seek' was not declared. Should it be 
static?

Signed-off-by: Jon Bernard 
---
 drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c 
b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index 90448e9..0e2071b 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -45,7 +45,7 @@
 #include "ptlrpc_internal.h"
 
 
-struct ll_rpc_opcode {
+static struct ll_rpc_opcode {
__u32   opcode;
const char *opname;
 } ll_rpc_opcode_table[LUSTRE_MAX_OPCODES] = {
@@ -136,7 +136,7 @@ struct ll_rpc_opcode {
{ UPDATE_OBJ,   "update_obj" },
 };
 
-struct ll_eopcode {
+static struct ll_eopcode {
__u32   opcode;
const char *opname;
 } ll_eopcode_table[EXTRA_LAST_OPC] = {
@@ -175,11 +175,12 @@ const char *ll_opcode2str(__u32 opcode)
return ll_rpc_opcode_table[offset].opname;
 }
 
-const char *ll_eopcode2str(__u32 opcode)
+static const char *ll_eopcode2str(__u32 opcode)
 {
LASSERT(ll_eopcode_table[opcode].opcode == opcode);
return ll_eopcode_table[opcode].opname;
 }
+
 #if defined (CONFIG_PROC_FS)
 static void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir,
char *name,
@@ -727,7 +728,7 @@ struct ptlrpc_srh_iterator {
struct ptlrpc_request   *srhi_req;
 };
 
-int
+static int
 ptlrpc_lprocfs_svc_req_history_seek(struct ptlrpc_service_part *svcpt,
struct ptlrpc_srh_iterator *srhi,
__u64 seq)
-- 
1.9.1

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


[PATCH v2] staging: lustre: fix sparse warnings related to lock context imbalance

2015-01-20 Thread Loic Pefferkorn
Applies against next-20150120.

Add __acquires() and __releases() function annotations, to fix sparse warnings 
related to lock context imbalance.

This patch fixes the following warnings:

drivers/staging/lustre//lustre/libcfs/linux/linux-tracefile.c:153:5: warning: 
context imbalance in 'cfs_trace_lock_tcd' - wrong count at exit
drivers/staging/lustre//lustre/libcfs/linux/linux-tracefile.c:171:39: warning: 
context imbalance in 'cfs_trace_unlock_tcd' - unexpected unlock
drivers/staging/lustre//lustre/libcfs/hash.c:128:1: warning: context imbalance 
in 'cfs_hash_spin_lock' - wrong count at exit
drivers/staging/lustre//lustre/libcfs/hash.c:134:1: warning: context imbalance 
in 'cfs_hash_spin_unlock' - unexpected unlock
drivers/staging/lustre//lustre/libcfs/hash.c:142:9: warning: context imbalance 
in 'cfs_hash_rw_lock' - wrong count at exit
include/linux/rwlock_api_smp.h:219:9: warning: context imbalance in 
'cfs_hash_rw_unlock' - unexpected unlock
drivers/staging/lustre//lustre/obdclass/cl_object.c:195:6: warning: context 
imbalance in 'cl_object_attr_lock' - wrong count at exit
drivers/staging/lustre//lustre/obdclass/cl_object.c:204:6: warning: context 
imbalance in 'cl_object_attr_unlock' - unexpected unlock

Signed-off-by: Loic Pefferkorn 
---
 drivers/staging/lustre/lustre/libcfs/hash.c  | 4 
 drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 2 ++
 drivers/staging/lustre/lustre/obdclass/cl_object.c   | 2 ++
 3 files changed, 8 insertions(+)

diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c 
b/drivers/staging/lustre/lustre/libcfs/hash.c
index 2d1e672..d89f81a 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -126,18 +126,21 @@ cfs_hash_nl_unlock(union cfs_hash_lock *lock, int 
exclusive) {}
 
 static inline void
 cfs_hash_spin_lock(union cfs_hash_lock *lock, int exclusive)
+   __acquires(&lock->spin)
 {
spin_lock(&lock->spin);
 }
 
 static inline void
 cfs_hash_spin_unlock(union cfs_hash_lock *lock, int exclusive)
+   __releases(&lock->spin)
 {
spin_unlock(&lock->spin);
 }
 
 static inline void
 cfs_hash_rw_lock(union cfs_hash_lock *lock, int exclusive)
+   __acquires(&lock->rw)
 {
if (!exclusive)
read_lock(&lock->rw);
@@ -147,6 +150,7 @@ cfs_hash_rw_lock(union cfs_hash_lock *lock, int exclusive)
 
 static inline void
 cfs_hash_rw_unlock(union cfs_hash_lock *lock, int exclusive)
+   __releases(&lock->rw)
 {
if (!exclusive)
read_unlock(&lock->rw);
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
index fdc7189..c8e2930 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
@@ -151,6 +151,7 @@ cfs_trace_buf_type_t cfs_trace_buf_idx_get(void)
  * for details.
  */
 int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
+   __acquires(&tcd->tc_lock)
 {
__LASSERT(tcd->tcd_type < CFS_TCD_TYPE_MAX);
if (tcd->tcd_type == CFS_TCD_TYPE_IRQ)
@@ -165,6 +166,7 @@ int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int 
walking)
 }
 
 void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
+   __releases(&tcd->tcd_lock)
 {
__LASSERT(tcd->tcd_type < CFS_TCD_TYPE_MAX);
if (tcd->tcd_type == CFS_TCD_TYPE_IRQ)
diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c 
b/drivers/staging/lustre/lustre/obdclass/cl_object.c
index c40bb6c..f13d1fb 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c
@@ -193,6 +193,7 @@ static spinlock_t *cl_object_attr_guard(struct cl_object *o)
  * cl_object_attr_get(), cl_object_attr_set().
  */
 void cl_object_attr_lock(struct cl_object *o)
+   __acquires(cl_object_attr_guard(o))
 {
spin_lock(cl_object_attr_guard(o));
 }
@@ -202,6 +203,7 @@ EXPORT_SYMBOL(cl_object_attr_lock);
  * Releases data-attributes lock, acquired by cl_object_attr_lock().
  */
 void cl_object_attr_unlock(struct cl_object *o)
+   __releases(cl_object_attr_guard(o))
 {
spin_unlock(cl_object_attr_guard(o));
 }
-- 
2.2.1

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


Re: Need help setting up git

2015-01-20 Thread Greg KH
On Tue, Jan 20, 2015 at 07:50:31PM +0100, Noralf Trønnes wrote:
> Hi,
> 
> I can't get my name: Noralf Trønnes, to come out correctly in From when I
> format and send a patch. The 'ø' becomes a question mark when received
> in my email client.
> 
> This is the head of the patch generated by git format-patch:
> 
> From b2a4f6abdb097c4dc092b56995a2af8e42fbea79 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Noralf=20Tr=F8nnes?= 

That doesn't look right...

> Date: Tue, 20 Jan 2015 18:34:47 +0100
> Subject: [PATCH] staging: fbtft: remove ARCH_BCM2708 optimization
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> ARCH_BCM2708 is not present in mainline so remove optimization.
> 
> Signed-off-by: Noralf Trønnes 
> ---
> 
> This is how it looks when I send from my Thunderbird email client:
> From: =?UTF-8?B?Tm9yYWxmIFRyw7hubmVz?= 

When git asks, are you selecting UTF-8 for the email message when
sending it out?

You might try playing with --compose-encoding as an option, but I do
have to say, I have had problems with this as well, it might be better
to ask this on the git mailing list as it's not a staging driver
specific question.  Feel free to cc: me as I want to know how to do this
properly as well.

thanks,

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


[PATCH 2/6] staging: comedi: comedidev.h: remove unused "polling" function prototypes

2015-01-20 Thread H Hartley Sweeten
These "polling" functions are not implemented in the comedi core. Remove the
unnecessary prototypes.

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

diff --git a/drivers/staging/comedi/comedidev.h 
b/drivers/staging/comedi/comedidev.h
index 84245fb..928572f 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -302,11 +302,6 @@ void comedi_event(struct comedi_device *dev, struct 
comedi_subdevice *s);
 struct comedi_device *comedi_dev_get_from_minor(unsigned minor);
 int comedi_dev_put(struct comedi_device *dev);
 
-void init_polling(void);
-void cleanup_polling(void);
-void start_polling(struct comedi_device *);
-void stop_polling(struct comedi_device *);
-
 /* subdevice runflags */
 enum subdevice_runflags {
SRF_RT = 0x0002,
-- 
2.0.3

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


[PATCH 6/6] staging: comedi: pcl818: introduce pcl818_ai_write_sample()

2015-01-20 Thread H Hartley Sweeten
This driver can acquire analog input samples during the async command with
DMA, by using the FIFO, or sample-by-sample using the End-Of-Conversion
interrupt. All three methods do the following sequence:

  1) check for channel dropout
  2) add the sample to the async buffer
  3) advance the channel dropout detection and detect the end of the command

Merge this sequence into a new helper function.

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

diff --git a/drivers/staging/comedi/drivers/pcl818.c 
b/drivers/staging/comedi/drivers/pcl818.c
index 6e5d8bf..a10ce41 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -454,11 +454,12 @@ static int pcl818_ai_eoc(struct comedi_device *dev,
return -EBUSY;
 }
 
-static bool pcl818_ai_dropout(struct comedi_device *dev,
- struct comedi_subdevice *s,
- unsigned int chan)
+static bool pcl818_ai_write_sample(struct comedi_device *dev,
+  struct comedi_subdevice *s,
+  unsigned int chan, unsigned int val)
 {
struct pcl818_private *devpriv = dev->private;
+   struct comedi_cmd *cmd = &s->async->cmd;
unsigned int expected_chan;
 
expected_chan = devpriv->act_chanlist[devpriv->act_chanlist_pos];
@@ -469,16 +470,10 @@ static bool pcl818_ai_dropout(struct comedi_device *dev,
(devpriv->usefifo) ? "FIFO" : "IRQ",
chan, expected_chan);
s->async->events |= COMEDI_CB_ERROR;
-   return true;
+   return false;
}
-   return false;
-}
 
-static bool pcl818_ai_next_chan(struct comedi_device *dev,
-   struct comedi_subdevice *s)
-{
-   struct pcl818_private *devpriv = dev->private;
-   struct comedi_cmd *cmd = &s->async->cmd;
+   comedi_buf_write_samples(s, &val, 1);
 
devpriv->act_chanlist_pos++;
if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len)
@@ -506,13 +501,7 @@ static void pcl818_handle_eoc(struct comedi_device *dev,
}
 
val = pcl818_ai_get_sample(dev, s, &chan);
-
-   if (pcl818_ai_dropout(dev, s, chan))
-   return;
-
-   comedi_buf_write_samples(s, &val, 1);
-
-   pcl818_ai_next_chan(dev, s);
+   pcl818_ai_write_sample(dev, s, chan, val);
 }
 
 static void pcl818_handle_dma(struct comedi_device *dev,
@@ -535,13 +524,7 @@ static void pcl818_handle_dma(struct comedi_device *dev,
val = ptr[i];
chan = val & 0xf;
val = (val >> 4) & s->maxdata;
-
-   if (pcl818_ai_dropout(dev, s, chan))
-   break;
-
-   comedi_buf_write_samples(s, &val, 1);
-
-   if (!pcl818_ai_next_chan(dev, s))
+   if (!pcl818_ai_write_sample(dev, s, chan, val))
break;
}
 }
@@ -576,13 +559,7 @@ static void pcl818_handle_fifo(struct comedi_device *dev,
 
for (i = 0; i < len; i++) {
val = pcl818_ai_get_fifo_sample(dev, s, &chan);
-
-   if (pcl818_ai_dropout(dev, s, chan))
-   break;
-
-   comedi_buf_write_samples(s, &val, 1);
-
-   if (!pcl818_ai_next_chan(dev, s))
+   if (!pcl818_ai_write_sample(dev, s, chan, val))
break;
}
 }
-- 
2.0.3

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


[PATCH 5/6] staging: comedi: drivers: remove inappropriate COMEDI_CB_EOA events

2015-01-20 Thread H Hartley Sweeten
Hardware errors should be reported with the COMEDI_CB_ERROR event. This event
will cause the async command to cancel. It's not necessary to also set the
COMEDI_CB_EOA event. Remove these events.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/adl_pci9111.c |  2 +-
 drivers/staging/comedi/drivers/adl_pci9118.c |  4 ++--
 drivers/staging/comedi/drivers/adv_pci1710.c | 12 ++--
 drivers/staging/comedi/drivers/cb_pcidas.c   |  2 +-
 drivers/staging/comedi/drivers/cb_pcidas64.c |  2 +-
 drivers/staging/comedi/drivers/das16m1.c |  2 +-
 drivers/staging/comedi/drivers/das1800.c |  2 +-
 drivers/staging/comedi/drivers/das800.c  |  2 +-
 drivers/staging/comedi/drivers/dt3000.c  |  2 +-
 drivers/staging/comedi/drivers/gsc_hpdi.c|  4 ++--
 drivers/staging/comedi/drivers/me4000.c  |  4 ++--
 drivers/staging/comedi/drivers/ni_at_a2150.c |  4 ++--
 drivers/staging/comedi/drivers/ni_labpc_common.c |  6 +++---
 drivers/staging/comedi/drivers/ni_mio_common.c   |  7 +++
 drivers/staging/comedi/drivers/ni_pcidio.c   |  4 ++--
 drivers/staging/comedi/drivers/pcl812.c  |  2 +-
 drivers/staging/comedi/drivers/pcl818.c  |  8 
 drivers/staging/comedi/drivers/quatech_daqp_cs.c |  5 ++---
 18 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c 
b/drivers/staging/comedi/drivers/adl_pci9111.c
index 47f6c0e..f68dc99 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -539,7 +539,7 @@ static irqreturn_t pci9111_interrupt(int irq, void 
*p_device)
spin_unlock_irqrestore(&dev->spinlock, irq_flags);
dev_dbg(dev->class_dev, "fifo overflow\n");
outb(0, dev->iobase + PCI9111_INT_CLR_REG);
-   async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
+   async->events |= COMEDI_CB_ERROR;
comedi_handle_events(dev, s);
 
return IRQ_HANDLED;
diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 2660358..f61e392 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -749,13 +749,13 @@ static irqreturn_t pci9118_interrupt(int irq, void *d)
 
if (intcsr & MASTER_ABORT_INT) {
dev_err(dev->class_dev, "AMCC IRQ - MASTER DMA ABORT!\n");
-   s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
+   s->async->events |= COMEDI_CB_ERROR;
goto interrupt_exit;
}
 
if (intcsr & TARGET_ABORT_INT) {
dev_err(dev->class_dev, "AMCC IRQ - TARGET DMA ABORT!\n");
-   s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
+   s->async->events |= COMEDI_CB_ERROR;
goto interrupt_exit;
}
 
diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index d02df7d..1b8715b 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -743,14 +743,14 @@ static void pci1710_handle_every_sample(struct 
comedi_device *dev,
status = inw(dev->iobase + PCI171x_STATUS);
if (status & Status_FE) {
dev_dbg(dev->class_dev, "A/D FIFO empty (%4x)\n", status);
-   s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+   s->async->events |= COMEDI_CB_ERROR;
comedi_handle_events(dev, s);
return;
}
if (status & Status_FF) {
dev_dbg(dev->class_dev,
"A/D FIFO Full status (Fatal Error!) (%4x)\n", status);
-   s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+   s->async->events |= COMEDI_CB_ERROR;
comedi_handle_events(dev, s);
return;
}
@@ -761,7 +761,7 @@ static void pci1710_handle_every_sample(struct 
comedi_device *dev,
val = inw(dev->iobase + PCI171x_AD_DATA);
ret = pci171x_ai_dropout(dev, s, s->async->cur_chan, val);
if (ret) {
-   s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+   s->async->events |= COMEDI_CB_ERROR;
break;
}
 
@@ -795,7 +795,7 @@ static int move_block_from_fifo(struct comedi_device *dev,
 
ret = pci171x_ai_dropout(dev, s, s->async->cur_chan, val);
if (ret) {
-   s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+   s->async->events |= COMEDI_CB_ERROR;
return ret;
}
 
@@ -816,14 +816,14 @@ static void pci1710_handle_fifo(struct comedi_devic

[PATCH 0/6] staging: comedi: misc cleanup

2015-01-20 Thread H Hartley Sweeten
Following are a couple random comedi cleanup patches that I have had
hanging around.

H Hartley Sweeten (6):
  staging: comedi: comedidev.h: remove unused "minor bits" information
  staging: comedi: comedidev.h: remove unused "polling" function prototypes
  staging: comedi: comedidev.h: add namespace to the subdevice "runflags"
  staging: comedi: das16: use COMEDI_CB_CANCEL_MASK to see if command is running
  staging: comedi: drivers: remove inappropriate COMEDI_CB_EOA events
  staging: comedi: pcl818: introduce pcl818_ai_write_sample()

 drivers/staging/comedi/comedi_fops.c | 30 +--
 drivers/staging/comedi/comedidev.h   | 41 
 drivers/staging/comedi/drivers.c |  2 +-
 drivers/staging/comedi/drivers/adl_pci9111.c |  2 +-
 drivers/staging/comedi/drivers/adl_pci9118.c |  4 +-
 drivers/staging/comedi/drivers/adv_pci1710.c | 12 +++---
 drivers/staging/comedi/drivers/cb_pcidas.c   |  2 +-
 drivers/staging/comedi/drivers/cb_pcidas64.c |  2 +-
 drivers/staging/comedi/drivers/das16.c   |  2 +-
 drivers/staging/comedi/drivers/das16m1.c |  2 +-
 drivers/staging/comedi/drivers/das1800.c |  2 +-
 drivers/staging/comedi/drivers/das800.c  |  2 +-
 drivers/staging/comedi/drivers/dt3000.c  |  2 +-
 drivers/staging/comedi/drivers/gsc_hpdi.c|  4 +-
 drivers/staging/comedi/drivers/me4000.c  |  4 +-
 drivers/staging/comedi/drivers/ni_at_a2150.c |  4 +-
 drivers/staging/comedi/drivers/ni_labpc_common.c |  6 +--
 drivers/staging/comedi/drivers/ni_mio_common.c   |  7 ++--
 drivers/staging/comedi/drivers/ni_pcidio.c   |  4 +-
 drivers/staging/comedi/drivers/pcl812.c  |  2 +-
 drivers/staging/comedi/drivers/pcl818.c  | 49 +++-
 drivers/staging/comedi/drivers/quatech_daqp_cs.c |  5 +--
 22 files changed, 81 insertions(+), 109 deletions(-)

-- 
2.0.3

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


[PATCH 1/6] staging: comedi: comedidev.h: remove unused "minor bits" information

2015-01-20 Thread H Hartley Sweeten
The enum comedi_minor_bits and the COMEDI_SUBDEVICE_MINOR_{SHIFT,OFFSET}
defines are not used. Remove them.

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

diff --git a/drivers/staging/comedi/comedidev.h 
b/drivers/staging/comedi/comedidev.h
index 77be191..84245fb 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -299,17 +299,6 @@ struct comedi_device {
 
 void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s);
 
-/* we can expand the number of bits used to encode devices/subdevices into
- the minor number soon, after more distros support > 8 bit minor numbers
- (like after Debian Etch gets released) */
-enum comedi_minor_bits {
-   COMEDI_DEVICE_MINOR_MASK = 0xf,
-   COMEDI_SUBDEVICE_MINOR_MASK = 0xf0
-};
-
-static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4;
-static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1;
-
 struct comedi_device *comedi_dev_get_from_minor(unsigned minor);
 int comedi_dev_put(struct comedi_device *dev);
 
-- 
2.0.3

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


[PATCH 3/6] staging: comedi: comedidev.h: add namespace to the subdevice "runflags"

2015-01-20 Thread H Hartley Sweeten
Tidy up and document the subdevice "runflags". Rename them so they have
comedi namespace.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/comedi_fops.c | 30 ++
 drivers/staging/comedi/comedidev.h   | 25 -
 drivers/staging/comedi/drivers.c |  2 +-
 3 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index f143cb6..68bfe92 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -604,7 +604,7 @@ bool comedi_is_subdevice_running(struct comedi_subdevice *s)
 {
unsigned runflags = comedi_get_subdevice_runflags(s);
 
-   return (runflags & SRF_RUNNING) ? true : false;
+   return (runflags & COMEDI_SRF_RUNNING) ? true : false;
 }
 EXPORT_SYMBOL_GPL(comedi_is_subdevice_running);
 
@@ -612,14 +612,14 @@ static bool comedi_is_subdevice_in_error(struct 
comedi_subdevice *s)
 {
unsigned runflags = comedi_get_subdevice_runflags(s);
 
-   return (runflags & SRF_ERROR) ? true : false;
+   return (runflags & COMEDI_SRF_ERROR) ? true : false;
 }
 
 static bool comedi_is_subdevice_idle(struct comedi_subdevice *s)
 {
unsigned runflags = comedi_get_subdevice_runflags(s);
 
-   return (runflags & (SRF_ERROR | SRF_RUNNING)) ? false : true;
+   return (runflags & COMEDI_SRF_BUSY_MASK) ? false : true;
 }
 
 /**
@@ -634,7 +634,7 @@ void *comedi_alloc_spriv(struct comedi_subdevice *s, size_t 
size)
 {
s->private = kzalloc(size, GFP_KERNEL);
if (s->private)
-   s->runflags |= SRF_FREE_SPRIV;
+   s->runflags |= COMEDI_SRF_FREE_SPRIV;
return s->private;
 }
 EXPORT_SYMBOL_GPL(comedi_alloc_spriv);
@@ -647,7 +647,7 @@ static void do_become_nonbusy(struct comedi_device *dev,
 {
struct comedi_async *async = s->async;
 
-   comedi_set_subdevice_runflags(s, SRF_RUNNING, 0);
+   comedi_set_subdevice_runflags(s, COMEDI_SRF_RUNNING, 0);
if (async) {
comedi_buf_reset(s);
async->inttrig = NULL;
@@ -1634,10 +1634,13 @@ static int do_cmd_ioctl(struct comedi_device *dev,
if (async->cmd.flags & CMDF_WAKE_EOS)
async->cb_mask |= COMEDI_CB_EOS;
 
-   comedi_set_subdevice_runflags(s, SRF_ERROR | SRF_RUNNING, SRF_RUNNING);
+   comedi_set_subdevice_runflags(s, COMEDI_SRF_BUSY_MASK,
+ COMEDI_SRF_RUNNING);
 
-   /* set s->busy _after_ setting SRF_RUNNING flag to avoid race with
-* comedi_read() or comedi_write() */
+   /*
+* Set s->busy _after_ setting COMEDI_SRF_RUNNING flag to avoid
+* race with comedi_read() or comedi_write().
+*/
s->busy = file;
ret = s->do_cmd(dev, s);
if (ret == 0)
@@ -2591,18 +2594,21 @@ void comedi_event(struct comedi_device *dev, struct 
comedi_subdevice *s)
return;
 
if (s->async->events & COMEDI_CB_CANCEL_MASK)
-   runflags_mask |= SRF_RUNNING;
+   runflags_mask |= COMEDI_SRF_RUNNING;
 
/*
 * Remember if an error event has occurred, so an error
 * can be returned the next time the user does a read().
 */
if (s->async->events & COMEDI_CB_ERROR_MASK) {
-   runflags_mask |= SRF_ERROR;
-   runflags |= SRF_ERROR;
+   runflags_mask |= COMEDI_SRF_ERROR;
+   runflags |= COMEDI_SRF_ERROR;
}
if (runflags_mask) {
-   /*sets SRF_ERROR and SRF_RUNNING together atomically */
+   /*
+* Sets COMEDI_SRF_ERROR and COMEDI_SRF_RUNNING together
+* atomically.
+*/
comedi_set_subdevice_runflags(s, runflags_mask, runflags);
}
 
diff --git a/drivers/staging/comedi/comedidev.h 
b/drivers/staging/comedi/comedidev.h
index 928572f..e5daaeb 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -302,15 +302,22 @@ void comedi_event(struct comedi_device *dev, struct 
comedi_subdevice *s);
 struct comedi_device *comedi_dev_get_from_minor(unsigned minor);
 int comedi_dev_put(struct comedi_device *dev);
 
-/* subdevice runflags */
-enum subdevice_runflags {
-   SRF_RT = 0x0002,
-   /* indicates an COMEDI_CB_ERROR event has occurred since the last
-* command was started */
-   SRF_ERROR = 0x0004,
-   SRF_RUNNING = 0x0800,
-   SRF_FREE_SPRIV = 0x8000,/* free s->private on detach */
-};
+/**
+ * comedi_subdevice "runflags"
+ * @COMEDI_SRF_RT: DEPRECATED: command is running real-time
+ * @COMEDI_SRF_ERROR:  indicates an COMEDI_CB_ERROR event has occurred
+ * since the last command was started
+ * @COMEDI_SRF_RUNNING:command is running
+ * @COMEDI_SRF_FREE_SPRIV:

[PATCH 4/6] staging: comedi: das16: use COMEDI_CB_CANCEL_MASK to see if command is running

2015-01-20 Thread H Hartley Sweeten
In das16_interrupt(), use COMEDI_CB_CANCEL_MASK to determine if the async
command is still running and the dma needs to be re-enabled. This will
cause the driver not re-enable the dma if the async buffer overflows
(COMEDI_CB_OVERFLOW), a hardware error occurs (COMEDI_CB_ERROR), or the
command completes (COMEDI_CB_EOA).

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

diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index 466d4ef..4608b01 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -523,7 +523,7 @@ static void das16_interrupt(struct comedi_device *dev)
devpriv->adc_byte_count -= num_bytes;
 
/* re-enable dma */
-   if ((async->events & COMEDI_CB_EOA) == 0) {
+   if (!(async->events & COMEDI_CB_CANCEL_MASK)) {
struct comedi_isadma_desc *nxt_desc = &dma->desc[dma->cur_dma];
 
nxt_desc->size = nxt_desc->maxsize;
-- 
2.0.3

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


[PATCH] staging: comedi: addi_apci_1500: rewrite the subdevice support functions

2015-01-20 Thread H Hartley Sweeten
This driver is a mess. It violates the comedi API so much that I doubt
anything actually works.

Drop the addi-data/hwdrv_apci1500.c file and rewrite the subdevice support
functions.

This board has 16 digital inputs (subdevice 0) and 16 digital outputs
(subdevice 1).

It also has three 16-bit timer/counters provided by a Z8536 CIO chip
(subdevice 2). The Z8536 chip is also used to support pattern match
interrupt detection of the first 14 digital input channels.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 1620 
 drivers/staging/comedi/drivers/addi_apci_1500.c|  812 +-
 drivers/staging/comedi/drivers/z8536.h |  202 +++
 3 files changed, 974 insertions(+), 1660 deletions(-)
 delete mode 100644 drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
 create mode 100644 drivers/staging/comedi/drivers/z8536.h

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
deleted file mode 100644
index 5bf943d..000
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ /dev/null
@@ -1,1620 +0,0 @@
-/*
- * Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
- *
- * ADDI-DATA GmbH
- * Dieselstrasse 3
- * D-77833 Ottersweier
- * Tel: +19(0)7223/9493-0
- * Fax: +49(0)7223/9493-92
- * http://www.addi-data.com
- * i...@addi-data.com
- *
- * 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.
- *
- */
-
-/* DIGITAL INPUT-OUTPUT DEFINE */
-
-#define APCI1500_AND   2
-#define APCI1500_OR4
-#define APCI1500_OR_PRIORITY   6
-#define COUNTER1   0
-#define COUNTER2   1
-#define COUNTER3   2
-#define APCI1500_COUNTER   0x20
-#define APCI1500_TIMER 0
-#define APCI1500_WATCHDOG  0
-#define APCI1500_SINGLE0
-#define APCI1500_CONTINUOUS0x80
-#define APCI1500_DISABLE   0
-#define APCI1500_ENABLE1
-#define APCI1500_SOFTWARE_TRIGGER  0x4
-#define APCI1500_HARDWARE_TRIGGER  0x10
-#define APCI1500_SOFTWARE_GATE 0
-#define APCI1500_HARDWARE_GATE 0x8
-#define START  0
-#define STOP   1
-#define TRIGGER2
-
-/*
- * Z8536 CIO Internal Address
- */
-enum {
-   APCI1500_RW_MASTER_INTERRUPT_CONTROL,
-   APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
-   APCI1500_RW_PORT_A_INTERRUPT_CONTROL,
-   APCI1500_RW_PORT_B_INTERRUPT_CONTROL,
-   APCI1500_RW_TIMER_COUNTER_INTERRUPT_VECTOR,
-   APCI1500_RW_PORT_C_DATA_PCITCH_POLARITY,
-   APCI1500_RW_PORT_C_DATA_DIRECTION,
-   APCI1500_RW_PORT_C_SPECIAL_IO_CONTROL,
-
-   APCI1500_RW_PORT_A_COMMAND_AND_STATUS,
-   APCI1500_RW_PORT_B_COMMAND_AND_STATUS,
-   APCI1500_RW_CPT_TMR1_CMD_STATUS,
-   APCI1500_RW_CPT_TMR2_CMD_STATUS,
-   APCI1500_RW_CPT_TMR3_CMD_STATUS,
-   APCI1500_RW_PORT_A_DATA,
-   APCI1500_RW_PORT_B_DATA,
-   APCI1500_RW_PORT_C_DATA,
-
-   APCI1500_R_CPT_TMR1_VALUE_HIGH,
-   APCI1500_R_CPT_TMR1_VALUE_LOW,
-   APCI1500_R_CPT_TMR2_VALUE_HIGH,
-   APCI1500_R_CPT_TMR2_VALUE_LOW,
-   APCI1500_R_CPT_TMR3_VALUE_HIGH,
-   APCI1500_R_CPT_TMR3_VALUE_LOW,
-   APCI1500_RW_CPT_TMR1_TIME_CST_HIGH,
-   APCI1500_RW_CPT_TMR1_TIME_CST_LOW,
-   APCI1500_RW_CPT_TMR2_TIME_CST_HIGH,
-   APCI1500_RW_CPT_TMR2_TIME_CST_LOW,
-   APCI1500_RW_CPT_TMR3_TIME_CST_HIGH,
-   APCI1500_RW_CPT_TMR3_TIME_CST_LOW,
-   APCI1500_RW_CPT_TMR1_MODE_SPECIFICATION,
-   APCI1500_RW_CPT_TMR2_MODE_SPECIFICATION,
-   APCI1500_RW_CPT_TMR3_MODE_SPECIFICATION,
-   APCI1500_R_CURRENT_VECTOR,
-
-   APCI1500_RW_PORT_A_SPECIFICATION,
-   APCI1500_RW_PORT_A_HANDSHAKE_SPECIFICATION,
-   APCI1500_RW_PORT_A_DATA_PCITCH_POLARITY,
-   APCI1500_RW_PORT_A_DATA_DIRECTION,
-   APCI1500_RW_PORT_A_SPECIAL_IO_CONTROL,
-   APCI1500_RW_PORT_A_PATTERN_POLARITY,
-   APCI1500_RW_PORT_A_PATTERN_TRANSITION,
-   APCI1500_RW_PORT_A_PATTERN_MASK,
-
-   APCI1500_RW_PORT_B_SPECIFICATION,
-   APCI1500_RW_PORT_B_HANDSHAKE_SPECIFICATION,
-   APCI1500_RW_PORT_B_DATA_PCITCH_POLARITY,
-   APCI1500_RW_PORT_B_DATA_DIRECTION,
-   APCI1500_RW_PORT_B_SPECIAL_IO_CONTROL,
-   APC

[PATCH] staging: comedi: aio_iiro_16: return input state in async command sample

2015-01-20 Thread H Hartley Sweeten
Modify the sample data returned by the async command to include the current
state of the digital inputs. Otherwise the command needs to be canceled in
order for the user to do an (*insn_bits) operation to check the digital
inputs.

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

diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c 
b/drivers/staging/comedi/drivers/aio_iiro_16.c
index d8884a3..1c7b325 100644
--- a/drivers/staging/comedi/drivers/aio_iiro_16.c
+++ b/drivers/staging/comedi/drivers/aio_iiro_16.c
@@ -27,11 +27,14 @@
  *
  * The board supports interrupts on change of state of the digital inputs.
  * The sample data returned by the async command indicates which inputs
- * changed state:
+ * changed state and the current state of the inputs:
  *
- * Bit 7 - IRQ Enable (1) / Disable (0)
- * Bit 1 - Input 8-15 Changed State (1 = Changed, 0 = No Change)
- * Bit 0 - Input 0-7 Changed State (1 = Changed, 0 = No Change)
+ * Bit 23 - IRQ Enable (1) / Disable (0)
+ * Bit 17 - Input 8-15 Changed State (1 = Changed, 0 = No Change)
+ * Bit 16 - Input 0-7 Changed State (1 = Changed, 0 = No Change)
+ * Bit 15 - Digital input 15
+ * ...
+ * Bit 0  - Digital input 0
  */
 
 #include 
@@ -51,17 +54,31 @@
 #define AIO_IIRO_16_STATUS_INPUT_8_15  BIT(1)
 #define AIO_IIRO_16_STATUS_INPUT_0_7   BIT(0)
 
+static unsigned int aio_iiro_16_read_inputs(struct comedi_device *dev)
+{
+   unsigned int val;
+
+   val = inb(dev->iobase + AIO_IIRO_16_INPUT_0_7);
+   val |= inb(dev->iobase + AIO_IIRO_16_INPUT_8_15) << 8;
+
+   return val;
+}
+
 static irqreturn_t aio_iiro_16_cos(int irq, void *d)
 {
struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->read_subdev;
unsigned int status;
+   unsigned int val;
 
status = inb(dev->iobase + AIO_IIRO_16_STATUS);
if (!(status & AIO_IIRO_16_STATUS_IRQE))
return IRQ_NONE;
 
-   comedi_buf_write_samples(s, &status, 1);
+   val = aio_iiro_16_read_inputs(dev);
+   val |= (status << 16);
+
+   comedi_buf_write_samples(s, &val, 1);
comedi_handle_events(dev, s);
 
return IRQ_HANDLED;
@@ -150,9 +167,7 @@ static int aio_iiro_16_di_insn_bits(struct comedi_device 
*dev,
struct comedi_insn *insn,
unsigned int *data)
 {
-   data[1] = 0;
-   data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_0_7);
-   data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_8_15) << 8;
+   data[1] = aio_iiro_16_read_inputs(dev);
 
return insn->n;
 }
@@ -207,7 +222,7 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
s->insn_bits= aio_iiro_16_di_insn_bits;
if (dev->irq) {
dev->read_subdev = s;
-   s->subdev_flags |= SDF_CMD_READ;
+   s->subdev_flags |= SDF_CMD_READ | SDF_LSAMPL;
s->len_chanlist = 1;
s->do_cmdtest   = aio_iiro_16_cos_cmdtest;
s->do_cmd   = aio_iiro_16_cos_cmd;
-- 
2.0.3

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


Need help setting up git

2015-01-20 Thread Noralf Trønnes

Hi,

I can't get my name: Noralf Trønnes, to come out correctly in From when I
format and send a patch. The 'ø' becomes a question mark when received
in my email client.

This is the head of the patch generated by git format-patch:

From b2a4f6abdb097c4dc092b56995a2af8e42fbea79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Noralf=20Tr=F8nnes?= 
Date: Tue, 20 Jan 2015 18:34:47 +0100
Subject: [PATCH] staging: fbtft: remove ARCH_BCM2708 optimization
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

ARCH_BCM2708 is not present in mainline so remove optimization.

Signed-off-by: Noralf Trønnes 
---

This is how it looks when I send from my Thunderbird email client:
From: =?UTF-8?B?Tm9yYWxmIFRyw7hubmVz?= 


$ git log -1
commit b2a4f6abdb097c4dc092b56995a2af8e42fbea79
Author: Noralf Trnnes 
Date:   Tue Jan 20 18:34:47 2015 +0100

staging: fbtft: remove ARCH_BCM2708 optimization

ARCH_BCM2708 is not present in mainline so remove optimization.

Signed-off-by: Noralf Trnnes 


Setup:

Ubuntu server
$ cat /etc/issue
Ubuntu 12.04.3 LTS \n \l

$ git --version
git version 2.2.2

$ git config -l
user.name=Noralf Trønnes
user.email=no...@tronnes.org
core.editor=nano
alias.serve=daemon --verbose --export-all --base-path=/home/pi --reuseaddr
sendemail.smtpserver=smtp.ebnett.no
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.staging-testing.remote=origin
branch.staging-testing.merge=refs/heads/staging-testing


Regards,
Noralf Trønnes

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


RE: [PATCH v3 3/3] Drivers: hv: vmbus: serialize Offer and Rescind offer

2015-01-20 Thread KY Srinivasan


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Tuesday, January 20, 2015 7:45 AM
> To: KY Srinivasan; de...@linuxdriverproject.org
> Cc: Haiyang Zhang; linux-ker...@vger.kernel.org; Dexuan Cui; Jason Wang;
> Radim Krčmář; Dan Carpenter
> Subject: [PATCH v3 3/3] Drivers: hv: vmbus: serialize Offer and Rescind offer
> 
> Commit 4b2f9abea52a ("staging: hv: convert channel_mgmt.c to not call
> osd_schedule_callback")' was written under an assumption that we never
> receive Rescind offer while we're still processing the initial Offer request.
> However, the issue we fixed in 04a258c162a8 could be caused by this
> assumption not always being true.
> 
> In particular, we need to protect against the following:
> 1) Receiving a Rescind offer after we do queue_work() for processing an
> Offer
>request and before we actually enter vmbus_process_offer(). work.func
> points
>to vmbus_process_offer() at this moment and in vmbus_onoffer_rescind()
> we do
>another queue_work() without a check so we'll enter
> vmbus_process_offer()
>twice.
> 2) Receiving a Rescind offer after we enter vmbus_process_offer() and
>especially after we set >state = CHANNEL_OPEN_STATE. Many things can
> go
>wrong in that case, e.g. we can call free_channel() while we're still using
>it.
> 
> Implement the required protection by changing work->func at the very end
> of
> vmbus_process_offer() and checking work->func in
> vmbus_onoffer_rescind(). In case we receive rescind offer during or before
> vmbus_process_offer() is done we set rescind flag to true and we check it at
> the end of vmbus_process_offer() so such offer will not get lost.
> 
> Suggested-by: Radim Krčmář 
> Signed-off-by: Vitaly Kuznetsov 

Thanks Vitaly.
Signed-off-by: K. Y. Srinivasan 
> ---
>  drivers/hv/channel_mgmt.c | 30 ++
>  1 file changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index
> c6fdd74..877a944 100644
> --- a/drivers/hv/channel_mgmt.c
> +++ b/drivers/hv/channel_mgmt.c
> @@ -279,9 +279,6 @@ static void vmbus_process_offer(struct work_struct
> *work)
>   int ret;
>   unsigned long flags;
> 
> - /* The next possible work is rescind handling */
> - INIT_WORK(&newchannel->work, vmbus_process_rescind_offer);
> -
>   /* Make sure this is a new offer */
>   spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
> 
> @@ -341,7 +338,7 @@ static void vmbus_process_offer(struct work_struct
> *work)
>   if (channel->sc_creation_callback != NULL)
>   channel->sc_creation_callback(newchannel);
> 
> - goto out;
> + goto done_init_rescind;
>   }
> 
>   goto err_free_chan;
> @@ -382,7 +379,14 @@ static void vmbus_process_offer(struct work_struct
> *work)
>   kfree(newchannel->device_obj);
>   goto err_free_chan;
>   }
> -out:
> +done_init_rescind:
> + spin_lock_irqsave(&newchannel->lock, flags);
> + /* The next possible work is rescind handling */
> + INIT_WORK(&newchannel->work, vmbus_process_rescind_offer);
> + /* Check if rescind offer was already received */
> + if (newchannel->rescind)
> + queue_work(newchannel->controlwq, &newchannel-
> >work);
> + spin_unlock_irqrestore(&newchannel->lock, flags);
>   return;
>  err_free_chan:
>   free_channel(newchannel);
> @@ -520,6 +524,7 @@ static void vmbus_onoffer_rescind(struct
> vmbus_channel_message_header *hdr)  {
>   struct vmbus_channel_rescind_offer *rescind;
>   struct vmbus_channel *channel;
> + unsigned long flags;
> 
>   rescind = (struct vmbus_channel_rescind_offer *)hdr;
>   channel = relid2channel(rescind->child_relid);
> @@ -528,11 +533,20 @@ static void vmbus_onoffer_rescind(struct
> vmbus_channel_message_header *hdr)
>   /* Just return here, no channel found */
>   return;
> 
> + spin_lock_irqsave(&channel->lock, flags);
>   channel->rescind = true;
> + /*
> +  * channel->work.func != vmbus_process_rescind_offer means we
> are still
> +  * processing offer request and the rescind offer processing should
> be
> +  * postponed. It will be done at the very end of
> vmbus_process_offer()
> +  * as rescind flag is being checked there.
> +  */
> + if (channel->work.func == vmbus_process_rescind_offer)
> + /* work is initialized for vmbus_process_rescind_offer() from
> +  * vmbus_process_offer() where the channel got created */
> + queue_work(channel->controlwq, &channel->work);
> 
> - /* work is initialized for vmbus_process_rescind_offer() from
> -  * vmbus_process_offer() where the channel got created */
> - queue_work(channel->controlwq, &channel->work);
> + spin_unlock_irqrestore(&channel->lock, flags);
>  }
> 
>  /*
> -

RE: [PATCH v3 2/3] Drivers: hv: rename sc_lock to the more generic lock

2015-01-20 Thread KY Srinivasan


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Tuesday, January 20, 2015 7:45 AM
> To: KY Srinivasan; de...@linuxdriverproject.org
> Cc: Haiyang Zhang; linux-ker...@vger.kernel.org; Dexuan Cui; Jason Wang;
> Radim Krčmář; Dan Carpenter
> Subject: [PATCH v3 2/3] Drivers: hv: rename sc_lock to the more generic lock
> 
> sc_lock spinlock in struct vmbus_channel is being used to not only protect
> the sc_list field, e.g. vmbus_open() function uses it to implement test-and-
> set access to the state field. Rename it to the more generic 'lock' and add 
> the
> description.
> 
> Signed-off-by: Vitaly Kuznetsov 
Thanks Vitaly.
Signed-off-by: K. Y. Srinivasan 

> ---
>  drivers/hv/channel.c  |  6 +++---
>  drivers/hv/channel_mgmt.c | 10 +-
>  include/linux/hyperv.h|  7 ++-
>  3 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index
> 433f72a..8608ed1 100644
> --- a/drivers/hv/channel.c
> +++ b/drivers/hv/channel.c
> @@ -73,14 +73,14 @@ int vmbus_open(struct vmbus_channel
> *newchannel, u32 send_ringbuffer_size,
>   unsigned long flags;
>   int ret, t, err = 0;
> 
> - spin_lock_irqsave(&newchannel->sc_lock, flags);
> + spin_lock_irqsave(&newchannel->lock, flags);
>   if (newchannel->state == CHANNEL_OPEN_STATE) {
>   newchannel->state = CHANNEL_OPENING_STATE;
>   } else {
> - spin_unlock_irqrestore(&newchannel->sc_lock, flags);
> + spin_unlock_irqrestore(&newchannel->lock, flags);
>   return -EINVAL;
>   }
> - spin_unlock_irqrestore(&newchannel->sc_lock, flags);
> + spin_unlock_irqrestore(&newchannel->lock, flags);
> 
>   newchannel->onchannel_callback = onchannelcallback;
>   newchannel->channel_callback_context = context; diff --git
> a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index
> 01f2c2b..c6fdd74 100644
> --- a/drivers/hv/channel_mgmt.c
> +++ b/drivers/hv/channel_mgmt.c
> @@ -146,7 +146,7 @@ static struct vmbus_channel *alloc_channel(void)
>   return NULL;
> 
>   spin_lock_init(&channel->inbound_lock);
> - spin_lock_init(&channel->sc_lock);
> + spin_lock_init(&channel->lock);
> 
>   INIT_LIST_HEAD(&channel->sc_list);
>   INIT_LIST_HEAD(&channel->percpu_list);
> @@ -246,9 +246,9 @@ static void vmbus_process_rescind_offer(struct
> work_struct *work)
>   spin_unlock_irqrestore(&vmbus_connection.channel_lock,
> flags);
>   } else {
>   primary_channel = channel->primary_channel;
> - spin_lock_irqsave(&primary_channel->sc_lock, flags);
> + spin_lock_irqsave(&primary_channel->lock, flags);
>   list_del(&channel->sc_list);
> - spin_unlock_irqrestore(&primary_channel->sc_lock, flags);
> + spin_unlock_irqrestore(&primary_channel->lock, flags);
>   }
>   free_channel(channel);
>  }
> @@ -323,9 +323,9 @@ static void vmbus_process_offer(struct work_struct
> *work)
>* Process the sub-channel.
>*/
>   newchannel->primary_channel = channel;
> - spin_lock_irqsave(&channel->sc_lock, flags);
> + spin_lock_irqsave(&channel->lock, flags);
>   list_add_tail(&newchannel->sc_list, &channel-
> >sc_list);
> - spin_unlock_irqrestore(&channel->sc_lock, flags);
> + spin_unlock_irqrestore(&channel->lock, flags);
> 
>   if (newchannel->target_cpu != get_cpu()) {
>   put_cpu();
> diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index
> 476c685..02dd978 100644
> --- a/include/linux/hyperv.h
> +++ b/include/linux/hyperv.h
> @@ -722,7 +722,12 @@ struct vmbus_channel {
>*/
>   void (*sc_creation_callback)(struct vmbus_channel *new_sc);
> 
> - spinlock_t sc_lock;
> + /*
> +  * The spinlock to protect the structure. It is being used to protect
> +  * test-and-set access to various attributes of the structure as well
> +  * as all sc_list operations.
> +  */
> + spinlock_t lock;
>   /*
>* All Sub-channels of a primary channel are linked here.
>*/
> --
> 1.9.3

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


RE: [PATCH v3 1/3] Drivers: hv: check vmbus_device_create() return value in vmbus_process_offer()

2015-01-20 Thread KY Srinivasan


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Tuesday, January 20, 2015 7:45 AM
> To: KY Srinivasan; de...@linuxdriverproject.org
> Cc: Haiyang Zhang; linux-ker...@vger.kernel.org; Dexuan Cui; Jason Wang;
> Radim Krčmář; Dan Carpenter
> Subject: [PATCH v3 1/3] Drivers: hv: check vmbus_device_create() return
> value in vmbus_process_offer()
> 
> vmbus_device_create() result is not being checked in
> vmbus_process_offer() and it can fail if kzalloc() fails. Add the check and do
> minor cleanup to avoid additional duplication of "free_channel(); return;"
> block.
> 
> Reported-by: Jason Wang 
> Signed-off-by: Vitaly Kuznetsov 

Thanks Vitaly.
Signed-off-by: K. Y. Srinivasan 
> ---
>  drivers/hv/channel_mgmt.c | 14 +-
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index
> 2c59f03..01f2c2b 100644
> --- a/drivers/hv/channel_mgmt.c
> +++ b/drivers/hv/channel_mgmt.c
> @@ -341,11 +341,10 @@ static void vmbus_process_offer(struct
> work_struct *work)
>   if (channel->sc_creation_callback != NULL)
>   channel->sc_creation_callback(newchannel);
> 
> - return;
> + goto out;
>   }
> 
> - free_channel(newchannel);
> - return;
> + goto err_free_chan;
>   }
> 
>   /*
> @@ -364,6 +363,8 @@ static void vmbus_process_offer(struct work_struct
> *work)
>   &newchannel->offermsg.offer.if_type,
>   &newchannel->offermsg.offer.if_instance,
>   newchannel);
> + if (!newchannel->device_obj)
> + goto err_free_chan;
> 
>   /*
>* Add the new device to the bus. This will kick off device-driver @@
> -379,9 +380,12 @@ static void vmbus_process_offer(struct work_struct
> *work)
>   list_del(&newchannel->listentry);
>   spin_unlock_irqrestore(&vmbus_connection.channel_lock,
> flags);
>   kfree(newchannel->device_obj);
> -
> - free_channel(newchannel);
> + goto err_free_chan;
>   }
> +out:
> + return;
> +err_free_chan:
> + free_channel(newchannel);
>  }
> 
>  enum {
> --
> 1.9.3

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


Re: [PATCH] staging: dgnc: warning line over 80 characters

2015-01-20 Thread Joe Perches
On Tue, 2015-01-20 at 16:08 +0200, Mohamed Lotfy Hammad wrote:
> This patch fixes the following checkpatch.pl warning:
> fix line over 80 characters 
[]
> diff --git a/drivers/staging/dgnc/dgnc_driver.c 
> b/drivers/staging/dgnc/dgnc_driver.c
[]
> @@ -54,14 +54,14 @@ MODULE_SUPPORTED_DEVICE("dgnc");
>   * protos for this file
>   *
>   */
> -static int   dgnc_start(void);
> -static int   dgnc_finalize_board_init(struct dgnc_board *brd);
> -static void  dgnc_init_globals(void);
> -static int   dgnc_found_board(struct pci_dev *pdev, int id);
> -static void  dgnc_cleanup_board(struct dgnc_board *brd);
> -static void  dgnc_poll_handler(ulong dummy);
> -static int   dgnc_init_one(struct pci_dev *pdev, const struct 
> pci_device_id *ent);
> -static void  dgnc_do_remap(struct dgnc_board *brd);
> +static int dgnc_start(void);
> +static int dgnc_finalize_board_init(struct dgnc_board *brd);
> +static void dgnc_init_globals(void);
> +static int dgnc_found_board(struct pci_dev *pdev, int id);
> +static void dgnc_cleanup_board(struct dgnc_board *brd);
> +static void dgnc_poll_handler(ulong dummy);
> +static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id 
> *ent);
> +static void dgnc_do_remap(struct dgnc_board *brd);

Better still would be to eventually rearrange the code
to avoid the need for static forward declarations.


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


Re: [PATCH] staging: davinci_vpfe: fix space prohibited before semicolon warning

2015-01-20 Thread Lad, Prabhakar
Hi,

Thanks for the patch.

On Wed, Jan 14, 2015 at 9:46 PM, Aya Mahfouz
 wrote:
> This patch fixes the following checkpatch.pl warning:
>
> space prohibited before semicolon
>
> Signed-off-by: Aya Mahfouz 

Acked-by: Lad, Prabhakar 

Regards,
--Prabhakar Lad

> ---
> v1: This patch applies to Greg's tree.
>
>  drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c 
> b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
> index 704fa20..a425f71 100644
> --- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
> +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
> @@ -901,7 +901,7 @@ static int ipipe_set_gbce_params(struct vpfe_ipipe_device 
> *ipipe, void *param)
> struct device *dev = ipipe->subdev.v4l2_dev->dev;
>
> if (!gbce_param) {
> -   memset(gbce, 0 , sizeof(struct vpfe_ipipe_gbce));
> +   memset(gbce, 0, sizeof(struct vpfe_ipipe_gbce));
> } else {
> memcpy(gbce, gbce_param, sizeof(struct vpfe_ipipe_gbce));
> if (ipipe_validate_gbce_params(gbce) < 0) {
> @@ -1086,7 +1086,7 @@ static int ipipe_set_car_params(struct 
> vpfe_ipipe_device *ipipe, void *param)
> struct vpfe_ipipe_car *car = &ipipe->config.car;
>
> if (!car_param) {
> -   memset(car , 0, sizeof(struct vpfe_ipipe_car));
> +   memset(car, 0, sizeof(struct vpfe_ipipe_car));
> } else {
> memcpy(car, car_param, sizeof(struct vpfe_ipipe_car));
> if (ipipe_validate_car_params(car) < 0) {
> --
> 1.9.3
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: fix davinci_vpfe: fix space prohibted before that ','

2015-01-20 Thread Lad, Prabhakar
Hi,

On Wed, Jan 21, 2015 at 4:52 AM, Ahmad Hassan  wrote:
> This patch fixes the following checkpatch.pl error:
> fix space prohibited before that ',' at line 904

Thanks for the patch, but there already exists a patch [1] fixing this.

[1] https://patchwork.linuxtv.org/patch/27912/

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


[PATCH] staging: fix davinci_vpfe: fix space prohibted before that ','

2015-01-20 Thread Ahmad Hassan
This patch fixes the following checkpatch.pl error:
fix space prohibited before that ',' at line 904
Signed-off-by: Ahmad Hassan 
---
 drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c 
b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
index 704fa20..b5ad7af 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
@@ -901,7 +901,7 @@ static int ipipe_set_gbce_params(struct vpfe_ipipe_device 
*ipipe, void *param)
struct device *dev = ipipe->subdev.v4l2_dev->dev;
 
if (!gbce_param) {
-   memset(gbce, 0 , sizeof(struct vpfe_ipipe_gbce));
+   memset(gbce, 0, sizeof(struct vpfe_ipipe_gbce));
} else {
memcpy(gbce, gbce_param, sizeof(struct vpfe_ipipe_gbce));
if (ipipe_validate_gbce_params(gbce) < 0) {
-- 
2.2.1

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


Re: [PATCH 1/2] mfd: rtsx_usb: Fix runtime PM deadlock

2015-01-20 Thread Lee Jones
On Tue, 20 Jan 2015, Roger Tseng wrote:

> On Mon, 2015-01-19 at 09:45 +, Lee Jones wrote:
> > On Thu, 15 Jan 2015, Roger Tseng wrote:
> > 
> > > sd_set_power_mode() in derived module drivers/mmc/host/rtsx_usb_sdmmc.c
> > > acquires dev_mutex and then calls pm_runtime_get_sync() to make sure the
> > > device is awake while initializing a newly inserted card. Once it is
> > > called during suspending state and explicitly before rtsx_usb_suspend()
> > > acquires the same dev_mutex, both routine deadlock and further hang the
> > > driver because pm_runtime_get_sync() waits the pending PM operations.
> > > 
> > > Fix this by using an empty suspend method. mmc_core always turns the
> > > LED off after a request is done and thus it is ok to remove the only
> > > rtsx_usb_turn_off_led() here.
> > > 
> > > Cc:  # v3.16+
> > > Fixes: 730876be2566 ("mfd: Add realtek USB card reader driver")
> > > Signed-off-by: Roger Tseng 
> > > ---
> > >  drivers/mfd/rtsx_usb.c | 9 -
> > >  1 file changed, 9 deletions(-)
> > 
> > Applied, thanks.
> > 
> I'm sorry but build bot from Intel just reported me that I forgot to
> delete an unused variable "ucr" between two commits. My bad.
> 
> Do I have a chance to send v2?

You're lucky I'm in a good mood. ;)

I fixed it already.

> > > diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
> > > index dbdd0faeb6ce..076694126e5d 100644
> > > --- a/drivers/mfd/rtsx_usb.c
> > > +++ b/drivers/mfd/rtsx_usb.c
> > > @@ -687,15 +687,6 @@ static int rtsx_usb_suspend(struct usb_interface 
> > > *intf, pm_message_t message)
> > >   dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n",
> > >   __func__, message.event);
> > >  
> > > - /*
> > > -  * Call to make sure LED is off during suspend to save more power.
> > > -  * It is NOT a permanent state and could be turned on anytime later.
> > > -  * Thus no need to call turn_on when resunming.
> > > -  */
> > > - mutex_lock(&ucr->dev_mutex);
> > > - rtsx_usb_turn_off_led(ucr);
> > > - mutex_unlock(&ucr->dev_mutex);
> > > -
> > >   return 0;
> > >  }
> > >  
> > 
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 1/3] Drivers: hv: check vmbus_device_create() return value in vmbus_process_offer()

2015-01-20 Thread Vitaly Kuznetsov
vmbus_device_create() result is not being checked in vmbus_process_offer() and
it can fail if kzalloc() fails. Add the check and do minor cleanup to avoid
additional duplication of "free_channel(); return;" block.

Reported-by: Jason Wang 
Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/channel_mgmt.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 2c59f03..01f2c2b 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -341,11 +341,10 @@ static void vmbus_process_offer(struct work_struct *work)
if (channel->sc_creation_callback != NULL)
channel->sc_creation_callback(newchannel);
 
-   return;
+   goto out;
}
 
-   free_channel(newchannel);
-   return;
+   goto err_free_chan;
}
 
/*
@@ -364,6 +363,8 @@ static void vmbus_process_offer(struct work_struct *work)
&newchannel->offermsg.offer.if_type,
&newchannel->offermsg.offer.if_instance,
newchannel);
+   if (!newchannel->device_obj)
+   goto err_free_chan;
 
/*
 * Add the new device to the bus. This will kick off device-driver
@@ -379,9 +380,12 @@ static void vmbus_process_offer(struct work_struct *work)
list_del(&newchannel->listentry);
spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
kfree(newchannel->device_obj);
-
-   free_channel(newchannel);
+   goto err_free_chan;
}
+out:
+   return;
+err_free_chan:
+   free_channel(newchannel);
 }
 
 enum {
-- 
1.9.3

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


[PATCH v3 0/3] Drivers: hv: vmbus: protect Offer/Rescind offer processing

2015-01-20 Thread Vitaly Kuznetsov
This patch series is a renamed successor of "[PATCH] Drivers: hv: vmbus:
serialize Offer and Rescind offer processing".

Changes from v2:
- Rename labels in vmbus_process_offer() ("out" -> "done_init_rescind" in
  PATCH 3/3, "error" -> "err_free_chan" in PATCH 1/3) [Dan Carpenter]
- Invert condition, update comment, and remove "out" label in
  vmbus_onoffer_rescind()

Changes from v1:
- Separate vmbus_device_create() return value check [K. Y. Srinivasan]
- Do not lose a rescind offer received during offer processing. Use renamed
(in [PATCH v2 2/3]) spinlock to protect simulteneous test-and-set workflow for
rescind and work fields. [K. Y. Srinivasan]

Vitaly Kuznetsov (3):
  Drivers: hv: check vmbus_device_create() return value in
vmbus_process_offer()
  Drivers: hv: rename sc_lock to the more generic lock
  Drivers: hv: vmbus: serialize Offer and Rescind offer

 drivers/hv/channel.c  |  6 +++---
 drivers/hv/channel_mgmt.c | 50 ---
 include/linux/hyperv.h|  7 ++-
 3 files changed, 43 insertions(+), 20 deletions(-)

-- 
1.9.3

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


[PATCH v3 2/3] Drivers: hv: rename sc_lock to the more generic lock

2015-01-20 Thread Vitaly Kuznetsov
sc_lock spinlock in struct vmbus_channel is being used to not only protect the
sc_list field, e.g. vmbus_open() function uses it to implement test-and-set
access to the state field. Rename it to the more generic 'lock' and add the
description.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/channel.c  |  6 +++---
 drivers/hv/channel_mgmt.c | 10 +-
 include/linux/hyperv.h|  7 ++-
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 433f72a..8608ed1 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -73,14 +73,14 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 
send_ringbuffer_size,
unsigned long flags;
int ret, t, err = 0;
 
-   spin_lock_irqsave(&newchannel->sc_lock, flags);
+   spin_lock_irqsave(&newchannel->lock, flags);
if (newchannel->state == CHANNEL_OPEN_STATE) {
newchannel->state = CHANNEL_OPENING_STATE;
} else {
-   spin_unlock_irqrestore(&newchannel->sc_lock, flags);
+   spin_unlock_irqrestore(&newchannel->lock, flags);
return -EINVAL;
}
-   spin_unlock_irqrestore(&newchannel->sc_lock, flags);
+   spin_unlock_irqrestore(&newchannel->lock, flags);
 
newchannel->onchannel_callback = onchannelcallback;
newchannel->channel_callback_context = context;
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 01f2c2b..c6fdd74 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -146,7 +146,7 @@ static struct vmbus_channel *alloc_channel(void)
return NULL;
 
spin_lock_init(&channel->inbound_lock);
-   spin_lock_init(&channel->sc_lock);
+   spin_lock_init(&channel->lock);
 
INIT_LIST_HEAD(&channel->sc_list);
INIT_LIST_HEAD(&channel->percpu_list);
@@ -246,9 +246,9 @@ static void vmbus_process_rescind_offer(struct work_struct 
*work)
spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
} else {
primary_channel = channel->primary_channel;
-   spin_lock_irqsave(&primary_channel->sc_lock, flags);
+   spin_lock_irqsave(&primary_channel->lock, flags);
list_del(&channel->sc_list);
-   spin_unlock_irqrestore(&primary_channel->sc_lock, flags);
+   spin_unlock_irqrestore(&primary_channel->lock, flags);
}
free_channel(channel);
 }
@@ -323,9 +323,9 @@ static void vmbus_process_offer(struct work_struct *work)
 * Process the sub-channel.
 */
newchannel->primary_channel = channel;
-   spin_lock_irqsave(&channel->sc_lock, flags);
+   spin_lock_irqsave(&channel->lock, flags);
list_add_tail(&newchannel->sc_list, &channel->sc_list);
-   spin_unlock_irqrestore(&channel->sc_lock, flags);
+   spin_unlock_irqrestore(&channel->lock, flags);
 
if (newchannel->target_cpu != get_cpu()) {
put_cpu();
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 476c685..02dd978 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -722,7 +722,12 @@ struct vmbus_channel {
 */
void (*sc_creation_callback)(struct vmbus_channel *new_sc);
 
-   spinlock_t sc_lock;
+   /*
+* The spinlock to protect the structure. It is being used to protect
+* test-and-set access to various attributes of the structure as well
+* as all sc_list operations.
+*/
+   spinlock_t lock;
/*
 * All Sub-channels of a primary channel are linked here.
 */
-- 
1.9.3

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


[PATCH v3 3/3] Drivers: hv: vmbus: serialize Offer and Rescind offer

2015-01-20 Thread Vitaly Kuznetsov
Commit 4b2f9abea52a ("staging: hv: convert channel_mgmt.c to not call
osd_schedule_callback")' was written under an assumption that we never receive
Rescind offer while we're still processing the initial Offer request. However,
the issue we fixed in 04a258c162a8 could be caused by this assumption not
always being true.

In particular, we need to protect against the following:
1) Receiving a Rescind offer after we do queue_work() for processing an Offer
   request and before we actually enter vmbus_process_offer(). work.func points
   to vmbus_process_offer() at this moment and in vmbus_onoffer_rescind() we do
   another queue_work() without a check so we'll enter vmbus_process_offer()
   twice.
2) Receiving a Rescind offer after we enter vmbus_process_offer() and
   especially after we set >state = CHANNEL_OPEN_STATE. Many things can go
   wrong in that case, e.g. we can call free_channel() while we're still using
   it.

Implement the required protection by changing work->func at the very end of
vmbus_process_offer() and checking work->func in vmbus_onoffer_rescind(). In
case we receive rescind offer during or before vmbus_process_offer() is done
we set rescind flag to true and we check it at the end of vmbus_process_offer()
so such offer will not get lost.

Suggested-by: Radim Krčmář 
Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/channel_mgmt.c | 30 ++
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index c6fdd74..877a944 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -279,9 +279,6 @@ static void vmbus_process_offer(struct work_struct *work)
int ret;
unsigned long flags;
 
-   /* The next possible work is rescind handling */
-   INIT_WORK(&newchannel->work, vmbus_process_rescind_offer);
-
/* Make sure this is a new offer */
spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
 
@@ -341,7 +338,7 @@ static void vmbus_process_offer(struct work_struct *work)
if (channel->sc_creation_callback != NULL)
channel->sc_creation_callback(newchannel);
 
-   goto out;
+   goto done_init_rescind;
}
 
goto err_free_chan;
@@ -382,7 +379,14 @@ static void vmbus_process_offer(struct work_struct *work)
kfree(newchannel->device_obj);
goto err_free_chan;
}
-out:
+done_init_rescind:
+   spin_lock_irqsave(&newchannel->lock, flags);
+   /* The next possible work is rescind handling */
+   INIT_WORK(&newchannel->work, vmbus_process_rescind_offer);
+   /* Check if rescind offer was already received */
+   if (newchannel->rescind)
+   queue_work(newchannel->controlwq, &newchannel->work);
+   spin_unlock_irqrestore(&newchannel->lock, flags);
return;
 err_free_chan:
free_channel(newchannel);
@@ -520,6 +524,7 @@ static void vmbus_onoffer_rescind(struct 
vmbus_channel_message_header *hdr)
 {
struct vmbus_channel_rescind_offer *rescind;
struct vmbus_channel *channel;
+   unsigned long flags;
 
rescind = (struct vmbus_channel_rescind_offer *)hdr;
channel = relid2channel(rescind->child_relid);
@@ -528,11 +533,20 @@ static void vmbus_onoffer_rescind(struct 
vmbus_channel_message_header *hdr)
/* Just return here, no channel found */
return;
 
+   spin_lock_irqsave(&channel->lock, flags);
channel->rescind = true;
+   /*
+* channel->work.func != vmbus_process_rescind_offer means we are still
+* processing offer request and the rescind offer processing should be
+* postponed. It will be done at the very end of vmbus_process_offer()
+* as rescind flag is being checked there.
+*/
+   if (channel->work.func == vmbus_process_rescind_offer)
+   /* work is initialized for vmbus_process_rescind_offer() from
+* vmbus_process_offer() where the channel got created */
+   queue_work(channel->controlwq, &channel->work);
 
-   /* work is initialized for vmbus_process_rescind_offer() from
-* vmbus_process_offer() where the channel got created */
-   queue_work(channel->controlwq, &channel->work);
+   spin_unlock_irqrestore(&channel->lock, flags);
 }
 
 /*
-- 
1.9.3

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


[PATCH 03/15] staging: unisys: Fix logical continuation checks in virthba.c

2015-01-20 Thread Benjamin Romer
From: Ken Depro 

This patch fixes checkpatch checks where the logical operator should be at the
end of the line above, not beginning the next line.

Signed-off-by: Ken Depro 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 38 
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 9ed858d..7dd9573 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -430,8 +430,8 @@ virthba_ISR(int irq, void *dev_id)
virthbainfo->interrupts_rcvd++;
pChannelHeader = virthbainfo->chinfo.queueinfo->chan;
if (((readq(&pChannelHeader->features)
- & ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS) != 0)
-   && ((readq(&pChannelHeader->features) &
+ & ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS) != 0) &&
+((readq(&pChannelHeader->features) &
 ULTRA_IO_DRIVER_DISABLES_INTS) !=
0)) {
virthbainfo->interrupts_disabled++;
@@ -808,9 +808,9 @@ virthba_abort_handler(struct scsi_cmnd *scsicmd)
scsidev = scsicmd->device;
for (vdisk = &((struct virthba_info *)scsidev->host->hostdata)->head;
 vdisk->next; vdisk = vdisk->next) {
-   if ((scsidev->channel == vdisk->channel)
-   && (scsidev->id == vdisk->id)
-   && (scsidev->lun == vdisk->lun)) {
+   if ((scsidev->channel == vdisk->channel) &&
+   (scsidev->id == vdisk->id) &&
+   (scsidev->lun == vdisk->lun)) {
if (atomic_read(&vdisk->error_count) <
VIRTHBA_ERROR_COUNT) {
atomic_inc(&vdisk->error_count);
@@ -834,9 +834,9 @@ virthba_bus_reset_handler(struct scsi_cmnd *scsicmd)
scsidev = scsicmd->device;
for (vdisk = &((struct virthba_info *)scsidev->host->hostdata)->head;
 vdisk->next; vdisk = vdisk->next) {
-   if ((scsidev->channel == vdisk->channel)
-   && (scsidev->id == vdisk->id)
-   && (scsidev->lun == vdisk->lun)) {
+   if ((scsidev->channel == vdisk->channel) &&
+   (scsidev->id == vdisk->id) &&
+   (scsidev->lun == vdisk->lun)) {
if (atomic_read(&vdisk->error_count) <
VIRTHBA_ERROR_COUNT) {
atomic_inc(&vdisk->error_count);
@@ -860,9 +860,9 @@ virthba_device_reset_handler(struct scsi_cmnd *scsicmd)
scsidev = scsicmd->device;
for (vdisk = &((struct virthba_info *)scsidev->host->hostdata)->head;
 vdisk->next; vdisk = vdisk->next) {
-   if ((scsidev->channel == vdisk->channel)
-   && (scsidev->id == vdisk->id)
-   && (scsidev->lun == vdisk->lun)) {
+   if ((scsidev->channel == vdisk->channel) &&
+   (scsidev->id == vdisk->id) &&
+   (scsidev->lun == vdisk->lun)) {
if (atomic_read(&vdisk->error_count) <
VIRTHBA_ERROR_COUNT) {
atomic_inc(&vdisk->error_count);
@@ -1132,9 +1132,9 @@ do_scsi_linuxstat(struct uiscmdrsp *cmdrsp, struct 
scsi_cmnd *scsicmd)
/* Okay see what our error_count is here */
for (vdisk = &((struct virthba_info *)scsidev->host->hostdata)->head;
 vdisk->next; vdisk = vdisk->next) {
-   if ((scsidev->channel != vdisk->channel)
-   || (scsidev->id != vdisk->id)
-   || (scsidev->lun != vdisk->lun))
+   if ((scsidev->channel != vdisk->channel) ||
+   (scsidev->id != vdisk->id) ||
+   (scsidev->lun != vdisk->lun))
continue;
 
if (atomic_read(&vdisk->error_count) < VIRTHBA_ERROR_COUNT) {
@@ -1170,8 +1170,8 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct 
scsi_cmnd *scsicmd)
struct virtdisk_info *vdisk;
 
scsidev = scsicmd->device;
-   if ((cmdrsp->scsi.cmnd[0] == INQUIRY)
-   && (cmdrsp->scsi.bufflen >= MIN_INQUIRY_RESULT_LEN)) {
+   if ((cmdrsp->scsi.cmnd[0] == INQUIRY) &&
+   (cmdrsp->scsi.bufflen >= MIN_INQUIRY_RESULT_LEN)) {
if (cmdrsp->scsi.no_disk_result == 0)
return;
 
@@ -1211,9 +1211,9 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct 
scsi_cmnd *scsicmd)
 
vdisk = &((struct virthba_info *)scsidev->host->hostdata)->head;
for ( ; vdisk->next; vdisk = vdisk->next) {
-   if ((scsidev->channel != vdisk->channel)
-   || (scsidev->id != vdisk->id)
-   || (scsidev->lun != vdisk->lun))
+   if ((

[PATCH 12/15] staging: unisys: Fix CamelCase for function names in virthba.c

2015-01-20 Thread Benjamin Romer
From: Ken Depro 

This patch fixes CamelCase function names in virthba.c, reported by the
checkpatch script:
  doDiskAddRemove --> do_disk_add_remove
  SendDiskAddRemove --> send_disk_add_remove

Signed-off-by: Ken Depro 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index a82ceb2..63ebc53 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -108,7 +108,7 @@ static void virthba_slave_destroy(struct scsi_device 
*scsidev);
 static int process_incoming_rsps(void *);
 static int virthba_serverup(struct virtpci_dev *virtpcidev);
 static int virthba_serverdown(struct virtpci_dev *virtpcidev, u32 state);
-static void doDiskAddRemove(struct work_struct *work);
+static void do_disk_add_remove(struct work_struct *work);
 static void virthba_serverdown_complete(struct work_struct *work);
 static ssize_t info_debugfs_read(struct file *file, char __user *buf,
 size_t len, loff_t *offset);
@@ -344,7 +344,7 @@ static unsigned short dar_work_queue_sched;
 }
 
 static inline void
-SendDiskAddRemove(struct diskaddremove *dar)
+send_disk_add_remove(struct diskaddremove *dar)
 {
struct scsi_device *sdev;
int error;
@@ -371,7 +371,7 @@ SendDiskAddRemove(struct diskaddremove *dar)
 /* dar_work_queue Handler Thread */
 /*/
 static void
-doDiskAddRemove(struct work_struct *work)
+do_disk_add_remove(struct work_struct *work)
 {
struct diskaddremove *dar;
struct diskaddremove *tmphead;
@@ -386,7 +386,7 @@ doDiskAddRemove(struct work_struct *work)
while (tmphead) {
dar = tmphead;
tmphead = dar->next;
-   SendDiskAddRemove(dar);
+   send_disk_add_remove(dar);
i++;
}
 }
@@ -1672,7 +1672,7 @@ virthba_mod_init(void)
virthba_debugfs_dir, NULL,
&debugfs_enable_ints_fops);
/* Initialize dar_work_queue */
-   INIT_WORK(&dar_work_queue, doDiskAddRemove);
+   INIT_WORK(&dar_work_queue, do_disk_add_remove);
spin_lock_init(&dar_work_queue_lock);
 
/* clear out array */
-- 
2.1.0

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


[PATCH 14/15] staging: unisys: fix CamelCase name in virthba_probe()

2015-01-20 Thread Benjamin Romer
Fix CamelCase local variable name:

pChannelHeader => channel_header

Update references to use the new name.

Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 400bb7a..ff780c9 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -463,7 +463,7 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct 
pci_device_id *id)
int rsp;
int i;
irq_handler_t handler = virthba_isr;
-   struct channel_header __iomem *pChannelHeader;
+   struct channel_header __iomem *channel_header;
struct signal_queue_header __iomem *pqhdr;
u64 mask;
 
@@ -587,10 +587,10 @@ virthba_probe(struct virtpci_dev *virtpcidev, const 
struct pci_device_id *id)
DBGINF("starting rsp thread -- queueinfo: 0x%p, threadinfo: 0x%p.\n",
   virthbainfo->chinfo.queueinfo, &virthbainfo->chinfo.threadinfo);
 
-   pChannelHeader = virthbainfo->chinfo.queueinfo->chan;
+   channel_header = virthbainfo->chinfo.queueinfo->chan;
pqhdr = (struct signal_queue_header __iomem *)
-   ((char __iomem *)pChannelHeader +
-readq(&pChannelHeader->ch_space_offset)) + IOCHAN_FROM_IOPART;
+   ((char __iomem *)channel_header +
+readq(&channel_header->ch_space_offset)) + IOCHAN_FROM_IOPART;
virthbainfo->flags_addr = &pqhdr->features;
 
if (!uisthread_start(&virthbainfo->chinfo.threadinfo,
-- 
2.1.0

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


[PATCH 07/15] staging: unisys: Fix "else not useful after return" warning in virthba.c

2015-01-20 Thread Benjamin Romer
From: Ken Depro 

This patch fixes a warning generated during the checkpatch script that stated
"else not useful after return".  I modified the code to return a designated
status at the end of the function, and replaced the return statement in the
"else if" to set the status accordingly.

Signed-off-by: Ken Depro 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 55017f5d..30c62fb 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -1584,6 +1584,8 @@ virthba_serverdown_complete(struct work_struct *work)
 static int
 virthba_serverdown(struct virtpci_dev *virtpcidev, u32 state)
 {
+   int stat = 1;
+
struct virthba_info *virthbainfo =
(struct virthba_info *)((struct Scsi_Host *)virtpcidev->scsi.
 scsihost)->hostdata;
@@ -1598,11 +1600,12 @@ virthba_serverdown(struct virtpci_dev *virtpcidev, u32 
state)
   &virthbainfo->serverdown_completion);
} else if (virthbainfo->serverchangingstate) {
LOGERR("Server already processing change state message\n");
-   return 0;
-   } else
+   stat = 0;
+   } else {
LOGERR("Server already down, but another server down message 
received.");
+   }
 
-   return 1;
+   return stat;
 }
 
 /*/
-- 
2.1.0

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


[PATCH 01/15] staging: unisys: Remove unneeded spaces after casts in virthba.c

2015-01-20 Thread Benjamin Romer
From: Ken Depro 

This patch removes all unnecessary spaces after casts, as reported by the
checkpatch script.

Signed-off-by: Ken Depro 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 130 +++
 1 file changed, 65 insertions(+), 65 deletions(-)

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

[PATCH 04/15] staging: unisys: Remove blank lines before/after braces in virthba.c

2015-01-20 Thread Benjamin Romer
From: Ken Depro 

This patch removes unnecessary blank lines either before opening braces or
after closing braces, as reported by the checkpatch script.

Signed-off-by: Ken Depro 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 7dd9573..3ebbbcb 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -990,7 +990,6 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd,
sgl = scsi_sglist(scsicmd);
 
for_each_sg(sgl, sg, scsi_sg_count(scsicmd), i) {
-
cmdrsp->scsi.gpi_list[i].address = sg_phys(sg);
cmdrsp->scsi.gpi_list[i].length = sg->length;
if ((i != 0) && (sg->offset != 0))
@@ -1208,7 +1207,6 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct 
scsi_cmnd *scsicmd)
bufind += sg[i].length;
}
} else {
-
vdisk = &((struct virthba_info *)scsidev->host->hostdata)->head;
for ( ; vdisk->next; vdisk = vdisk->next) {
if ((scsidev->channel != vdisk->channel) ||
@@ -1656,7 +1654,6 @@ virthba_mod_init(void)
POSTCODE_LINUX_3(VHBA_CREATE_FAILURE_PC, error,
 POSTCODE_SEVERITY_ERR);
} else {
-
/* create the debugfs directories and entries */
virthba_debugfs_dir = debugfs_create_dir("virthba", NULL);
debugfs_create_file("info", S_IRUSR, virthba_debugfs_dir,
@@ -1747,7 +1744,6 @@ virthba_mod_exit(void)
 
debugfs_remove_recursive(virthba_debugfs_dir);
LOGINF("Leaving virthba_mod_exit\n");
-
 }
 
 /* specify function to be run at module insertion time */
-- 
2.1.0

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


[PATCH 11/15] staging: unisys: Fix remaining CamelCase global variables in virthba.c

2015-01-20 Thread Benjamin Romer
From: Ken Depro 

This patch fixes the remaining CamelCase global variables in virthba.c reported
by the checkpatch script:
  MaxBuffLen --> max_buff_len
  VirtHbasOpen --> virthbas_open

Signed-off-by: Ken Depro 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 5176e35..a82ceb2 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -121,7 +121,7 @@ static ssize_t enable_ints_write(struct file *file,
 /*/
 
 static int rsltq_wait_usecs = 4000;/* Default 4ms */
-static unsigned int MaxBuffLen;
+static unsigned int max_buff_len;
 
 /* Module options */
 static char *virthba_options = "NONE";
@@ -247,7 +247,7 @@ static const struct file_operations 
debugfs_enable_ints_fops = {
 
 #define VIRTHBASOPENMAX 1
 /* array of open devices maintained by open() and close(); */
-static struct virthba_devices_open VirtHbasOpen[VIRTHBASOPENMAX];
+static struct virthba_devices_open virthbas_open[VIRTHBASOPENMAX];
 static struct dentry *virthba_debugfs_dir;
 
 /*/
@@ -550,8 +550,8 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct 
pci_device_id *id)
virthbainfo = (struct virthba_info *)scsihost->hostdata;
memset(virthbainfo, 0, sizeof(struct virthba_info));
for (i = 0; i < VIRTHBASOPENMAX; i++) {
-   if (VirtHbasOpen[i].virthbainfo == NULL) {
-   VirtHbasOpen[i].virthbainfo = virthbainfo;
+   if (virthbas_open[i].virthbainfo == NULL) {
+   virthbas_open[i].virthbainfo = virthbainfo;
break;
}
}
@@ -964,8 +964,8 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd,
cmdrsp->scsi.bufflen = scsi_bufflen(scsicmd);
 
/* keep track of the max buffer length so far. */
-   if (cmdrsp->scsi.bufflen > MaxBuffLen)
-   MaxBuffLen = cmdrsp->scsi.bufflen;
+   if (cmdrsp->scsi.bufflen > max_buff_len)
+   max_buff_len = cmdrsp->scsi.bufflen;
 
if (scsi_sg_count(scsicmd) > MAX_PHYS_INFO) {
LOGERR("scsicmd use_sg:%d greater than MAX:%d\n",
@@ -1386,13 +1386,14 @@ static ssize_t info_debugfs_read(struct file *file,
return -ENOMEM;
 
for (i = 0; i < VIRTHBASOPENMAX; i++) {
-   if (VirtHbasOpen[i].virthbainfo == NULL)
+   if (virthbas_open[i].virthbainfo == NULL)
continue;
 
-   virthbainfo = VirtHbasOpen[i].virthbainfo;
+   virthbainfo = virthbas_open[i].virthbainfo;
 
str_pos += scnprintf(vbuf + str_pos,
-   len - str_pos, "MaxBuffLen:%u\n", MaxBuffLen);
+   len - str_pos, "max_buff_len:%u\n",
+   max_buff_len);
 
str_pos += scnprintf(vbuf + str_pos, len - str_pos,
"\nvirthba result queue poll wait:%d usecs.\n",
@@ -1451,8 +1452,8 @@ static ssize_t enable_ints_write(struct file *file, const 
char __user *buffer,
 
/* set all counts to new_value usually 0 */
for (i = 0; i < VIRTHBASOPENMAX; i++) {
-   if (VirtHbasOpen[i].virthbainfo != NULL) {
-   virthbainfo = VirtHbasOpen[i].virthbainfo;
+   if (virthbas_open[i].virthbainfo != NULL) {
+   virthbainfo = virthbas_open[i].virthbainfo;
Features_addr =
&virthbainfo->chinfo.queueinfo->chan->features;
if (new_value == 1) {
@@ -1676,7 +1677,7 @@ virthba_mod_init(void)
 
/* clear out array */
for (i = 0; i < VIRTHBASOPENMAX; i++)
-   VirtHbasOpen[i].virthbainfo = NULL;
+   virthbas_open[i].virthbainfo = NULL;
/* Initialize the serverdown workqueue */
virthba_serverdown_workqueue =
create_singlethread_workqueue("virthba_serverdown");
-- 
2.1.0

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


[PATCH 10/15] staging: unisys: Fix CamelCase for Disk Add/Remove global variables in virthba.c

2015-01-20 Thread Benjamin Romer
From: Ken Depro 

This patch fixes the Disk Add/Remove (DAR) related CamelCase global
variables in virthba.c, reported by the checkpatch script:
  DARWorkQ --> dar_work_queue
  DARWorkQHead --> dar_work_queue_head
  DARWorkQLock --> dar_work_queue_lock
  DARWorkQSched --> dar_work_queue_sched

Signed-off-by: Ken Depro 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 48 
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index ee11d89..5176e35 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -196,7 +196,7 @@ struct virthba_info {
struct virtdisk_info head;
 };
 
-/* Work Data for DARWorkQ */
+/* Work Data for dar_work_queue */
 struct diskaddremove {
u8 add; /* 0-remove, 1-add */
struct Scsi_Host *shost; /* Scsi Host for this virthba instance */
@@ -321,26 +321,26 @@ del_scsipending_entry(struct virthba_info *vhbainfo, 
uintptr_t del)
return sent;
 }
 
-/* DARWorkQ (Disk Add/Remove) */
-static struct work_struct DARWorkQ;
-static struct diskaddremove *DARWorkQHead;
-static spinlock_t DARWorkQLock;
-static unsigned short DARWorkQSched;
+/* dar_work_queue (Disk Add/Remove) */
+static struct work_struct dar_work_queue;
+static struct diskaddremove *dar_work_queue_head;
+static spinlock_t dar_work_queue_lock;
+static unsigned short dar_work_queue_sched;
 #define QUEUE_DISKADDREMOVE(dar) { \
-   spin_lock_irqsave(&DARWorkQLock, flags); \
-   if (!DARWorkQHead) { \
-   DARWorkQHead = dar; \
+   spin_lock_irqsave(&dar_work_queue_lock, flags); \
+   if (!dar_work_queue_head) { \
+   dar_work_queue_head = dar; \
dar->next = NULL; \
} \
else { \
-   dar->next = DARWorkQHead; \
-   DARWorkQHead = dar; \
+   dar->next = dar_work_queue_head; \
+   dar_work_queue_head = dar; \
} \
-   if (!DARWorkQSched) { \
-   schedule_work(&DARWorkQ); \
-   DARWorkQSched = 1; \
+   if (!dar_work_queue_sched) { \
+   schedule_work(&dar_work_queue); \
+   dar_work_queue_sched = 1; \
} \
-   spin_unlock_irqrestore(&DARWorkQLock, flags); \
+   spin_unlock_irqrestore(&dar_work_queue_lock, flags); \
 }
 
 static inline void
@@ -368,7 +368,7 @@ SendDiskAddRemove(struct diskaddremove *dar)
 }
 
 /*/
-/* DARWorkQ Handler Thread   */
+/* dar_work_queue Handler Thread */
 /*/
 static void
 doDiskAddRemove(struct work_struct *work)
@@ -378,11 +378,11 @@ doDiskAddRemove(struct work_struct *work)
int i = 0;
unsigned long flags;
 
-   spin_lock_irqsave(&DARWorkQLock, flags);
-   tmphead = DARWorkQHead;
-   DARWorkQHead = NULL;
-   DARWorkQSched = 0;
-   spin_unlock_irqrestore(&DARWorkQLock, flags);
+   spin_lock_irqsave(&dar_work_queue_lock, flags);
+   tmphead = dar_work_queue_head;
+   dar_work_queue_head = NULL;
+   dar_work_queue_sched = 0;
+   spin_unlock_irqrestore(&dar_work_queue_lock, flags);
while (tmphead) {
dar = tmphead;
tmphead = dar->next;
@@ -392,7 +392,7 @@ doDiskAddRemove(struct work_struct *work)
 }
 
 /*/
-/* Routine to add entry to DARWorkQ  */
+/* Routine to add entry to dar_work_queue*/
 /*/
 static void
 process_disk_notify(struct Scsi_Host *shost, struct uiscmdrsp *cmdrsp)
@@ -1671,8 +1671,8 @@ virthba_mod_init(void)
virthba_debugfs_dir, NULL,
&debugfs_enable_ints_fops);
/* Initialize dar_work_queue */
-   INIT_WORK(&DARWorkQ, doDiskAddRemove);
-   spin_lock_init(&DARWorkQLock);
+   INIT_WORK(&dar_work_queue, doDiskAddRemove);
+   spin_lock_init(&dar_work_queue_lock);
 
/* clear out array */
for (i = 0; i < VIRTHBASOPENMAX; i++)
-- 
2.1.0

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


[PATCH 13/15] staging: unisys: refactor virthba_ISR()

2015-01-20 Thread Benjamin Romer
Fix CamelCase names:

virthba_ISR => virthba_isr
pChannelHeader => channel_header

Update all references to the modified names.

Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 63ebc53..400bb7a 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -419,10 +419,10 @@ process_disk_notify(struct Scsi_Host *shost, struct 
uiscmdrsp *cmdrsp)
 /* Probe Remove Functions*/
 /*/
 static irqreturn_t
-virthba_ISR(int irq, void *dev_id)
+virthba_isr(int irq, void *dev_id)
 {
struct virthba_info *virthbainfo = (struct virthba_info *)dev_id;
-   struct channel_header __iomem *pChannelHeader;
+   struct channel_header __iomem *channel_header;
struct signal_queue_header __iomem *pqhdr;
u64 mask;
unsigned long long rc1;
@@ -430,23 +430,23 @@ virthba_ISR(int irq, void *dev_id)
if (virthbainfo == NULL)
return IRQ_NONE;
virthbainfo->interrupts_rcvd++;
-   pChannelHeader = virthbainfo->chinfo.queueinfo->chan;
-   if (((readq(&pChannelHeader->features)
+   channel_header = virthbainfo->chinfo.queueinfo->chan;
+   if (((readq(&channel_header->features)
  & ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS) != 0) &&
-((readq(&pChannelHeader->features) &
+((readq(&channel_header->features) &
 ULTRA_IO_DRIVER_DISABLES_INTS) !=
0)) {
virthbainfo->interrupts_disabled++;
mask = ~ULTRA_CHANNEL_ENABLE_INTS;
rc1 = uisqueue_interlocked_and(virthbainfo->flags_addr, mask);
}
-   if (spar_signalqueue_empty(pChannelHeader, IOCHAN_FROM_IOPART)) {
+   if (spar_signalqueue_empty(channel_header, IOCHAN_FROM_IOPART)) {
virthbainfo->interrupts_notme++;
return IRQ_NONE;
}
pqhdr = (struct signal_queue_header __iomem *)
-   ((char __iomem *)pChannelHeader +
-readq(&pChannelHeader->ch_space_offset)) + IOCHAN_FROM_IOPART;
+   ((char __iomem *)channel_header +
+readq(&channel_header->ch_space_offset)) + IOCHAN_FROM_IOPART;
writeq(readq(&pqhdr->num_irq_received) + 1,
   &pqhdr->num_irq_received);
atomic_set(&virthbainfo->interrupt_rcvd, 1);
@@ -462,7 +462,7 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct 
pci_device_id *id)
struct virthba_info *virthbainfo;
int rsp;
int i;
-   irq_handler_t handler = virthba_ISR;
+   irq_handler_t handler = virthba_isr;
struct channel_header __iomem *pChannelHeader;
struct signal_queue_header __iomem *pqhdr;
u64 mask;
-- 
2.1.0

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


[PATCH 05/15] staging: unisys: Change alloc calls to use var name instead of type in virthba.c

2015-01-20 Thread Benjamin Romer
From: Ken Depro 

This patch changes a couple of kzalloc calls to pass the variable name to the
call, rather than the variable struct type.  This is a result of checks
generated during the checkpatch script.

Signed-off-by: Ken Depro 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 3ebbbcb..28d11af 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -398,7 +398,7 @@ process_disk_notify(struct Scsi_Host *shost, struct 
uiscmdrsp *cmdrsp)
struct diskaddremove *dar;
unsigned long flags;
 
-   dar = kzalloc(sizeof(struct diskaddremove), GFP_ATOMIC);
+   dar = kzalloc(sizeof(*dar), GFP_ATOMIC);
if (dar) {
dar->add = cmdrsp->disknotify.add;
dar->shost = shost;
@@ -1061,7 +1061,7 @@ virthba_slave_alloc(struct scsi_device *scsidev)
(vdisk->next->lun == scsidev->lun))
return 0;
}
-   tmpvdisk = kzalloc(sizeof(struct virtdisk_info), GFP_ATOMIC);
+   tmpvdisk = kzalloc(sizeof(*tmpvdisk), GFP_ATOMIC);
if (!tmpvdisk) {/* error allocating */
LOGERR("Could not allocate memory for disk\n");
return 0;
-- 
2.1.0

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


[PATCH 00/15] Virthba cleanup series

2015-01-20 Thread Benjamin Romer
This patch set cleans up warnings, errors, and strict checks generated by
checkpatch.pl against the virthba driver.

Some of these patches were submitted as part of a larger set, but they were not
considered due to an earlier patch in the set not being accepted. Those patches
have been reworked slightly and the commit comments reworded.

Benjamin Romer (3):
  staging: unisys: refactor virthba_ISR()
  staging: unisys: fix CamelCase name in virthba_probe()
  staging: unisys: fix CamelCase in enable_ints_write()

Ken Depro (12):
  staging: unisys: Remove unneeded spaces after casts in virthba.c
  staging: unisys: Fix open parenthesis alignment checks in virthba.c
  staging: unisys: Fix logical continuation checks in virthba.c
  staging: unisys: Remove blank lines before/after braces in virthba.c
  staging: unisys: Change alloc calls to use var name instead of type in
virthba.c
  staging: unisys: fix checkpatch checks for structs in virthba.c
  staging: unisys: Fix "else not useful after return" warning in
virthba.c
  staging: unisys: Fix warnings regarding lines over 80 characters in
virthba.c
  staging: unisys: Fix open parenthesis alignment issues in virthba.c
  staging: unisys: Fix CamelCase for Disk Add/Remove global variables in
virthba.c
  staging: unisys: Fix remaining CamelCase global variables in virthba.c
  staging: unisys: Fix CamelCase for function names in virthba.c

 drivers/staging/unisys/virthba/virthba.c | 349 ---
 1 file changed, 177 insertions(+), 172 deletions(-)

-- 
2.1.0

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


[PATCH 08/15] staging: unisys: Fix warnings regarding lines over 80 characters in virthba.c

2015-01-20 Thread Benjamin Romer
From: Ken Depro 

This patch fixes warnings generated by checkpatch script regarding lines
over 80 characters long.

Signed-off-by: Ken Depro 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 30c62fb..9a6e67d 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -85,7 +85,8 @@ static int virthba_host_reset_handler(struct scsi_cmnd 
*scsicmd);
 static const char *virthba_get_info(struct Scsi_Host *shp);
 static int virthba_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
 static int virthba_queue_command_lck(struct scsi_cmnd *scsicmd,
-void (*virthba_cmnd_done)(struct scsi_cmnd 
*));
+void (*virthba_cmnd_done)
+  (struct scsi_cmnd *));
 
 static const struct x86_cpu_id unisys_spar_ids[] = {
{ X86_VENDOR_INTEL, 6, 62, X86_FEATURE_ANY },
-- 
2.1.0

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


[PATCH 02/15] staging: unisys: Fix open parenthesis alignment checks in virthba.c

2015-01-20 Thread Benjamin Romer
From: Ken Depro 

This patch fixes the "alignment should match open parenthesis" checks from the
checkpatch script.

Signed-off-by: Ken Depro 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 43 
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 3c36653..9ed858d 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -110,9 +110,10 @@ static int virthba_serverdown(struct virtpci_dev 
*virtpcidev, u32 state);
 static void doDiskAddRemove(struct work_struct *work);
 static void virthba_serverdown_complete(struct work_struct *work);
 static ssize_t info_debugfs_read(struct file *file, char __user *buf,
-   size_t len, loff_t *offset);
+size_t len, loff_t *offset);
 static ssize_t enable_ints_write(struct file *file,
-   const char __user *buffer, size_t count, loff_t *ppos);
+const char __user *buffer, size_t count,
+loff_t *ppos);
 
 /*/
 /* Globals   */
@@ -994,17 +995,17 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd,
cmdrsp->scsi.gpi_list[i].length = sg->length;
if ((i != 0) && (sg->offset != 0))
LOGINF("Offset on a sg_entry other than zero 
=<<%d>>.\n",
-sg->offset);
+  sg->offset);
}
 
if (sg_failed) {
LOGERR("Start sg_list dump (entries %d, bufflen 
%d)...\n",
-scsi_sg_count(scsicmd), cmdrsp->scsi.bufflen);
+  scsi_sg_count(scsicmd), cmdrsp->scsi.bufflen);
for_each_sg(sgl, sg, scsi_sg_count(scsicmd), i) {
LOGERR("   Entry(%d): page->[0x%p], 
phys->[0x%Lx], off(%d), len(%d)\n",
-i, sg_page(sg),
-(unsigned long long)sg_phys(sg),
-sg->offset, sg->length);
+  i, sg_page(sg),
+  (unsigned long long)sg_phys(sg),
+  sg->offset, sg->length);
}
LOGERR("Done sg_list dump.\n");
/* BUG(); * For now, let it fail in uissd
@@ -1148,8 +1149,8 @@ do_scsi_linuxstat(struct uiscmdrsp *cmdrsp, struct 
scsi_cmnd *scsicmd)
if (atomic_read(&vdisk->error_count) ==
VIRTHBA_ERROR_COUNT) {
LOGERR("Throtling SCSICMD errors disk 
<%d:%d:%d:%llu>\n",
-scsidev->host->host_no, scsidev->id,
-scsidev->channel, scsidev->lun);
+  scsidev->host->host_no, scsidev->id,
+  scsidev->channel, scsidev->lun);
}
atomic_set(&vdisk->ios_threshold, IOS_ERROR_THRESHOLD);
}
@@ -1198,7 +1199,7 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct 
scsi_cmnd *scsicmd)
sg = scsi_sglist(scsicmd);
for (i = 0; i < scsi_sg_count(scsicmd); i++) {
DBGVER("copying OUT OF buf into 0x%p %d\n",
-sg_page(sg + i), sg[i].length);
+  sg_page(sg + i), sg[i].length);
thispage_orig = kmap_atomic(sg_page(sg + i));
thispage = (void *)((unsigned long)thispage_orig |
 sg[i].offset);
@@ -1267,7 +1268,7 @@ complete_taskmgmt_command(struct uiscmdrsp *cmdrsp)
 
 static void
 drain_queue(struct virthba_info *virthbainfo, struct chaninfo *dc,
-   struct uiscmdrsp *cmdrsp)
+   struct uiscmdrsp *cmdrsp)
 {
unsigned long flags;
int qrslt = 0;
@@ -1277,7 +1278,7 @@ drain_queue(struct virthba_info *virthbainfo, struct 
chaninfo *dc,
while (1) {
spin_lock_irqsave(&virthbainfo->chinfo.insertlock, flags);
if (!spar_channel_client_acquire_os(dc->queueinfo->chan,
-"vhba")) {
+   "vhba")) {
spin_unlock_irqrestore(&virthbainfo->chinfo.insertlock,
   flags);
virthbainfo->acquire_failed_cnt++;
@@ -1347,7 +1348,7 @@ process_incoming_rsps(void *v)
while (1) {
wait_event_interrupt

[PATCH 06/15] staging: unisys: fix checkpatch checks for structs in virthba.c

2015-01-20 Thread Benjamin Romer
From: Ken Depro 

This patch fixes a couple small issues reported by the checkpatch script:
  Adds a blank line after a struct definition.
  Removes unnecessary parentheses surrounding a dereference of a struct member.

Signed-off-by: Ken Depro 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 28d11af..55017f5d 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -166,6 +166,7 @@ struct virtdisk_info {
atomic_t error_count;
struct virtdisk_info *next;
 };
+
 /* Each Scsi_Host has a host_data area that contains this struct. */
 struct virthba_info {
struct Scsi_Host *scsihost;
@@ -1534,7 +1535,7 @@ virthba_serverdown_complete(struct work_struct *work)
/* Fail Commands that weren't completed */
spin_lock_irqsave(&virthbainfo->privlock, flags);
for (i = 0; i < MAX_PENDING_REQUESTS; i++) {
-   pendingdel = &(virthbainfo->pending[i]);
+   pendingdel = &virthbainfo->pending[i];
switch (pendingdel->cmdtype) {
case CMD_SCSI_TYPE:
scsicmd = (struct scsi_cmnd *)pendingdel->sent;
-- 
2.1.0

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


[PATCH 09/15] staging: unisys: Fix open parenthesis alignment issues in virthba.c

2015-01-20 Thread Benjamin Romer
From: Ken Depro 

This patch fixes a couple checkpatch checks where alignment of the parameters
did not match the open parenthesis of the function.

Signed-off-by: Ken Depro 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index 9a6e67d..ee11d89 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -1295,7 +1295,8 @@ drain_queue(struct virthba_info *virthbainfo, struct 
chaninfo *dc,
 * deletion
 */
scsicmd = del_scsipending_entry(virthbainfo,
-   (uintptr_t)cmdrsp->scsi.scsicmd);
+   (uintptr_t)
+cmdrsp->scsi.scsicmd);
if (!scsicmd)
break;
/* complete the orig cmd */
@@ -1314,7 +1315,8 @@ drain_queue(struct virthba_info *virthbainfo, struct 
chaninfo *dc,
process_disk_notify(shost, cmdrsp);
} else if (cmdrsp->cmdtype == CMD_VDISKMGMT_TYPE) {
if (!del_scsipending_entry(virthbainfo,
-  (uintptr_t)cmdrsp->vdiskmgmt.scsicmd))
+  (uintptr_t)
+   cmdrsp->vdiskmgmt.scsicmd))
break;
complete_vdiskmgmt_command(cmdrsp);
} else
-- 
2.1.0

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


[PATCH 15/15] staging: unisys: fix CamelCase in enable_ints_write()

2015-01-20 Thread Benjamin Romer
Fix CamelCase variable name:

Features_addr => features_addr

Update references to use the new name.

Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/virthba/virthba.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index ff780c9..8cd090b 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -1429,7 +1429,7 @@ static ssize_t enable_ints_write(struct file *file, const 
char __user *buffer,
int i, new_value;
struct virthba_info *virthbainfo;
 
-   u64 __iomem *Features_addr;
+   u64 __iomem *features_addr;
u64 mask;
 
if (count >= ARRAY_SIZE(buf))
@@ -1454,21 +1454,21 @@ static ssize_t enable_ints_write(struct file *file, 
const char __user *buffer,
for (i = 0; i < VIRTHBASOPENMAX; i++) {
if (virthbas_open[i].virthbainfo != NULL) {
virthbainfo = virthbas_open[i].virthbainfo;
-   Features_addr =
+   features_addr =
&virthbainfo->chinfo.queueinfo->chan->features;
if (new_value == 1) {
mask = ~(ULTRA_IO_CHANNEL_IS_POLLING |
 ULTRA_IO_DRIVER_DISABLES_INTS);
-   uisqueue_interlocked_and(Features_addr, mask);
+   uisqueue_interlocked_and(features_addr, mask);
mask = ULTRA_IO_DRIVER_ENABLES_INTS;
-   uisqueue_interlocked_or(Features_addr, mask);
+   uisqueue_interlocked_or(features_addr, mask);
rsltq_wait_usecs = 400;
} else {
mask = ~(ULTRA_IO_DRIVER_ENABLES_INTS |
 ULTRA_IO_DRIVER_DISABLES_INTS);
-   uisqueue_interlocked_and(Features_addr, mask);
+   uisqueue_interlocked_and(features_addr, mask);
mask = ULTRA_IO_CHANNEL_IS_POLLING;
-   uisqueue_interlocked_or(Features_addr, mask);
+   uisqueue_interlocked_or(features_addr, mask);
rsltq_wait_usecs = 4000;
}
}
-- 
2.1.0

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


Re: [PATCH v5 1/6] mfd: rtsx: add func to split u32 into register

2015-01-20 Thread Lee Jones
On Tue, 23 Dec 2014, micky_ch...@realsil.com.cn wrote:

> From: Micky Ching 
> 
> Add helper function to write u32 to registers, if we want to put u32
> value to 4 continuous register, this can help us reduce tedious work.
> 
> Signed-off-by: Micky Ching 
> Acked-by: Lee Jones 
> ---
>  include/linux/mfd/rtsx_pci.h | 9 +
>  1 file changed, 9 insertions(+)

Applied, thanks.

> diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
> index 74346d5..9234449 100644
> --- a/include/linux/mfd/rtsx_pci.h
> +++ b/include/linux/mfd/rtsx_pci.h
> @@ -558,6 +558,7 @@
>  #define SD_SAMPLE_POINT_CTL  0xFDA7
>  #define SD_PUSH_POINT_CTL0xFDA8
>  #define SD_CMD0  0xFDA9
> +#define   SD_CMD_START   0x40
>  #define SD_CMD1  0xFDAA
>  #define SD_CMD2  0xFDAB
>  #define SD_CMD3  0xFDAC
> @@ -967,4 +968,12 @@ static inline u8 *rtsx_pci_get_cmd_data(struct rtsx_pcr 
> *pcr)
>   return (u8 *)(pcr->host_cmds_ptr);
>  }
>  
> +static inline void rtsx_pci_write_be32(struct rtsx_pcr *pcr, u16 reg, u32 
> val)
> +{
> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg, 0xFF, val >> 24);
> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 1, 0xFF, val >> 16);
> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 2, 0xFF, val >> 8);
> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 3, 0xFF, val);
> +}
> +
>  #endif

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: dgnc: warning line over 80 characters

2015-01-20 Thread Mohamed Lotfy Hammad
This patch fixes the following checkpatch.pl warning:
fix line over 80 characters 

Signed-off-by: Mohamed Lotfy Hammad 
---
 drivers/staging/dgnc/dgnc_driver.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index ba98ff3..050061e 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -54,14 +54,14 @@ MODULE_SUPPORTED_DEVICE("dgnc");
  * protos for this file
  *
  */
-static int dgnc_start(void);
-static int dgnc_finalize_board_init(struct dgnc_board *brd);
-static voiddgnc_init_globals(void);
-static int dgnc_found_board(struct pci_dev *pdev, int id);
-static voiddgnc_cleanup_board(struct dgnc_board *brd);
-static voiddgnc_poll_handler(ulong dummy);
-static int dgnc_init_one(struct pci_dev *pdev, const struct 
pci_device_id *ent);
-static voiddgnc_do_remap(struct dgnc_board *brd);
+static int dgnc_start(void);
+static int dgnc_finalize_board_init(struct dgnc_board *brd);
+static void dgnc_init_globals(void);
+static int dgnc_found_board(struct pci_dev *pdev, int id);
+static void dgnc_cleanup_board(struct dgnc_board *brd);
+static void dgnc_poll_handler(ulong dummy);
+static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id 
*ent);
+static void dgnc_do_remap(struct dgnc_board *brd);
 
 /*
  * File operations permitted on Control/Management major.
-- 
2.1.0

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


Re: staging: fbtft: CONFIG_ARCH_BCM2708?

2015-01-20 Thread Noralf Trønnes

Den 20.01.2015 09:46, skrev Paul Bolle:

Thomas, Noralf,

Your commit c296d5f9957c ("staging: fbtft: core support") is included in
today's linux-next (ie, next-20150120). I noticed because a script I use
to check linux-next spotted a problem in it.

See, that commit adds two checks for CONFIG_ARCH_BCM2708. But there's no
Kconfig symbol ARCH_BCM2708. (A comment in
drivers/mmc/host/sdhci-bcm2835.c does suggest there's an out of tree
"Main bcm2708 linux port".)

Is the code to add the Kconfig symbol ARCH_BCM2708 queued somewhere?

Hi Paul,

ARCH_BCM2708 is used instead of ARCH_BCM2835 in the Raspberry Pi kernel 
fork.
The optimization code enabled by ARCH_BCM2708 in 
drivers/staging/fbtft/fbtft-io.c can be removed.

There will be another take on the I/O stage for those drivers later.

I can make a patch for this. Just need to find out how to setup git to 
send paches for me.


Thanks for spotting this.


Noralf.

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


Re: [PATCH 1/2] mfd: rtsx_usb: Fix runtime PM deadlock

2015-01-20 Thread Roger Tseng
On Mon, 2015-01-19 at 09:45 +, Lee Jones wrote:
> On Thu, 15 Jan 2015, Roger Tseng wrote:
> 
> > sd_set_power_mode() in derived module drivers/mmc/host/rtsx_usb_sdmmc.c
> > acquires dev_mutex and then calls pm_runtime_get_sync() to make sure the
> > device is awake while initializing a newly inserted card. Once it is
> > called during suspending state and explicitly before rtsx_usb_suspend()
> > acquires the same dev_mutex, both routine deadlock and further hang the
> > driver because pm_runtime_get_sync() waits the pending PM operations.
> > 
> > Fix this by using an empty suspend method. mmc_core always turns the
> > LED off after a request is done and thus it is ok to remove the only
> > rtsx_usb_turn_off_led() here.
> > 
> > Cc:  # v3.16+
> > Fixes: 730876be2566 ("mfd: Add realtek USB card reader driver")
> > Signed-off-by: Roger Tseng 
> > ---
> >  drivers/mfd/rtsx_usb.c | 9 -
> >  1 file changed, 9 deletions(-)
> 
> Applied, thanks.
> 
I'm sorry but build bot from Intel just reported me that I forgot to
delete an unused variable "ucr" between two commits. My bad.

Do I have a chance to send v2?

> > diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
> > index dbdd0faeb6ce..076694126e5d 100644
> > --- a/drivers/mfd/rtsx_usb.c
> > +++ b/drivers/mfd/rtsx_usb.c
> > @@ -687,15 +687,6 @@ static int rtsx_usb_suspend(struct usb_interface 
> > *intf, pm_message_t message)
> > dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n",
> > __func__, message.event);
> >  
> > -   /*
> > -* Call to make sure LED is off during suspend to save more power.
> > -* It is NOT a permanent state and could be turned on anytime later.
> > -* Thus no need to call turn_on when resunming.
> > -*/
> > -   mutex_lock(&ucr->dev_mutex);
> > -   rtsx_usb_turn_off_led(ucr);
> > -   mutex_unlock(&ucr->dev_mutex);
> > -
> > return 0;
> >  }
> >  
> 

-- 
Best regards,
Roger Tseng
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: comedi: das1800: prefer kmalloc_array over kmalloc with multiply

2015-01-20 Thread Ian Abbott

On 20/01/15 02:42, Chase Southwood wrote:

Checkpatch doesn't like kmalloc with multiply very much:
drivers/staging/comedi/drivers/das1800.c:1377: WARNING: Prefer kmalloc_array 
over kmalloc with multiply

So this patch swaps that use out for kmalloc_array instead.

Signed-off-by: Chase Southwood 
---
  drivers/staging/comedi/drivers/das1800.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 381ae94..13ed31c 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1374,7 +1374,7 @@ static int das1800_attach(struct comedi_device *dev,
if (dev->irq & it->options[2])
das1800_init_dma(dev, it);

-   devpriv->fifo_buf = kmalloc(FIFO_SIZE * sizeof(uint16_t), GFP_KERNEL);
+   devpriv->fifo_buf = kmalloc_array(FIFO_SIZE, sizeof(uint16_t), 
GFP_KERNEL);
if (!devpriv->fifo_buf)
return -ENOMEM;




Reviewed-by: Ian Abbott 

--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/3] Drivers: hv: check vmbus_device_create() return value in vmbus_process_offer()

2015-01-20 Thread Dan Carpenter
Fine.  Fine.  I saw the 3/3 patch after I wrote the email.  Anyway I
hope that my ranting has planted a seed of doubt and from now you will
begin to view "out" labels with suspicion which will eventually flourish
into the flower of hatred.

regards,
dan carpenter

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


[PATCH] staging: iio: tsl2583: fix format string warnings

2015-01-20 Thread Asaf Vertz
Fixed the following warnings (reported by cppcheck):
[drivers/staging/iio/light/tsl2583.c:695]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/staging/iio/light/tsl2583.c:695]: (warning) %d in format string (no. 2)
requires 'int' but the argument type is 'unsigned int'.
[drivers/staging/iio/light/tsl2583.c:695]: (warning) %d in format string (no. 3)
requires 'int' but the argument type is 'unsigned int'.

Signed-off-by: Asaf Vertz 
---
 drivers/staging/iio/light/tsl2583.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index cc4ddcc..8afae8e 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -692,7 +692,7 @@ static ssize_t taos_luxtable_show(struct device *dev,
int offset = 0;
 
for (i = 0; i < ARRAY_SIZE(taos_device_lux); i++) {
-   offset += sprintf(buf + offset, "%d,%d,%d,",
+   offset += sprintf(buf + offset, "%u,%u,%u,",
  taos_device_lux[i].ratio,
  taos_device_lux[i].ch0,
  taos_device_lux[i].ch1);
-- 
1.7.0.4

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


Re: [PATCH 06/10] mfd: rtsx: update phy register

2015-01-20 Thread Lee Jones
On Tue, 20 Jan 2015, 敬锐 wrote:
> On 01/19/2015 03:47 PM, Lee Jones wrote:
> > On Mon, 19 Jan 2015, 敬锐 wrote:
> >> >On 01/18/2015 08:29 PM, Lee Jones wrote:
> >>> > >On Thu, 15 Jan 2015,micky_ch...@realsil.com.cn  wrote:
> >>> > >
>  > >>From: Micky Ching
>  > >>
>  > >>update phy register value and using direct value instead of macros.
>  > >>It is much easier to debug using constant value than a lot of macros.
>  > >>We usually need compare the value directly to check the configure.
> >>> > >NACK.  This is the opposite of what I would like to see.
> >>> > >
> >> >When we debug, we usually need to compare the value provided from 
> >> >hardware,
> >> >of course we can compare by print them to kernel log. but I think it more
> >> >convenient from source code. And we only set phy register when
> >> >initialize chip,
> >> >so the value will not scattered everywhere, we will not benefit from 
> >> >macros.
> >> >
> >> >if we want to know the meaning of setting, we can look at the register
> >> >define.
> > This is not acceptable and is the complete opposite of what we're
> > trying to achieve.  I promote readability (by humans) as one of the
> > highest priorities when writing code.  0xFE6C is far from readable.
> >
> Because the truly thing we concerned is the address and value, not
> a lot of macros. 0xFE6C is a magic number, but a lot of macros
> even hide the magic number we curious. To verify if the source
> code is right, we only need to compare the value, if too much macros
> joined together, the work is boring and easy to inject errors.

I completely disagree and think the converse to be true.  It's _much_
easier to get the magic number incorrect.

> I hate magic number too, but in this case using magic number
> is deserved for correctness.
> 
> Two method can help enhance readability.
> (1). define register address and values
> If we want to know what the bit field means, we can jump to the register
> define. This is very easy by tag system.
> eg.
> rtsx_pci_write_phy_register(pcr, PHY_BPCR, 0x05C0);
> we can jump to PHY_BPCR to see bit-field define.
>
> (2). add comment for magic number.
> I don't like comment.
> 
> If you still like macro list, I will update the register next patch.

Defining register values and bit fields is the _correct_ way to do
this.  Using magic numbers is the _wrong_ way.

I'm sorry Micky, but I am not moving on this.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/3] Drivers: hv: check vmbus_device_create() return value in vmbus_process_offer()

2015-01-20 Thread Vitaly Kuznetsov
Dan Carpenter  writes:

> On Mon, Jan 19, 2015 at 05:56:11PM +0100, Vitaly Kuznetsov wrote:
>> vmbus_device_create() result is not being checked in vmbus_process_offer() 
>> and
>> it can fail if kzalloc() fails. Add the check and do minor cleanup to avoid
>> additional duplication of "free_channel(); return;" block.
>> 
>> Reported-by: Jason Wang 
>> Signed-off-by: Vitaly Kuznetsov 
>
> "out" is always a bad name for a label.  It's too vague.  It implies
> that the code uses "One Err" style error handling which is bug prone and
> I've ranted about that in the past so I won't here.  This kind of coding
> is buggier than direct returns.  But recently I've been looking at bugs
> where we return zero where the code should return a negative error code
> and, wow, do I hate "out" labels!
>
>   if (function_whatever(xxx))
>   goto out;
>
> [ thousands of lines removed. ]
>
> out:
>   return ret;
>
> Oh crap...  Did the coder mean to return success or not???
>
> If you use a direct return then the code looks like:
>
>   if (function_whatever(xxx))
>   return 0;
>
> In that case, you can immediately see that the coder typed "0"
> deliberately.  Direct returns are best.  I guess that's not directly
> related to this code.  But I didn't know that until I read to the bottom
> of the patch and I already had this rant prepared in my head ready to
> go...

Thank you for your rant, Dan! It contains an explanation _why_ and so is
useful. However ... :-)

1) vmbus_process_offer() returns void so we won't forget to set proper
return code.
2) this patch is a preparation for the PATCH 3/3 where the label is
being used to do some useful (non-trivial) work. "Direct returns"
approach would require us to duplicate the code or move it to a function
and call it from all return places. I consider adding "out" label being
less evil.

Anyway, I can rename it to something less provocative in PATCH 3/3,
e.g. init_rescind.

>
> "error" is a crap label name because it doesn't tell you what the code
> does.  A better name is "err_free_chan" or something which talks about
> freeing the channel.

And here I have to completely agree with you, I'll rename it in v3.

>
> regards,
> dan carpenter

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


[PATCH] staging: iio: tsl2x7x_core: fix format string warnings

2015-01-20 Thread Asaf Vertz
Fixed the following warnings (reported by cppcheck):
[drivers/staging/iio/light/tsl2x7x_core.c:1150]: (warning) %d in format string 
(no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/staging/iio/light/tsl2x7x_core.c:1150]: (warning) %d in format string 
(no. 2)
requires 'int' but the argument type is 'unsigned int'.
[drivers/staging/iio/light/tsl2x7x_core.c:1150]: (warning) %d in format string 
(no. 3)
requires 'int' but the argument type is 'unsigned int'.

Signed-off-by: Asaf Vertz 
---
 drivers/staging/iio/light/tsl2x7x_core.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2x7x_core.c 
b/drivers/staging/iio/light/tsl2x7x_core.c
index 423f96b..4a5dc26 100644
--- a/drivers/staging/iio/light/tsl2x7x_core.c
+++ b/drivers/staging/iio/light/tsl2x7x_core.c
@@ -1147,7 +1147,7 @@ static ssize_t tsl2x7x_luxtable_show(struct device *dev,
int offset = 0;
 
while (i < (TSL2X7X_MAX_LUX_TABLE_SIZE * 3)) {
-   offset += snprintf(buf + offset, PAGE_SIZE, "%d,%d,%d,",
+   offset += snprintf(buf + offset, PAGE_SIZE, "%u,%u,%u,",
chip->tsl2x7x_device_lux[i].ratio,
chip->tsl2x7x_device_lux[i].ch0,
chip->tsl2x7x_device_lux[i].ch1);
-- 
1.7.0.4

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


Re: [PATCH] staging: iio: ad5933: fix format string warnings

2015-01-20 Thread Lars-Peter Clausen

On 01/20/2015 08:25 AM, Asaf Vertz wrote:

Fixed the following warnings (reported by cppcheck):
[drivers/staging/iio/impedance-analyzer/ad5933.c:363]: (warning) %d in format 
string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/staging/iio/impedance-analyzer/ad5933.c:367]: (warning) %d in format 
string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/staging/iio/impedance-analyzer/ad5933.c:367]: (warning) %d in format 
string (no. 2)
requires 'int' but the argument type is 'unsigned int'.
[drivers/staging/iio/impedance-analyzer/ad5933.c:367]: (warning) %d in format 
string (no. 3)
requires 'int' but the argument type is 'unsigned int'.
[drivers/staging/iio/impedance-analyzer/ad5933.c:367]: (warning) %d in format 
string (no. 4)
requires 'int' but the argument type is 'unsigned int'.

Signed-off-by: Asaf Vertz 


Acked-by: Lars-Peter Clausen 

Thanks.


---
  drivers/staging/iio/impedance-analyzer/ad5933.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c 
b/drivers/staging/iio/impedance-analyzer/ad5933.c
index b6bd609..4230a43 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -360,11 +360,11 @@ static ssize_t ad5933_show(struct device *dev,
mutex_lock(&indio_dev->mlock);
switch ((u32) this_attr->address) {
case AD5933_OUT_RANGE:
-   len = sprintf(buf, "%d\n",
+   len = sprintf(buf, "%u\n",
  st->range_avail[(st->ctrl_hb >> 1) & 0x3]);
break;
case AD5933_OUT_RANGE_AVAIL:
-   len = sprintf(buf, "%d %d %d %d\n", st->range_avail[0],
+   len = sprintf(buf, "%u %u %u %u\n", st->range_avail[0],
  st->range_avail[3], st->range_avail[2],
  st->range_avail[1]);
break;



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


staging: fbtft: CONFIG_ARCH_BCM2708?

2015-01-20 Thread Paul Bolle
Thomas, Noralf, 

Your commit c296d5f9957c ("staging: fbtft: core support") is included in
today's linux-next (ie, next-20150120). I noticed because a script I use
to check linux-next spotted a problem in it.

See, that commit adds two checks for CONFIG_ARCH_BCM2708. But there's no
Kconfig symbol ARCH_BCM2708. (A comment in
drivers/mmc/host/sdhci-bcm2835.c does suggest there's an out of tree
"Main bcm2708 linux port".)

Is the code to add the Kconfig symbol ARCH_BCM2708 queued somewhere?

Thanks,


Paul Bolle

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