Re: [PATCH 25/73] staging/lustre: use 64-bit times in debug print

2015-09-28 Thread Arnd Bergmann
On Sunday 27 September 2015 23:57:30 Dilger, Andreas wrote:
> >diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c
> >b/drivers/staging/lustre/lustre/libcfs/debug.c
> >index e93f556..ae325f7 100644
> >--- a/drivers/staging/lustre/lustre/libcfs/debug.c
> >+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
> >@@ -452,8 +452,8 @@ void libcfs_debug_dumplog_internal(void *arg)
> > 
> >   if (strncmp(libcfs_debug_file_path_arr, "NONE", 4) != 0) {
> >   snprintf(debug_file_name, sizeof(debug_file_name) - 1,
> >-   "%s.%ld.%ld", libcfs_debug_file_path_arr,
> >-   get_seconds(), (long_ptr_t)arg);
> >+   "%s.%lld.%ld", libcfs_debug_file_path_arr,
> >+   (s64)ktime_get_real_seconds(), (long_ptr_t)arg);
> 
> One question about all of these patches - is "s64" always a "long long" or
> might it be just a "long" on some 64-bit platforms?

It's always 'long long' in the kernel, but always not in user space (ia64,
alpha, powerpc and mips). 

>  I recall times in the
> past where you needed to cast a __u64 to (unsigned long long) to avoid
> compiler warnings when using "%llu" in printk(), but maybe things have
> changed?  Otherwise, all of these patches need to be redone to cast the
> variables to "long long" before printing.

We fixed those a couple of years ago, and now we rely on s64 and u64 to
be 'long long' in a lot of places.

Reviewing what I did now, I find that a lot of the casts are actually
not needed, we only need it when printing the tv_sec portion of
a timespec64 (which is #defined to timespec with 'long tv_sec' on
64-bit architectures), but not for any of the plain time64_t variables,
which are already using 'long long'.

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


Re: [PATCH 04/73] staging/lustre: tracefile: document seconds overflow

2015-09-28 Thread Arnd Bergmann
On Monday 28 September 2015 00:38:37 Dilger, Andreas wrote:
> >Changing this would unfortunately change the format in an incompatible
> >way, breaking all existing user space tools that access the data.
> 
> It seems that it would be possible to fix this declaration to be
> compatible with current usage, since these fields are always written
> in host-endian order:
> 
> 
> #ifdef(__LITTLE_ENDIAN)
>   __u32 ph_sec;
>   __u32 ph_usec;
> __u32 ph_sec_hi;
> #else
>   __u32 ph_sec;
> __u32 ph_sec_hi;
> __u32 ph_usec;
> #endif
> 
> ph_sec_hi will always be zero today because microseconds don't grow
> so large, and we have 22 years to ensure existing user tools are
> updated to handle this in a similar manner.
> 
> Another option would be to mark in ph_flags whether the ph_sec field
> is a __u32 or __u64 and that would allow us to migrate over to a
> "normal" field ordering gradually (these debug logs are only useful
> for a short time anyway).
> 
> It would probably also make sense to change to use ph_nsec at this point
> as well, since that avoids the division (which might be noticeable in
> itself) and gives us better time resolution.

See the discussion for the previous version I sent. Unfortunately, there
is no generic __LITTLE_ENDIAN macro that we can use in both kernel
and user space, so we'd either have to introduce that for all architectures
first, or use the approach I described earlier:

ph_usec = (now.tv_nsec / NSEC_PER_SEC) | (now.tv_sec & 
0xull);

which Oleg said was a bit too ugly.

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


Re: [PATCH 30/73] staging/lustre: use 64-bit times for request times

2015-09-28 Thread Arnd Bergmann
On Monday 28 September 2015 01:09:18 Dilger, Andreas wrote:
> On 2015/09/27, 10:45 PM, "gr...@linuxhacker.ru" 
> wrote:
> >diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c
> >b/drivers/staging/lustre/lustre/ptlrpc/events.c
> >index 53f6b62..afd869b 100644
> >--- a/drivers/staging/lustre/lustre/ptlrpc/events.c
> >+++ b/drivers/staging/lustre/lustre/ptlrpc/events.c
> >@@ -246,7 +246,7 @@ static void ptlrpc_req_add_history(struct
> >ptlrpc_service_part *svcpt,
> >struct ptlrpc_request *req)
> > {
> > __u64 sec = req->rq_arrival_time.tv_sec;
> >-__u32 usec = req->rq_arrival_time.tv_usec >> 4; /* usec / 16 */
> >+__u32 usec = req->rq_arrival_time.tv_nsec / NSEC_PER_USEC / 16; /* usec
> >/ 16 */
> 
> This could just be written like:
> 
>   __u32 usec = req->rq_arrival_time.tv_nsec >> 14 /* nsec / 16384 */;
> 
> since the main point of this calculation is to get a number that fits
> into a 16-bit field to provide ordering for items in a trace log.  It
> doesn't have to be exactly "nsec / 16000", and it avoids the division.

Ok, that wasn't clear from the original code, so I just moved the division
from the do_gettimeofday() here to keep the data unchanged.

With your change, the 

new_seq = (sec << REQS_SEC_SHIFT) |
  (usec << REQS_USEC_SHIFT) |
  (svcpt->scp_cpt < 0 ? 0 : svcpt->scp_cpt);

calculation will get forward jumps once a second, but I guess that
doesn't matter if it's only used for sequencing.

The part that I had not noticed here is the y2106 overflow in the
sequence number. If we change the logic, we should probably give
a few more bits to the seconds, as well, or use monotonic time.

> >diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c
> >b/drivers/staging/lustre/lustre/ptlrpc/service.c
> >index 40de622..28f57d7 100644
> >--- a/drivers/staging/lustre/lustre/ptlrpc/service.c
> >+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
> >@@ -1191,7 +1191,7 @@ static int ptlrpc_at_add_timed(struct
> >ptlrpc_request *req)
> > spin_lock(&svcpt->scp_at_lock);
> > LASSERT(list_empty(&req->rq_timed_list));
> > 
> >-index = (unsigned long)req->rq_deadline % array->paa_size;
> >+div_u64_rem(req->rq_deadline, array->paa_size, &index);
> 
> Since this is just a round-robin index that advances once per second,
> it doesn't matter at all whether the calculation is computed on the
> 64-bit seconds or on the 32-bit seconds, so there isn't any need for
> the more expensive div_u64_rem() call here at all.  It is fine to
> just truncate the seconds and then do the modulus on the 32-bit value.
> 
> >@@ -1421,7 +1421,7 @@ static int ptlrpc_at_check_timed(struct
> >ptlrpc_service_part *svcpt)
> >server will take. Send early replies to everyone expiring soon. */
> > INIT_LIST_HEAD(&work_list);
> > deadline = -1;
> >-index = (unsigned long)array->paa_deadline % array->paa_size;
> >+div_u64_rem(array->paa_deadline, array->paa_size, &index);
> 
> Same here.

I went back and forth on these. Initially I did just what you suggest
here and added a (u32) cast on the deadline fields, but I could not
convince myself that the backwards jump in 2038 is harmless. For all
I can tell,  array->paa_size is not normally a power-of-two number, so
(0x % array->paa_size) and (0 % array->paa_size) are not
neighboring indices. If you are sure that the index can be allowed to
jump in 2038, we should do the simpler math and add a comment.

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


Re: [PATCH] Staging: rtl8712: rtl871x_ioctl_linux.c Move constant to right side of the comparision

2015-09-28 Thread Dan Carpenter
Don't worry too much.  I think your patches are basically fine.  I'm a
fairly experience kernel dev but I don't know what an N/M patch is...

Just don't work on staging/rtl* any more.  The rest of staging is fine.

regards,
dan carpenter

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


Re: [PATCH] drivers: staging: wilc1000: Replace message queue with standard Linux lists

2015-09-28 Thread Dan Carpenter
On Sun, Sep 27, 2015 at 07:43:18PM +0530, Chandra S Gorentla wrote:
> The message queue is replaced with standard Linux linked list.  A check for
> return value of receive method is added.
> 
> Signed-off-by: Chandra S Gorentla 
> ---
>  drivers/staging/wilc1000/host_interface.c |  7 +++-
>  drivers/staging/wilc1000/wilc_msgqueue.c  | 62 
> ++-
>  drivers/staging/wilc1000/wilc_platform.h  |  5 ++-
>  3 files changed, 36 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/host_interface.c 
> b/drivers/staging/wilc1000/host_interface.c
> index 62f4a8a..8d0776f 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -4304,11 +4304,16 @@ static int hostIFthread(void *pvArg)
>   u32 u32Ret;
>   struct host_if_msg msg;
>   tstrWILC_WFIDrv *pstrWFIDrv;
> + int recv_ret;

Name it "ret".

int ret;

>  
>   memset(&msg, 0, sizeof(struct host_if_msg));
>  
>   while (1) {
> - wilc_mq_recv(&gMsgQHostIF, &msg, sizeof(struct host_if_msg), 
> &u32Ret);
> + recv_ret = wilc_mq_recv(&gMsgQHostIF, &msg,
> + sizeof(struct host_if_msg), &u32Ret);
> + if (recv_ret)
> + continue;

This looks like a forever loop.

> +
>   pstrWFIDrv = (tstrWILC_WFIDrv *)msg.drvHandler;
>   if (msg.id == HOST_IF_MSG_EXIT) {
>   PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n");
> diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
> b/drivers/staging/wilc1000/wilc_msgqueue.c
> index 869736a..67617d5 100644
> --- a/drivers/staging/wilc1000/wilc_msgqueue.c
> +++ b/drivers/staging/wilc1000/wilc_msgqueue.c
> @@ -12,9 +12,15 @@
>   */
>  int wilc_mq_create(WILC_MsgQueueHandle *pHandle)
>  {
> + pHandle->msg_cache = kmem_cache_create("wilc_message_queue",
> + sizeof(Message),
> + 0, SLAB_POISON, NULL);
> + if (!pHandle->msg_cache)
> + return -ENOMEM;

This is a separate thing from using list macros.  Or maybe it's not but
that isn't explained in the changelog.  Do one thing per patch so it's
easier to review.

> +
>   spin_lock_init(&pHandle->strCriticalSection);
>   sema_init(&pHandle->hSem, 0);
> - pHandle->pstrMessageList = NULL;
> + INIT_LIST_HEAD(&pHandle->msg_list_head);
>   pHandle->u32ReceiversCount = 0;
>   pHandle->bExiting = false;
>   return 0;
> @@ -28,6 +34,7 @@ int wilc_mq_create(WILC_MsgQueueHandle *pHandle)
>   */
>  int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle)
>  {
> + Message *msg;
>   pHandle->bExiting = true;
>  
>   /* Release any waiting receiver thread. */
> @@ -36,13 +43,16 @@ int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle)
>   pHandle->u32ReceiversCount--;
>   }
>  
> - while (pHandle->pstrMessageList) {
> - Message *pstrMessge = pHandle->pstrMessageList->pstrNext;
> -
> - kfree(pHandle->pstrMessageList);
> - pHandle->pstrMessageList = pstrMessge;
> + while (!list_empty(&pHandle->msg_list_head)) {
> + msg = list_first_entry(&pHandle->msg_list_head,
> + Message, link);
> + list_del(&msg->link);
> + kfree(msg->pvBuffer);
> + kmem_cache_free(pHandle->msg_cache, msg);
>   }
>  
> + kmem_cache_destroy(pHandle->msg_cache);
> +
>   return 0;
>  }
>  
> @@ -74,41 +84,28 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
>   spin_lock_irqsave(&pHandle->strCriticalSection, flags);
>  
>   /* construct a new message */
> - pstrMessage = kmalloc(sizeof(Message), GFP_ATOMIC);
> - if (!pstrMessage)
> + pstrMessage = kmem_cache_zalloc(pHandle->msg_cache, GFP_ATOMIC);
> + if (!pstrMessage) {
> + spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
>   return -ENOMEM;
> + }

Do the allocation outside the lock so it doesn't have to be atomic.

>   pstrMessage->u32Length = u32SendBufferSize;
> - pstrMessage->pstrNext = NULL;
>   pstrMessage->pvBuffer = kmalloc(u32SendBufferSize, GFP_ATOMIC);
>   if (!pstrMessage->pvBuffer) {
> + kmem_cache_free(pHandle->msg_cache, pstrMessage);
>   result = -ENOMEM;
>   goto ERRORHANDLER;

This goto is meaningless now that it doesn't handle any errors.  Just do
a direct return.  Except, wait, aren't we holding a couple locks?  This
looks buggy.

>   }
>   memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize);
>  
>   /* add it to the message queue */
> - if (!pHandle->pstrMessageList) {
> - pHandle->pstrMessageList  = pstrMessage;
> - } else {
> - Message *pstrTailMsg = pHandle->pstrMessageList;
> -
> - while (pstrTailMsg->pstrNext)
> - ps

Re: [PATCH 66/73] staging/lustre: remove lots of dead code

2015-09-28 Thread Arnd Bergmann
On Sunday 27 September 2015 16:46:06 gr...@linuxhacker.ru wrote:
> From: Oleg Drokin 
> 
> This is a large patch to remove all dead code from obdclass and
> ptlrpc, purely removing functions and declarations now, so
> despite the size should be easy enough to verify.
> 
> Signed-off-by: Arnd Bergmann 
> Signed-off-by: Oleg Drokin 

Thanks for all the work to split out the smaller patches from my
larger code removal!

There is one small point about the attribution though: your split
out patches now have 'From: Oleg Drokin ' along
wtih 'Signed-off-by: Arnd Bergmann ', which is
inconsistent. For the larger chunks of patches that you took from me
and that retain my 'Signed-off-by', it would be nice if you could
set the author field to me for consistency as well.

For the smaller patches for which writing the changelog was likely
more work than doing the patch, it's fine if you claim authorship,
but if you do that then please change the 'Signed-off-by' to
'Reported-by' or 'Suggested-by' for me, so the author field
matches the first Signed-off-by.

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


Re: [PATCH] Staging: rtl8712: rtl871x_ioctl_linux.c Move constant to right side of the comparision

2015-09-28 Thread Sudip Mukherjee
On Sat, Sep 26, 2015 at 12:45:46PM -0500, Larry Finger wrote:
> On 09/26/2015 11:49 AM, Punit Vara wrote:
> >This patch is to the rtl871x_ioctl_linux.c that fixes up following
> >warning reported by checkpatch.pl :
> >
> >- Comparisons should place the constant on the right side of the test
> >
> >Signed-off-by: Punit Vara 
> 
> This warning is crap. WTF difference does it make The compiler
> does not care, and any reader with any piece of a brain is not going
> to be confused!
> 
> This patch and all others like it are just meaningless source churning!
> 
> This author has made such a royal mess of his patches that I
> recommend that ALL of them be dropped. In addition, we should
> continue to drop his changes until he learns how to use git to
> generate N/M patches, and until he reads the documentation on patch
> submission.
Excuse me for my ignorance, but I still can not see what was wrong with
his patch. checkpatch is giving warning and he has fixed it. As far as
sending in series is concerned, he is a newbie and after telling him how
to generate patches in series he has learnt that. I have already told
him that his patches might be dropped as they are not in series and he
is ready to resend in series as soon as Greg confirms that they are
dropped. And as long as the driver is in staging there will be source
churning, isn't it?
If i remember correctly I was told that for a driver to be moved out of
staging the primary thing is that all checkpatch warnings needs to fixed.
So if this driver has to move out of staging someday then these warnings
also has to be fixed by someone.

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


Re: [PATCH] staging: rtl8723au: Fix resource leak

2015-09-28 Thread Sudip Mukherjee
On Sun, Sep 27, 2015 at 09:30:54PM +0200, Mateusz Kulikowski wrote:
> Firmware was not released properly if kmemdup fails.
> 
> Addresses-Coverity-Id: 1269118
> Signed-off-by: Mateusz Kulikowski 
> ---
>  drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c 
> b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
> index cd014f7..87bb87f 100644
> --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
> +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
> @@ -249,13 +249,13 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter 
> *padapter)
>   goto Exit;
>   }
>   firmware_buf = kmemdup(fw->data, fw->size, GFP_KERNEL);
> + release_firmware(fw);
>   if (!firmware_buf) {
>   rtStatus = _FAIL;
>   goto Exit;
>   }
>   buf = firmware_buf;
>   fw_size = fw->size;
> - release_firmware(fw);
You are releasing the firmware and then accessing fw->size here. That
just introduced a NULL pointer dereference.

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


Re: [PATCH v2] staging: rtl8723au: Fix resource leak

2015-09-28 Thread Sudip Mukherjee
On Sun, Sep 27, 2015 at 09:48:19PM +0200, Mateusz Kulikowski wrote:
> Firmware was not released properly if kmemdup fails.
> 
> Addresses-Coverity-Id: 1269118
> Signed-off-by: Mateusz Kulikowski 
> ---
Not seen your v2 while replying to your v1. Sorry for the noise.

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


Re: [PATCH] Staging: rtl8712: rtl871x_ioctl_linux.c Move constant to right side of the comparision

2015-09-28 Thread punit vara
On Mon, Sep 28, 2015 at 4:48 PM, Sudip Mukherjee
 wrote:
> On Sat, Sep 26, 2015 at 12:45:46PM -0500, Larry Finger wrote:
>> On 09/26/2015 11:49 AM, Punit Vara wrote:
>> >This patch is to the rtl871x_ioctl_linux.c that fixes up following
>> >warning reported by checkpatch.pl :
>> >
>> >- Comparisons should place the constant on the right side of the test
>> >
>> >Signed-off-by: Punit Vara 
>>
>> This warning is crap. WTF difference does it make The compiler
>> does not care, and any reader with any piece of a brain is not going
>> to be confused!
>>
>> This patch and all others like it are just meaningless source churning!
>>
>> This author has made such a royal mess of his patches that I
>> recommend that ALL of them be dropped. In addition, we should
>> continue to drop his changes until he learns how to use git to
>> generate N/M patches, and until he reads the documentation on patch
>> submission.
> Excuse me for my ignorance, but I still can not see what was wrong with
> his patch. checkpatch is giving warning and he has fixed it. As far as
> sending in series is concerned, he is a newbie and after telling him how
> to generate patches in series he has learnt that. I have already told
> him that his patches might be dropped as they are not in series and he
> is ready to resend in series as soon as Greg confirms that they are
> dropped. And as long as the driver is in staging there will be source
> churning, isn't it?
> If i remember correctly I was told that for a driver to be moved out of
> staging the primary thing is that all checkpatch warnings needs to fixed.
> So if this driver has to move out of staging someday then these warnings
> also has to be fixed by someone.
>
> regards
> sudip

Thank you for understanding my situation @Sudip @Dan Carpenter ..
First I have planned to clean all the warning whatever it may be silly
or some serious. So that by cleaning those I can easily understand the
whole process . I was thinking to dig into TODO list and followed by
writing any driver. Greg please confirm me what should I do ? Do i
touch any rtl* ? It is first time I am working with this much huge
project .So may be I dont know what warnings are priority and what are
not ? I felt proud when my first patch was accepted .Execuse me @Larry
@Joshua if I irritate you by sending so many patches in sequence but I
am happy to clean all the staging driver warning first. So that every
programmer can focus on programming only not on cleanpatch warnings .

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


Re: [PATCH] Staging: rtl8712: rtl871x_ioctl_linux.c Move constant to right side of the comparision

2015-09-28 Thread Larry Finger

On 09/28/2015 06:18 AM, Sudip Mukherjee wrote:

On Sat, Sep 26, 2015 at 12:45:46PM -0500, Larry Finger wrote:

On 09/26/2015 11:49 AM, Punit Vara wrote:

This patch is to the rtl871x_ioctl_linux.c that fixes up following
warning reported by checkpatch.pl :

- Comparisons should place the constant on the right side of the test

Signed-off-by: Punit Vara 


This warning is crap. WTF difference does it make The compiler
does not care, and any reader with any piece of a brain is not going
to be confused!

This patch and all others like it are just meaningless source churning!

This author has made such a royal mess of his patches that I
recommend that ALL of them be dropped. In addition, we should
continue to drop his changes until he learns how to use git to
generate N/M patches, and until he reads the documentation on patch
submission.

Excuse me for my ignorance, but I still can not see what was wrong with
his patch. checkpatch is giving warning and he has fixed it. As far as
sending in series is concerned, he is a newbie and after telling him how
to generate patches in series he has learnt that. I have already told
him that his patches might be dropped as they are not in series and he
is ready to resend in series as soon as Greg confirms that they are
dropped. And as long as the driver is in staging there will be source
churning, isn't it?
If i remember correctly I was told that for a driver to be moved out of
staging the primary thing is that all checkpatch warnings needs to fixed.
So if this driver has to move out of staging someday then these warnings
also has to be fixed by someone.


The primary requirement for moving a driver out of staging is that it use 
mac80211. No amount of cosmetic fixing will ever make that change for rtl8712u!


In my opinion, not ALL checkpatch warnings ever need to be heeded.Can you tell 
me why


/**
 * This is a comment
 */

is superior to

/*
  This is a comment also
 */

The difference is not significant, yet checkpatch treats it as though the source 
was horribly flawed. Similarly, satisfying the 80-character requirement can 
leave the code horribly unreadable.


My main complaint is that the OP submitted dozens of patches with similar 
subjects, yet gave no indication is any of these were resubmissions, and 
completely failed to utilize the patch series mechanism of git. This behavior 
makes life difficult for both the maintainer and the reviewer.


Larry

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


[PATCH 00/29] staging: most: update driver

2015-09-28 Thread Christian Gromm
This patchset is needed to pull Microchip's latest driver changes into
the staging tree. The patches include bug fixes, feature updates and
coding style changes.

Christian Gromm (29):
  staging: most: change structure initialization
  staging: most: remove aim reset
  staging: most: fix race condition in AIM networking
  staging: most: remove shared IRQ request
  staging: most: fix USB babble on IN pipe
  staging: most: fix channel operation in multi-aim context
  staging: most: remove unnecessary field initialization
  staging: most: remove dead code
  staging: most: fix buffer syncronization request
  staging: most: remove macro cpu_to_le16
  staging: most: fix buffer size for DIM2
  staging: most: fix MAC address representation
  staging: most: simplify code
  staging: most: prevent DMA on stack
  staging: most: consolidate code
  staging: most: add fair buffer distribution
  staging: most: refactor channel structure
  staging: most: add multi channel support to sound AIM
  staging: most: include vendor in audio card's shortname
  staging: most: make hardware parameters channel exclusive
  staging: most: squash AIM sound
  staging: most: purge unnecessary variable
  staging: most: add missing channel initialization
  staging: most: rename function
  staging: most: move initialization code
  staging: most: fix style problems
  staging: most: remove audio resolution format check
  staging: most: add poll syscall to AIM cdev
  staging: most: fix pcm_write input/output error

 drivers/staging/most/aim-cdev/cdev.c  |   36 +-
 drivers/staging/most/aim-network/networking.c |   28 ++--
 drivers/staging/most/aim-sound/sound.c|  110 
 drivers/staging/most/aim-v4l2/video.c |   18 +--
 drivers/staging/most/hdm-dim2/dim2_hal.c  |4 +-
 drivers/staging/most/hdm-dim2/dim2_hdm.c  |2 +-
 drivers/staging/most/hdm-i2c/hdm_i2c.c|2 +-
 drivers/staging/most/hdm-usb/hdm_usb.c|  116 +++--
 drivers/staging/most/mostcore/core.c  |  171 +
 drivers/staging/most/mostcore/mostcore.h  |   11 +-
 10 files changed, 297 insertions(+), 201 deletions(-)

-- 
1.7.9.5

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


[PATCH 04/29] staging: most: remove shared IRQ request

2015-09-28 Thread Christian Gromm
Since there is no way find out whether the INIC has generated an
interrupt, the I2C interrupt must not be registered as a shared
interrupt.

Reported-by: PrasannaKumar Muralidharan 

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-i2c/hdm_i2c.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/hdm-i2c/hdm_i2c.c 
b/drivers/staging/most/hdm-i2c/hdm_i2c.c
index 029ded3..7e0c461 100644
--- a/drivers/staging/most/hdm-i2c/hdm_i2c.c
+++ b/drivers/staging/most/hdm-i2c/hdm_i2c.c
@@ -364,7 +364,7 @@ static int i2c_probe(struct i2c_client *client, const 
struct i2c_device_id *id)
dev->polling_mode = polling_req || client->irq <= 0;
if (!dev->polling_mode) {
pr_info("Requesting IRQ: %d\n", client->irq);
-   ret = request_irq(client->irq, most_irq_handler, IRQF_SHARED,
+   ret = request_irq(client->irq, most_irq_handler, 0,
  client->name, dev);
if (ret) {
pr_info("IRQ request failed: %d, "
-- 
1.7.9.5

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


[PATCH 03/29] staging: most: fix race condition in AIM networking

2015-09-28 Thread Christian Gromm
If the network device is being opened right after it has been registered
via function register_netdev(), the device state is not yet consistent in
the context of function ndo_open(). This patch cares about having the
initialization done right, before the networking device is registered.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-network/networking.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/most/aim-network/networking.c 
b/drivers/staging/most/aim-network/networking.c
index dd36872..761c4cb 100644
--- a/drivers/staging/most/aim-network/networking.c
+++ b/drivers/staging/most/aim-network/networking.c
@@ -356,10 +356,13 @@ static int aim_probe_channel(struct most_interface 
*iface, int channel_idx,
}
 
nd->dev = dev;
+   ch->ch_id = channel_idx;
+   ch->linked = true;
 
dev->ml_priv = nd;
if (register_netdev(dev)) {
pr_err("registering net device failed\n");
+   ch->linked = false;
free_netdev(dev);
return -EINVAL;
}
-- 
1.7.9.5

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


[PATCH 07/29] staging: most: remove unnecessary field initialization

2015-09-28 Thread Christian Gromm
Since conf->extra_len has already been reset in most_start_channel() when
function hdm_configure_channel() gets called, it can safely be removed
here.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index 9006793..61974dd 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -771,7 +771,6 @@ static int hdm_configure_channel(struct most_interface 
*iface, int channel,
!((conf->data_type == MOST_CH_ISOC_AVP) &&
  (conf->packets_per_xact != 0xFF))) {
mdev->padding_active[channel] = false;
-   conf->extra_len = 0;
goto exit;
}
 
-- 
1.7.9.5

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


[PATCH 09/29] staging: most: fix buffer synchronization request

2015-09-28 Thread Christian Gromm
Revision D of OS81118 network interface controller have the internal
buffer synchronization mechanism changed. This patch adapts the driver
to this.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |   41 
 1 file changed, 10 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index 54c8c1e..3c731da 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -59,6 +59,8 @@
 #define DRCI_REG_HW_ADDR_HI0x0145
 #define DRCI_REG_HW_ADDR_MI0x0146
 #define DRCI_REG_HW_ADDR_LO0x0147
+#define DRCI_REG_BASE  0x1100
+#define DRCI_COMMAND   0x02
 #define DRCI_READ_REQ  0xA0
 #define DRCI_WRITE_REQ 0xA1
 
@@ -137,36 +139,6 @@ static void wq_clear_halt(struct work_struct *wq_obj);
 static void wq_netinfo(struct work_struct *wq_obj);
 
 /**
- * trigger_resync_vr - Vendor request to trigger HW re-sync mechanism
- * @dev: usb device
- *
- */
-static void trigger_resync_vr(struct usb_device *dev)
-{
-   int retval;
-   u8 request_type = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT;
-   int *data = kzalloc(sizeof(*data), GFP_KERNEL);
-
-   if (!data)
-   goto error;
-   *data = HW_RESYNC;
-   retval = usb_control_msg(dev,
-usb_sndctrlpipe(dev, 0),
-0,
-request_type,
-0,
-0,
-data,
-0,
-5 * HZ);
-   kfree(data);
-   if (retval >= 0)
-   return;
-error:
-   dev_err(&dev->dev, "Vendor request \"stall\" failed\n");
-}
-
-/**
  * drci_rd_reg - read a DCI register
  * @dev: usb device
  * @reg: register address
@@ -1239,6 +1211,7 @@ hdm_probe(struct usb_interface *interface, const struct 
usb_device_id *id)
struct usb_host_interface *usb_iface_desc;
struct usb_endpoint_descriptor *ep_desc;
int ret = 0;
+   int err;
 
usb_iface_desc = interface->cur_altsetting;
usb_dev = interface_to_usbdev(interface);
@@ -1319,6 +1292,13 @@ hdm_probe(struct usb_interface *interface, const struct 
usb_device_id *id)
tmp_cap++;
INIT_LIST_HEAD(&mdev->anchor_list[i]);
spin_lock_init(&mdev->anchor_list_lock[i]);
+   err = drci_wr_reg(usb_dev,
+ DRCI_REG_BASE + DRCI_COMMAND +
+ ep_desc->bEndpointAddress * 16,
+ cpu_to_le16(1));
+   if (err < 0)
+   pr_warn("DCI Sync for EP %02x failed",
+   ep_desc->bEndpointAddress);
}
dev_notice(dev, "claimed gadget: Vendor=%4.4x ProdID=%4.4x Bus=%02x 
Device=%02x\n",
   le16_to_cpu(usb_dev->descriptor.idVendor),
@@ -1353,7 +1333,6 @@ hdm_probe(struct usb_interface *interface, const struct 
usb_device_id *id)
 
kobject_uevent(&mdev->dci->kobj, KOBJ_ADD);
mdev->dci->usb_device = mdev->usb_device;
-   trigger_resync_vr(usb_dev);
}
mutex_unlock(&mdev->io_mutex);
return 0;
-- 
1.7.9.5

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


[PATCH 10/29] staging: most: remove macro cpu_to_le16

2015-09-28 Thread Christian Gromm
This patch removes the wrongly used macros cpu_to_le16

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index 3c731da..a9da92f 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -1077,7 +1077,7 @@ static ssize_t store_value(struct most_dci_obj *dci_obj,
   struct most_dci_attribute *attr,
   const char *buf, size_t count)
 {
-   u16 v16;
+   u16 val;
u16 reg_addr;
int err;
 
@@ -1100,11 +1100,11 @@ static ssize_t store_value(struct most_dci_obj *dci_obj,
else
return -EIO;
 
-   err = kstrtou16(buf, 16, &v16);
+   err = kstrtou16(buf, 16, &val);
if (err)
return err;
 
-   err = drci_wr_reg(dci_obj->usb_device, reg_addr, cpu_to_le16(v16));
+   err = drci_wr_reg(dci_obj->usb_device, reg_addr, val);
if (err < 0)
return err;
 
@@ -1295,7 +1295,7 @@ hdm_probe(struct usb_interface *interface, const struct 
usb_device_id *id)
err = drci_wr_reg(usb_dev,
  DRCI_REG_BASE + DRCI_COMMAND +
  ep_desc->bEndpointAddress * 16,
- cpu_to_le16(1));
+ 1);
if (err < 0)
pr_warn("DCI Sync for EP %02x failed",
ep_desc->bEndpointAddress);
-- 
1.7.9.5

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


[PATCH 06/29] staging: most: fix channel operation in multi-aim context

2015-09-28 Thread Christian Gromm
This patch fixes the opening and closing process of a physical channel
when used by different AIMs.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-cdev/cdev.c  |5 +-
 drivers/staging/most/aim-network/networking.c |   11 ++--
 drivers/staging/most/aim-sound/sound.c|5 +-
 drivers/staging/most/aim-v4l2/video.c |5 +-
 drivers/staging/most/mostcore/core.c  |   73 +
 drivers/staging/most/mostcore/mostcore.h  |6 +-
 6 files changed, 68 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/most/aim-cdev/cdev.c 
b/drivers/staging/most/aim-cdev/cdev.c
index 1a17e2a..a8a7689 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -27,6 +27,7 @@ static dev_t aim_devno;
 static struct class *aim_class;
 static struct ida minor_id;
 static unsigned int major;
+static struct most_aim cdev_aim;
 
 struct aim_channel {
wait_queue_head_t wq;
@@ -96,7 +97,7 @@ static int aim_open(struct inode *inode, struct file *filp)
return -EBUSY;
}
 
-   ret = most_start_channel(channel->iface, channel->channel_id);
+   ret = most_start_channel(channel->iface, channel->channel_id, 
&cdev_aim);
if (ret)
atomic_dec(&channel->access_ref);
return ret;
@@ -134,7 +135,7 @@ static int aim_close(struct inode *inode, struct file *filp)
most_put_mbo(mbo);
if (channel->keep_mbo)
most_put_mbo(channel->stacked_mbo);
-   ret = most_stop_channel(channel->iface, channel->channel_id);
+   ret = most_stop_channel(channel->iface, channel->channel_id, &cdev_aim);
atomic_dec(&channel->access_ref);
wake_up_interruptible(&channel->wq);
return ret;
diff --git a/drivers/staging/most/aim-network/networking.c 
b/drivers/staging/most/aim-network/networking.c
index 761c4cb..c13bd89 100644
--- a/drivers/staging/most/aim-network/networking.c
+++ b/drivers/staging/most/aim-network/networking.c
@@ -79,6 +79,7 @@ struct net_dev_context {
 
 static struct list_head net_devices = LIST_HEAD_INIT(net_devices);
 static struct spinlock list_lock;
+static struct most_aim aim;
 
 
 static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo)
@@ -194,14 +195,14 @@ static int most_nd_open(struct net_device *dev)
 
BUG_ON(!nd->tx.linked || !nd->rx.linked);
 
-   if (most_start_channel(nd->iface, nd->rx.ch_id)) {
+   if (most_start_channel(nd->iface, nd->rx.ch_id, &aim)) {
netdev_err(dev, "most_start_channel() failed\n");
return -EBUSY;
}
 
-   if (most_start_channel(nd->iface, nd->tx.ch_id)) {
+   if (most_start_channel(nd->iface, nd->tx.ch_id, &aim)) {
netdev_err(dev, "most_start_channel() failed\n");
-   most_stop_channel(nd->iface, nd->rx.ch_id);
+   most_stop_channel(nd->iface, nd->rx.ch_id, &aim);
return -EBUSY;
}
 
@@ -227,8 +228,8 @@ static int most_nd_stop(struct net_device *dev)
netif_stop_queue(dev);
 
if (nd->channels_opened) {
-   most_stop_channel(nd->iface, nd->rx.ch_id);
-   most_stop_channel(nd->iface, nd->tx.ch_id);
+   most_stop_channel(nd->iface, nd->rx.ch_id, &aim);
+   most_stop_channel(nd->iface, nd->tx.ch_id, &aim);
nd->channels_opened = false;
}
 
diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index 27449d2..2d4732c 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -26,6 +26,7 @@
 #define DRIVER_NAME "sound"
 
 static struct list_head dev_list;
+static struct most_aim audio_aim;
 
 /**
  * struct channel - private structure to keep channel specific data
@@ -298,7 +299,7 @@ static int pcm_open(struct snd_pcm_substream *substream)
return PTR_ERR(channel->playback_task);
}
 
-   if (most_start_channel(channel->iface, channel->id)) {
+   if (most_start_channel(channel->iface, channel->id, &audio_aim)) {
pr_err("most_start_channel() failed!\n");
if (cfg->direction == MOST_CH_TX)
kthread_stop(channel->playback_task);
@@ -333,7 +334,7 @@ static int pcm_close(struct snd_pcm_substream *substream)
 
if (channel->cfg->direction == MOST_CH_TX)
kthread_stop(channel->playback_task);
-   most_stop_channel(channel->iface, channel->id);
+   most_stop_channel(channel->iface, channel->id, &audio_aim);
 
return 0;
 }
diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index 377bb10..345a824 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -32,6 +32,7 @@
 
 #define V4L2_AIM_MAX_INPUT  1
 
+static struct most_aim aim_info;
 
 struct mos

[PATCH 12/29] staging: most: fix MAC address representation

2015-09-28 Thread Christian Gromm
This patch fixes the representation of the MAC address within the HDM USB
module.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |   24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index a9da92f..315abec 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -790,29 +790,37 @@ exit:
 static int hdm_update_netinfo(struct most_dev *mdev)
 {
struct device *dev = &mdev->usb_device->dev;
-   int i;
-   u16 link;
-   u8 addr[6];
+   u16 hi, mi, lo, link;
 
if (!is_valid_ether_addr(mdev->hw_addr)) {
if (0 > drci_rd_reg(mdev->usb_device,
-   DRCI_REG_HW_ADDR_HI, addr)) {
+   DRCI_REG_HW_ADDR_HI, &hi)) {
dev_err(dev, "Vendor request \"hw_addr_hi\" failed\n");
return -1;
}
+   le16_to_cpus(&hi);
+
if (0 > drci_rd_reg(mdev->usb_device,
-   DRCI_REG_HW_ADDR_MI, addr + 2)) {
+   DRCI_REG_HW_ADDR_MI, &mi)) {
dev_err(dev, "Vendor request \"hw_addr_mid\" failed\n");
return -1;
}
+   le16_to_cpus(&mi);
+
if (0 > drci_rd_reg(mdev->usb_device,
-   DRCI_REG_HW_ADDR_LO, addr + 4)) {
+   DRCI_REG_HW_ADDR_LO, &lo)) {
dev_err(dev, "Vendor request \"hw_addr_low\" failed\n");
return -1;
}
+   le16_to_cpus(&lo);
+
mutex_lock(&mdev->io_mutex);
-   for (i = 0; i < 6; i++)
-   mdev->hw_addr[i] = addr[i];
+   mdev->hw_addr[0] = hi >> 8;
+   mdev->hw_addr[1] = hi;
+   mdev->hw_addr[2] = mi >> 8;
+   mdev->hw_addr[3] = mi;
+   mdev->hw_addr[4] = lo >> 8;
+   mdev->hw_addr[5] = lo;
mutex_unlock(&mdev->io_mutex);
 
}
-- 
1.7.9.5

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


[PATCH 08/29] staging: most: remove dead code

2015-09-28 Thread Christian Gromm
The case where the channel type is neither synchronous nor isochronous is
already covered by a previous condition.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index 61974dd..54c8c1e 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -777,12 +777,6 @@ static int hdm_configure_channel(struct most_interface 
*iface, int channel,
mdev->padding_active[channel] = true;
temp_size = conf->buffer_size;
 
-   if ((conf->data_type != MOST_CH_SYNC) &&
-   (conf->data_type != MOST_CH_ISOC_AVP)) {
-   dev_warn(dev, "Unsupported data type\n");
-   return -EINVAL;
-   }
-
frame_size = get_stream_frame_size(conf);
if ((frame_size == 0) || (frame_size > USB_MTU)) {
dev_warn(dev, "Misconfig: frame size wrong\n");
-- 
1.7.9.5

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


[PATCH 15/29] staging: most: consolidate code

2015-09-28 Thread Christian Gromm
The function drci_rd_reg() always delivers little endian representation of
the 16-bit DCI register. The value returned by this function must always be
carefully converted from __le16 to u16 type. This patch moves all those
conversions to the function itself.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index 7722212..fcd7559 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -159,7 +159,7 @@ static inline int drci_rd_reg(struct usb_device *dev, u16 
reg, u16 *buf)
 DRCI_READ_REQ, req_type,
 0x,
 reg, dma_buf, sizeof(u16), 5 * HZ);
-   *buf = *dma_buf;
+   *buf = le16_to_cpu(*dma_buf);
kfree(dma_buf);
 
return retval;
@@ -804,19 +804,16 @@ static int hdm_update_netinfo(struct most_dev *mdev)
dev_err(dev, "Vendor request \"hw_addr_hi\" failed\n");
return -1;
}
-   le16_to_cpus(&hi);
 
if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_MI, &mi) < 0) {
dev_err(dev, "Vendor request \"hw_addr_mid\" failed\n");
return -1;
}
-   le16_to_cpus(&mi);
 
if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_LO, &lo) < 0) {
dev_err(dev, "Vendor request \"hw_addr_low\" failed\n");
return -1;
}
-   le16_to_cpus(&lo);
 
mutex_lock(&mdev->io_mutex);
mdev->hw_addr[0] = hi >> 8;
@@ -832,7 +829,6 @@ static int hdm_update_netinfo(struct most_dev *mdev)
dev_err(dev, "Vendor request \"link status\" failed\n");
return -1;
}
-   le16_to_cpus(&link);
 
mutex_lock(&mdev->io_mutex);
mdev->link_stat = link;
@@ -1083,7 +1079,7 @@ static ssize_t show_value(struct most_dci_obj *dci_obj,
if (err < 0)
return err;
 
-   return snprintf(buf, PAGE_SIZE, "%04x\n", le16_to_cpu(tmp_val));
+   return snprintf(buf, PAGE_SIZE, "%04x\n", tmp_val);
 }
 
 static ssize_t store_value(struct most_dci_obj *dci_obj,
-- 
1.7.9.5

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


[PATCH 17/29] staging: most: refactor channel structure

2015-09-28 Thread Christian Gromm
The struct most_c_obj has the same set of attributes for each of two AIMs.
This patch cleans up the code by introducing the new struct most_c_aim_obj
hat contains those fields.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/mostcore/core.c |  108 +-
 1 file changed, 55 insertions(+), 53 deletions(-)

diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index 4dfa001..ee6deb8 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -38,6 +38,12 @@ static struct ida mdev_id;
 static int modref;
 static int dummy_num_buffers;
 
+struct most_c_aim_obj {
+   struct most_aim *ptr;
+   int refs;
+   int num_buffers;
+};
+
 struct most_c_obj {
struct kobject kobj;
struct completion cleanup;
@@ -56,12 +62,8 @@ struct most_c_obj {
spinlock_t fifo_lock;
struct list_head halt_fifo;
struct list_head list;
-   struct most_aim *first_aim;
-   struct most_aim *second_aim;
-   int first_aim_refs;
-   int second_aim_refs;
-   int first_num_buffers;
-   int second_num_buffers;
+   struct most_c_aim_obj aim0;
+   struct most_c_aim_obj aim1;
struct list_head trash_fifo;
struct task_struct *hdm_enqueue_task;
struct mutex stop_task_mutex;
@@ -557,12 +559,12 @@ create_most_c_obj(const char *name, struct kobject 
*parent)
  */
 static void destroy_most_c_obj(struct most_c_obj *c)
 {
-   if (c->first_aim)
-   c->first_aim->disconnect_channel(c->iface, c->channel_id);
-   if (c->second_aim)
-   c->second_aim->disconnect_channel(c->iface, c->channel_id);
-   c->first_aim = NULL;
-   c->second_aim = NULL;
+   if (c->aim0.ptr)
+   c->aim0.ptr->disconnect_channel(c->iface, c->channel_id);
+   if (c->aim1.ptr)
+   c->aim1.ptr->disconnect_channel(c->iface, c->channel_id);
+   c->aim0.ptr = NULL;
+   c->aim1.ptr = NULL;
 
mutex_lock(&deregister_mutex);
flush_trash_fifo(c);
@@ -994,10 +996,10 @@ static ssize_t store_add_link(struct most_aim_obj 
*aim_obj,
if (IS_ERR(c))
return -ENODEV;
 
-   if (!c->first_aim)
-   aim_ptr = &c->first_aim;
-   else if (!c->second_aim)
-   aim_ptr = &c->second_aim;
+   if (!c->aim0.ptr)
+   aim_ptr = &c->aim0.ptr;
+   else if (!c->aim1.ptr)
+   aim_ptr = &c->aim1.ptr;
else
return -ENOSPC;
 
@@ -1051,10 +1053,10 @@ static ssize_t store_remove_link(struct most_aim_obj 
*aim_obj,
if (IS_ERR(c))
return -ENODEV;
 
-   if (c->first_aim == aim_obj->driver)
-   c->first_aim = NULL;
-   if (c->second_aim == aim_obj->driver)
-   c->second_aim = NULL;
+   if (c->aim0.ptr == aim_obj->driver)
+   c->aim0.ptr = NULL;
+   if (c->aim1.ptr == aim_obj->driver)
+   c->aim1.ptr = NULL;
if (aim_obj->driver->disconnect_channel(c->iface, c->channel_id))
return -EIO;
return len;
@@ -1240,11 +1242,11 @@ static void arm_mbo(struct mbo *mbo)
list_add_tail(&mbo->list, &c->fifo);
spin_unlock_irqrestore(&c->fifo_lock, flags);
 
-   if (c->first_aim_refs && c->first_aim->tx_completion)
-   c->first_aim->tx_completion(c->iface, c->channel_id);
+   if (c->aim0.refs && c->aim0.ptr->tx_completion)
+   c->aim0.ptr->tx_completion(c->iface, c->channel_id);
 
-   if (c->second_aim_refs && c->second_aim->tx_completion)
-   c->second_aim->tx_completion(c->iface, c->channel_id);
+   if (c->aim1.refs && c->aim1.ptr->tx_completion)
+   c->aim1.ptr->tx_completion(c->iface, c->channel_id);
 }
 
 /**
@@ -1401,15 +1403,15 @@ struct mbo *most_get_mbo(struct most_interface *iface, 
int id,
if (unlikely(!c))
return NULL;
 
-   if (c->first_aim_refs && c->second_aim_refs &&
-   ((aim == c->first_aim && c->first_num_buffers <= 0) ||
-(aim == c->second_aim && c->second_num_buffers <= 0)))
+   if (c->aim0.refs && c->aim1.refs &&
+   ((aim == c->aim0.ptr && c->aim0.num_buffers <= 0) ||
+(aim == c->aim1.ptr && c->aim1.num_buffers <= 0)))
return NULL;
 
-   if (aim == c->first_aim)
-   num_buffers_ptr = &c->first_num_buffers;
-   else if (aim == c->second_aim)
-   num_buffers_ptr = &c->second_num_buffers;
+   if (aim == c->aim0.ptr)
+   num_buffers_ptr = &c->aim0.num_buffers;
+   else if (aim == c->aim1.ptr)
+   num_buffers_ptr = &c->aim1.num_buffers;
else
num_buffers_ptr = &dummy_num_buffers;
 
@@ -1485,12 +1487,12 @@ static void most_read_completion(struct mbo *mbo)
c->is_starving = 1;
}
 
-   if (c->first_aim_refs && c->first_aim->rx_compl

[PATCH 05/29] staging: most: fix USB babble on IN pipe

2015-09-28 Thread Christian Gromm
This patch prevents the HDM USB from submitting an URB with a buffer size
unaligned to 512 bytes to the USB subsystem.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index 9bbefaa..9006793 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -711,7 +711,7 @@ static int hdm_enqueue(struct most_interface *iface, int 
channel, struct mbo *mb
  usb_rcvbulkpipe(mdev->usb_device,
  mdev->ep_address[channel]),
  virt_address,
- length,
+ length + conf->extra_len,
  hdm_read_completion,
  mbo);
}
@@ -771,6 +771,7 @@ static int hdm_configure_channel(struct most_interface 
*iface, int channel,
!((conf->data_type == MOST_CH_ISOC_AVP) &&
  (conf->packets_per_xact != 0xFF))) {
mdev->padding_active[channel] = false;
+   conf->extra_len = 0;
goto exit;
}
 
-- 
1.7.9.5

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


[PATCH 20/29] staging: most: make hardware parameters channel exclusive

2015-09-28 Thread Christian Gromm
Since the PCM interface's hardware parameters are channel/substream
exclusive, the struct snd_pcm_hardware needs to be embedded in the
channel structure.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-sound/sound.c |   68 +---
 1 file changed, 36 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index c9b62c3..30a2894 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -46,6 +46,7 @@ static struct most_aim audio_aim;
  */
 struct channel {
struct snd_pcm_substream *substream;
+   struct snd_pcm_hardware pcm_hardware;
struct most_interface *iface;
struct most_channel_config *cfg;
struct snd_card *card;
@@ -70,13 +71,12 @@ struct channel {
 /**
  * Initialization of struct snd_pcm_hardware
  */
-static struct snd_pcm_hardware pcm_hardware_template = {
-   .info   = MOST_PCM_INFO,
-   .rates  = SNDRV_PCM_RATE_48000,
-   .rate_min   = 48000,
-   .rate_max   = 48000,
-   .channels_min   = 1,
-   .channels_max   = 1,
+static void init_pcm_hardware(struct snd_pcm_hardware *pcm_hw)
+{
+   pcm_hw->info = MOST_PCM_INFO;
+   pcm_hw->rates = SNDRV_PCM_RATE_48000;
+   pcm_hw->rate_min = 48000;
+   pcm_hw->rate_max = 48000;
 };
 
 #define swap16(val) ( \
@@ -308,7 +308,7 @@ static int pcm_open(struct snd_pcm_substream *substream)
return -EBUSY;
}
 
-   runtime->hw = pcm_hardware_template;
+   runtime->hw = channel->pcm_hardware;
runtime->hw.buffer_bytes_max = cfg->num_buffers * cfg->buffer_size;
runtime->hw.period_bytes_min = cfg->buffer_size;
runtime->hw.period_bytes_max = cfg->buffer_size;
@@ -357,15 +357,16 @@ static int pcm_hw_params(struct snd_pcm_substream 
*substream,
 struct snd_pcm_hw_params *hw_params)
 {
int ret;
+   struct channel *channel = substream->private_data;
 
pr_info("pcm_hw_params()\n");
 
-   if ((params_channels(hw_params) > pcm_hardware_template.channels_max) ||
-   (params_channels(hw_params) < pcm_hardware_template.channels_min) ||
-   !(params_format(hw_params) != pcm_hardware_template.formats))
+   if ((params_channels(hw_params) > channel->pcm_hardware.channels_max) ||
+   (params_channels(hw_params) < channel->pcm_hardware.channels_min) ||
+   !(params_format(hw_params) != channel->pcm_hardware.formats))
return -EINVAL;
ret = snd_pcm_lib_alloc_vmalloc_buffer(substream,
-   params_buffer_bytes(hw_params));
+  params_buffer_bytes(hw_params));
 
return ret;
 }
@@ -508,46 +509,47 @@ static int split_arg_list(char *buf, char **card_name, 
char **pcm_format)
return 0;
 }
 
-static int audio_set_pcm_format(char *pcm_format,
+static int audio_set_pcm_format(struct snd_pcm_hardware *pcm_hw,
+   char *pcm_format,
struct most_channel_config *cfg)
 {
if (!strcmp(pcm_format, "1x8")) {
if (cfg->subbuffer_size != 1)
goto error;
pr_info("PCM format is 8-bit mono\n");
-   pcm_hardware_template.formats = SNDRV_PCM_FMTBIT_S8;
+   pcm_hw->formats = SNDRV_PCM_FMTBIT_S8;
} else if (!strcmp(pcm_format, "2x16")) {
if (cfg->subbuffer_size != 4)
goto error;
pr_info("PCM format is 16-bit stereo\n");
-   pcm_hardware_template.channels_min = 2;
-   pcm_hardware_template.channels_max = 2;
-   pcm_hardware_template.formats = SNDRV_PCM_FMTBIT_S16_LE |
-   SNDRV_PCM_FMTBIT_S16_BE;
+   pcm_hw->channels_min = 2;
+   pcm_hw->channels_max = 2;
+   pcm_hw->formats = SNDRV_PCM_FMTBIT_S16_LE |
+ SNDRV_PCM_FMTBIT_S16_BE;
} else if (!strcmp(pcm_format, "2x24")) {
if (cfg->subbuffer_size != 6)
goto error;
pr_info("PCM format is 24-bit stereo\n");
-   pcm_hardware_template.channels_min = 2;
-   pcm_hardware_template.channels_max = 2;
-   pcm_hardware_template.formats = SNDRV_PCM_FMTBIT_S24_3LE |
-   SNDRV_PCM_FMTBIT_S24_3BE;
+   pcm_hw->channels_min = 2;
+   pcm_hw->channels_max = 2;
+   pcm_hw->formats = SNDRV_PCM_FMTBIT_S24_3LE |
+ SNDRV_PCM_FMTBIT_S24_3BE;
} else if (!strcmp(pcm_format, "2x32")) {
if (cfg->subbuffer_size != 8)
goto error;
pr_info("PCM forma

[PATCH 28/29] staging: most: add poll syscall to AIM cdev

2015-09-28 Thread Christian Gromm
This patch adds the implementation of the poll syscall to the AIM cdev.
To have the full functionality, a helper function is needed in the
core module to retrieve the instantaneous availability of tx buffers.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-cdev/cdev.c |   26 ++
 drivers/staging/most/mostcore/core.c |   16 
 drivers/staging/most/mostcore/mostcore.h |1 +
 3 files changed, 43 insertions(+)

diff --git a/drivers/staging/most/aim-cdev/cdev.c 
b/drivers/staging/most/aim-cdev/cdev.c
index 23c3f6e..930ada0 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -31,6 +32,7 @@ static struct most_aim cdev_aim;
 
 struct aim_channel {
wait_queue_head_t wq;
+   wait_queue_head_t poll_wq;
struct cdev cdev;
struct device *dev;
struct mutex io_mutex;
@@ -271,6 +273,28 @@ start_copy:
return retval;
 }
 
+static inline bool __must_check IS_ERR_OR_FALSE(int x)
+{
+   return x <= 0;
+}
+
+static unsigned int aim_poll(struct file *filp, poll_table *wait)
+{
+   struct aim_channel *c = filp->private_data;
+   unsigned int mask = 0;
+
+   poll_wait(filp, &c->poll_wq, wait);
+
+   if (c->cfg->direction == MOST_CH_RX) {
+   if (!kfifo_is_empty(&c->fifo))
+   mask |= POLLIN | POLLRDNORM;
+   } else {
+   if (!IS_ERR_OR_FALSE(channel_has_mbo(c->iface, c->channel_id)))
+   mask |= POLLOUT | POLLWRNORM;
+   }
+   return mask;
+}
+
 /**
  * Initialization of struct file_operations
  */
@@ -280,6 +304,7 @@ static const struct file_operations channel_fops = {
.write = aim_write,
.open = aim_open,
.release = aim_close,
+   .poll = aim_poll,
 };
 
 /**
@@ -434,6 +459,7 @@ static int aim_probe(struct most_interface *iface, int 
channel_id,
goto error_alloc_kfifo;
}
init_waitqueue_head(&channel->wq);
+   init_waitqueue_head(&channel->poll_wq);
mutex_init(&channel->io_mutex);
spin_lock_irqsave(&ch_list_lock, cl_flags);
list_add_tail(&channel->list, &channel_list);
diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index ee6deb8..0045c10 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -1383,6 +1383,22 @@ most_c_obj *get_channel_by_iface(struct most_interface 
*iface, int id)
return i->channel[id];
 }
 
+int channel_has_mbo(struct most_interface *iface, int id)
+{
+   struct most_c_obj *c = get_channel_by_iface(iface, id);
+   unsigned long flags;
+   int empty;
+
+   if (unlikely(!c))
+   return -EINVAL;
+
+   spin_lock_irqsave(&c->fifo_lock, flags);
+   empty = list_empty(&c->fifo);
+   spin_unlock_irqrestore(&c->fifo_lock, flags);
+   return !empty;
+}
+EXPORT_SYMBOL_GPL(channel_has_mbo);
+
 /**
  * most_get_mbo - get pointer to an MBO of pool
  * @iface: pointer to interface instance
diff --git a/drivers/staging/most/mostcore/mostcore.h 
b/drivers/staging/most/mostcore/mostcore.h
index 3c6fb19..9bd4c77 100644
--- a/drivers/staging/most/mostcore/mostcore.h
+++ b/drivers/staging/most/mostcore/mostcore.h
@@ -311,6 +311,7 @@ int most_deregister_aim(struct most_aim *aim);
 struct mbo *most_get_mbo(struct most_interface *iface, int channel_idx,
 struct most_aim *);
 void most_put_mbo(struct mbo *mbo);
+int channel_has_mbo(struct most_interface *iface, int channel_idx);
 int most_start_channel(struct most_interface *iface, int channel_idx,
   struct most_aim *);
 int most_stop_channel(struct most_interface *iface, int channel_idx,
-- 
1.7.9.5

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


[PATCH 23/29] staging: most: add missing channel initialization

2015-09-28 Thread Christian Gromm
This patch adds missing initialization of channel count for 8-bit mono
audio resolution.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-sound/sound.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index a579c5b..59e1294 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -504,6 +504,8 @@ static int audio_set_pcm_format(struct snd_pcm_hardware 
*pcm_hw,
if (cfg->subbuffer_size != 1)
goto error;
pr_info("PCM format is 8-bit mono\n");
+   pcm_hw->channels_min = 1;
+   pcm_hw->channels_max = 1;
pcm_hw->formats = SNDRV_PCM_FMTBIT_S8;
} else if (!strcmp(pcm_format, "2x16")) {
if (cfg->subbuffer_size != 4)
-- 
1.7.9.5

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


[PATCH 14/29] staging: most: prevent DMA on stack

2015-09-28 Thread Christian Gromm
This patch is needed to avoid having DMA on the stack.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |   26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index 01ea91b..7722212 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -146,17 +146,23 @@ static void wq_netinfo(struct work_struct *wq_obj);
  *
  * This is reads data from INIC's direct register communication interface
  */
-static inline int drci_rd_reg(struct usb_device *dev, u16 reg, void *buf)
+static inline int drci_rd_reg(struct usb_device *dev, u16 reg, u16 *buf)
 {
-   return usb_control_msg(dev,
-  usb_rcvctrlpipe(dev, 0),
-  DRCI_READ_REQ,
-  USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
-  0x,
-  reg,
-  buf,
-  2,
-  5 * HZ);
+   int retval;
+   u16 *dma_buf = kzalloc(sizeof(u16), GFP_KERNEL);
+   u8 req_type = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
+
+   if (!dma_buf)
+   return -ENOMEM;
+
+   retval = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
+DRCI_READ_REQ, req_type,
+0x,
+reg, dma_buf, sizeof(u16), 5 * HZ);
+   *buf = *dma_buf;
+   kfree(dma_buf);
+
+   return retval;
 }
 
 /**
-- 
1.7.9.5

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


[PATCH 22/29] staging: most: purge unecessary variable

2015-09-28 Thread Christian Gromm
This patch purges a temp. variable to store the functions return value.
Since the content is never being evaluated, it can safely be removed.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-sound/sound.c |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index 73a133d..a579c5b 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -350,17 +350,14 @@ static int pcm_close(struct snd_pcm_substream *substream)
 static int pcm_hw_params(struct snd_pcm_substream *substream,
 struct snd_pcm_hw_params *hw_params)
 {
-   int ret;
struct channel *channel = substream->private_data;
 
if ((params_channels(hw_params) > channel->pcm_hardware.channels_max) ||
(params_channels(hw_params) < channel->pcm_hardware.channels_min) ||
!(params_format(hw_params) != channel->pcm_hardware.formats))
return -EINVAL;
-   ret = snd_pcm_lib_alloc_vmalloc_buffer(substream,
+   return snd_pcm_lib_alloc_vmalloc_buffer(substream,
   params_buffer_bytes(hw_params));
-
-   return ret;
 }
 
 /**
-- 
1.7.9.5

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


[PATCH 27/29] staging: most: remove audio resolution format check

2015-09-28 Thread Christian Gromm
This patch removes the audio format cross-check, because the definitions
are not compatible.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-sound/sound.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index 18c346a..df14ce5 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -336,8 +336,7 @@ static int pcm_hw_params(struct snd_pcm_substream 
*substream,
struct channel *channel = substream->private_data;
 
if ((params_channels(hw_params) > channel->pcm_hardware.channels_max) ||
-   (params_channels(hw_params) < channel->pcm_hardware.channels_min) ||
-   !(params_format(hw_params) != channel->pcm_hardware.formats))
+   (params_channels(hw_params) < channel->pcm_hardware.channels_min))
return -EINVAL;
return snd_pcm_lib_alloc_vmalloc_buffer(substream,
params_buffer_bytes(hw_params));
-- 
1.7.9.5

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


[PATCH 24/29] staging: most: rename function

2015-09-28 Thread Christian Gromm
This patch renames the function audio_set_pcm_format(). Since the
function doesn't only set the PCM format anymore and to guard against
misunderstandings, its name needs to be changed.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-sound/sound.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index 59e1294..ee02273 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -496,7 +496,7 @@ static int split_arg_list(char *buf, char **card_name, char 
**pcm_format)
return 0;
 }
 
-static int audio_set_pcm_format(struct snd_pcm_hardware *pcm_hw,
+static int audio_set_hw_params(struct snd_pcm_hardware *pcm_hw,
char *pcm_format,
struct most_channel_config *cfg)
 {
@@ -616,7 +616,7 @@ static int audio_probe_channel(struct most_interface 
*iface, int channel_id,
channel->id = channel_id;
init_pcm_hardware(&channel->pcm_hardware);
 
-   if (audio_set_pcm_format(&channel->pcm_hardware, pcm_format, cfg))
+   if (audio_set_hw_params(&channel->pcm_hardware, pcm_format, cfg))
goto err_free_card;
 
snprintf(card->driver, sizeof(card->driver), "%s", DRIVER_NAME);
-- 
1.7.9.5

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


[PATCH 21/29] staging: most: squash AIM sound

2015-09-28 Thread Christian Gromm
This patch removes debug messages and prevents the sound AIM from being
noisy in kernel log.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-sound/sound.c |   14 --
 1 file changed, 14 deletions(-)

diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index 30a2894..73a133d 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -242,8 +242,6 @@ static int playback_thread(void *data)
 {
struct channel *const channel = data;
 
-   pr_info("playback thread started\n");
-
while (!kthread_should_stop()) {
struct mbo *mbo = NULL;
bool period_elapsed = false;
@@ -289,8 +287,6 @@ static int pcm_open(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct most_channel_config *cfg = channel->cfg;
 
-   pr_info("pcm_open(), %s\n", substream->name);
-
channel->substream = substream;
 
if (cfg->direction == MOST_CH_TX) {
@@ -332,8 +328,6 @@ static int pcm_close(struct snd_pcm_substream *substream)
 {
struct channel *channel = substream->private_data;
 
-   pr_info("pcm_close(), %s\n", substream->name);
-
if (channel->cfg->direction == MOST_CH_TX)
kthread_stop(channel->playback_task);
most_stop_channel(channel->iface, channel->id, &audio_aim);
@@ -359,8 +353,6 @@ static int pcm_hw_params(struct snd_pcm_substream 
*substream,
int ret;
struct channel *channel = substream->private_data;
 
-   pr_info("pcm_hw_params()\n");
-
if ((params_channels(hw_params) > channel->pcm_hardware.channels_max) ||
(params_channels(hw_params) < channel->pcm_hardware.channels_min) ||
!(params_format(hw_params) != channel->pcm_hardware.formats))
@@ -382,8 +374,6 @@ static int pcm_hw_params(struct snd_pcm_substream 
*substream,
  */
 static int pcm_hw_free(struct snd_pcm_substream *substream)
 {
-   pr_info("pcm_hw_free()\n");
-
return snd_pcm_lib_free_vmalloc_buffer(substream);
 }
 
@@ -587,8 +577,6 @@ static int audio_probe_channel(struct most_interface 
*iface, int channel_id,
char *card_name;
char *pcm_format;
 
-   pr_info("sound_probe_channel()\n");
-
if (!iface)
return -EINVAL;
 
@@ -674,8 +662,6 @@ static int audio_disconnect_channel(struct most_interface 
*iface,
 {
struct channel *channel;
 
-   pr_info("sound_disconnect_channel()\n");
-
channel = get_channel(iface, channel_id);
if (!channel) {
pr_err("sound_disconnect_channel(), invalid channel %d\n",
-- 
1.7.9.5

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


[PATCH 13/29] staging: most: simplify code

2015-09-28 Thread Christian Gromm
This patch simply rearranges code for better readability.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |   17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index 315abec..01ea91b 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -789,26 +789,24 @@ exit:
  */
 static int hdm_update_netinfo(struct most_dev *mdev)
 {
-   struct device *dev = &mdev->usb_device->dev;
+   struct usb_device *usb_device = mdev->usb_device;
+   struct device *dev = &usb_device->dev;
u16 hi, mi, lo, link;
 
if (!is_valid_ether_addr(mdev->hw_addr)) {
-   if (0 > drci_rd_reg(mdev->usb_device,
-   DRCI_REG_HW_ADDR_HI, &hi)) {
+   if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_HI, &hi) < 0) {
dev_err(dev, "Vendor request \"hw_addr_hi\" failed\n");
return -1;
}
le16_to_cpus(&hi);
 
-   if (0 > drci_rd_reg(mdev->usb_device,
-   DRCI_REG_HW_ADDR_MI, &mi)) {
+   if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_MI, &mi) < 0) {
dev_err(dev, "Vendor request \"hw_addr_mid\" failed\n");
return -1;
}
le16_to_cpus(&mi);
 
-   if (0 > drci_rd_reg(mdev->usb_device,
-   DRCI_REG_HW_ADDR_LO, &lo)) {
+   if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_LO, &lo) < 0) {
dev_err(dev, "Vendor request \"hw_addr_low\" failed\n");
return -1;
}
@@ -822,13 +820,14 @@ static int hdm_update_netinfo(struct most_dev *mdev)
mdev->hw_addr[4] = lo >> 8;
mdev->hw_addr[5] = lo;
mutex_unlock(&mdev->io_mutex);
-
}
-   if (0 > drci_rd_reg(mdev->usb_device, DRCI_REG_NI_STATE, &link)) {
+
+   if (drci_rd_reg(usb_device, DRCI_REG_NI_STATE, &link) < 0) {
dev_err(dev, "Vendor request \"link status\" failed\n");
return -1;
}
le16_to_cpus(&link);
+
mutex_lock(&mdev->io_mutex);
mdev->link_stat = link;
mutex_unlock(&mdev->io_mutex);
-- 
1.7.9.5

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


[PATCH 19/29] staging: most: include vendor in audio card's shortname

2015-09-28 Thread Christian Gromm
This patch adds Microchip as vendor to the audio card's shortname to
be displayed, when playback and capture devices are queried.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-sound/sound.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index 88221f0..c9b62c3 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -629,7 +629,7 @@ static int audio_probe_channel(struct most_interface 
*iface, int channel_id,
channel->id = channel_id;
 
snprintf(card->driver, sizeof(card->driver), "%s", DRIVER_NAME);
-   snprintf(card->shortname, sizeof(card->shortname), "MOST:%d",
+   snprintf(card->shortname, sizeof(card->shortname), "Microchip MOST:%d",
 card->number);
snprintf(card->longname, sizeof(card->longname), "%s at %s, ch %d",
 card->shortname, iface->description, channel_id);
-- 
1.7.9.5

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


[PATCH 29/29] staging: most: fix pcm_write input/output error

2015-09-28 Thread Christian Gromm
This patch keeps the process from sleeping after the PCM middle layer has
stopped playback by calling the pcm trigger callback. The patch is needed
to prevent aplay from causing a pcm_write Input/Output error.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-sound/sound.c |   17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index df14ce5..f08545c 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -239,9 +239,9 @@ static int playback_thread(void *data)
wait_event_interruptible(
channel->playback_waitq,
kthread_should_stop() ||
-   (mbo = most_get_mbo(channel->iface, channel->id,
-   &audio_aim)));
-
+   (channel->is_stream_running &&
+(mbo = most_get_mbo(channel->iface, channel->id,
+&audio_aim;
if (!mbo)
continue;
 
@@ -279,11 +279,12 @@ static int pcm_open(struct snd_pcm_substream *substream)
channel->substream = substream;
 
if (cfg->direction == MOST_CH_TX) {
-   init_waitqueue_head(&channel->playback_waitq);
channel->playback_task = kthread_run(&playback_thread, channel,
 "most_audio_playback");
-   if (IS_ERR(channel->playback_task))
+   if (IS_ERR(channel->playback_task)) {
+   pr_err("Couldn't start thread\n");
return PTR_ERR(channel->playback_task);
+   }
}
 
if (most_start_channel(channel->iface, channel->id, &audio_aim)) {
@@ -336,8 +337,10 @@ static int pcm_hw_params(struct snd_pcm_substream 
*substream,
struct channel *channel = substream->private_data;
 
if ((params_channels(hw_params) > channel->pcm_hardware.channels_max) ||
-   (params_channels(hw_params) < channel->pcm_hardware.channels_min))
+   (params_channels(hw_params) < channel->pcm_hardware.channels_min)) {
+   pr_err("Requested number of channels not supported.\n");
return -EINVAL;
+   }
return snd_pcm_lib_alloc_vmalloc_buffer(substream,
params_buffer_bytes(hw_params));
 }
@@ -422,6 +425,7 @@ static int pcm_trigger(struct snd_pcm_substream *substream, 
int cmd)
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
channel->is_stream_running = true;
+   wake_up_interruptible(&channel->playback_waitq);
return 0;
 
case SNDRV_PCM_TRIGGER_STOP:
@@ -606,6 +610,7 @@ static int audio_probe_channel(struct most_interface 
*iface, int channel_id,
channel->cfg = cfg;
channel->iface = iface;
channel->id = channel_id;
+   init_waitqueue_head(&channel->playback_waitq);
 
if (audio_set_hw_params(&channel->pcm_hardware, pcm_format, cfg))
goto err_free_card;
-- 
1.7.9.5

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


[PATCH 25/29] staging: most: move initialization code

2015-09-28 Thread Christian Gromm
This pathch moves the initialization of the PCM middle layer hardware
parameters to function audio_set_hw_params().

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-sound/sound.c |   28 ++--
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index ee02273..dff8f74 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -68,17 +68,6 @@ struct channel {
   SNDRV_PCM_INFO_INTERLEAVED | \
   SNDRV_PCM_INFO_BLOCK_TRANSFER)
 
-/**
- * Initialization of struct snd_pcm_hardware
- */
-static void init_pcm_hardware(struct snd_pcm_hardware *pcm_hw)
-{
-   pcm_hw->info = MOST_PCM_INFO;
-   pcm_hw->rates = SNDRV_PCM_RATE_48000;
-   pcm_hw->rate_min = 48000;
-   pcm_hw->rate_max = 48000;
-};
-
 #define swap16(val) ( \
(((u16)(val) << 8) & (u16)0xFF00) | \
(((u16)(val) >> 8) & (u16)0x00FF))
@@ -305,12 +294,6 @@ static int pcm_open(struct snd_pcm_substream *substream)
}
 
runtime->hw = channel->pcm_hardware;
-   runtime->hw.buffer_bytes_max = cfg->num_buffers * cfg->buffer_size;
-   runtime->hw.period_bytes_min = cfg->buffer_size;
-   runtime->hw.period_bytes_max = cfg->buffer_size;
-   runtime->hw.periods_min = 1;
-   runtime->hw.periods_max = cfg->num_buffers;
-
return 0;
 }
 
@@ -500,6 +483,16 @@ static int audio_set_hw_params(struct snd_pcm_hardware 
*pcm_hw,
char *pcm_format,
struct most_channel_config *cfg)
 {
+   pcm_hw->info = MOST_PCM_INFO;
+   pcm_hw->rates = SNDRV_PCM_RATE_48000;
+   pcm_hw->rate_min = 48000;
+   pcm_hw->rate_max = 48000;
+   pcm_hw->buffer_bytes_max = cfg->num_buffers * cfg->buffer_size;
+   pcm_hw->period_bytes_min = cfg->buffer_size;
+   pcm_hw->period_bytes_max = cfg->buffer_size;
+   pcm_hw->periods_min = 1;
+   pcm_hw->periods_max = cfg->num_buffers;
+
if (!strcmp(pcm_format, "1x8")) {
if (cfg->subbuffer_size != 1)
goto error;
@@ -614,7 +607,6 @@ static int audio_probe_channel(struct most_interface 
*iface, int channel_id,
channel->cfg = cfg;
channel->iface = iface;
channel->id = channel_id;
-   init_pcm_hardware(&channel->pcm_hardware);
 
if (audio_set_hw_params(&channel->pcm_hardware, pcm_format, cfg))
goto err_free_card;
-- 
1.7.9.5

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


[PATCH 18/29] staging: most: add multi channel support to sound AIM

2015-09-28 Thread Christian Gromm
This patch adds 5.1 surround configuration with subbuffer cross-check,
when establishing a link to the core. For the sake of simplicity, only
one specific channel configuration is allowed.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-sound/sound.c |   27 +--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index 0d7425b..88221f0 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -75,7 +76,7 @@ static struct snd_pcm_hardware pcm_hardware_template = {
.rate_min   = 48000,
.rate_max   = 48000,
.channels_min   = 1,
-   .channels_max   = 8,
+   .channels_max   = 1,
 };
 
 #define swap16(val) ( \
@@ -355,10 +356,18 @@ static int pcm_close(struct snd_pcm_substream *substream)
 static int pcm_hw_params(struct snd_pcm_substream *substream,
 struct snd_pcm_hw_params *hw_params)
 {
+   int ret;
+
pr_info("pcm_hw_params()\n");
 
-   return snd_pcm_lib_alloc_vmalloc_buffer(substream,
+   if ((params_channels(hw_params) > pcm_hardware_template.channels_max) ||
+   (params_channels(hw_params) < pcm_hardware_template.channels_min) ||
+   !(params_format(hw_params) != pcm_hardware_template.formats))
+   return -EINVAL;
+   ret = snd_pcm_lib_alloc_vmalloc_buffer(substream,
params_buffer_bytes(hw_params));
+
+   return ret;
 }
 
 /**
@@ -511,20 +520,34 @@ static int audio_set_pcm_format(char *pcm_format,
if (cfg->subbuffer_size != 4)
goto error;
pr_info("PCM format is 16-bit stereo\n");
+   pcm_hardware_template.channels_min = 2;
+   pcm_hardware_template.channels_max = 2;
pcm_hardware_template.formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S16_BE;
} else if (!strcmp(pcm_format, "2x24")) {
if (cfg->subbuffer_size != 6)
goto error;
pr_info("PCM format is 24-bit stereo\n");
+   pcm_hardware_template.channels_min = 2;
+   pcm_hardware_template.channels_max = 2;
pcm_hardware_template.formats = SNDRV_PCM_FMTBIT_S24_3LE |
SNDRV_PCM_FMTBIT_S24_3BE;
} else if (!strcmp(pcm_format, "2x32")) {
if (cfg->subbuffer_size != 8)
goto error;
pr_info("PCM format is 32-bit stereo\n");
+   pcm_hardware_template.channels_min = 2;
+   pcm_hardware_template.channels_max = 2;
pcm_hardware_template.formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S32_BE;
+   } else if (!strcmp(pcm_format, "6x16")) {
+   if (cfg->subbuffer_size != 12)
+   goto error;
+   pr_info("PCM format is 16-bit 5.1 multi channel\n");
+   pcm_hardware_template.channels_min = 6;
+   pcm_hardware_template.channels_max = 6;
+   pcm_hardware_template.formats = SNDRV_PCM_FMTBIT_S16_LE |
+   SNDRV_PCM_FMTBIT_S16_BE;
} else {
pr_err("PCM format %s not supported\n", pcm_format);
return -EIO;
-- 
1.7.9.5

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


[PATCH 26/29] staging: most: fix style problems

2015-09-28 Thread Christian Gromm
This patch simply corrects style violations.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-sound/sound.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index dff8f74..18c346a 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -340,7 +340,7 @@ static int pcm_hw_params(struct snd_pcm_substream 
*substream,
!(params_format(hw_params) != channel->pcm_hardware.formats))
return -EINVAL;
return snd_pcm_lib_alloc_vmalloc_buffer(substream,
-  params_buffer_bytes(hw_params));
+   params_buffer_bytes(hw_params));
 }
 
 /**
@@ -480,8 +480,8 @@ static int split_arg_list(char *buf, char **card_name, char 
**pcm_format)
 }
 
 static int audio_set_hw_params(struct snd_pcm_hardware *pcm_hw,
-   char *pcm_format,
-   struct most_channel_config *cfg)
+  char *pcm_format,
+  struct most_channel_config *cfg)
 {
pcm_hw->info = MOST_PCM_INFO;
pcm_hw->rates = SNDRV_PCM_RATE_48000;
-- 
1.7.9.5

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


[PATCH 02/29] staging: most: remove aim reset

2015-09-28 Thread Christian Gromm
This patch partly reverts a modification of function most_stop_channel()
that is trying to reset an established link between an AIM and an HDM in
all suitable places. But since the function most_stop_channel() is
stopping the data transfer it is the wrong place to do so.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/mostcore/core.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index eb4e159..5d99628 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -1555,11 +1555,6 @@ int most_stop_channel(struct most_interface *iface, int 
id)
if (!c->is_started)
return 0;
 
-   /* FIXME: we need to know calling AIM to reset only one link */
-   c->first_aim = NULL;
-   c->second_aim = NULL;
-   /* do not go into recursion calling aim->disconnect_channel */
-
mutex_lock(&c->stop_task_mutex);
if (c->hdm_enqueue_task)
kthread_stop(c->hdm_enqueue_task);
-- 
1.7.9.5

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


[PATCH 16/29] staging: most: add fair buffer distribution

2015-09-28 Thread Christian Gromm
This patch ensures a fair distribution of buffers, when two AIMs share a
single channel. The AIMs then won't be able to use more than half of all
pre-allocated buffers of the linked channel. However, in case the channel
is not shared, the AIM can exclusively use all available buffers.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-cdev/cdev.c  |5 +++--
 drivers/staging/most/aim-network/networking.c |2 +-
 drivers/staging/most/aim-sound/sound.c|3 ++-
 drivers/staging/most/hdm-dim2/dim2_hdm.c  |2 +-
 drivers/staging/most/mostcore/core.c  |   27 -
 drivers/staging/most/mostcore/mostcore.h  |4 +++-
 6 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/most/aim-cdev/cdev.c 
b/drivers/staging/most/aim-cdev/cdev.c
index a8a7689..23c3f6e 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -165,7 +165,7 @@ static ssize_t aim_write(struct file *filp, const char 
__user *buf,
}
mutex_unlock(&channel->io_mutex);
 
-   mbo = most_get_mbo(channel->iface, channel->channel_id);
+   mbo = most_get_mbo(channel->iface, channel->channel_id, &cdev_aim);
 
if (!mbo) {
if ((filp->f_flags & O_NONBLOCK))
@@ -173,7 +173,8 @@ static ssize_t aim_write(struct file *filp, const char 
__user *buf,
if (wait_event_interruptible(
channel->wq,
(mbo = most_get_mbo(channel->iface,
-   channel->channel_id)) ||
+   channel->channel_id,
+   &cdev_aim)) ||
(!channel->dev)))
return -ERESTARTSYS;
}
diff --git a/drivers/staging/most/aim-network/networking.c 
b/drivers/staging/most/aim-network/networking.c
index c13bd89..f0d9a43 100644
--- a/drivers/staging/most/aim-network/networking.c
+++ b/drivers/staging/most/aim-network/networking.c
@@ -245,7 +245,7 @@ static netdev_tx_t most_nd_start_xmit(struct sk_buff *skb,
 
BUG_ON(nd->dev != dev);
 
-   mbo = most_get_mbo(nd->iface, nd->tx.ch_id);
+   mbo = most_get_mbo(nd->iface, nd->tx.ch_id, &aim);
 
if (!mbo) {
netif_stop_queue(dev);
diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index 2d4732c..0d7425b 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -251,7 +251,8 @@ static int playback_thread(void *data)
wait_event_interruptible(
channel->playback_waitq,
kthread_should_stop() ||
-   (mbo = most_get_mbo(channel->iface, channel->id)));
+   (mbo = most_get_mbo(channel->iface, channel->id,
+   &audio_aim)));
 
if (!mbo)
continue;
diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c 
b/drivers/staging/most/hdm-dim2/dim2_hdm.c
index 4481a0b..1bb70b7 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
@@ -669,7 +669,7 @@ static void request_netinfo(struct most_interface 
*most_iface, int ch_idx)
return;
}
 
-   mbo = most_get_mbo(&dev->most_iface, dev->atx_idx);
+   mbo = most_get_mbo(&dev->most_iface, dev->atx_idx, NULL);
if (!mbo)
return;
 
diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index 0053b8c..4dfa001 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -36,6 +36,7 @@ static struct class *most_class;
 static struct device *class_glue_dir;
 static struct ida mdev_id;
 static int modref;
+static int dummy_num_buffers;
 
 struct most_c_obj {
struct kobject kobj;
@@ -59,6 +60,8 @@ struct most_c_obj {
struct most_aim *second_aim;
int first_aim_refs;
int second_aim_refs;
+   int first_num_buffers;
+   int second_num_buffers;
struct list_head trash_fifo;
struct task_struct *hdm_enqueue_task;
struct mutex stop_task_mutex;
@@ -1233,6 +1236,7 @@ static void arm_mbo(struct mbo *mbo)
}
 
spin_lock_irqsave(&c->fifo_lock, flags);
+   ++*mbo->num_buffers_ptr;
list_add_tail(&mbo->list, &c->fifo);
spin_unlock_irqrestore(&c->fifo_lock, flags);
 
@@ -1286,6 +1290,7 @@ static int arm_mbo_chain(struct most_c_obj *c, int dir,
goto _error1;
}
mbo->complete = compl;
+   mbo->num_buffers_ptr = &dummy_num_buffers;
if (dir == MOST_CH_RX) {
nq_hdm_mbo(mbo);
atomic_inc(&c->mbo_nq_level);
@@ -1384,22

[PATCH 01/29] staging: most: change structure initialization

2015-09-28 Thread Christian Gromm
By applying this patch the initialization of the most_aim structure is
performed at compile time.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-network/networking.c |   14 --
 drivers/staging/most/aim-v4l2/video.c |   13 +++--
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/most/aim-network/networking.c 
b/drivers/staging/most/aim-network/networking.c
index cbda189..dd36872 100644
--- a/drivers/staging/most/aim-network/networking.c
+++ b/drivers/staging/most/aim-network/networking.c
@@ -79,7 +79,6 @@ struct net_dev_context {
 
 static struct list_head net_devices = LIST_HEAD_INIT(net_devices);
 static struct spinlock list_lock;
-static struct most_aim aim;
 
 
 static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo)
@@ -491,15 +490,18 @@ out:
return 0;
 }
 
+static struct most_aim aim = {
+   .name = "networking",
+   .probe_channel = aim_probe_channel,
+   .disconnect_channel = aim_disconnect_channel,
+   .tx_completion = aim_resume_tx_channel,
+   .rx_completion = aim_rx_data,
+};
+
 static int __init most_net_init(void)
 {
pr_info("most_net_init()\n");
spin_lock_init(&list_lock);
-   aim.name = "networking";
-   aim.probe_channel = aim_probe_channel;
-   aim.disconnect_channel = aim_disconnect_channel;
-   aim.tx_completion = aim_resume_tx_channel;
-   aim.rx_completion = aim_rx_data;
return most_register_aim(&aim);
 }
 
diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index 8333245..377bb10 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -62,7 +62,6 @@ struct aim_fh {
 
 static struct list_head video_devices = LIST_HEAD_INIT(video_devices);
 static struct spinlock list_lock;
-static struct most_aim aim_info;
 
 
 static inline bool data_ready(struct most_video_dev *mdev)
@@ -590,14 +589,16 @@ static int aim_disconnect_channel(struct most_interface 
*iface,
return 0;
 }
 
+static struct most_aim aim_info = {
+   .name = "v4l",
+   .probe_channel = aim_probe_channel,
+   .disconnect_channel = aim_disconnect_channel,
+   .rx_completion = aim_rx_data,
+};
+
 static int __init aim_init(void)
 {
spin_lock_init(&list_lock);
-
-   aim_info.name = "v4l";
-   aim_info.probe_channel = aim_probe_channel;
-   aim_info.disconnect_channel = aim_disconnect_channel;
-   aim_info.rx_completion = aim_rx_data;
return most_register_aim(&aim_info);
 }
 
-- 
1.7.9.5

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


[PATCH 11/29] staging: most: fix buffer size for DIM2

2015-09-28 Thread Christian Gromm
This patch reduces the DBR buffer size to prevent an overflow in the DIM2
module. It is needed, because the MediaLB hardware has problems with DBR
buffers that exceed the size of 255 messages.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-dim2/dim2_hal.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c 
b/drivers/staging/most/hdm-dim2/dim2_hal.c
index e334206..0e54830 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hal.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hal.c
@@ -766,14 +766,14 @@ u8 DIM_InitControl(struct dim_channel *ch, u8 is_tx, u16 
ch_address,
   u16 max_buffer_size)
 {
return init_ctrl_async(ch, CAT_CT_VAL_CONTROL, is_tx, ch_address,
-  max_buffer_size * 2);
+  max_buffer_size);
 }
 
 u8 DIM_InitAsync(struct dim_channel *ch, u8 is_tx, u16 ch_address,
 u16 max_buffer_size)
 {
return init_ctrl_async(ch, CAT_CT_VAL_ASYNC, is_tx, ch_address,
-  max_buffer_size * 2);
+  max_buffer_size);
 }
 
 u8 DIM_InitIsoc(struct dim_channel *ch, u8 is_tx, u16 ch_address,
-- 
1.7.9.5

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


Re: [PATCH] Staging: rtl8712: rtl871x_ioctl_linux.c Move constant to right side of the comparision

2015-09-28 Thread Sudip Mukherjee
On Mon, Sep 28, 2015 at 09:56:19AM -0500, Larry Finger wrote:
> On 09/28/2015 06:18 AM, Sudip Mukherjee wrote:
> >On Sat, Sep 26, 2015 at 12:45:46PM -0500, Larry Finger wrote:
> >>On 09/26/2015 11:49 AM, Punit Vara wrote:
> >>>This patch is to the rtl871x_ioctl_linux.c that fixes up following
> >>>warning reported by checkpatch.pl :
> >>>
> >>>- Comparisons should place the constant on the right side of the test
> >>>
> >>>Signed-off-by: Punit Vara 
> >>
> >>This warning is crap. WTF difference does it make The compiler
> >>does not care, and any reader with any piece of a brain is not going
> >>to be confused!
> >>
> >>This patch and all others like it are just meaningless source churning!
> >>
> >>This author has made such a royal mess of his patches that I
> >>recommend that ALL of them be dropped. In addition, we should
> >>continue to drop his changes until he learns how to use git to
> >>generate N/M patches, and until he reads the documentation on patch
> >>submission.
> >Excuse me for my ignorance, but I still can not see what was wrong with
> >his patch. checkpatch is giving warning and he has fixed it. As far as
> >sending in series is concerned, he is a newbie and after telling him how
> >to generate patches in series he has learnt that. I have already told
> >him that his patches might be dropped as they are not in series and he
> >is ready to resend in series as soon as Greg confirms that they are
> >dropped. And as long as the driver is in staging there will be source
> >churning, isn't it?
> >If i remember correctly I was told that for a driver to be moved out of
> >staging the primary thing is that all checkpatch warnings needs to fixed.
> >So if this driver has to move out of staging someday then these warnings
> >also has to be fixed by someone.
> 
> The primary requirement for moving a driver out of staging is that
> it use mac80211. No amount of cosmetic fixing will ever make that
> change for rtl8712u!
Yes, ofcourse. But you will also have to admit that since this is in
staging and newbies are encouraged to first work with staging to fix
checkpatch warnings, so you will get these kind of patches. Outreachy is
starting from tomorrow and I am sure Greg will be flooded with these
kind of patches.
> 
> In my opinion, not ALL checkpatch warnings ever need to be
> heeded.Can you tell me why
> 
> /**
>  * This is a comment
>  */
> 
> is superior to
> 
> /*
>   This is a comment also
>  */
> 
> The difference is not significant, yet checkpatch treats it as
> though the source was horribly flawed. Similarly, satisfying the
> 80-character requirement can leave the code horribly unreadable.
Yes, I admit. Just recently I submited some memory leak patches to another
subsystem and there I had more than 80 char, so just kept a comment that
this warning is not taken care of as it improves readability. But like I
just told this is staging and unless all checkpatch warnings are fixed
someone or the other will continue to send these patches.
> 
> My main complaint is that the OP submitted dozens of patches with
> similar subjects, yet gave no indication is any of these were
> resubmissions, and completely failed to utilize the patch series
> mechanism of git. This behavior makes life difficult for both the
> maintainer and the reviewer.
Yes. True. Even some time he has sent exactly same patch more than one
time, sometimes a new version with no version in subject. That was
confusing. But again he is a newbie. By the time he was informed to send
in series he has already sent lots of patches. I understand your
irritation for that but again he is a newbie. So first few mistakes are
excusable. Isn't it?

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


[PATCH RESEND] staging/rdma: Kconfig change STAGING_RDMA to be tristate.

2015-09-28 Thread ira . weiny
From: Ira Weiny 

STAGING_RDMA was failing to build when INFINIBAND was set to 'm' and
STAGING_RDMA was set to 'y'.

Making this a tristate properly inherits the 'm' from the INFINIBAND setting.

Reviewed-by: Dalessandro, Dennis 
Reviewed-by: John, Jubin 
Reviewed-by: Mike Marciniszyn 
Signed-off-by: Ira Weiny 
---

This is a resend to linux-rdma.
For staging I should have sent it to Greg rather than Doug.


 drivers/staging/rdma/Kconfig |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/rdma/Kconfig b/drivers/staging/rdma/Kconfig
index d7f6235..ba87650 100644
--- a/drivers/staging/rdma/Kconfig
+++ b/drivers/staging/rdma/Kconfig
@@ -1,5 +1,5 @@
 menuconfig STAGING_RDMA
-bool "RDMA staging drivers"
+tristate "RDMA staging drivers"
depends on INFINIBAND
depends on PCI || BROKEN
depends on HAS_IOMEM
-- 
1.7.1

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


[PATCH 1/2] drivers: staging: wilc1000: Replace message queue with standard Linux lists

2015-09-28 Thread Chandra S Gorentla
 - The message queue is replaced with standard Linux linked list
 - kmem_cache is used for list members
 - A check for return value of receive method is added
 - GFP_ATOMIC is changed to GFP_KERNEL
 - A few other related minor changes

Signed-off-by: Chandra S Gorentla 
---
 - Comments of Dan Carpenter are taken care
   - If receive method return value not checked, case statement for previous
 message may get executed if not done
   - Indication of usage of 'kmem_cache' is added to the description
   - Memory allocation donw outside spin_lock; GFP_ATOMIC replaced
 with GFP_KERNEL
   - spin_lock, spin_unlock are matched
   - goto statements removed
   - Unrelated changes moved to a different patch
   - PRINT_ERR can be taken up in a seperate patch

 drivers/staging/wilc1000/host_interface.c |  7 ++-
 drivers/staging/wilc1000/wilc_msgqueue.c  | 73 +--
 drivers/staging/wilc1000/wilc_platform.h  |  5 ++-
 3 files changed, 40 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 62f4a8a..954656d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4304,11 +4304,16 @@ static int hostIFthread(void *pvArg)
u32 u32Ret;
struct host_if_msg msg;
tstrWILC_WFIDrv *pstrWFIDrv;
+   int ret;
 
memset(&msg, 0, sizeof(struct host_if_msg));
 
while (1) {
-   wilc_mq_recv(&gMsgQHostIF, &msg, sizeof(struct host_if_msg), 
&u32Ret);
+   ret = wilc_mq_recv(&gMsgQHostIF, &msg,
+   sizeof(struct host_if_msg), &u32Ret);
+   if (ret)
+   continue;
+
pstrWFIDrv = (tstrWILC_WFIDrv *)msg.drvHandler;
if (msg.id == HOST_IF_MSG_EXIT) {
PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n");
diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index 869736a..a01ada4 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -12,9 +12,15 @@
  */
 int wilc_mq_create(WILC_MsgQueueHandle *pHandle)
 {
+   pHandle->msg_cache = kmem_cache_create("wilc_message_queue",
+   sizeof(Message),
+   0, SLAB_POISON, NULL);
+   if (!pHandle->msg_cache)
+   return -ENOMEM;
+
spin_lock_init(&pHandle->strCriticalSection);
sema_init(&pHandle->hSem, 0);
-   pHandle->pstrMessageList = NULL;
+   INIT_LIST_HEAD(&pHandle->msg_list_head);
pHandle->u32ReceiversCount = 0;
pHandle->bExiting = false;
return 0;
@@ -28,6 +34,7 @@ int wilc_mq_create(WILC_MsgQueueHandle *pHandle)
  */
 int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle)
 {
+   Message *msg;
pHandle->bExiting = true;
 
/* Release any waiting receiver thread. */
@@ -36,13 +43,16 @@ int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle)
pHandle->u32ReceiversCount--;
}
 
-   while (pHandle->pstrMessageList) {
-   Message *pstrMessge = pHandle->pstrMessageList->pstrNext;
-
-   kfree(pHandle->pstrMessageList);
-   pHandle->pstrMessageList = pstrMessge;
+   while (!list_empty(&pHandle->msg_list_head)) {
+   msg = list_first_entry(&pHandle->msg_list_head,
+   Message, link);
+   list_del(&msg->link);
+   kfree(msg->pvBuffer);
+   kmem_cache_free(pHandle->msg_cache, msg);
}
 
+   kmem_cache_destroy(pHandle->msg_cache);
+
return 0;
 }
 
@@ -55,61 +65,40 @@ int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle)
 int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
 const void *pvSendBuffer, u32 u32SendBufferSize)
 {
-   int result = 0;
unsigned long flags;
Message *pstrMessage = NULL;
 
if ((!pHandle) || (u32SendBufferSize == 0) || (!pvSendBuffer)) {
PRINT_ER("pHandle or pvSendBuffer is null\n");
-   result = -EFAULT;
-   goto ERRORHANDLER;
+   return -EFAULT;
}
 
if (pHandle->bExiting) {
PRINT_ER("pHandle fail\n");
-   result = -EFAULT;
-   goto ERRORHANDLER;
+   return -EFAULT;
}
 
-   spin_lock_irqsave(&pHandle->strCriticalSection, flags);
-
/* construct a new message */
-   pstrMessage = kmalloc(sizeof(Message), GFP_ATOMIC);
+   pstrMessage = kmem_cache_zalloc(pHandle->msg_cache, GFP_KERNEL);
if (!pstrMessage)
return -ENOMEM;
+
pstrMessage->u32Length = u32SendBufferSize;
-   pstrMessage->pstrNext = NULL;
-   pstrMessage->pvBuffer = kmalloc(u32SendBufferSize, GFP_ATOMIC);
+   pstrMessage->pvBuffer = kma

[PATCH 2/2] drivers: staging: wilc1000: wilc_msgqueue.c: Remove ineffective code

2015-09-28 Thread Chandra S Gorentla
Signed-off-by: Chandra S Gorentla 
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index a01ada4..1a411d3 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -133,11 +133,6 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,
down(&pHandle->hSem);
 
/* other non-timeout scenarios */
-   if (result) {
-   PRINT_ER("Non-timeout\n");
-   return result;
-   }
-
if (pHandle->bExiting) {
PRINT_ER("pHandle fail\n");
return -EFAULT;
-- 
2.1.4

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


[PATCH 2/2] drivers: staging: wilc1000: wilc_msgqueue.c: Remove code that no effect

2015-09-28 Thread Chandra S Gorentla
Signed-off-by: Chandra S Gorentla 
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index a01ada4..1a411d3 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -133,11 +133,6 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,
down(&pHandle->hSem);
 
/* other non-timeout scenarios */
-   if (result) {
-   PRINT_ER("Non-timeout\n");
-   return result;
-   }
-
if (pHandle->bExiting) {
PRINT_ER("pHandle fail\n");
return -EFAULT;
-- 
2.1.4

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


Re: [PATCH v2] staging: rtl8723au: Fix resource leak

2015-09-28 Thread Jes Sorensen
Mateusz Kulikowski  writes:
> Firmware was not released properly if kmemdup fails.
>
> Addresses-Coverity-Id: 1269118
> Signed-off-by: Mateusz Kulikowski 
> ---
>  drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Jes Sorensen 

>
> diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c 
> b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
> index cd014f7..ecf54ee 100644
> --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
> +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
> @@ -249,13 +249,13 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter 
> *padapter)
>   goto Exit;
>   }
>   firmware_buf = kmemdup(fw->data, fw->size, GFP_KERNEL);
> + fw_size = fw->size;
> + release_firmware(fw);
>   if (!firmware_buf) {
>   rtStatus = _FAIL;
>   goto Exit;
>   }
>   buf = firmware_buf;
> - fw_size = fw->size;
> - release_firmware(fw);
>  
>   /*  To Check Fw header. Added by tynli. 2009.12.04. */
>   pFwHdr = (struct rt_8723a_firmware_hdr *)firmware_buf;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] drivers: staging: wilc1000: wilc_msgqueue.c: Remove code that no effect

2015-09-28 Thread Chandra Gorentla
Please do not review this.  This is duplicate to -
[PATCH 2/2] drivers: staging: wilc1000: wilc_msgqueue.c: Remove ineffective code

On Mon, Sep 28, 2015 at 11:43:56PM +0530, Chandra S Gorentla wrote:
> Signed-off-by: Chandra S Gorentla 
> ---
>  drivers/staging/wilc1000/wilc_msgqueue.c | 5 -
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
> b/drivers/staging/wilc1000/wilc_msgqueue.c
> index a01ada4..1a411d3 100644
> --- a/drivers/staging/wilc1000/wilc_msgqueue.c
> +++ b/drivers/staging/wilc1000/wilc_msgqueue.c
> @@ -133,11 +133,6 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,
>   down(&pHandle->hSem);
>  
>   /* other non-timeout scenarios */
> - if (result) {
> - PRINT_ER("Non-timeout\n");
> - return result;
> - }
> -
>   if (pHandle->bExiting) {
>   PRINT_ER("pHandle fail\n");
>   return -EFAULT;
> -- 
> 2.1.4
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: comedi: ni_tiocmd: remove unused code

2015-09-28 Thread Luis de Bethencourt
Remove the unused code, which isn't implemented yet, using #if 0.

Signed-off-by: Luis de Bethencourt 
---

Hi,

The code after the return is dead code. My understanding is that it is
there for when the output commands are implemented in the future.
Meanwhile it would be clearer if the code is removed with #if 0.

Thanks,
Luis

 drivers/staging/comedi/drivers/ni_tiocmd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index 9b124b0..728c7f4 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -158,11 +158,13 @@ static int ni_tio_output_cmd(struct comedi_subdevice *s)
"output commands not yet implemented.\n");
return -ENOTSUPP;
 
+#if 0 /* unused */
counter->mite_chan->dir = COMEDI_OUTPUT;
mite_prep_dma(counter->mite_chan, 32, 32);
ni_tio_configure_dma(counter, true, false);
mite_dma_arm(counter->mite_chan);
return ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE);
+#endif
 }
 
 static int ni_tio_cmd_setup(struct comedi_subdevice *s)
-- 
2.5.1

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


[PATCH] staging: comedi: cb_pcidas64: remove unused code

2015-09-28 Thread Luis de Bethencourt
Remove the disabled code, for now, with #if 0.

Signed-off-by: Luis de Bethencourt 
---

Hi,

The code after the return is dead code. There is a comment saying it is
disabled for now, it would be good if the code is removed with #if 0 as
well.

Thanks,
Luis

 drivers/staging/comedi/drivers/cb_pcidas64.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index d33b8fe..f86ea9f 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -2233,10 +2233,12 @@ static int use_hw_sample_counter(struct comedi_cmd *cmd)
 /* disable for now until I work out a race */
return 0;
 
+#if 0
if (cmd->stop_src == TRIG_COUNT && cmd->stop_arg <= max_counter_value)
return 1;
 
return 0;
+#endif
 }
 
 static void setup_sample_counters(struct comedi_device *dev,
-- 
2.5.1

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


[PATCH] staging: rtl8712: remove dead code

2015-09-28 Thread Luis de Bethencourt
The while() loop will only exit in a return or a goto ask_for_joinbss,
which means it will never break and execute the return after it.
Removing return _FAIL since it is dead code.

Signed-off-by: Luis de Bethencourt 
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c 
b/drivers/staging/rtl8712/rtl871x_mlme.c
index fc5dbea..fbcb248 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -1190,7 +1190,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv 
*pmlmepriv)
}
}
}
-   return _FAIL;
+
 ask_for_joinbss:
return r8712_joinbss_cmd(adapter, pnetwork);
 }
-- 
2.5.1

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


Re: [lustre-devel] [PATCH 30/73] staging/lustre: use 64-bit times for request times

2015-09-28 Thread Dilger, Andreas
On 2015/09/28, 2:19 AM, "lustre-devel on behalf of Arnd Bergmann"
 wrote:

>On Monday 28 September 2015 01:09:18 Dilger, Andreas wrote:
>> On 2015/09/27, 10:45 PM, "gr...@linuxhacker.ru" 
>> wrote:
>> >diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c
>> >b/drivers/staging/lustre/lustre/ptlrpc/events.c
>> >index 53f6b62..afd869b 100644
>> >--- a/drivers/staging/lustre/lustre/ptlrpc/events.c
>> >+++ b/drivers/staging/lustre/lustre/ptlrpc/events.c
>> >@@ -246,7 +246,7 @@ static void ptlrpc_req_add_history(struct
>> >ptlrpc_service_part *svcpt,
>> >   struct ptlrpc_request *req)
>> > {
>> >__u64 sec = req->rq_arrival_time.tv_sec;
>> >-   __u32 usec = req->rq_arrival_time.tv_usec >> 4; /* usec / 16 */
>> >+   __u32 usec = req->rq_arrival_time.tv_nsec / NSEC_PER_USEC / 16; /*
>>usec
>> >/ 16 */
>> 
>> This could just be written like:
>> 
>>  __u32 usec = req->rq_arrival_time.tv_nsec >> 14 /* nsec / 16384 */;
>> 
>> since the main point of this calculation is to get a number that fits
>> into a 16-bit field to provide ordering for items in a trace log.  It
>> doesn't have to be exactly "nsec / 16000", and it avoids the division.
>
>Ok, that wasn't clear from the original code, so I just moved the division
>from the do_gettimeofday() here to keep the data unchanged.
>
>With your change, the
>
>new_seq = (sec << REQS_SEC_SHIFT) |
>  (usec << REQS_USEC_SHIFT) |
>  (svcpt->scp_cpt < 0 ? 0 : svcpt->scp_cpt);
>
>calculation will get forward jumps once a second, but I guess that
>doesn't matter if it's only used for sequencing.
>
>The part that I had not noticed here is the y2106 overflow in the
>sequence number. If we change the logic, we should probably give
>a few more bits to the seconds, as well, or use monotonic time.
>
>> >diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c
>> >b/drivers/staging/lustre/lustre/ptlrpc/service.c
>> >index 40de622..28f57d7 100644
>> >--- a/drivers/staging/lustre/lustre/ptlrpc/service.c
>> >+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
>> >@@ -1191,7 +1191,7 @@ static int ptlrpc_at_add_timed(struct
>> >ptlrpc_request *req)
>> >spin_lock(&svcpt->scp_at_lock);
>> >LASSERT(list_empty(&req->rq_timed_list));
>> > 
>> >-   index = (unsigned long)req->rq_deadline % array->paa_size;
>> >+   div_u64_rem(req->rq_deadline, array->paa_size, &index);
>> 
>> Since this is just a round-robin index that advances once per second,
>> it doesn't matter at all whether the calculation is computed on the
>> 64-bit seconds or on the 32-bit seconds, so there isn't any need for
>> the more expensive div_u64_rem() call here at all.  It is fine to
>> just truncate the seconds and then do the modulus on the 32-bit value.
>> 
>> >@@ -1421,7 +1421,7 @@ static int ptlrpc_at_check_timed(struct
>> >ptlrpc_service_part *svcpt)
>> >   server will take. Send early replies to everyone expiring soon. */
>> >INIT_LIST_HEAD(&work_list);
>> >deadline = -1;
>> >-   index = (unsigned long)array->paa_deadline % array->paa_size;
>> >+   div_u64_rem(array->paa_deadline, array->paa_size, &index);
>> 
>> Same here.
>
>I went back and forth on these. Initially I did just what you suggest
>here and added a (u32) cast on the deadline fields, but I could not
>convince myself that the backwards jump in 2038 is harmless. For all
>I can tell,  array->paa_size is not normally a power-of-two number, so
>(0x % array->paa_size) and (0 % array->paa_size) are not
>neighboring indices. If you are sure that the index can be allowed to
>jump in 2038, we should do the simpler math and add a comment.

The jump should be largely harmless.  This array is tracking the maximum
RPC service time over the past paa_size interval to avoid sending spurious
RPC retries if the server is already heavily loaded.  If these values
are not expired in 100% accurate order the worst thing that can happen is
that some clients may resend their RPCs unnecessarily under heavy load.

Cheers, Andreas
-- 
Andreas Dilger

Lustre Software Architect
Intel High Performance Data Division


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


Re: [PATCH] staging:rtl8188eu: style fix comparisons moved to right

2015-09-28 Thread Greg KH
On Mon, Sep 28, 2015 at 06:02:34PM -0600, BryanSPaul wrote:
> fixed style issue comparisons should place the constant on the right side of 
> the test
> 
> Signed-off-by: BryanSPaul 

I doubt you sign legal papers without a ' ' in them :(

Please fix this up, and properly wrap your changelog at 72 columns and
resend.

thanks,

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


[PATCH] staging:rtl8188eu: style fix comparisons moved to right

2015-09-28 Thread BryanSPaul
fixed style issue comparisons should place the constant on the right side of 
the test

Signed-off-by: BryanSPaul 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 89b5e48..9b7026e 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -125,7 +125,7 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct 
cmd_obj *cmd_obj)
cmd_obj->padapter = padapter;

res = rtw_cmd_filter(pcmdpriv, cmd_obj);
-   if (_FAIL == res) {
+   if (res == _FAIL) {
rtw_free_cmd_obj(cmd_obj);
goto exit;
}
@@ -199,7 +199,7 @@ _next:
if (!pcmd)
continue;

-   if (_FAIL == rtw_cmd_filter(pcmdpriv, pcmd)) {
+   if (rtw_cmd_filter(pcmdpriv, pcmd) == _FAIL) {
pcmd->res = H2C_DROPPED;
goto post_process;
}
@@ -553,7 +553,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 
deauth_timeout_ms, bool enqueu
res = rtw_enqueue_cmd(cmdpriv, cmdobj);
} else {
/* no need to enqueue, do the cmd hdl directly and free cmd 
parameter */
-   if (H2C_SUCCESS != disconnect_hdl(padapter, (u8 *)param))
+   if (disconnect_hdl(padapter, (u8 *)param) != H2C_SUCCESS)
res = _FAIL;
kfree(param);
}
@@ -819,7 +819,7 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, 
u8 enqueue)
res = rtw_enqueue_cmd(pcmdpriv, pcmdobj);
} else {
/* no need to enqueue, do the cmd hdl directly and free cmd 
parameter */
-   if (H2C_SUCCESS != set_chplan_hdl(padapter, (unsigned char 
*)setChannelPlan_param))
+   if (set_chplan_hdl(padapter, (unsigned char 
*)setChannelPlan_param) != H2C_SUCCESS)
res = _FAIL;

kfree(setChannelPlan_param);
--
2.4.9
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv4 3/3] drm: bridge: anx78xx: Add anx78xx driver support by analogix.

2015-09-28 Thread drinkcat
Hi Enric,

On Fri, Sep 25, 2015 at 09:29:28PM +0200, Enric Balletbo i Serra wrote:
> At the moment it only supports ANX7814.
> 
> The ANX7814 is an ultra-low power Full-HD (1080p60) SlimPort transmitter
> designed for portable devices.
> 
> This driver adds initial support and supports HDMI to DP pass-through mode.
> 
> Signed-off-by: Enric Balletbo i Serra 

More comments. Please look at patterns (u8->bool, use bit_ctl, etc.):
I did not comment on every single instance of these.

Best,

> ---
>  drivers/gpu/drm/bridge/Kconfig   |2 +
>  drivers/gpu/drm/bridge/Makefile  |1 +
>  drivers/gpu/drm/bridge/anx78xx/Kconfig   |7 +
>  drivers/gpu/drm/bridge/anx78xx/Makefile  |4 +
>  drivers/gpu/drm/bridge/anx78xx/anx78xx.h |   41 +
>  drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c|  228 ++
>  drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.c | 3148 
> ++
>  drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.h |  214 ++
>  drivers/gpu/drm/bridge/anx78xx/slimport_tx_reg.h |  807 ++
>  9 files changed, 4452 insertions(+)
>  create mode 100644 drivers/gpu/drm/bridge/anx78xx/Kconfig
>  create mode 100644 drivers/gpu/drm/bridge/anx78xx/Makefile
>  create mode 100644 drivers/gpu/drm/bridge/anx78xx/anx78xx.h
>  create mode 100644 drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c
>  create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.c
>  create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.h
>  create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_reg.h
> 
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 2de52a5..aa6fe12 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -29,4 +29,6 @@ config DRM_PARADE_PS8622
>   ---help---
> Parade eDP-LVDS bridge chip driver.
>  
> +source "drivers/gpu/drm/bridge/anx78xx/Kconfig"
> +
>  endmenu
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index e2eef1c..e5bd38b 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -3,3 +3,4 @@ ccflags-y := -Iinclude/drm
>  obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o
>  obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
>  obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
> +obj-$(CONFIG_DRM_ANX78XX) += anx78xx/
> diff --git a/drivers/gpu/drm/bridge/anx78xx/Kconfig 
> b/drivers/gpu/drm/bridge/anx78xx/Kconfig
> new file mode 100644
> index 000..08f9c08
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/anx78xx/Kconfig
> @@ -0,0 +1,7 @@
> +config DRM_ANX78XX
> + tristate "Analogix ANX78XX bridge"
> + help
> + ANX78XX is a HD video transmitter chip over micro-USB
> + connector for smartphone device.
> +
> +
> diff --git a/drivers/gpu/drm/bridge/anx78xx/Makefile 
> b/drivers/gpu/drm/bridge/anx78xx/Makefile
> new file mode 100644
> index 000..a843733
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/anx78xx/Makefile
> @@ -0,0 +1,4 @@
> +obj-${CONFIG_DRM_ANX78XX} :=  anx78xx.o
> +
> +anx78xx-y += anx78xx_main.o
> +anx78xx-y += slimport_tx_drv.o
> diff --git a/drivers/gpu/drm/bridge/anx78xx/anx78xx.h 
> b/drivers/gpu/drm/bridge/anx78xx/anx78xx.h
> new file mode 100644
> index 000..f62c8e7
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/anx78xx/anx78xx.h
> @@ -0,0 +1,41 @@
> +/*
> + * Copyright(c) 2015, Analogix Semiconductor. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 and
> + * only version 2 as published by the Free Software Foundation.
> + *
> + * 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.
> + *
> + */
> +
> +#ifndef __ANX78xx_H
> +#define __ANX78xx_H
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct anx78xx_platform_data {
> + struct gpio_desc *gpiod_pd;
> + struct gpio_desc *gpiod_reset;
> + spinlock_t lock;
> +};
> +
> +struct anx78xx {
> + struct i2c_client *client;
> + struct anx78xx_platform_data *pdata;
> + struct delayed_work work;
> + struct workqueue_struct *workqueue;
> + struct mutex lock;
> +};
> +
> +void anx78xx_poweron(struct anx78xx *data);
> +void anx78xx_poweroff(struct anx78xx *data);
> +
> +#endif
> diff --git a/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c 
> b/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c
> new file mode 100644
> index 000..1e4a87e
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c
> @@ -0,0 +1,228 @@
> +/*
> + * Copyright(c) 2015, Analogix Semiconductor. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU G

Re: [PATCH 3/3] Staging: rts5208: Coding style warnings fix for block comments

2015-09-28 Thread Greg KH
On Mon, Sep 21, 2015 at 11:29:50PM +0530, Punit Vara wrote:
> This patch is to rtsx_chip.h that fixes up following warning reported
> by checkpatch.pl :
> 
> -Block comments use * on subsequent lines
> -Block comments use a trailing */ on a separate line
> 
> Signed-off-by: Punit Vara 
> ---
>  drivers/staging/rts5208/rtsx_chip.h | 66 
> +++--
>  1 file changed, 42 insertions(+), 24 deletions(-)

Where is patch 1/3 and 2/3?

You have sent me almost 60 different patches, yet you gave me no idea
what order to apply them in at all, what am I supposed to do with all of
them?

Please redo all of your outstanding patches that I have not taken and
resend them in a proper patch series, numbered correctly so that I have
a chance to know what order to apply the.  I've now purged my todo queue
of all of your patches.

thanks,

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


Re: [PATCH 3/4] staging: wilc1000: remove define WILC_PARSE_SCAN_IN_HOST

2015-09-28 Thread Greg KH
On Wed, Sep 23, 2015 at 04:10:54PM +0900, Glen Lee wrote:
> The define WILC_PARSE_SCAN_IN_HOST is always used in the driver, so just
> delete ifdef WILC_PARSE_SCAN_IN_HOST line, ifndef WILC_PARSE_SCAN_IN_HOST
> line and it's related codes. Finally, remove define in Makefile.
> 
> Signed-off-by: Glen Lee 
> ---
>  drivers/staging/wilc1000/Makefile |  1 -
>  drivers/staging/wilc1000/host_interface.c | 62 
> ---
>  drivers/staging/wilc1000/wilc_wlan_if.h   |  3 +-
>  3 files changed, 1 insertion(+), 65 deletions(-)

This and the 4/4 patch does not apply to my tree, please rebase and
resend.

thanks,

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


Re: [PATCH 5/6] staging: wilc1000: remove wilc_platform include file

2015-09-28 Thread Greg KH
On Wed, Sep 23, 2015 at 06:03:49PM +0900, Chaehyun Lim wrote:
> This patch removes wilc_platform.h include file in wilc_oswrapper.h
> Because wilc_platform.h have several standard header files so that some
> header file should be included .c file to avoid compilation errors.
> 
> Signed-off-by: Chaehyun Lim 
> ---
>  drivers/staging/wilc1000/coreconfigurator.c | 1 +
>  drivers/staging/wilc1000/host_interface.c   | 4 
>  drivers/staging/wilc1000/wilc_oswrapper.h   | 2 --
>  drivers/staging/wilc1000/wilc_wlan_if.h | 2 +-
>  4 files changed, 6 insertions(+), 3 deletions(-)

This patch, and 6/6 doesn't apply to the tree anymore, can you rebase
and resend them?

thanks,

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


Re: [PATCH staging 2/3] wilc1000 : Remove leftover comment delimiters

2015-09-28 Thread Greg KH
On Fri, Sep 25, 2015 at 12:45:16AM -0700, Anish Bhatt wrote:
> Remove leftover comment delimiters that were only partially removed
> in a previous cleanup.

You also changed code formatting, which isn't ok to do in the same
patch, please break it up into different patches.

thanks,

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


Re: [PATCH 2/2] drivers: staging: wilc1000: wilc_msgqueue.c: Remove code that no effect

2015-09-28 Thread Greg KH
On Tue, Sep 29, 2015 at 12:07:43AM +0530, Chandra Gorentla wrote:
> Please do not review this.  This is duplicate to -
> [PATCH 2/2] drivers: staging: wilc1000: wilc_msgqueue.c: Remove ineffective 
> code

I don't understand, you sent 2 2/2 patches, which one do I look at?

Please just resend the whole series.

thanks,

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


Re: [PATCH 00/29] staging: most: update driver

2015-09-28 Thread Greg KH
On Mon, Sep 28, 2015 at 05:18:29PM +0200, Christian Gromm wrote:
> This patchset is needed to pull Microchip's latest driver changes into
> the staging tree. The patches include bug fixes, feature updates and
> coding style changes.

I'll take these, but I really don't want to see new "features" added
before the code is merged out of the staging tree, can we work on those
things first before adding new code please?

thanks,

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


Re: [PATCH 1/2] drivers: staging: wilc1000: Replace message queue with standard Linux lists

2015-09-28 Thread Greg KH
On Mon, Sep 28, 2015 at 11:43:55PM +0530, Chandra S Gorentla wrote:
>  - The message queue is replaced with standard Linux linked list
>  - kmem_cache is used for list members

Why?

>  - A check for return value of receive method is added
>  - GFP_ATOMIC is changed to GFP_KERNEL

Why?  Are you sure that is safe?

>  - A few other related minor changes

Be specific please.

thanks,

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


Re: [PATCH] staging: comedi: cb_pcidas64: remove unused code

2015-09-28 Thread Greg KH
On Mon, Sep 28, 2015 at 10:10:42PM +0100, Luis de Bethencourt wrote:
> Remove the disabled code, for now, with #if 0.
> 
> Signed-off-by: Luis de Bethencourt 
> ---
> 
> Hi,
> 
> The code after the return is dead code. There is a comment saying it is
> disabled for now, it would be good if the code is removed with #if 0 as
> well.

The compiler doesn't add it anyway, so this is the same as what you just
did, so I don't think it's needed.

thanks,

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


Re: [PATCH] staging: comedi: ni_tiocmd: remove unused code

2015-09-28 Thread Greg KH
On Mon, Sep 28, 2015 at 09:54:45PM +0100, Luis de Bethencourt wrote:
> Remove the unused code, which isn't implemented yet, using #if 0.
> 
> Signed-off-by: Luis de Bethencourt 
> ---
> 
> Hi,
> 
> The code after the return is dead code. My understanding is that it is
> there for when the output commands are implemented in the future.
> Meanwhile it would be clearer if the code is removed with #if 0.
> 
> Thanks,
> Luis
> 
>  drivers/staging/comedi/drivers/ni_tiocmd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
> b/drivers/staging/comedi/drivers/ni_tiocmd.c
> index 9b124b0..728c7f4 100644
> --- a/drivers/staging/comedi/drivers/ni_tiocmd.c
> +++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
> @@ -158,11 +158,13 @@ static int ni_tio_output_cmd(struct comedi_subdevice *s)
>   "output commands not yet implemented.\n");
>   return -ENOTSUPP;
>  
> +#if 0 /* unused */
>   counter->mite_chan->dir = COMEDI_OUTPUT;
>   mite_prep_dma(counter->mite_chan, 32, 32);
>   ni_tio_configure_dma(counter, true, false);
>   mite_dma_arm(counter->mite_chan);
>   return ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE);
> +#endif

That's not clear at all, if the code isn't needed, let's just delete it,
why is it here at all?

thanks,

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


Re: [PATCH 1/2] drivers: staging: wilc1000: Replace message queue with standard Linux lists

2015-09-28 Thread Dan Carpenter
On Mon, Sep 28, 2015 at 11:43:55PM +0530, Chandra S Gorentla wrote:
>  - The message queue is replaced with standard Linux linked list
>  - kmem_cache is used for list members
>  - A check for return value of receive method is added
>  - GFP_ATOMIC is changed to GFP_KERNEL
>  - A few other related minor changes

These should be listed and explained.

>  
>   while (1) {
> - wilc_mq_recv(&gMsgQHostIF, &msg, sizeof(struct host_if_msg), 
> &u32Ret);
> + ret = wilc_mq_recv(&gMsgQHostIF, &msg,
> + sizeof(struct host_if_msg), &u32Ret);
> + if (ret)
> + continue;
> +

I asked before if this was a forever loop and never got a response.
Also what does this have to do with list macros?

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


Re: [PATCH 66/73] staging/lustre: remove lots of dead code

2015-09-28 Thread Greg Kroah-Hartman
On Mon, Sep 28, 2015 at 11:36:01AM +0200, Arnd Bergmann wrote:
> On Sunday 27 September 2015 16:46:06 gr...@linuxhacker.ru wrote:
> > From: Oleg Drokin 
> > 
> > This is a large patch to remove all dead code from obdclass and
> > ptlrpc, purely removing functions and declarations now, so
> > despite the size should be easy enough to verify.
> > 
> > Signed-off-by: Arnd Bergmann 
> > Signed-off-by: Oleg Drokin 
> 
> Thanks for all the work to split out the smaller patches from my
> larger code removal!
> 
> There is one small point about the attribution though: your split
> out patches now have 'From: Oleg Drokin ' along
> wtih 'Signed-off-by: Arnd Bergmann ', which is
> inconsistent. For the larger chunks of patches that you took from me
> and that retain my 'Signed-off-by', it would be nice if you could
> set the author field to me for consistency as well.
> 
> For the smaller patches for which writing the changelog was likely
> more work than doing the patch, it's fine if you claim authorship,
> but if you do that then please change the 'Signed-off-by' to
> 'Reported-by' or 'Suggested-by' for me, so the author field
> matches the first Signed-off-by.

I agree, this isn't good.  I've applied the first 47 patches in this
series as they authorship info all seemed correct up until then.

Oleg, can you rebase and resend the remaining ones after fixing this up?

thanks,

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


Re: [PATCH 66/73] staging/lustre: remove lots of dead code

2015-09-28 Thread Oleg Drokin

On Sep 28, 2015, at 10:08 PM, Greg Kroah-Hartman wrote:

> On Mon, Sep 28, 2015 at 11:36:01AM +0200, Arnd Bergmann wrote:
>> On Sunday 27 September 2015 16:46:06 gr...@linuxhacker.ru wrote:
>>> From: Oleg Drokin 
>>> 
>>> This is a large patch to remove all dead code from obdclass and
>>> ptlrpc, purely removing functions and declarations now, so
>>> despite the size should be easy enough to verify.
>>> 
>>> Signed-off-by: Arnd Bergmann 
>>> Signed-off-by: Oleg Drokin 
>> 
>> Thanks for all the work to split out the smaller patches from my
>> larger code removal!
>> 
>> There is one small point about the attribution though: your split
>> out patches now have 'From: Oleg Drokin ' along
>> wtih 'Signed-off-by: Arnd Bergmann ', which is
>> inconsistent. For the larger chunks of patches that you took from me
>> and that retain my 'Signed-off-by', it would be nice if you could
>> set the author field to me for consistency as well.
>> 
>> For the smaller patches for which writing the changelog was likely
>> more work than doing the patch, it's fine if you claim authorship,
>> but if you do that then please change the 'Signed-off-by' to
>> 'Reported-by' or 'Suggested-by' for me, so the author field
>> matches the first Signed-off-by.
> 
> I agree, this isn't good.  I've applied the first 47 patches in this
> series as they authorship info all seemed correct up until then.
> 
> Oleg, can you rebase and resend the remaining ones after fixing this up?

Sure.
In fact I am not sure why the author got reset in that one in the
first place.

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


Re: [PATCH] Staging: rtl8188eu: os_dep: Stop using DBG_88E

2015-09-28 Thread Greg Kroah-Hartman
On Fri, Sep 25, 2015 at 10:23:44PM +0530, Shraddha Barke wrote:
> Stop using DBG_88E which is a custom macro for printing debugging
> messages. Instead start using pr_debug and in the process define
> pr_fmt.
> 
> Signed-off-by: Shraddha Barke 
> ---
>  drivers/staging/rtl8188eu/os_dep/os_intfs.c | 31 
> +++--
>  1 file changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
> b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
> index 2361bce..42ce02c 100644
> --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
> +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
> @@ -19,6 +19,7 @@
>   
> **/
>  #define _OS_INTFS_C_
>  
> +#define pr_fmt(fmt) "R8188EU: " fmt
>  #include 
>  #include 
>  #include 
> @@ -742,7 +743,7 @@ struct net_device *rtw_init_netdev(struct adapter 
> *old_padapter)
>   pnetdev->dev.type = &wlan_type;
>   padapter = rtw_netdev_priv(pnetdev);
>   padapter->pnetdev = pnetdev;
> - DBG_88E("register rtw_netdev_ops to netdev_ops\n");
> + pr_debug("register rtw_netdev_ops to netdev_ops\n");

can't you use dev_dbg() instead?  or netdev_dbg()?

Same goes for all of these.

thanks,

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


[PATCH 06/29] staging/lustre: Remove high-priority request callbacks

2015-09-28 Thread green
From: Oleg Drokin 

This function is only used on the server where real high-priority
requests actually exist.
This deletes ptlrpc_hpreq_handler() and ptlrpc_request_change_export()

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_net.h |  3 --
 drivers/staging/lustre/lustre/ptlrpc/service.c | 53 --
 2 files changed, 56 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index e7faf0e..090484b 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -2526,7 +2526,6 @@ struct ptlrpc_service_conf {
  */
 void ptlrpc_dispatch_difficult_reply(struct ptlrpc_reply_state *rs);
 void ptlrpc_schedule_difficult_reply(struct ptlrpc_reply_state *rs);
-int ptlrpc_hpreq_handler(struct ptlrpc_request *req);
 struct ptlrpc_service *ptlrpc_register_service(
struct ptlrpc_service_conf *conf,
struct kset *parent,
@@ -2538,8 +2537,6 @@ int ptlrpc_unregister_service(struct ptlrpc_service 
*service);
 int liblustre_check_services(void *arg);
 void ptlrpc_daemonize(char *name);
 void ptlrpc_server_drop_request(struct ptlrpc_request *req);
-void ptlrpc_request_change_export(struct ptlrpc_request *req,
- struct obd_export *export);
 
 int ptlrpc_hr_init(void);
 void ptlrpc_hr_fini(void);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c 
b/drivers/staging/lustre/lustre/ptlrpc/service.c
index 506fc36..353ac22 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/service.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
@@ -819,35 +819,6 @@ void ptlrpc_server_drop_request(struct ptlrpc_request *req)
}
 }
 
-/** Change request export and move hp request from old export to new */
-void ptlrpc_request_change_export(struct ptlrpc_request *req,
- struct obd_export *export)
-{
-   if (req->rq_export != NULL) {
-   if (!list_empty(&req->rq_exp_list)) {
-   /* remove rq_exp_list from last export */
-   spin_lock_bh(&req->rq_export->exp_rpc_lock);
-   list_del_init(&req->rq_exp_list);
-   spin_unlock_bh(&req->rq_export->exp_rpc_lock);
-
-   /* export has one reference already, so it`s safe to
-* add req to export queue here and get another
-* reference for request later */
-   spin_lock_bh(&export->exp_rpc_lock);
-   list_add(&req->rq_exp_list, &export->exp_hp_rpcs);
-   spin_unlock_bh(&export->exp_rpc_lock);
-   }
-   class_export_rpc_dec(req->rq_export);
-   class_export_put(req->rq_export);
-   }
-
-   /* request takes one export refcount */
-   req->rq_export = class_export_get(export);
-   class_export_rpc_inc(export);
-
-   return;
-}
-
 /**
  * to finish a request: stop sending more early replies, and release
  * the request.
@@ -1329,30 +1300,6 @@ static void ptlrpc_server_hpreq_fini(struct 
ptlrpc_request *req)
}
 }
 
-static int ptlrpc_hpreq_check(struct ptlrpc_request *req)
-{
-   return 1;
-}
-
-static struct ptlrpc_hpreq_ops ptlrpc_hpreq_common = {
-   .hpreq_check   = ptlrpc_hpreq_check,
-};
-
-/* Hi-Priority RPC check by RPC operation code. */
-int ptlrpc_hpreq_handler(struct ptlrpc_request *req)
-{
-   int opc = lustre_msg_get_opc(req->rq_reqmsg);
-
-   /* Check for export to let only reconnects for not yet evicted
-* export to become a HP rpc. */
-   if ((req->rq_export != NULL) &&
-   (opc == OBD_PING || opc == MDS_CONNECT || opc == OST_CONNECT))
-   req->rq_ops = &ptlrpc_hpreq_common;
-
-   return 0;
-}
-EXPORT_SYMBOL(ptlrpc_hpreq_handler);
-
 static int ptlrpc_server_request_add(struct ptlrpc_service_part *svcpt,
 struct ptlrpc_request *req)
 {
-- 
2.1.0

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


[PATCH 02/29] staging/lustre: Remove unused lustre_acl_xattr_merge2posix()

2015-09-28 Thread green
From: Oleg Drokin 

Apparently this is only used only on the metadata server.

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/include/lustre_eacl.h|   4 -
 drivers/staging/lustre/lustre/obdclass/acl.c   | 119 -
 2 files changed, 123 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_eacl.h 
b/drivers/staging/lustre/lustre/include/lustre_eacl.h
index 0f8f76c..499f9c8 100644
--- a/drivers/staging/lustre/lustre/include/lustre_eacl.h
+++ b/drivers/staging/lustre/lustre/include/lustre_eacl.h
@@ -80,10 +80,6 @@ extern void
 lustre_posix_acl_xattr_free(posix_acl_xattr_header *header, int size);
 extern void
 lustre_ext_acl_xattr_free(ext_acl_xattr_header *header);
-extern int
-lustre_acl_xattr_merge2posix(posix_acl_xattr_header *posix_header, int size,
-ext_acl_xattr_header *ext_header,
-posix_acl_xattr_header **out);
 extern ext_acl_xattr_header *
 lustre_acl_xattr_merge2ext(posix_acl_xattr_header *posix_header, int size,
   ext_acl_xattr_header *ext_header);
diff --git a/drivers/staging/lustre/lustre/obdclass/acl.c 
b/drivers/staging/lustre/lustre/obdclass/acl.c
index 933456c..1dace14 100644
--- a/drivers/staging/lustre/lustre/obdclass/acl.c
+++ b/drivers/staging/lustre/lustre/obdclass/acl.c
@@ -287,125 +287,6 @@ again:
 }
 
 /*
- * Merge the posix ACL and the extended ACL into new posix ACL.
- */
-int lustre_acl_xattr_merge2posix(posix_acl_xattr_header *posix_header, int 
size,
-ext_acl_xattr_header *ext_header,
-posix_acl_xattr_header **out)
-{
-   int posix_count, posix_size, i, j;
-   int ext_count = le32_to_cpu(ext_header->a_count), pos = 0, rc = 0;
-   posix_acl_xattr_entry pe = {ACL_MASK, 0, ACL_UNDEFINED_ID};
-   posix_acl_xattr_header *new;
-   ext_acl_xattr_entry *ee, ae;
-
-   lustre_posix_acl_cpu_to_le(&pe, &pe);
-   ee = lustre_ext_acl_xattr_search(ext_header, &pe, &pos);
-   if (ee == NULL || le32_to_cpu(ee->e_stat) == ES_DEL) {
-   /* there are only base ACL entries at most. */
-   posix_count = 3;
-   posix_size = CFS_ACL_XATTR_SIZE(posix_count, posix_acl_xattr);
-   new = kzalloc(posix_size, GFP_NOFS);
-   if (unlikely(new == NULL))
-   return -ENOMEM;
-
-   new->a_version = cpu_to_le32(CFS_ACL_XATTR_VERSION);
-   for (i = 0, j = 0; i < ext_count; i++) {
-   lustre_ext_acl_le_to_cpu(&ae,
-&ext_header->a_entries[i]);
-   switch (ae.e_tag) {
-   case ACL_USER_OBJ:
-   case ACL_GROUP_OBJ:
-   case ACL_OTHER:
-   if (ae.e_id != ACL_UNDEFINED_ID) {
-   rc = -EIO;
-   goto _out;
-   }
-
-   if (ae.e_stat != ES_DEL) {
-   new->a_entries[j].e_tag =
-   ext_header->a_entries[i].e_tag;
-   new->a_entries[j].e_perm =
-   ext_header->a_entries[i].e_perm;
-   new->a_entries[j++].e_id =
-   ext_header->a_entries[i].e_id;
-   }
-   break;
-   case ACL_MASK:
-   case ACL_USER:
-   case ACL_GROUP:
-   if (ae.e_stat == ES_DEL)
-   break;
-   default:
-   rc = -EIO;
-   goto _out;
-   }
-   }
-   } else {
-   /* maybe there are valid ACL_USER or ACL_GROUP entries in the
-* original server-side ACL, they are regarded as ES_UNC stat.*/
-   int ori_posix_count;
-
-   if (unlikely(size < 0))
-   return -EINVAL;
-   else if (!size)
-   ori_posix_count = 0;
-   else
-   ori_posix_count =
-   CFS_ACL_XATTR_COUNT(size, posix_acl_xattr);
-   posix_count = ori_posix_count + ext_count;
-   posix_size =
-   CFS_ACL_XATTR_SIZE(posix_count, posix_acl_xattr);
-   new = kzalloc(posix_size, GFP_NOFS);
-   if (unlikely(new == NULL))
-   return -ENOMEM;
-
-   new->a_version = cpu_to_le32(CFS_ACL_XATTR_VERSION);
-   /* 1. process the unchanged ACL entries
-*in 

[PATCH 07/29] staging/lustre: Remove unused statfs_pack()

2015-09-28 Thread green
From: Oleg Drokin 

It's only used on the server.

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_lib.h   |  1 -
 drivers/staging/lustre/lustre/obdclass/statfs_pack.c | 14 --
 2 files changed, 15 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h 
b/drivers/staging/lustre/lustre/include/lustre_lib.h
index b380359..35175fd 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lib.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
@@ -100,7 +100,6 @@ struct obd_client_handle {
 #define OBD_CLIENT_HANDLE_MAGIC 0xd15ea5ed
 
 /* statfs_pack.c */
-void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs);
 void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs);
 
 /*
diff --git a/drivers/staging/lustre/lustre/obdclass/statfs_pack.c 
b/drivers/staging/lustre/lustre/obdclass/statfs_pack.c
index cc785ab..fb4e3ae 100644
--- a/drivers/staging/lustre/lustre/obdclass/statfs_pack.c
+++ b/drivers/staging/lustre/lustre/obdclass/statfs_pack.c
@@ -46,20 +46,6 @@
 #include "../include/obd_support.h"
 #include "../include/obd_class.h"
 
-void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs)
-{
-   memset(osfs, 0, sizeof(*osfs));
-   osfs->os_type = sfs->f_type;
-   osfs->os_blocks = sfs->f_blocks;
-   osfs->os_bfree = sfs->f_bfree;
-   osfs->os_bavail = sfs->f_bavail;
-   osfs->os_files = sfs->f_files;
-   osfs->os_ffree = sfs->f_ffree;
-   osfs->os_bsize = sfs->f_bsize;
-   osfs->os_namelen = sfs->f_namelen;
-}
-EXPORT_SYMBOL(statfs_pack);
-
 void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs)
 {
memset(sfs, 0, sizeof(*sfs));
-- 
2.1.0

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


[PATCH 03/29] staging/lustre/ptlrpc: Remove server-specific health checks

2015-09-28 Thread green
From: Oleg Drokin 

ptlrpc_service_health_check is only used on a service, so
it makes no point to retain it in the client code.
Also removing it's helpers: ptlrpc_svcpt_health_check and
ptlrpc_nrs_req_peek_nolock

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_net.h |  1 -
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |  6 ---
 drivers/staging/lustre/lustre/ptlrpc/service.c | 58 --
 3 files changed, 65 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index e929c93..a928631 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -2541,7 +2541,6 @@ int ptlrpc_start_threads(struct ptlrpc_service *svc);
 int ptlrpc_unregister_service(struct ptlrpc_service *service);
 int liblustre_check_services(void *arg);
 void ptlrpc_daemonize(char *name);
-int ptlrpc_service_health_check(struct ptlrpc_service *);
 void ptlrpc_server_drop_request(struct ptlrpc_request *req);
 void ptlrpc_request_change_export(struct ptlrpc_request *req,
  struct obd_export *export);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h 
b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
index 059ad96b..a3608a9 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
@@ -137,12 +137,6 @@ ptlrpc_nrs_req_get_nolock(struct ptlrpc_service_part 
*svcpt, bool hp,
return ptlrpc_nrs_req_get_nolock0(svcpt, hp, false, force);
 }
 
-static inline struct ptlrpc_request *
-ptlrpc_nrs_req_peek_nolock(struct ptlrpc_service_part *svcpt, bool hp)
-{
-   return ptlrpc_nrs_req_get_nolock0(svcpt, hp, true, false);
-}
-
 void ptlrpc_nrs_req_del_nolock(struct ptlrpc_request *req);
 bool ptlrpc_nrs_req_pending_nolock(struct ptlrpc_service_part *svcpt, bool hp);
 
diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c 
b/drivers/staging/lustre/lustre/ptlrpc/service.c
index 326f89e..cdc7e62 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/service.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
@@ -2977,61 +2977,3 @@ int ptlrpc_unregister_service(struct ptlrpc_service 
*service)
return 0;
 }
 EXPORT_SYMBOL(ptlrpc_unregister_service);
-
-/**
- * Returns 0 if the service is healthy.
- *
- * Right now, it just checks to make sure that requests aren't languishing
- * in the queue.  We'll use this health check to govern whether a node needs
- * to be shot, so it's intentionally non-aggressive. */
-static int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt)
-{
-   struct ptlrpc_request *request = NULL;
-   struct timespec64 right_now;
-   struct timespec64 timediff;
-
-   ktime_get_real_ts64(&right_now);
-
-   spin_lock(&svcpt->scp_req_lock);
-   /* How long has the next entry been waiting? */
-   if (ptlrpc_server_high_pending(svcpt, true))
-   request = ptlrpc_nrs_req_peek_nolock(svcpt, true);
-   else if (ptlrpc_server_normal_pending(svcpt, true))
-   request = ptlrpc_nrs_req_peek_nolock(svcpt, false);
-
-   if (request == NULL) {
-   spin_unlock(&svcpt->scp_req_lock);
-   return 0;
-   }
-
-   timediff = timespec64_sub(right_now, request->rq_arrival_time);
-   spin_unlock(&svcpt->scp_req_lock);
-
-   if ((timediff.tv_sec) >
-   (AT_OFF ? obd_timeout * 3 / 2 : at_max)) {
-   CERROR("%s: unhealthy - request has been waiting %llds\n",
-  svcpt->scp_service->srv_name, (s64)timediff.tv_sec);
-   return -1;
-   }
-
-   return 0;
-}
-
-int
-ptlrpc_service_health_check(struct ptlrpc_service *svc)
-{
-   struct ptlrpc_service_part *svcpt;
-   int i;
-
-   if (svc == NULL)
-   return 0;
-
-   ptlrpc_service_for_each_part(svcpt, i, svc) {
-   int rc = ptlrpc_svcpt_health_check(svcpt);
-
-   if (rc != 0)
-   return rc;
-   }
-   return 0;
-}
-EXPORT_SYMBOL(ptlrpc_service_health_check);
-- 
2.1.0

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


[PATCH 00/29] Removal of unused Lustre code

2015-09-28 Thread green
From: Oleg Drokin 

This set removes a bunch of lustre code that is no lonver relevant,
is server specific or is otherwise unused.

Please consider.

More to come later.

Arnd Bergmann (1):
  staging/lustre: remove lots of dead code

Oleg Drokin (28):
  staging/lustre: Remove unused target_print_req()
  staging/lustre: Remove unused lustre_acl_xattr_merge2posix()
  staging/lustre/ptlrpc: Remove server-specific health checks
  staging/lustre: Remove unused req_capsule_server_grow
  staging/lustre: Remove unused reply state batches code
  staging/lustre: Remove high-priority request callbacks
  staging/lustre: Remove unused statfs_pack()
  staging/lustre: Remove unused ptlrpcd_add_rqset()
  staging/lustre: Remove unused functions and definitions from cl_object
  staging/lustre: Remove unused lu_object functions.
  staging/lustre/ldlm: Remove unused round_timeout function
  staging/lustre/obdclass: Remove unused functions from genops.c
  staging/lustre: Remove unused function class_handle_hash_back()
  staging/lustre: Remove unused function server_name2svname()
  staging/lustre/obdclass: Drop unused code from obdo.c
  staging/lustre/ptlrpc: Drop unused client code
  staging/lustre/ptlrpc: secure wrapping code cleanup
  staging/lustre: Drop unused obdo_from_la() and la_from_obdo()
  staging/lustre/fid: Remove server fid function declarations
  staging/lustre/fid: seq_client_init/fini don't need to be exported
  staging/lustre/fid: Remove unused seq_client_get_seq function
  staging/lustre/fid: Get rid of lcs_srv in lu_client_seq
  staging/lustre/fid: Remove unused struct lu_server_seq
  staging/lustre/obdclass: Remove unused nid_hash
  staging/lustre: Remove server-only recovery-related bits
  staging/lustre: Remove ccc_attr/conf_set()
  staging/lustre: Remove unused ccc_io_fini()
  staging/lustre: Remove ccc_transient_page_* methods

 drivers/staging/lustre/lustre/fid/fid_request.c| 132 ++--
 drivers/staging/lustre/lustre/fid/lproc_fid.c  |   2 -
 drivers/staging/lustre/lustre/include/cl_object.h  |  26 --
 drivers/staging/lustre/lustre/include/lclient.h|  24 --
 .../staging/lustre/lustre/include/lprocfs_status.h |   4 -
 drivers/staging/lustre/lustre/include/lu_object.h  |  27 --
 .../lustre/lustre/include/lustre/lustre_idl.h  |   8 -
 .../lustre/lustre/include/lustre/lustre_user.h |   2 -
 .../staging/lustre/lustre/include/lustre_debug.h   |   1 -
 .../staging/lustre/lustre/include/lustre_disk.h|   2 -
 .../staging/lustre/lustre/include/lustre_eacl.h|   4 -
 .../staging/lustre/lustre/include/lustre_export.h  |  19 +-
 drivers/staging/lustre/lustre/include/lustre_fid.h |  91 --
 .../staging/lustre/lustre/include/lustre_handles.h |   1 -
 .../staging/lustre/lustre/include/lustre_import.h  |   1 -
 drivers/staging/lustre/lustre/include/lustre_lib.h |   1 -
 drivers/staging/lustre/lustre/include/lustre_net.h |  42 +--
 .../staging/lustre/lustre/include/lustre_param.h   |   6 -
 .../lustre/lustre/include/lustre_req_layout.h  |   7 -
 drivers/staging/lustre/lustre/include/lustre_sec.h |  20 --
 drivers/staging/lustre/lustre/include/obd.h|  29 --
 drivers/staging/lustre/lustre/include/obd_class.h  |  28 --
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c |  70 
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c|   5 -
 drivers/staging/lustre/lustre/obdclass/acl.c   | 119 ---
 drivers/staging/lustre/lustre/obdclass/cl_io.c |  65 
 drivers/staging/lustre/lustre/obdclass/cl_lock.c   |  26 --
 drivers/staging/lustre/lustre/obdclass/cl_object.c |  41 ---
 drivers/staging/lustre/lustre/obdclass/debug.c |  10 -
 drivers/staging/lustre/lustre/obdclass/genops.c| 249 +-
 .../lustre/lustre/obdclass/linux/linux-obdo.c  | 137 
 .../lustre/lustre/obdclass/linux/linux-sysctl.c|   4 -
 drivers/staging/lustre/lustre/obdclass/lu_object.c | 241 --
 .../lustre/lustre/obdclass/lustre_handles.c|  13 -
 .../staging/lustre/lustre/obdclass/obd_config.c| 358 -
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |  27 --
 drivers/staging/lustre/lustre/obdclass/obdo.c  | 170 --
 .../staging/lustre/lustre/obdclass/statfs_pack.c   |  14 -
 drivers/staging/lustre/lustre/ptlrpc/client.c  |  95 --
 drivers/staging/lustre/lustre/ptlrpc/import.c  |  11 -
 drivers/staging/lustre/lustre/ptlrpc/layout.c  | 126 
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c|  30 --
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  |   3 +-
 drivers/staging/lustre/lustre/ptlrpc/nrs.c | 123 ---
 .../staging/lustre/lustre/ptlrpc/pack_generic.c| 197 
 drivers/staging/lustre/lustre/ptlrpc/pinger.c  |  18 --
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |   8 -
 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c |  42 ---
 drivers/staging/lustre/lustre/ptlrpc/sec.c | 116 ---
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c| 329

[PATCH 08/29] staging/lustre: Remove unused ptlrpcd_add_rqset()

2015-09-28 Thread green
From: Oleg Drokin 

No point in retaining it if it's unused.

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_net.h |  1 -
 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 42 --
 2 files changed, 43 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index 090484b..6df3e70 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -2902,7 +2902,6 @@ void ptlrpcd_stop(struct ptlrpcd_ctl *pc, int force);
 void ptlrpcd_free(struct ptlrpcd_ctl *pc);
 void ptlrpcd_wake(struct ptlrpc_request *req);
 void ptlrpcd_add_req(struct ptlrpc_request *req);
-void ptlrpcd_add_rqset(struct ptlrpc_request_set *set);
 int ptlrpcd_addref(void);
 void ptlrpcd_decref(void);
 
diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c 
b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
index 00efdbf..ce036a1 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
@@ -196,48 +196,6 @@ ptlrpcd_select_pc(struct ptlrpc_request *req)
 }
 
 /**
- * Move all request from an existing request set to the ptlrpcd queue.
- * All requests from the set must be in phase RQ_PHASE_NEW.
- */
-void ptlrpcd_add_rqset(struct ptlrpc_request_set *set)
-{
-   struct list_head *tmp, *pos;
-   struct ptlrpcd_ctl *pc;
-   struct ptlrpc_request_set *new;
-   int count, i;
-
-   pc = ptlrpcd_select_pc(NULL);
-   new = pc->pc_set;
-
-   list_for_each_safe(pos, tmp, &set->set_requests) {
-   struct ptlrpc_request *req =
-   list_entry(pos, struct ptlrpc_request,
-  rq_set_chain);
-
-   LASSERT(req->rq_phase == RQ_PHASE_NEW);
-   req->rq_set = new;
-   req->rq_queued_time = cfs_time_current();
-   }
-
-   spin_lock(&new->set_new_req_lock);
-   list_splice_init(&set->set_requests, &new->set_new_requests);
-   i = atomic_read(&set->set_remaining);
-   count = atomic_add_return(i, &new->set_new_count);
-   atomic_set(&set->set_remaining, 0);
-   spin_unlock(&new->set_new_req_lock);
-   if (count == i) {
-   wake_up(&new->set_waitq);
-
-   /* XXX: It maybe unnecessary to wakeup all the partners. But to
-*  guarantee the async RPC can be processed ASAP, we have
-*  no other better choice. It maybe fixed in future. */
-   for (i = 0; i < pc->pc_npartners; i++)
-   wake_up(&pc->pc_partners[i]->pc_set->set_waitq);
-   }
-}
-EXPORT_SYMBOL(ptlrpcd_add_rqset);
-
-/**
  * Return transferred RPCs count.
  */
 static int ptlrpcd_steal_rqset(struct ptlrpc_request_set *des,
-- 
2.1.0

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


[PATCH 04/29] staging/lustre: Remove unused req_capsule_server_grow

2015-09-28 Thread green
From: Oleg Drokin 

It's only used on the server

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 .../lustre/lustre/include/lustre_req_layout.h  |  3 --
 drivers/staging/lustre/lustre/ptlrpc/layout.c  | 62 --
 2 files changed, 65 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_req_layout.h 
b/drivers/staging/lustre/lustre/include/lustre_req_layout.h
index c6457b2..04c0076 100644
--- a/drivers/staging/lustre/lustre/include/lustre_req_layout.h
+++ b/drivers/staging/lustre/lustre/include/lustre_req_layout.h
@@ -129,9 +129,6 @@ void req_capsule_shrink(struct req_capsule *pill,
const struct req_msg_field *field,
unsigned int newlen,
enum req_location loc);
-int req_capsule_server_grow(struct req_capsule *pill,
-   const struct req_msg_field *field,
-   unsigned int newlen);
 int  req_layout_init(void);
 void req_layout_fini(void);
 
diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c 
b/drivers/staging/lustre/lustre/ptlrpc/layout.c
index 5d19cfc..4ddbe0d 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/layout.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c
@@ -2376,67 +2376,5 @@ void req_capsule_shrink(struct req_capsule *pill,
 }
 EXPORT_SYMBOL(req_capsule_shrink);
 
-int req_capsule_server_grow(struct req_capsule *pill,
-   const struct req_msg_field *field,
-   unsigned int newlen)
-{
-   struct ptlrpc_reply_state *rs = pill->rc_req->rq_reply_state, *nrs;
-   char *from, *to;
-   int offset, len, rc;
-
-   LASSERT(pill->rc_fmt != NULL);
-   LASSERT(__req_format_is_sane(pill->rc_fmt));
-   LASSERT(req_capsule_has_field(pill, field, RCL_SERVER));
-   LASSERT(req_capsule_field_present(pill, field, RCL_SERVER));
-
-   len = req_capsule_get_size(pill, field, RCL_SERVER);
-   offset = __req_capsule_offset(pill, field, RCL_SERVER);
-   if (pill->rc_req->rq_repbuf_len >=
-   lustre_packed_msg_size(pill->rc_req->rq_repmsg) - len + newlen)
-   CERROR("Inplace repack might be done\n");
-
-   pill->rc_req->rq_reply_state = NULL;
-   req_capsule_set_size(pill, field, RCL_SERVER, newlen);
-   rc = req_capsule_server_pack(pill);
-   if (rc) {
-   /* put old rs back, the caller will decide what to do */
-   pill->rc_req->rq_reply_state = rs;
-   return rc;
-   }
-   nrs = pill->rc_req->rq_reply_state;
-   /* Now we need only buffers, copy first chunk */
-   to = lustre_msg_buf(nrs->rs_msg, 0, 0);
-   from = lustre_msg_buf(rs->rs_msg, 0, 0);
-   len = (char *)lustre_msg_buf(rs->rs_msg, offset, 0) - from;
-   memcpy(to, from, len);
-   /* check if we have tail and copy it too */
-   if (rs->rs_msg->lm_bufcount > offset + 1) {
-   to = lustre_msg_buf(nrs->rs_msg, offset + 1, 0);
-   from = lustre_msg_buf(rs->rs_msg, offset + 1, 0);
-   offset = rs->rs_msg->lm_bufcount - 1;
-   len = (char *)lustre_msg_buf(rs->rs_msg, offset, 0) +
- cfs_size_round(rs->rs_msg->lm_buflens[offset]) - from;
-   memcpy(to, from, len);
-   }
-   /* drop old reply if everything is fine */
-   if (rs->rs_difficult) {
-   /* copy rs data */
-   int i;
-
-   nrs->rs_difficult = 1;
-   nrs->rs_no_ack = rs->rs_no_ack;
-   for (i = 0; i < rs->rs_nlocks; i++) {
-   nrs->rs_locks[i] = rs->rs_locks[i];
-   nrs->rs_modes[i] = rs->rs_modes[i];
-   nrs->rs_nlocks++;
-   }
-   rs->rs_nlocks = 0;
-   rs->rs_difficult = 0;
-   rs->rs_no_ack = 0;
-   }
-   ptlrpc_rs_decref(rs);
-   return 0;
-}
-EXPORT_SYMBOL(req_capsule_server_grow);
 /* __REQ_LAYOUT_USER__ */
 #endif
-- 
2.1.0

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


[PATCH 01/29] staging/lustre: Remove unused target_print_req()

2015-09-28 Thread green
From: Oleg Drokin 

This is a server-side request printing function, so we don't
really need it on the client.

Signed-off-by: Oleg Drokin 
Reported-by: Arnd Bergmann 
---
 .../staging/lustre/lustre/include/lprocfs_status.h |  4 ---
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c| 30 --
 2 files changed, 34 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 5262b4f..22f3777 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -720,10 +720,6 @@ ssize_t lustre_attr_store(struct kobject *kobj, struct 
attribute *attr,
 
 extern const struct sysfs_ops lustre_sysfs_ops;
 
-/* lproc_ptlrpc.c */
-struct ptlrpc_request;
-void target_print_req(void *seq_file, struct ptlrpc_request *req);
-
 /* all quota proc functions */
 int lprocfs_quota_rd_bunit(char *page, char **start,
   loff_t off, int count,
diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c 
b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index d66a7b8..3a212b4 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -890,36 +890,6 @@ ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s,
return NULL;
 }
 
-/* common ost/mdt so_req_printer */
-void target_print_req(void *seq_file, struct ptlrpc_request *req)
-{
-   /* Called holding srv_lock with irqs disabled.
-* Print specific req contents and a newline.
-* CAVEAT EMPTOR: check request message length before printing!!!
-* You might have received any old crap so you must be just as
-* careful here as the service's request parser!!! */
-   struct seq_file *sf = seq_file;
-
-   switch (req->rq_phase) {
-   case RQ_PHASE_NEW:
-   /* still awaiting a service thread's attention, or rejected
-* because the generic request message didn't unpack */
-   seq_printf(sf, "\n");
-   break;
-   case RQ_PHASE_INTERPRET:
-   /* being handled, so basic msg swabbed, and opc is valid
-* but racing with mds_handle() */
-   case RQ_PHASE_COMPLETE:
-   /* been handled by mds_handle() reply state possibly still
-* volatile */
-   seq_printf(sf, "opc %d\n", lustre_msg_get_opc(req->rq_reqmsg));
-   break;
-   default:
-   DEBUG_REQ(D_ERROR, req, "bad phase %d", req->rq_phase);
-   }
-}
-EXPORT_SYMBOL(target_print_req);
-
 static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter)
 {
struct ptlrpc_service *svc = s->private;
-- 
2.1.0

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


[PATCH 10/29] staging/lustre: Remove unused lu_object functions.

2015-09-28 Thread green
From: Oleg Drokin 

Quite a bunch of them are only used on the server.
lu_object_put_nocache, lu_object_invariant, lu_dev_del_linkage,
lu_context_tags_update, lu_context_tags_clear, lu_session_tags_update,
lu_session_tags_clear, lu_env_refill_by_tags, lu_printk_printer,
lu_object_assign_fid, lu_object_anon, lu_buf_free, lu_buf_alloc,
lu_buf_realloc, lu_buf_check_and_alloc, lu_buf_check_and_grow

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lu_object.h  |  27 ---
 drivers/staging/lustre/lustre/obdclass/lu_object.c | 241 -
 2 files changed, 268 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lu_object.h 
b/drivers/staging/lustre/lustre/include/lu_object.h
index 7756008..e2199c2 100644
--- a/drivers/staging/lustre/lustre/include/lu_object.h
+++ b/drivers/staging/lustre/lustre/include/lu_object.h
@@ -672,7 +672,6 @@ void lu_object_add_top(struct lu_object_header *h, 
struct lu_object *o);
 void lu_object_add (struct lu_object *before, struct lu_object *o);
 
 void lu_dev_add_linkage(struct lu_site *s, struct lu_device *d);
-void lu_dev_del_linkage(struct lu_site *s, struct lu_device *d);
 
 /**
  * Helpers to initialize and finalize device types.
@@ -710,7 +709,6 @@ static inline int lu_object_is_dying(const struct 
lu_object_header *h)
 }
 
 void lu_object_put(const struct lu_env *env, struct lu_object *o);
-void lu_object_put_nocache(const struct lu_env *env, struct lu_object *o);
 void lu_object_unhash(const struct lu_env *env, struct lu_object *o);
 
 int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr);
@@ -1241,14 +1239,6 @@ void lu_context_key_degister_many(struct lu_context_key 
*k, ...);
 void lu_context_key_revive_many  (struct lu_context_key *k, ...);
 void lu_context_key_quiesce_many (struct lu_context_key *k, ...);
 
-/*
- * update/clear ctx/ses tags.
- */
-void lu_context_tags_update(__u32 tags);
-void lu_context_tags_clear(__u32 tags);
-void lu_session_tags_update(__u32 tags);
-void lu_session_tags_clear(__u32 tags);
-
 /**
  * Environment.
  */
@@ -1266,7 +1256,6 @@ struct lu_env {
 int  lu_env_init  (struct lu_env *env, __u32 tags);
 void lu_env_fini  (struct lu_env *env);
 int  lu_env_refill(struct lu_env *env);
-int  lu_env_refill_by_tags(struct lu_env *env, __u32 ctags, __u32 stags);
 
 /** @} lu_context */
 
@@ -1319,21 +1308,5 @@ struct lu_kmem_descr {
 int  lu_kmem_init(struct lu_kmem_descr *caches);
 void lu_kmem_fini(struct lu_kmem_descr *caches);
 
-void lu_object_assign_fid(const struct lu_env *env, struct lu_object *o,
- const struct lu_fid *fid);
-struct lu_object *lu_object_anon(const struct lu_env *env,
-struct lu_device *dev,
-const struct lu_object_conf *conf);
-
-/** null buffer */
-extern struct lu_buf LU_BUF_NULL;
-
-void lu_buf_free(struct lu_buf *buf);
-void lu_buf_alloc(struct lu_buf *buf, int size);
-void lu_buf_realloc(struct lu_buf *buf, int size);
-
-int lu_buf_check_and_grow(struct lu_buf *buf, int len);
-struct lu_buf *lu_buf_check_and_alloc(struct lu_buf *buf, int len);
-
 /** @} lu */
 #endif /* __LUSTRE_LU_OBJECT_H */
diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c 
b/drivers/staging/lustre/lustre/obdclass/lu_object.c
index c892e82..01d70f0 100644
--- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
@@ -157,17 +157,6 @@ void lu_object_put(const struct lu_env *env, struct 
lu_object *o)
 EXPORT_SYMBOL(lu_object_put);
 
 /**
- * Put object and don't keep in cache. This is temporary solution for
- * multi-site objects when its layering is not constant.
- */
-void lu_object_put_nocache(const struct lu_env *env, struct lu_object *o)
-{
-   set_bit(LU_OBJECT_HEARD_BANSHEE, &o->lo_header->loh_flags);
-   return lu_object_put(env, o);
-}
-EXPORT_SYMBOL(lu_object_put_nocache);
-
-/**
  * Kill the object and take it out of LRU cache.
  * Currently used by client code for layout change.
  */
@@ -529,23 +518,6 @@ void lu_object_print(const struct lu_env *env, void 
*cookie,
 }
 EXPORT_SYMBOL(lu_object_print);
 
-/**
- * Check object consistency.
- */
-int lu_object_invariant(const struct lu_object *o)
-{
-   struct lu_object_header *top;
-
-   top = o->lo_header;
-   list_for_each_entry(o, &top->loh_layers, lo_linkage) {
-   if (o->lo_ops->loo_object_invariant != NULL &&
-   !o->lo_ops->loo_object_invariant(o))
-   return 0;
-   }
-   return 1;
-}
-EXPORT_SYMBOL(lu_object_invariant);
-
 static struct lu_object *htable_lookup(struct lu_site *s,
   struct cfs_hash_bd *bd,
   const struct lu_fid *f,
@@ -962,14 +934,6 @@ void lu_dev_add_linkage(struct lu_site *s, struct 
lu_device *d)
 }
 EXPORT_SYMBOL(lu_dev_add_linkage);
 
-void lu_dev_del_linkage(struct 

[PATCH 09/29] staging/lustre: Remove unused functions and definitions from cl_object

2015-09-28 Thread green
From: Oleg Drokin 

cl_object_header_fini, cl_object_has_locks, cl_attr2lvb,
cl_page_list_own, cl_page_list_unmap, cl_2queue_assume,
cl_io_print, cl_enqueue,
also cleanup extern declarations in cl_object.h

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/cl_object.h  | 26 -
 drivers/staging/lustre/lustre/obdclass/cl_io.c | 65 --
 drivers/staging/lustre/lustre/obdclass/cl_lock.c   | 26 -
 drivers/staging/lustre/lustre/obdclass/cl_object.c | 41 --
 4 files changed, 158 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/cl_object.h 
b/drivers/staging/lustre/lustre/include/cl_object.h
index b2366ca..b073313 100644
--- a/drivers/staging/lustre/lustre/include/cl_object.h
+++ b/drivers/staging/lustre/lustre/include/cl_object.h
@@ -2733,7 +2733,6 @@ struct cl_object *cl_object_find(const struct lu_env 
*env, struct cl_device *cd,
 const struct cl_object_conf *c);
 
 int  cl_object_header_init(struct cl_object_header *h);
-void cl_object_header_fini(struct cl_object_header *h);
 void cl_object_put (const struct lu_env *env, struct cl_object *o);
 void cl_object_get (struct cl_object *o);
 void cl_object_attr_lock  (struct cl_object *o);
@@ -2748,7 +2747,6 @@ int  cl_conf_set(const struct lu_env *env, struct 
cl_object *obj,
   const struct cl_object_conf *conf);
 void cl_object_prune  (const struct lu_env *env, struct cl_object *obj);
 void cl_object_kill   (const struct lu_env *env, struct cl_object *obj);
-int  cl_object_has_locks  (struct cl_object *obj);
 
 /**
  * Returns true, iff \a o0 and \a o1 are slices of the same object.
@@ -2935,10 +2933,6 @@ void  cl_lock_release   (const struct lu_env *env, 
struct cl_lock *lock,
 void  cl_lock_user_add  (const struct lu_env *env, struct cl_lock *lock);
 void  cl_lock_user_del  (const struct lu_env *env, struct cl_lock *lock);
 
-enum cl_lock_state cl_lock_intransit(const struct lu_env *env,
-struct cl_lock *lock);
-void cl_lock_extransit(const struct lu_env *env, struct cl_lock *lock,
-  enum cl_lock_state state);
 int cl_lock_is_intransit(struct cl_lock *lock);
 
 int cl_lock_enqueue_wait(const struct lu_env *env, struct cl_lock *lock,
@@ -2976,8 +2970,6 @@ int cl_lock_enqueue_wait(const struct lu_env *env, struct 
cl_lock *lock,
  *
  * @{ */
 
-int   cl_enqueue(const struct lu_env *env, struct cl_lock *lock,
-struct cl_io *io, __u32 flags);
 int   cl_wait   (const struct lu_env *env, struct cl_lock *lock);
 void  cl_unuse  (const struct lu_env *env, struct cl_lock *lock);
 int   cl_enqueue_try(const struct lu_env *env, struct cl_lock *lock,
@@ -2996,7 +2988,6 @@ int  cl_queue_match  (const struct list_head *queue,
  const struct cl_lock_descr *need);
 
 void cl_lock_mutex_get  (const struct lu_env *env, struct cl_lock *lock);
-int  cl_lock_mutex_try  (const struct lu_env *env, struct cl_lock *lock);
 void cl_lock_mutex_put  (const struct lu_env *env, struct cl_lock *lock);
 int  cl_lock_is_mutexed (struct cl_lock *lock);
 int  cl_lock_nr_mutexed (const struct lu_env *env);
@@ -3062,10 +3053,6 @@ int   cl_io_submit_rw(const struct lu_env *env, 
struct cl_io *io,
 int   cl_io_submit_sync  (const struct lu_env *env, struct cl_io *io,
  enum cl_req_type iot, struct cl_2queue *queue,
  long timeout);
-void  cl_io_rw_advance   (const struct lu_env *env, struct cl_io *io,
- size_t nob);
-int   cl_io_cancel   (const struct lu_env *env, struct cl_io *io,
- struct cl_page_list *queue);
 int   cl_io_is_going (const struct lu_env *env);
 
 /**
@@ -3097,9 +3084,6 @@ static inline int cl_io_is_trunc(const struct cl_io *io)
 
 struct cl_io *cl_io_top(struct cl_io *io);
 
-void cl_io_print(const struct lu_env *env, void *cookie,
-lu_printer_t printer, const struct cl_io *io);
-
 #define CL_IO_SLICE_CLEAN(foo_io, base)
\
 do {   \
typeof(foo_io) __foo_io = (foo_io); \
@@ -3145,22 +3129,14 @@ void cl_page_list_del(const struct lu_env *env,
  struct cl_page_list *plist, struct cl_page *page);
 void cl_page_list_disown (const struct lu_env *env,
  struct cl_io *io, struct cl_page_list *plist);
-int  cl_page_list_own(const struct lu_env *env,
- struct cl_io *io, struct cl_page_list *plist);
-void cl_page_list_assume (const struct lu_env *env,
- struct cl_io *io, struct cl_page_list *plist);
 void cl_page_list_discard(const struct lu_env *env,
  struct cl_io *io, struct cl_page_list *plist);
-int 

[PATCH 05/29] staging/lustre: Remove unused reply state batches code

2015-09-28 Thread green
From: Oleg Drokin 

rs_batch is used on the server only.

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_net.h |   6 +-
 drivers/staging/lustre/lustre/ptlrpc/service.c | 145 -
 2 files changed, 1 insertion(+), 150 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index a928631..e7faf0e 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -429,8 +429,7 @@ struct ptlrpc_reply_state {
unsigned long rs_on_net:1;   /* reply_out_callback pending? */
unsigned long rs_prealloc:1; /* rs from prealloc list */
unsigned long rs_committed:1;/* the transaction was committed
-and the rs was dispatched
-by ptlrpc_commit_replies */
+ * and the rs was dispatched */
/** Size of the state */
int rs_size;
/** opcode */
@@ -2525,9 +2524,6 @@ struct ptlrpc_service_conf {
  *
  * @{
  */
-void ptlrpc_save_lock(struct ptlrpc_request *req,
- struct lustre_handle *lock, int mode, int no_ack);
-void ptlrpc_commit_replies(struct obd_export *exp);
 void ptlrpc_dispatch_difficult_reply(struct ptlrpc_reply_state *rs);
 void ptlrpc_schedule_difficult_reply(struct ptlrpc_reply_state *rs);
 int ptlrpc_hpreq_handler(struct ptlrpc_request *req);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c 
b/drivers/staging/lustre/lustre/ptlrpc/service.c
index cdc7e62..506fc36 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/service.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
@@ -179,33 +179,6 @@ ptlrpc_grow_req_bufs(struct ptlrpc_service_part *svcpt, 
int post)
return rc;
 }
 
-/**
- * Part of Rep-Ack logic.
- * Puts a lock and its mode into reply state associated to request reply.
- */
-void
-ptlrpc_save_lock(struct ptlrpc_request *req,
-struct lustre_handle *lock, int mode, int no_ack)
-{
-   struct ptlrpc_reply_state *rs = req->rq_reply_state;
-   int idx;
-
-   LASSERT(rs != NULL);
-   LASSERT(rs->rs_nlocks < RS_MAX_LOCKS);
-
-   if (req->rq_export->exp_disconnected) {
-   ldlm_lock_decref(lock, mode);
-   } else {
-   idx = rs->rs_nlocks++;
-   rs->rs_locks[idx] = *lock;
-   rs->rs_modes[idx] = mode;
-   rs->rs_difficult = 1;
-   rs->rs_no_ack = !!no_ack;
-   }
-}
-EXPORT_SYMBOL(ptlrpc_save_lock);
-
-
 struct ptlrpc_hr_partition;
 
 struct ptlrpc_hr_thread {
@@ -246,32 +219,10 @@ struct ptlrpc_hr_service {
struct ptlrpc_hr_partition  **hr_partitions;
 };
 
-struct rs_batch {
-   struct list_headrsb_replies;
-   unsigned intrsb_n_replies;
-   struct ptlrpc_service_part  *rsb_svcpt;
-};
-
 /** reply handling service. */
 static struct ptlrpc_hr_serviceptlrpc_hr;
 
 /**
- * maximum number of replies scheduled in one batch
- */
-#define MAX_SCHEDULED 256
-
-/**
- * Initialize a reply batch.
- *
- * \param b batch
- */
-static void rs_batch_init(struct rs_batch *b)
-{
-   memset(b, 0, sizeof(*b));
-   INIT_LIST_HEAD(&b->rsb_replies);
-}
-
-/**
  * Choose an hr thread to dispatch requests to.
  */
 static struct ptlrpc_hr_thread *
@@ -297,76 +248,6 @@ ptlrpc_hr_select(struct ptlrpc_service_part *svcpt)
 }
 
 /**
- * Dispatch all replies accumulated in the batch to one from
- * dedicated reply handling threads.
- *
- * \param b batch
- */
-static void rs_batch_dispatch(struct rs_batch *b)
-{
-   if (b->rsb_n_replies != 0) {
-   struct ptlrpc_hr_thread *hrt;
-
-   hrt = ptlrpc_hr_select(b->rsb_svcpt);
-
-   spin_lock(&hrt->hrt_lock);
-   list_splice_init(&b->rsb_replies, &hrt->hrt_queue);
-   spin_unlock(&hrt->hrt_lock);
-
-   wake_up(&hrt->hrt_waitq);
-   b->rsb_n_replies = 0;
-   }
-}
-
-/**
- * Add a reply to a batch.
- * Add one reply object to a batch, schedule batched replies if overload.
- *
- * \param b batch
- * \param rs reply
- */
-static void rs_batch_add(struct rs_batch *b, struct ptlrpc_reply_state *rs)
-{
-   struct ptlrpc_service_part *svcpt = rs->rs_svcpt;
-
-   if (svcpt != b->rsb_svcpt || b->rsb_n_replies >= MAX_SCHEDULED) {
-   if (b->rsb_svcpt != NULL) {
-   rs_batch_dispatch(b);
-   spin_unlock(&b->rsb_svcpt->scp_rep_lock);
-   }
-   spin_lock(&svcpt->scp_rep_lock);
-   b->rsb_svcpt = svcpt;
-   }
-   spin_lock(&rs->rs_lock);
-   rs->rs_scheduled_ever = 1;
-   if (rs->rs_scheduled == 0) {
-   list_move(&rs->rs_list, &b->rsb_r

[PATCH 18/29] staging/lustre: Drop unused obdo_from_la() and la_from_obdo()

2015-09-28 Thread green
From: Oleg Drokin 

They are no longer used anywhere.

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 .../lustre/lustre/obdclass/linux/linux-obdo.c  | 137 -
 1 file changed, 137 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
index 62ed706..9496c09 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
@@ -49,102 +49,6 @@
 #include 
 #include  /* for PAGE_CACHE_SIZE */
 
-/*FIXME: Just copy from obdo_from_inode*/
-void obdo_from_la(struct obdo *dst, struct lu_attr *la, __u64 valid)
-{
-   u32 newvalid = 0;
-
-   if (valid & LA_ATIME) {
-   dst->o_atime = la->la_atime;
-   newvalid |= OBD_MD_FLATIME;
-   }
-   if (valid & LA_MTIME) {
-   dst->o_mtime = la->la_mtime;
-   newvalid |= OBD_MD_FLMTIME;
-   }
-   if (valid & LA_CTIME) {
-   dst->o_ctime = la->la_ctime;
-   newvalid |= OBD_MD_FLCTIME;
-   }
-   if (valid & LA_SIZE) {
-   dst->o_size = la->la_size;
-   newvalid |= OBD_MD_FLSIZE;
-   }
-   if (valid & LA_BLOCKS) {  /* allocation of space (x512 bytes) */
-   dst->o_blocks = la->la_blocks;
-   newvalid |= OBD_MD_FLBLOCKS;
-   }
-   if (valid & LA_TYPE) {
-   dst->o_mode = (dst->o_mode & S_IALLUGO) |
- (la->la_mode & S_IFMT);
-   newvalid |= OBD_MD_FLTYPE;
-   }
-   if (valid & LA_MODE) {
-   dst->o_mode = (dst->o_mode & S_IFMT) |
- (la->la_mode & S_IALLUGO);
-   newvalid |= OBD_MD_FLMODE;
-   }
-   if (valid & LA_UID) {
-   dst->o_uid = la->la_uid;
-   newvalid |= OBD_MD_FLUID;
-   }
-   if (valid & LA_GID) {
-   dst->o_gid = la->la_gid;
-   newvalid |= OBD_MD_FLGID;
-   }
-   dst->o_valid |= newvalid;
-}
-EXPORT_SYMBOL(obdo_from_la);
-
-/*FIXME: Just copy from obdo_from_inode*/
-void la_from_obdo(struct lu_attr *dst, struct obdo *obdo, u32 valid)
-{
-   __u64 newvalid = 0;
-
-   valid &= obdo->o_valid;
-
-   if (valid & OBD_MD_FLATIME) {
-   dst->la_atime = obdo->o_atime;
-   newvalid |= LA_ATIME;
-   }
-   if (valid & OBD_MD_FLMTIME) {
-   dst->la_mtime = obdo->o_mtime;
-   newvalid |= LA_MTIME;
-   }
-   if (valid & OBD_MD_FLCTIME) {
-   dst->la_ctime = obdo->o_ctime;
-   newvalid |= LA_CTIME;
-   }
-   if (valid & OBD_MD_FLSIZE) {
-   dst->la_size = obdo->o_size;
-   newvalid |= LA_SIZE;
-   }
-   if (valid & OBD_MD_FLBLOCKS) {
-   dst->la_blocks = obdo->o_blocks;
-   newvalid |= LA_BLOCKS;
-   }
-   if (valid & OBD_MD_FLTYPE) {
-   dst->la_mode = (dst->la_mode & S_IALLUGO) |
-  (obdo->o_mode & S_IFMT);
-   newvalid |= LA_TYPE;
-   }
-   if (valid & OBD_MD_FLMODE) {
-   dst->la_mode = (dst->la_mode & S_IFMT) |
-  (obdo->o_mode & S_IALLUGO);
-   newvalid |= LA_MODE;
-   }
-   if (valid & OBD_MD_FLUID) {
-   dst->la_uid = obdo->o_uid;
-   newvalid |= LA_UID;
-   }
-   if (valid & OBD_MD_FLGID) {
-   dst->la_gid = obdo->o_gid;
-   newvalid |= LA_GID;
-   }
-   dst->la_valid = newvalid;
-}
-EXPORT_SYMBOL(la_from_obdo);
-
 void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid)
 {
valid &= src->o_valid;
@@ -179,44 +83,3 @@ void obdo_refresh_inode(struct inode *dst, struct obdo 
*src, u32 valid)
dst->i_blocks = src->o_blocks;
 }
 EXPORT_SYMBOL(obdo_refresh_inode);
-
-void obdo_to_inode(struct inode *dst, struct obdo *src, u32 valid)
-{
-   valid &= src->o_valid;
-
-   LASSERTF(!(valid & (OBD_MD_FLTYPE | OBD_MD_FLGENER | OBD_MD_FLFID |
-   OBD_MD_FLID | OBD_MD_FLGROUP)),
-"object "DOSTID", valid %x\n", POSTID(&src->o_oi), valid);
-
-   if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
-   CDEBUG(D_INODE,
-  "valid %#llx, cur time %lu/%lu, new %llu/%llu\n",
-  src->o_valid, LTIME_S(dst->i_mtime),
-  LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime);
-
-   if (valid & OBD_MD_FLATIME)
-   LTIME_S(dst->i_atime) = src->o_atime;
-   if (valid & OBD_MD_FLMTIME)
-   LTIME_S(dst->i_mtime) = src->o_mtime;
-   if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(dst->i_ctime))
-   LTIME_S(dst->i_ctime) = src->o_ctime;
-   if (valid & OBD_MD_FLSIZE)
-   i_size_write(dst, src->o_size);
-  

[PATCH 11/29] staging/lustre/ldlm: Remove unused round_timeout function

2015-09-28 Thread green
From: Oleg Drokin 

It's not referenced anywhere anymore.

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
index ac79db9..a78c4a4 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
@@ -71,11 +71,6 @@ struct ldlm_cb_async_args {
 
 static struct ldlm_state *ldlm_state;
 
-inline unsigned long round_timeout(unsigned long timeout)
-{
-   return cfs_time_seconds((int)cfs_duration_sec(cfs_time_sub(timeout, 0)) 
+ 1);
-}
-
 #define ELT_STOPPED   0
 #define ELT_READY 1
 #define ELT_TERMINATE 2
-- 
2.1.0

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


[PATCH 24/29] staging/lustre/fid: Remove unused struct lu_server_seq

2015-09-28 Thread green
From: Oleg Drokin 

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_fid.h | 51 --
 1 file changed, 51 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h 
b/drivers/staging/lustre/lustre/include/lustre_fid.h
index bbe3ff8..19d9175 100644
--- a/drivers/staging/lustre/lustre/include/lustre_fid.h
+++ b/drivers/staging/lustre/lustre/include/lustre_fid.h
@@ -369,57 +369,6 @@ struct lu_client_seq {
int  lcs_update;
 };
 
-/* server sequence manager interface */
-struct lu_server_seq {
-   /* Available sequences space */
-   struct lu_seq_range  lss_space;
-
-   /* keeps highwater in lsr_end for seq allocation algorithm */
-   struct lu_seq_range  lss_lowater_set;
-   struct lu_seq_range  lss_hiwater_set;
-
-   /*
-* Device for server side seq manager needs (saving sequences to backing
-* store).
-*/
-   struct dt_device   *lss_dev;
-
-   /* LUSTRE_SEQ_SERVER or LUSTRE_SEQ_CONTROLLER */
-   enum lu_mgr_type   lss_type;
-
-   /* Client interface to request controller */
-   struct lu_client_seq   *lss_cli;
-
-   /* Mutex for protecting allocation */
-   struct mutexlss_mutex;
-
-   /*
-* Service uuid, passed from MDT + seq name to form unique seq name to
-* use it with procfs.
-*/
-   charlss_name[LUSTRE_MDT_MAXNAMELEN];
-
-   /*
-* Allocation chunks for super and meta sequences. Default values are
-* LUSTRE_SEQ_SUPER_WIDTH and LUSTRE_SEQ_META_WIDTH.
-*/
-   __u64  lss_width;
-
-   /*
-* minimum lss_alloc_set size that should be allocated from
-* lss_space
-*/
-   __u64  lss_set_width;
-
-   /* sync is needed for update operation */
-   __u32  lss_need_sync;
-
-   /**
-* Pointer to site object, required to access site fld.
-*/
-   struct seq_server_site  *lss_site;
-};
-
 /* Client methods */
 void seq_client_flush(struct lu_client_seq *seq);
 
-- 
2.1.0

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


[PATCH 22/29] staging/lustre/fid: Remove unused seq_client_get_seq function

2015-09-28 Thread green
From: Oleg Drokin 

Also while we are at it, remove seq_site_fini forward declaration
as there's no such function anymore.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/fid/fid_request.c| 51 --
 drivers/staging/lustre/lustre/include/lustre_fid.h |  3 --
 2 files changed, 54 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c 
b/drivers/staging/lustre/lustre/fid/fid_request.c
index 16264bc..ce55340 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -248,57 +248,6 @@ static void seq_fid_alloc_fini(struct lu_client_seq *seq)
wake_up(&seq->lcs_waitq);
 }
 
-/**
- * Allocate the whole seq to the caller.
- **/
-int seq_client_get_seq(const struct lu_env *env,
-  struct lu_client_seq *seq, u64 *seqnr)
-{
-   wait_queue_t link;
-   int rc;
-
-   LASSERT(seqnr != NULL);
-   mutex_lock(&seq->lcs_mutex);
-   init_waitqueue_entry(&link, current);
-
-   while (1) {
-   rc = seq_fid_alloc_prep(seq, &link);
-   if (rc == 0)
-   break;
-   }
-
-   rc = seq_client_alloc_seq(env, seq, seqnr);
-   if (rc) {
-   CERROR("%s: Can't allocate new sequence, rc %d\n",
-  seq->lcs_name, rc);
-   seq_fid_alloc_fini(seq);
-   mutex_unlock(&seq->lcs_mutex);
-   return rc;
-   }
-
-   CDEBUG(D_INFO, "%s: allocate sequence [0x%16.16Lx]\n",
-  seq->lcs_name, *seqnr);
-
-   /* Since the caller require the whole seq,
-* so marked this seq to be used */
-   if (seq->lcs_type == LUSTRE_SEQ_METADATA)
-   seq->lcs_fid.f_oid = LUSTRE_METADATA_SEQ_MAX_WIDTH;
-   else
-   seq->lcs_fid.f_oid = LUSTRE_DATA_SEQ_MAX_WIDTH;
-
-   seq->lcs_fid.f_seq = *seqnr;
-   seq->lcs_fid.f_ver = 0;
-   /*
-* Inform caller that sequence switch is performed to allow it
-* to setup FLD for it.
-*/
-   seq_fid_alloc_fini(seq);
-   mutex_unlock(&seq->lcs_mutex);
-
-   return rc;
-}
-EXPORT_SYMBOL(seq_client_get_seq);
-
 /* Allocate new fid on passed client @seq and save it to @fid. */
 int seq_client_alloc_fid(const struct lu_env *env,
 struct lu_client_seq *seq, struct lu_fid *fid)
diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h 
b/drivers/staging/lustre/lustre/include/lustre_fid.h
index f60c20a..22fc96e 100644
--- a/drivers/staging/lustre/lustre/include/lustre_fid.h
+++ b/drivers/staging/lustre/lustre/include/lustre_fid.h
@@ -430,9 +430,6 @@ void seq_client_flush(struct lu_client_seq *seq);
 
 int seq_client_alloc_fid(const struct lu_env *env, struct lu_client_seq *seq,
 struct lu_fid *fid);
-int seq_client_get_seq(const struct lu_env *env, struct lu_client_seq *seq,
-  u64 *seqnr);
-int seq_site_fini(const struct lu_env *env, struct seq_server_site *ss);
 /* Fids common stuff */
 int fid_is_local(const struct lu_env *env,
 struct lu_site *site, const struct lu_fid *fid);
-- 
2.1.0

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


[PATCH 25/29] staging/lustre/obdclass: Remove unused nid_hash

2015-09-28 Thread green
From: Oleg Drokin 

nid_hash is used on export to faster find clients based on
their NID. There's no use for that on the client.

Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/include/lustre_export.h  |  1 -
 drivers/staging/lustre/lustre/include/obd.h|  2 -
 drivers/staging/lustre/lustre/obdclass/genops.c| 10 +--
 .../staging/lustre/lustre/obdclass/obd_config.c| 95 --
 4 files changed, 1 insertion(+), 107 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h 
b/drivers/staging/lustre/lustre/include/lustre_export.h
index 7634dea..5b8f4e8 100644
--- a/drivers/staging/lustre/lustre/include/lustre_export.h
+++ b/drivers/staging/lustre/lustre/include/lustre_export.h
@@ -147,7 +147,6 @@ struct obd_export {
/** To link all exports on an obd device */
struct list_headexp_obd_chain;
struct hlist_node exp_uuid_hash; /** uuid-export hash*/
-   struct hlist_node exp_nid_hash; /** nid-export hash */
/** Obd device of this export */
struct obd_device   *exp_obd;
/**
diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index e8317b8..3fb72dc 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -746,8 +746,6 @@ struct obd_device {
unsigned long obd_recovery_expired:1;
/* uuid-export hash body */
struct cfs_hash  *obd_uuid_hash;
-   /* nid-export hash body */
-   struct cfs_hash  *obd_nid_hash;
atomic_tobd_refcount;
wait_queue_head_tobd_refcount_waitq;
struct list_head  obd_exports;
diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c 
b/drivers/staging/lustre/lustre/obdclass/genops.c
index 4467baa..681312e 100644
--- a/drivers/staging/lustre/lustre/obdclass/genops.c
+++ b/drivers/staging/lustre/lustre/obdclass/genops.c
@@ -757,7 +757,6 @@ struct obd_export *class_new_export(struct obd_device *obd,
spin_lock_init(&export->exp_lock);
spin_lock_init(&export->exp_rpc_lock);
INIT_HLIST_NODE(&export->exp_uuid_hash);
-   INIT_HLIST_NODE(&export->exp_nid_hash);
spin_lock_init(&export->exp_bl_list_lock);
INIT_LIST_HEAD(&export->exp_bl_list);
 
@@ -1103,19 +1102,12 @@ int class_disconnect(struct obd_export *export)
/* class_cleanup(), abort_recovery(), and class_fail_export()
 * all end up in here, and if any of them race we shouldn't
 * call extra class_export_puts(). */
-   if (already_disconnected) {
-   LASSERT(hlist_unhashed(&export->exp_nid_hash));
+   if (already_disconnected)
goto no_disconn;
-   }
 
CDEBUG(D_IOCTL, "disconnect: cookie %#llx\n",
   export->exp_handle.h_cookie);
 
-   if (!hlist_unhashed(&export->exp_nid_hash))
-   cfs_hash_del(export->exp_obd->obd_nid_hash,
-&export->exp_connection->c_peer.nid,
-&export->exp_nid_hash);
-
class_export_recovery_cleanup(export);
class_unlink_export(export);
 no_disconn:
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c 
b/drivers/staging/lustre/lustre/obdclass/obd_config.c
index a8a1cb7..48c712e 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_config.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c
@@ -48,7 +48,6 @@
 #include "llog_internal.h"
 
 static cfs_hash_ops_t uuid_hash_ops;
-static cfs_hash_ops_t nid_hash_ops;
 
 /*** string parsing utils */
 
@@ -327,7 +326,6 @@ int class_setup(struct obd_device *obd, struct lustre_cfg 
*lcfg)
   other fns check that status, and we're not actually set up yet. */
obd->obd_starting = 1;
obd->obd_uuid_hash = NULL;
-   obd->obd_nid_hash = NULL;
spin_unlock(&obd->obd_dev_lock);
 
/* create an uuid-export lustre hash */
@@ -343,19 +341,6 @@ int class_setup(struct obd_device *obd, struct lustre_cfg 
*lcfg)
goto err_hash;
}
 
-   /* create a nid-export lustre hash */
-   obd->obd_nid_hash = cfs_hash_create("NID_HASH",
-   HASH_NID_CUR_BITS,
-   HASH_NID_MAX_BITS,
-   HASH_NID_BKT_BITS, 0,
-   CFS_HASH_MIN_THETA,
-   CFS_HASH_MAX_THETA,
-   &nid_hash_ops, CFS_HASH_DEFAULT);
-   if (!obd->obd_nid_hash) {
-   err = -ENOMEM;
-   goto err_hash;
-   }
-
exp = class_new_export(obd, &obd->obd_uuid);
if (IS_ERR(exp)) {
err = PTR_ERR(exp);
@@ -390,10 +375,6 @@ err_hash:
cfs_hash_putref(obd->obd_uuid_hash);
obd->ob

[PATCH 13/29] staging/lustre: Remove unused function class_handle_hash_back()

2015-09-28 Thread green
From: Oleg Drokin 

No callers left.

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_handles.h  |  1 -
 drivers/staging/lustre/lustre/obdclass/lustre_handles.c | 13 -
 2 files changed, 14 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_handles.h 
b/drivers/staging/lustre/lustre/include/lustre_handles.h
index 726bbd3..4d51c8a 100644
--- a/drivers/staging/lustre/lustre/include/lustre_handles.h
+++ b/drivers/staging/lustre/lustre/include/lustre_handles.h
@@ -86,7 +86,6 @@ struct portals_handle {
 void class_handle_hash(struct portals_handle *,
   struct portals_handle_ops *ops);
 void class_handle_unhash(struct portals_handle *);
-void class_handle_hash_back(struct portals_handle *);
 void *class_handle2object(__u64 cookie);
 void class_handle_free_cb(struct rcu_head *rcu);
 int class_handle_init(void);
diff --git a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c 
b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c
index 97d79da..d19ec15 100644
--- a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c
+++ b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c
@@ -134,19 +134,6 @@ void class_handle_unhash(struct portals_handle *h)
 }
 EXPORT_SYMBOL(class_handle_unhash);
 
-void class_handle_hash_back(struct portals_handle *h)
-{
-   struct handle_bucket *bucket;
-
-   bucket = handle_hash + (h->h_cookie & HANDLE_HASH_MASK);
-
-   spin_lock(&bucket->lock);
-   list_add_rcu(&h->h_link, &bucket->head);
-   h->h_in = 1;
-   spin_unlock(&bucket->lock);
-}
-EXPORT_SYMBOL(class_handle_hash_back);
-
 void *class_handle2object(__u64 cookie)
 {
struct handle_bucket *bucket;
-- 
2.1.0

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


[PATCH 14/29] staging/lustre: Remove unused function server_name2svname()

2015-09-28 Thread green
From: Oleg Drokin 

All users are only in the server code

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/include/lustre_disk.h|  2 --
 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 27 --
 2 files changed, 29 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_disk.h 
b/drivers/staging/lustre/lustre/include/lustre_disk.h
index ec33259..4178c85 100644
--- a/drivers/staging/lustre/lustre/include/lustre_disk.h
+++ b/drivers/staging/lustre/lustre/include/lustre_disk.h
@@ -385,8 +385,6 @@ struct lustre_mount_info {
 /* obd_mount.c */
 int server_name2fsname(const char *svname, char *fsname, const char **endptr);
 int server_name2index(const char *svname, __u32 *idx, const char **endptr);
-int server_name2svname(const char *label, char *svname, const char **endptr,
-  size_t svsize);
 
 int lustre_put_lsi(struct super_block *sb);
 int lustre_start_simple(char *obdname, char *type, char *uuid,
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c 
b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index 16009a6..bc15e15 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -599,33 +599,6 @@ int server_name2fsname(const char *svname, char *fsname, 
const char **endptr)
 }
 EXPORT_SYMBOL(server_name2fsname);
 
-/**
- * Get service name (svname) from string
- * rc < 0 on error
- * if endptr isn't NULL it is set to end of fsname *
- */
-int server_name2svname(const char *label, char *svname, const char **endptr,
-  size_t svsize)
-{
-   int rc;
-   const char *dash;
-
-   /* We use server_name2fsname() just for parsing */
-   rc = server_name2fsname(label, NULL, &dash);
-   if (rc != 0)
-   return rc;
-
-   if (endptr != NULL)
-   *endptr = dash;
-
-   if (strlcpy(svname, dash + 1, svsize) >= svsize)
-   return -E2BIG;
-
-   return 0;
-}
-EXPORT_SYMBOL(server_name2svname);
-
-
 /* Get the index from the obd name.
rc = server type, or
rc < 0  on error
-- 
2.1.0

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


[PATCH 20/29] staging/lustre/fid: Remove server fid function declarations

2015-09-28 Thread green
From: Oleg Drokin 

Those functions are not present anywhere in the client code.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_fid.h | 24 --
 1 file changed, 24 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h 
b/drivers/staging/lustre/lustre/include/lustre_fid.h
index abc9345..1b50e66 100644
--- a/drivers/staging/lustre/lustre/include/lustre_fid.h
+++ b/drivers/staging/lustre/lustre/include/lustre_fid.h
@@ -425,30 +425,6 @@ struct lu_server_seq {
struct seq_server_site  *lss_site;
 };
 
-/* Server methods */
-
-int seq_server_init(struct lu_server_seq *seq,
-   struct dt_device *dev,
-   const char *prefix,
-   enum lu_mgr_type type,
-   struct seq_server_site *ss,
-   const struct lu_env *env);
-
-void seq_server_fini(struct lu_server_seq *seq,
-const struct lu_env *env);
-
-int seq_server_alloc_super(struct lu_server_seq *seq,
-  struct lu_seq_range *out,
-  const struct lu_env *env);
-
-int seq_server_alloc_meta(struct lu_server_seq *seq,
- struct lu_seq_range *out,
- const struct lu_env *env);
-
-int seq_server_set_cli(struct lu_server_seq *seq,
-  struct lu_client_seq *cli,
-  const struct lu_env *env);
-
 /* Client methods */
 int seq_client_init(struct lu_client_seq *seq,
struct obd_export *exp,
-- 
2.1.0

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


[PATCH 21/29] staging/lustre/fid: seq_client_init/fini don't need to be exported

2015-09-28 Thread green
From: Oleg Drokin 

In fact they could be static as they are only used inside
this file, so remove EXPORT_SYMBOL and declarations.
Also seq_client_init is always called with srv = NULL, so just
drop this argument.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/fid/fid_request.c| 39 ++
 drivers/staging/lustre/lustre/include/lustre_fid.h |  8 -
 2 files changed, 18 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c 
b/drivers/staging/lustre/lustre/fid/fid_request.c
index a16d577..16264bc 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -438,18 +438,29 @@ out_cleanup:
return rc;
 }
 
-int seq_client_init(struct lu_client_seq *seq,
-   struct obd_export *exp,
-   enum lu_cli_type type,
-   const char *prefix,
-   struct lu_server_seq *srv)
+static void seq_client_fini(struct lu_client_seq *seq)
+{
+   seq_client_debugfs_fini(seq);
+
+   if (seq->lcs_exp) {
+   class_export_put(seq->lcs_exp);
+   seq->lcs_exp = NULL;
+   }
+
+   seq->lcs_srv = NULL;
+}
+
+static int seq_client_init(struct lu_client_seq *seq,
+  struct obd_export *exp,
+  enum lu_cli_type type,
+  const char *prefix)
 {
int rc;
 
LASSERT(seq != NULL);
LASSERT(prefix != NULL);
 
-   seq->lcs_srv = srv;
+   seq->lcs_srv = NULL;
seq->lcs_type = type;
 
mutex_init(&seq->lcs_mutex);
@@ -475,20 +486,6 @@ int seq_client_init(struct lu_client_seq *seq,
seq_client_fini(seq);
return rc;
 }
-EXPORT_SYMBOL(seq_client_init);
-
-void seq_client_fini(struct lu_client_seq *seq)
-{
-   seq_client_debugfs_fini(seq);
-
-   if (seq->lcs_exp != NULL) {
-   class_export_put(seq->lcs_exp);
-   seq->lcs_exp = NULL;
-   }
-
-   seq->lcs_srv = NULL;
-}
-EXPORT_SYMBOL(seq_client_fini);
 
 int client_fid_init(struct obd_device *obd,
struct obd_export *exp, enum lu_cli_type type)
@@ -510,7 +507,7 @@ int client_fid_init(struct obd_device *obd,
snprintf(prefix, MAX_OBD_NAME + 5, "cli-%s", obd->obd_name);
 
/* Init client side sequence-manager */
-   rc = seq_client_init(cli->cl_seq, exp, type, prefix, NULL);
+   rc = seq_client_init(cli->cl_seq, exp, type, prefix);
kfree(prefix);
if (rc)
goto out_free_seq;
diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h 
b/drivers/staging/lustre/lustre/include/lustre_fid.h
index 1b50e66..f60c20a 100644
--- a/drivers/staging/lustre/lustre/include/lustre_fid.h
+++ b/drivers/staging/lustre/lustre/include/lustre_fid.h
@@ -426,14 +426,6 @@ struct lu_server_seq {
 };
 
 /* Client methods */
-int seq_client_init(struct lu_client_seq *seq,
-   struct obd_export *exp,
-   enum lu_cli_type type,
-   const char *prefix,
-   struct lu_server_seq *srv);
-
-void seq_client_fini(struct lu_client_seq *seq);
-
 void seq_client_flush(struct lu_client_seq *seq);
 
 int seq_client_alloc_fid(const struct lu_env *env, struct lu_client_seq *seq,
-- 
2.1.0

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


[PATCH 17/29] staging/lustre/ptlrpc: secure wrapping code cleanup

2015-09-28 Thread green
From: Oleg Drokin 

Drop unused functions.

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_sec.h |  20 --
 drivers/staging/lustre/lustre/ptlrpc/sec.c | 116 
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c| 329 -
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  |  48 ---
 drivers/staging/lustre/lustre/ptlrpc/sec_gc.c  |  15 -
 5 files changed, 528 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h 
b/drivers/staging/lustre/lustre/include/lustre_sec.h
index 871185c..1d2c572 100644
--- a/drivers/staging/lustre/lustre/include/lustre_sec.h
+++ b/drivers/staging/lustre/lustre/include/lustre_sec.h
@@ -295,7 +295,6 @@ enum lustre_sec_part {
LUSTRE_SP_ANY  = 0xFF
 };
 
-const char *sptlrpc_part2name(enum lustre_sec_part sp);
 enum lustre_sec_part sptlrpc_target_sec_part(struct obd_device *obd);
 
 /**
@@ -339,7 +338,6 @@ int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
enum lustre_sec_part to,
lnet_nid_t nid,
struct sptlrpc_flavor *sf);
-void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *set);
 
 int  sptlrpc_process_config(struct lustre_cfg *lcfg);
 void sptlrpc_conf_log_start(const char *logname);
@@ -347,10 +345,6 @@ void sptlrpc_conf_log_stop(const char *logname);
 void sptlrpc_conf_log_update_begin(const char *logname);
 void sptlrpc_conf_log_update_end(const char *logname);
 void sptlrpc_conf_client_adapt(struct obd_device *obd);
-void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset,
- enum lustre_sec_part from,
- lnet_nid_t nid,
- struct sptlrpc_flavor *flavor);
 
 /* The maximum length of security payload. 1024 is enough for Kerberos 5,
  * and should be enough for other future mechanisms but not sure.
@@ -1002,16 +996,12 @@ void sptlrpc_sec_put(struct ptlrpc_sec *sec);
  * internal apis which only used by policy implementation
  */
 int  sptlrpc_get_next_secid(void);
-void sptlrpc_sec_destroy(struct ptlrpc_sec *sec);
 
 /*
  * exported client context api
  */
 struct ptlrpc_cli_ctx *sptlrpc_cli_ctx_get(struct ptlrpc_cli_ctx *ctx);
 void sptlrpc_cli_ctx_put(struct ptlrpc_cli_ctx *ctx, int sync);
-void sptlrpc_cli_ctx_expire(struct ptlrpc_cli_ctx *ctx);
-void sptlrpc_cli_ctx_wakeup(struct ptlrpc_cli_ctx *ctx);
-int sptlrpc_cli_ctx_display(struct ptlrpc_cli_ctx *ctx, char *buf, int 
bufsize);
 
 /*
  * exported client context wrap/buffers
@@ -1054,7 +1044,6 @@ int sptlrpc_parse_rule(char *param, struct sptlrpc_rule 
*rule);
 /* gc */
 void sptlrpc_gc_add_sec(struct ptlrpc_sec *sec);
 void sptlrpc_gc_del_sec(struct ptlrpc_sec *sec);
-void sptlrpc_gc_add_ctx(struct ptlrpc_cli_ctx *ctx);
 
 /* misc */
 const char *sec2target_str(struct ptlrpc_sec *sec);
@@ -1078,25 +1067,16 @@ int  sptlrpc_svc_wrap_reply(struct ptlrpc_request *req);
 void sptlrpc_svc_free_rs(struct ptlrpc_reply_state *rs);
 void sptlrpc_svc_ctx_addref(struct ptlrpc_request *req);
 void sptlrpc_svc_ctx_decref(struct ptlrpc_request *req);
-void sptlrpc_svc_ctx_invalidate(struct ptlrpc_request *req);
 
 int  sptlrpc_target_export_check(struct obd_export *exp,
 struct ptlrpc_request *req);
-void sptlrpc_target_update_exp_flavor(struct obd_device *obd,
- struct sptlrpc_rule_set *rset);
-
 /*
  * reverse context
  */
 int sptlrpc_svc_install_rvs_ctx(struct obd_import *imp,
struct ptlrpc_svc_ctx *ctx);
-int sptlrpc_cli_install_rvs_ctx(struct obd_import *imp,
-   struct ptlrpc_cli_ctx *ctx);
 
 /* bulk security api */
-int sptlrpc_enc_pool_add_user(void);
-int sptlrpc_enc_pool_del_user(void);
-int  sptlrpc_enc_pool_get_pages(struct ptlrpc_bulk_desc *desc);
 void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc);
 
 int sptlrpc_cli_wrap_bulk(struct ptlrpc_request *req,
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec.c
index 5ee6641..67604b5 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
@@ -297,46 +297,6 @@ void sptlrpc_cli_ctx_put(struct ptlrpc_cli_ctx *ctx, int 
sync)
 }
 EXPORT_SYMBOL(sptlrpc_cli_ctx_put);
 
-/**
- * Expire the client context immediately.
- *
- * \pre Caller must hold at least 1 reference on the \a ctx.
- */
-void sptlrpc_cli_ctx_expire(struct ptlrpc_cli_ctx *ctx)
-{
-   LASSERT(ctx->cc_ops->force_die);
-   ctx->cc_ops->force_die(ctx, 0);
-}
-EXPORT_SYMBOL(sptlrpc_cli_ctx_expire);
-
-/**
- * To wake up the threads who are waiting for this client context. Called
- * after some status change happened on \a ctx.
- */
-void sptlrpc_cli_ctx_wakeup(struct ptlrpc_cli_ctx *ctx)
-{
-   struct ptlrpc_request *req, *next;
-
-   spin_lock(&ctx->cc_

[PATCH 23/29] staging/lustre/fid: Get rid of lcs_srv in lu_client_seq

2015-09-28 Thread green
From: Oleg Drokin 

Since we know lcs_srv is always NULL, just get rid of it completely
and fix up all the code to assumee it was never there.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/fid/fid_request.c| 48 --
 drivers/staging/lustre/lustre/fid/lproc_fid.c  |  2 -
 drivers/staging/lustre/lustre/include/lustre_fid.h |  5 ---
 3 files changed, 17 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c 
b/drivers/staging/lustre/lustre/fid/fid_request.c
index ce55340..7c45e74 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -150,19 +150,15 @@ int seq_client_alloc_super(struct lu_client_seq *seq,
 
mutex_lock(&seq->lcs_mutex);
 
-   if (seq->lcs_srv) {
-   rc = 0;
-   } else {
-   /* Check whether the connection to seq controller has been
-* setup (lcs_exp != NULL) */
-   if (seq->lcs_exp == NULL) {
-   mutex_unlock(&seq->lcs_mutex);
-   return -EINPROGRESS;
-   }
-
-   rc = seq_client_rpc(seq, &seq->lcs_space,
-   SEQ_ALLOC_SUPER, "super");
+   /* Check whether the connection to seq controller has been
+* setup (lcs_exp != NULL) */
+   if (!seq->lcs_exp) {
+   mutex_unlock(&seq->lcs_mutex);
+   return -EINPROGRESS;
}
+
+   rc = seq_client_rpc(seq, &seq->lcs_space,
+   SEQ_ALLOC_SUPER, "super");
mutex_unlock(&seq->lcs_mutex);
return rc;
 }
@@ -173,18 +169,14 @@ static int seq_client_alloc_meta(const struct lu_env *env,
 {
int rc;
 
-   if (seq->lcs_srv) {
-   rc = 0;
-   } else {
-   do {
-   /* If meta server return -EINPROGRESS or EAGAIN,
-* it means meta server might not be ready to
-* allocate super sequence from sequence controller
-* (MDT0)yet */
-   rc = seq_client_rpc(seq, &seq->lcs_space,
-   SEQ_ALLOC_META, "meta");
-   } while (rc == -EINPROGRESS || rc == -EAGAIN);
-   }
+   do {
+   /* If meta server return -EINPROGRESS or EAGAIN,
+* it means meta server might not be ready to
+* allocate super sequence from sequence controller
+* (MDT0)yet */
+   rc = seq_client_rpc(seq, &seq->lcs_space,
+   SEQ_ALLOC_META, "meta");
+   } while (rc == -EINPROGRESS || rc == -EAGAIN);
 
return rc;
 }
@@ -395,8 +387,6 @@ static void seq_client_fini(struct lu_client_seq *seq)
class_export_put(seq->lcs_exp);
seq->lcs_exp = NULL;
}
-
-   seq->lcs_srv = NULL;
 }
 
 static int seq_client_init(struct lu_client_seq *seq,
@@ -409,7 +399,6 @@ static int seq_client_init(struct lu_client_seq *seq,
LASSERT(seq != NULL);
LASSERT(prefix != NULL);
 
-   seq->lcs_srv = NULL;
seq->lcs_type = type;
 
mutex_init(&seq->lcs_mutex);
@@ -422,10 +411,7 @@ static int seq_client_init(struct lu_client_seq *seq,
/* Make sure that things are clear before work is started. */
seq_client_flush(seq);
 
-   if (exp != NULL)
-   seq->lcs_exp = class_export_get(exp);
-   else if (type == LUSTRE_SEQ_METADATA)
-   LASSERT(seq->lcs_srv != NULL);
+   seq->lcs_exp = class_export_get(exp);
 
snprintf(seq->lcs_name, sizeof(seq->lcs_name),
 "cli-%s", prefix);
diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c 
b/drivers/staging/lustre/lustre/fid/lproc_fid.c
index bf12723..ce90c1c 100644
--- a/drivers/staging/lustre/lustre/fid/lproc_fid.c
+++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c
@@ -204,8 +204,6 @@ ldebugfs_fid_server_seq_show(struct seq_file *m, void 
*unused)
if (seq->lcs_exp != NULL) {
cli = &seq->lcs_exp->exp_obd->u.cli;
seq_printf(m, "%s\n", cli->cl_target_uuid.uuid);
-   } else {
-   seq_printf(m, "%s\n", seq->lcs_srv->lss_name);
}
 
return 0;
diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h 
b/drivers/staging/lustre/lustre/include/lustre_fid.h
index 22fc96e..bbe3ff8 100644
--- a/drivers/staging/lustre/lustre/include/lustre_fid.h
+++ b/drivers/staging/lustre/lustre/include/lustre_fid.h
@@ -330,8 +330,6 @@ enum lu_mgr_type {
LUSTRE_SEQ_CONTROLLER
 };
 
-struct lu_server_seq;
-
 /* Client sequence manager interface. */
 struct lu_client_seq {
/* Sequence-controller export. */
@@ -366,9 +364,6 @@ struct lu_client_seq {
 */
__u64  lcs_width;
 
-   /* Seq-server for direct talking */
-   struct lu_server_seq   *lcs_srv;
-
  

[PATCH 15/29] staging/lustre/obdclass: Drop unused code from obdo.c

2015-09-28 Thread green
From: Oleg Drokin 

These functions are not even referenced in any header files anymore.

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/obdclass/obdo.c | 170 --
 1 file changed, 170 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c 
b/drivers/staging/lustre/lustre/obdclass/obdo.c
index 307ffe3..1a950fb 100644
--- a/drivers/staging/lustre/lustre/obdclass/obdo.c
+++ b/drivers/staging/lustre/lustre/obdclass/obdo.c
@@ -115,90 +115,6 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, 
u32 valid)
 }
 EXPORT_SYMBOL(obdo_from_inode);
 
-void obdo_cpy_md(struct obdo *dst, struct obdo *src, u32 valid)
-{
-   CDEBUG(D_INODE, "src obdo "DOSTID" valid %#llx, dst obdo "DOSTID"\n",
-  POSTID(&src->o_oi), src->o_valid, POSTID(&dst->o_oi));
-   if (valid & OBD_MD_FLATIME)
-   dst->o_atime = src->o_atime;
-   if (valid & OBD_MD_FLMTIME)
-   dst->o_mtime = src->o_mtime;
-   if (valid & OBD_MD_FLCTIME)
-   dst->o_ctime = src->o_ctime;
-   if (valid & OBD_MD_FLSIZE)
-   dst->o_size = src->o_size;
-   if (valid & OBD_MD_FLBLOCKS) /* allocation of space */
-   dst->o_blocks = src->o_blocks;
-   if (valid & OBD_MD_FLBLKSZ)
-   dst->o_blksize = src->o_blksize;
-   if (valid & OBD_MD_FLTYPE)
-   dst->o_mode = (dst->o_mode & ~S_IFMT) | (src->o_mode & S_IFMT);
-   if (valid & OBD_MD_FLMODE)
-   dst->o_mode = (dst->o_mode & S_IFMT) | (src->o_mode & ~S_IFMT);
-   if (valid & OBD_MD_FLUID)
-   dst->o_uid = src->o_uid;
-   if (valid & OBD_MD_FLGID)
-   dst->o_gid = src->o_gid;
-   if (valid & OBD_MD_FLFLAGS)
-   dst->o_flags = src->o_flags;
-   if (valid & OBD_MD_FLFID) {
-   dst->o_parent_seq = src->o_parent_seq;
-   dst->o_parent_ver = src->o_parent_ver;
-   }
-   if (valid & OBD_MD_FLGENER)
-   dst->o_parent_oid = src->o_parent_oid;
-   if (valid & OBD_MD_FLHANDLE)
-   dst->o_handle = src->o_handle;
-   if (valid & OBD_MD_FLCOOKIE)
-   dst->o_lcookie = src->o_lcookie;
-
-   dst->o_valid |= valid;
-}
-EXPORT_SYMBOL(obdo_cpy_md);
-
-/* returns FALSE if comparison (by flags) is same, TRUE if changed */
-int obdo_cmp_md(struct obdo *dst, struct obdo *src, u32 compare)
-{
-   int res = 0;
-
-   if (compare & OBD_MD_FLATIME)
-   res |= dst->o_atime != src->o_atime;
-   if (compare & OBD_MD_FLMTIME)
-   res |= dst->o_mtime != src->o_mtime;
-   if (compare & OBD_MD_FLCTIME)
-   res |= dst->o_ctime != src->o_ctime;
-   if (compare & OBD_MD_FLSIZE)
-   res |= dst->o_size != src->o_size;
-   if (compare & OBD_MD_FLBLOCKS) /* allocation of space */
-   res |= dst->o_blocks != src->o_blocks;
-   if (compare & OBD_MD_FLBLKSZ)
-   res |= dst->o_blksize != src->o_blksize;
-   if (compare & OBD_MD_FLTYPE)
-   res |= ((dst->o_mode ^ src->o_mode) & S_IFMT) != 0;
-   if (compare & OBD_MD_FLMODE)
-   res |= ((dst->o_mode ^ src->o_mode) & ~S_IFMT) != 0;
-   if (compare & OBD_MD_FLUID)
-   res |= dst->o_uid != src->o_uid;
-   if (compare & OBD_MD_FLGID)
-   res |= dst->o_gid != src->o_gid;
-   if (compare & OBD_MD_FLFLAGS)
-   res |= dst->o_flags != src->o_flags;
-   if (compare & OBD_MD_FLNLINK)
-   res |= dst->o_nlink != src->o_nlink;
-   if (compare & OBD_MD_FLFID) {
-   res |= dst->o_parent_seq != src->o_parent_seq;
-   res |= dst->o_parent_ver != src->o_parent_ver;
-   }
-   if (compare & OBD_MD_FLGENER)
-   res |= dst->o_parent_oid != src->o_parent_oid;
-   /* XXX Don't know if these should be included here - wasn't previously
-   if ( compare & OBD_MD_FLINLINE )
-   res |= memcmp(dst->o_inline, src->o_inline);
-   */
-   return res;
-}
-EXPORT_SYMBOL(obdo_cmp_md);
-
 void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj)
 {
ioobj->ioo_oid = oa->o_oi;
@@ -211,42 +127,6 @@ void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj 
*ioobj)
 }
 EXPORT_SYMBOL(obdo_to_ioobj);
 
-void obdo_from_iattr(struct obdo *oa, struct iattr *attr, unsigned int 
ia_valid)
-{
-   if (ia_valid & ATTR_ATIME) {
-   oa->o_atime = LTIME_S(attr->ia_atime);
-   oa->o_valid |= OBD_MD_FLATIME;
-   }
-   if (ia_valid & ATTR_MTIME) {
-   oa->o_mtime = LTIME_S(attr->ia_mtime);
-   oa->o_valid |= OBD_MD_FLMTIME;
-   }
-   if (ia_valid & ATTR_CTIME) {
-   oa->o_ctime = LTIME_S(attr->ia_ctime);
-   oa->o_valid |= OBD_MD_FLCTIME;
-   }
-   if (ia_valid & ATTR_SIZE) {
-   oa->o_size = attr->ia_size;
-   oa->o_valid |= 

[PATCH 12/29] staging/lustre/obdclass: Remove unused functions from genops.c

2015-09-28 Thread green
From: Oleg Drokin 

These functions are mostly used on the server.

class_uuid2obd, get_devices_count, class_obd_list, class_conn2obd,
class_conn2cliimp, class_connected_export, obd_exports_barrier,
kuc_* (kernel-userspace communications).

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/include/lustre_import.h  |   1 -
 drivers/staging/lustre/lustre/include/obd_class.h  |  11 --
 drivers/staging/lustre/lustre/obdclass/genops.c| 189 -
 3 files changed, 201 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_import.h 
b/drivers/staging/lustre/lustre/include/lustre_import.h
index 079db52..660d290 100644
--- a/drivers/staging/lustre/lustre/include/lustre_import.h
+++ b/drivers/staging/lustre/lustre/include/lustre_import.h
@@ -374,7 +374,6 @@ extern unsigned int at_max;
 /* genops.c */
 struct obd_export;
 struct obd_import *class_exp2cliimp(struct obd_export *);
-struct obd_import *class_conn2cliimp(struct lustre_handle *);
 
 /** @} import */
 
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h 
b/drivers/staging/lustre/lustre/include/obd_class.h
index 8bfdc97..b323403 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -64,7 +64,6 @@ extern struct obd_device *obd_devs[MAX_OBD_DEVICES];
 extern rwlock_t obd_dev_lock;
 
 /* OBD Operations Declarations */
-struct obd_device *class_conn2obd(struct lustre_handle *);
 struct obd_device *class_exp2obd(struct obd_export *);
 int class_handle_ioctl(unsigned int cmd, unsigned long arg);
 int lustre_get_jobid(char *jobid);
@@ -84,15 +83,12 @@ void class_release_dev(struct obd_device *obd);
 int class_name2dev(const char *name);
 struct obd_device *class_name2obd(const char *name);
 int class_uuid2dev(struct obd_uuid *uuid);
-struct obd_device *class_uuid2obd(struct obd_uuid *uuid);
-void class_obd_list(void);
 struct obd_device *class_find_client_obd(struct obd_uuid *tgt_uuid,
  const char *typ_name,
  struct obd_uuid *grp_uuid);
 struct obd_device *class_devices_in_group(struct obd_uuid *grp_uuid,
   int *next);
 struct obd_device *class_num2obd(int num);
-int get_devices_count(void);
 
 int class_notify_sptlrpc_conf(const char *fsname, int namelen);
 
@@ -104,12 +100,6 @@ int obd_zombie_impexp_init(void);
 void obd_zombie_impexp_stop(void);
 void obd_zombie_impexp_cull(void);
 void obd_zombie_barrier(void);
-void obd_exports_barrier(struct obd_device *obd);
-int kuc_len(int payload_len);
-struct kuc_hdr *kuc_ptr(void *p);
-int kuc_ispayload(void *p);
-void *kuc_alloc(int payload_len, int transport, int type);
-void kuc_free(void *p, int payload_len);
 
 struct llog_handle;
 struct llog_rec_hdr;
@@ -283,7 +273,6 @@ int class_connect(struct lustre_handle *conn, struct 
obd_device *obd,
  struct obd_uuid *cluuid);
 int class_disconnect(struct obd_export *exp);
 void class_fail_export(struct obd_export *exp);
-int class_connected_export(struct obd_export *exp);
 int class_manual_cleanup(struct obd_device *obd);
 static inline enum obd_option exp_flags_from_obd(struct obd_device *obd)
 {
diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c 
b/drivers/staging/lustre/lustre/obdclass/genops.c
index 059611b..4467baa 100644
--- a/drivers/staging/lustre/lustre/obdclass/genops.c
+++ b/drivers/staging/lustre/lustre/obdclass/genops.c
@@ -439,16 +439,6 @@ int class_uuid2dev(struct obd_uuid *uuid)
 }
 EXPORT_SYMBOL(class_uuid2dev);
 
-struct obd_device *class_uuid2obd(struct obd_uuid *uuid)
-{
-   int dev = class_uuid2dev(uuid);
-
-   if (dev < 0)
-   return NULL;
-   return class_num2obd(dev);
-}
-EXPORT_SYMBOL(class_uuid2obd);
-
 /**
  * Get obd device from ::obd_devs[]
  *
@@ -478,55 +468,6 @@ struct obd_device *class_num2obd(int num)
 }
 EXPORT_SYMBOL(class_num2obd);
 
-/**
- * Get obd devices count. Device in any
- *state are counted
- * \retval obd device count
- */
-int get_devices_count(void)
-{
-   int index, max_index = class_devno_max(), dev_count = 0;
-
-   read_lock(&obd_dev_lock);
-   for (index = 0; index <= max_index; index++) {
-   struct obd_device *obd = class_num2obd(index);
-
-   if (obd != NULL)
-   dev_count++;
-   }
-   read_unlock(&obd_dev_lock);
-
-   return dev_count;
-}
-EXPORT_SYMBOL(get_devices_count);
-
-void class_obd_list(void)
-{
-   char *status;
-   int i;
-
-   read_lock(&obd_dev_lock);
-   for (i = 0; i < class_devno_max(); i++) {
-   struct obd_device *obd = class_num2obd(i);
-
-   if (!obd)
-   continue;
-   if (obd->obd_stopping)
-   status = "ST";
-   else if (obd->obd_set_up)
-   status = "UP";
-   else if (o

[PATCH 19/29] staging/lustre: remove lots of dead code

2015-09-28 Thread green
From: Arnd Bergmann 

This is a large patch to remove all dead code from obdclass and
ptlrpc, purely removing functions and declarations now, so
despite the size should be easy enough to verify.

Signed-off-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 .../lustre/lustre/include/lustre/lustre_idl.h  |   8 -
 .../lustre/lustre/include/lustre/lustre_user.h |   2 -
 .../staging/lustre/lustre/include/lustre_debug.h   |   1 -
 .../staging/lustre/lustre/include/lustre_export.h  |   1 -
 drivers/staging/lustre/lustre/include/lustre_net.h |  18 --
 .../staging/lustre/lustre/include/lustre_param.h   |   6 -
 .../lustre/lustre/include/lustre_req_layout.h  |   4 -
 drivers/staging/lustre/lustre/include/obd_class.h  |  16 --
 drivers/staging/lustre/lustre/obdclass/debug.c |  10 -
 .../lustre/lustre/obdclass/linux/linux-sysctl.c|   4 -
 .../staging/lustre/lustre/obdclass/obd_config.c| 257 -
 drivers/staging/lustre/lustre/ptlrpc/layout.c  |  64 -
 drivers/staging/lustre/lustre/ptlrpc/nrs.c | 123 --
 .../staging/lustre/lustre/ptlrpc/pack_generic.c| 197 
 drivers/staging/lustre/lustre/ptlrpc/pinger.c  |  18 --
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |   2 -
 16 files changed, 731 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h 
b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index 3ac1de3..9cc92bb 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -2587,8 +2587,6 @@ struct lmv_desc {
struct obd_uuid ld_uuid;
 };
 
-void lustre_swab_lmv_desc(struct lmv_desc *ld);
-
 /* TODO: lmv_stripe_md should contain mds capabilities for all slave fids */
 struct lmv_stripe_md {
__u32mea_magic;
@@ -2599,8 +2597,6 @@ struct lmv_stripe_md {
struct lu_fid mea_ids[0];
 };
 
-void lustre_swab_lmv_stripe_md(struct lmv_stripe_md *mea);
-
 /* lmv structures */
 #define MEA_MAGIC_LAST_CHAR  0xb2221ca1
 #define MEA_MAGIC_ALL_CHARS  0xb222a11c
@@ -3442,8 +3438,6 @@ struct lu_idxpage {
charlip_entries[0];
 };
 
-void lustre_swab_lip_header(struct lu_idxpage *lip);
-
 #define LIP_HDR_SIZE (offsetof(struct lu_idxpage, lip_entries))
 
 /* Gather all possible type associated with a 4KB container */
@@ -3517,8 +3511,6 @@ struct lustre_capa_key {
__u8lk_key[CAPA_HMAC_KEY_MAX_LEN];/**< key */
 } __attribute__((packed));
 
-void lustre_swab_lustre_capa_key(struct lustre_capa_key *k);
-
 /** The link ea holds 1 \a link_ea_entry for each hardlink */
 #define LINK_EA_MAGIC 0x11EAF1DFUL
 struct link_ea_header {
diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h 
b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index e9925ef..1a41366 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -406,8 +406,6 @@ static inline int lmv_user_md_size(int stripes, int 
lmm_magic)
  stripes * sizeof(struct lmv_user_mds_data);
 }
 
-void lustre_swab_lmv_user_md(struct lmv_user_md *lum);
-
 struct ll_recreate_obj {
__u64 lrc_id;
__u32 lrc_ost_idx;
diff --git a/drivers/staging/lustre/lustre/include/lustre_debug.h 
b/drivers/staging/lustre/lustre/include/lustre_debug.h
index 6c92d0b..8a08941 100644
--- a/drivers/staging/lustre/lustre/include/lustre_debug.h
+++ b/drivers/staging/lustre/lustre/include/lustre_debug.h
@@ -46,7 +46,6 @@
 #include "obd.h"
 
 /* lib/debug.c */
-void dump_lniobuf(struct niobuf_local *lnb);
 int dump_req(struct ptlrpc_request *req);
 int block_debug_setup(void *addr, int len, __u64 off, __u64 id);
 int block_debug_check(char *who, void *addr, int len, __u64 off, __u64 id);
diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h 
b/drivers/staging/lustre/lustre/include/lustre_export.h
index c29bfdb..7634dea 100644
--- a/drivers/staging/lustre/lustre/include/lustre_export.h
+++ b/drivers/staging/lustre/lustre/include/lustre_export.h
@@ -353,7 +353,6 @@ static inline bool imp_connect_disp_stripe(struct 
obd_import *imp)
 }
 
 struct obd_export *class_conn2export(struct lustre_handle *conn);
-struct obd_device *class_conn2obd(struct lustre_handle *conn);
 
 /** @} export */
 
diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index a486c1d..af3bf21 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -642,7 +642,6 @@ struct ptlrpc_nrs_pol_ops {
 *
 * \see ptlrpc_nrs_req_initialize()
 * \see ptlrpc_nrs_hpreq_add_nolock()
-* \see ptlrpc_nrs_req_hp_move()
 */
int (*op_res_get) (struct ptlrpc_nrs_policy *policy,
   struct ptlrpc_nrs_request *nrq,
@@ -658,7 +657,6 @@ struct ptlrpc_nrs

[PATCH 16/29] staging/lustre/ptlrpc: Drop unused client code

2015-09-28 Thread green
From: Oleg Drokin 

These client request/import functions are not used anywhere,
so drop them.

Reported-by: Arnd Bergmann 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_net.h | 13 ---
 drivers/staging/lustre/lustre/ptlrpc/client.c  | 95 --
 drivers/staging/lustre/lustre/ptlrpc/import.c  | 11 ---
 3 files changed, 119 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index 6df3e70..a486c1d 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -2356,22 +2356,17 @@ void ptlrpc_request_committed(struct ptlrpc_request 
*req, int force);
 
 void ptlrpc_init_client(int req_portal, int rep_portal, char *name,
struct ptlrpc_client *);
-void ptlrpc_cleanup_client(struct obd_import *imp);
 struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid);
 
 int ptlrpc_queue_wait(struct ptlrpc_request *req);
 int ptlrpc_replay_req(struct ptlrpc_request *req);
 int ptlrpc_unregister_reply(struct ptlrpc_request *req, int async);
-void ptlrpc_restart_req(struct ptlrpc_request *req);
 void ptlrpc_abort_inflight(struct obd_import *imp);
-void ptlrpc_cleanup_imp(struct obd_import *imp);
 void ptlrpc_abort_set(struct ptlrpc_request_set *set);
 
 struct ptlrpc_request_set *ptlrpc_prep_set(void);
 struct ptlrpc_request_set *ptlrpc_prep_fcset(int max, set_producer_func func,
 void *arg);
-int ptlrpc_set_add_cb(struct ptlrpc_request_set *set,
- set_interpreter_func fn, void *data);
 int ptlrpc_set_next_timeout(struct ptlrpc_request_set *);
 int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set);
 int ptlrpc_set_wait(struct ptlrpc_request_set *);
@@ -2405,15 +2400,7 @@ struct ptlrpc_request *ptlrpc_request_alloc_pack(struct 
obd_import *imp,
 int ptlrpc_request_bufs_pack(struct ptlrpc_request *request,
 __u32 version, int opcode, char **bufs,
 struct ptlrpc_cli_ctx *ctx);
-struct ptlrpc_request *ptlrpc_prep_req(struct obd_import *imp, __u32 version,
-  int opcode, int count, __u32 *lengths,
-  char **bufs);
-struct ptlrpc_request *ptlrpc_prep_req_pool(struct obd_import *imp,
-__u32 version, int opcode,
-   int count, __u32 *lengths, char 
**bufs,
-   struct ptlrpc_request_pool *pool);
 void ptlrpc_req_finished(struct ptlrpc_request *request);
-void ptlrpc_req_finished_with_imp_lock(struct ptlrpc_request *request);
 struct ptlrpc_request *ptlrpc_request_addref(struct ptlrpc_request *req);
 struct ptlrpc_bulk_desc *ptlrpc_prep_bulk_imp(struct ptlrpc_request *req,
  unsigned npages, unsigned max_brw,
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index d013d4b..6aaa5dd 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -802,48 +802,6 @@ struct ptlrpc_request *ptlrpc_request_alloc_pack(struct 
obd_import *imp,
 EXPORT_SYMBOL(ptlrpc_request_alloc_pack);
 
 /**
- * Prepare request (fetched from pool \a pool if not NULL) on import \a imp
- * for operation \a opcode. Request would contain \a count buffers.
- * Sizes of buffers are described in array \a lengths and buffers themselves
- * are provided by a pointer \a bufs.
- * Returns prepared request structure pointer or NULL on error.
- */
-struct ptlrpc_request *
-ptlrpc_prep_req_pool(struct obd_import *imp,
-__u32 version, int opcode,
-int count, __u32 *lengths, char **bufs,
-struct ptlrpc_request_pool *pool)
-{
-   struct ptlrpc_request *request;
-   int rc;
-
-   request = __ptlrpc_request_alloc(imp, pool);
-   if (!request)
-   return NULL;
-
-   rc = __ptlrpc_request_bufs_pack(request, version, opcode, count,
-   lengths, bufs, NULL);
-   if (rc) {
-   ptlrpc_request_free(request);
-   request = NULL;
-   }
-   return request;
-}
-EXPORT_SYMBOL(ptlrpc_prep_req_pool);
-
-/**
- * Same as ptlrpc_prep_req_pool, but without pool
- */
-struct ptlrpc_request *
-ptlrpc_prep_req(struct obd_import *imp, __u32 version, int opcode, int count,
-   __u32 *lengths, char **bufs)
-{
-   return ptlrpc_prep_req_pool(imp, version, opcode, count, lengths, bufs,
-   NULL);
-}
-EXPORT_SYMBOL(ptlrpc_prep_req);
-
-/**
  * Allocate and initialize new request set structure on the current CPT.
  * Returns a pointer to the newly allocated set structure or NULL o

[PATCH 28/29] staging/lustre: Remove unused ccc_io_fini()

2015-09-28 Thread green
From: Oleg Drokin 

Does not appear to be used anywhere.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lclient.h| 1 -
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 7 ---
 2 files changed, 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lclient.h 
b/drivers/staging/lustre/lustre/include/lclient.h
index d09d005..823be81 100644
--- a/drivers/staging/lustre/lustre/include/lclient.h
+++ b/drivers/staging/lustre/lustre/include/lclient.h
@@ -332,7 +332,6 @@ void ccc_lock_state(const struct lu_env *env,
const struct cl_lock_slice *slice,
enum cl_lock_state state);
 
-void ccc_io_fini(const struct lu_env *env, const struct cl_io_slice *ios);
 int ccc_io_one_lock_index(const struct lu_env *env, struct cl_io *io,
  __u32 enqflags, enum cl_lock_mode mode,
  pgoff_t start, pgoff_t end);
diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c 
b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index 98a2e0e..eb43174 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -675,13 +675,6 @@ void ccc_lock_state(const struct lu_env *env,
  *
  */
 
-void ccc_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
-{
-   struct cl_io *io = ios->cis_io;
-
-   CLOBINVRNT(env, io->ci_obj, ccc_object_invariant(io->ci_obj));
-}
-
 int ccc_io_one_lock_index(const struct lu_env *env, struct cl_io *io,
  __u32 enqflags, enum cl_lock_mode mode,
  pgoff_t start, pgoff_t end)
-- 
2.1.0

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


[PATCH 29/29] staging/lustre: Remove ccc_transient_page_* methods

2015-09-28 Thread green
From: Oleg Drokin 

All of them but the ccc_transient_page_prep are unused, so remove
the unused ones.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lclient.h| 19 -
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 48 --
 2 files changed, 67 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lclient.h 
b/drivers/staging/lustre/lustre/include/lclient.h
index 823be81..be5499c 100644
--- a/drivers/staging/lustre/lustre/include/lclient.h
+++ b/drivers/staging/lustre/lustre/include/lclient.h
@@ -233,8 +233,6 @@ static inline struct ccc_page *cl2ccc_page(const struct 
cl_page_slice *slice)
return container_of(slice, struct ccc_page, cpg_cl);
 }
 
-struct cl_page*ccc_vmpage_page_transient(struct page *vmpage);
-
 struct ccc_device {
struct cl_devicecdv_cl;
struct super_block *cdv_sb;
@@ -296,22 +294,6 @@ struct page *ccc_page_vmpage(const struct lu_env *env,
 int ccc_page_is_under_lock(const struct lu_env *env,
   const struct cl_page_slice *slice, struct cl_io *io);
 int ccc_fail(const struct lu_env *env, const struct cl_page_slice *slice);
-void ccc_transient_page_verify(const struct cl_page *page);
-int  ccc_transient_page_own(const struct lu_env *env,
-   const struct cl_page_slice *slice,
-   struct cl_io *io, int nonblock);
-void ccc_transient_page_assume(const struct lu_env *env,
-  const struct cl_page_slice *slice,
-  struct cl_io *io);
-void ccc_transient_page_unassume(const struct lu_env *env,
-const struct cl_page_slice *slice,
-struct cl_io *io);
-void ccc_transient_page_disown(const struct lu_env *env,
-  const struct cl_page_slice *slice,
-  struct cl_io *io);
-void ccc_transient_page_discard(const struct lu_env *env,
-   const struct cl_page_slice *slice,
-   struct cl_io *io);
 int ccc_transient_page_prep(const struct lu_env *env,
const struct cl_page_slice *slice,
struct cl_io *io);
@@ -368,7 +350,6 @@ struct ccc_object  *cl_inode2ccc(struct inode *inode);
 
 int cl_setattr_ost(struct inode *inode, const struct iattr *attr);
 
-struct cl_page *ccc_vmpage_page_transient(struct page *vmpage);
 int ccc_object_invariant(const struct cl_object *obj);
 int cl_file_inode_init(struct inode *inode, struct lustre_md *md);
 void cl_inode_fini(struct inode *inode);
diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c 
b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index eb43174..8764df9 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -488,54 +488,6 @@ int ccc_fail(const struct lu_env *env, const struct 
cl_page_slice *slice)
return 0;
 }
 
-void ccc_transient_page_verify(const struct cl_page *page)
-{
-}
-
-int ccc_transient_page_own(const struct lu_env *env,
-  const struct cl_page_slice *slice,
-  struct cl_io *unused,
-  int nonblock)
-{
-   ccc_transient_page_verify(slice->cpl_page);
-   return 0;
-}
-
-void ccc_transient_page_assume(const struct lu_env *env,
- const struct cl_page_slice *slice,
- struct cl_io *unused)
-{
-   ccc_transient_page_verify(slice->cpl_page);
-}
-
-void ccc_transient_page_unassume(const struct lu_env *env,
-   const struct cl_page_slice *slice,
-   struct cl_io *unused)
-{
-   ccc_transient_page_verify(slice->cpl_page);
-}
-
-void ccc_transient_page_disown(const struct lu_env *env,
- const struct cl_page_slice *slice,
- struct cl_io *unused)
-{
-   ccc_transient_page_verify(slice->cpl_page);
-}
-
-void ccc_transient_page_discard(const struct lu_env *env,
-  const struct cl_page_slice *slice,
-  struct cl_io *unused)
-{
-   struct cl_page *page = slice->cpl_page;
-
-   ccc_transient_page_verify(slice->cpl_page);
-
-   /*
-* For transient pages, remove it from the radix tree.
-*/
-   cl_page_delete(env, page);
-}
-
 int ccc_transient_page_prep(const struct lu_env *env,
   const struct cl_page_slice *slice,
   struct cl_io *unused)
-- 
2.1.0

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


[PATCH 27/29] staging/lustre: Remove ccc_attr/conf_set()

2015-09-28 Thread green
From: Oleg Drokin 

These seem to be unused.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lclient.h|  4 
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 15 ---
 2 files changed, 19 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lclient.h 
b/drivers/staging/lustre/lustre/include/lclient.h
index 67d41bb..d09d005 100644
--- a/drivers/staging/lustre/lustre/include/lclient.h
+++ b/drivers/staging/lustre/lustre/include/lclient.h
@@ -289,12 +289,8 @@ void ccc_object_free(const struct lu_env *env, struct 
lu_object *obj);
 int ccc_lock_init(const struct lu_env *env, struct cl_object *obj,
  struct cl_lock *lock, const struct cl_io *io,
  const struct cl_lock_operations *lkops);
-int ccc_attr_set(const struct lu_env *env, struct cl_object *obj,
-const struct cl_attr *attr, unsigned valid);
 int ccc_object_glimpse(const struct lu_env *env,
   const struct cl_object *obj, struct ost_lvb *lvb);
-int ccc_conf_set(const struct lu_env *env, struct cl_object *obj,
-const struct cl_object_conf *conf);
 struct page *ccc_page_vmpage(const struct lu_env *env,
const struct cl_page_slice *slice);
 int ccc_page_is_under_lock(const struct lu_env *env,
diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c 
b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index f049d55..98a2e0e 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -406,12 +406,6 @@ int ccc_lock_init(const struct lu_env *env,
return result;
 }
 
-int ccc_attr_set(const struct lu_env *env, struct cl_object *obj,
-const struct cl_attr *attr, unsigned valid)
-{
-   return 0;
-}
-
 int ccc_object_glimpse(const struct lu_env *env,
   const struct cl_object *obj, struct ost_lvb *lvb)
 {
@@ -430,15 +424,6 @@ int ccc_object_glimpse(const struct lu_env *env,
return 0;
 }
 
-
-
-int ccc_conf_set(const struct lu_env *env, struct cl_object *obj,
-   const struct cl_object_conf *conf)
-{
-   /* TODO: destroy all pages attached to this object. */
-   return 0;
-}
-
 static void ccc_object_size_lock(struct cl_object *obj)
 {
struct inode *inode = ccc_object_inode(obj);
-- 
2.1.0

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


[PATCH 26/29] staging/lustre: Remove server-only recovery-related bits

2015-09-28 Thread green
From: Oleg Drokin 

This patch is a first stab at trying to remove structure fields
from obd_export and obd structures that are only used on the
server or make sense on the server. These include tracking
requests in recovery, various recovery stages, lists of
recovered and not yet recovered clients and so on.
Also prune functions that use these fields.

Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/include/lustre_export.h  | 17 +-
 drivers/staging/lustre/lustre/include/obd.h| 27 -
 drivers/staging/lustre/lustre/include/obd_class.h  |  1 -
 drivers/staging/lustre/lustre/obdclass/genops.c| 50 +
 .../staging/lustre/lustre/obdclass/obd_config.c|  6 --
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  |  3 +-
 drivers/staging/lustre/lustre/ptlrpc/service.c | 64 --
 7 files changed, 28 insertions(+), 140 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h 
b/drivers/staging/lustre/lustre/include/lustre_export.h
index 5b8f4e8..1daf4c5 100644
--- a/drivers/staging/lustre/lustre/include/lustre_export.h
+++ b/drivers/staging/lustre/lustre/include/lustre_export.h
@@ -183,25 +183,10 @@ struct obd_export {
struct obd_connect_data   exp_connect_data;
enum obd_optionexp_flags;
unsigned longexp_failed:1,
- exp_in_recovery:1,
  exp_disconnected:1,
  exp_connecting:1,
- /** VBR: export missed recovery */
- exp_delayed:1,
- /** VBR: failed version checking */
- exp_vbr_failed:1,
- exp_req_replay_needed:1,
- exp_lock_replay_needed:1,
- exp_need_sync:1,
  exp_flvr_changed:1,
- exp_flvr_adapt:1,
- exp_libclient:1, /* liblustre client? */
- /* client timed out and tried to reconnect,
-  * but couldn't because of active rpcs */
- exp_abort_active_req:1,
- /* if to swap nidtbl entries for 2.2 clients.
-  * Only used by the MGS to fix LU-1644. */
- exp_need_mne_swab:1;
+ exp_flvr_adapt:1;
/* also protected by exp_lock */
enum lustre_sec_part  exp_sp_peer;
struct sptlrpc_flavor exp_flvr;  /* current */
diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index 3fb72dc..314f5c7 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -725,8 +725,6 @@ struct obd_device {
/* bitfield modification is protected by obd_dev_lock */
unsigned long obd_attached:1,  /* finished attach */
  obd_set_up:1, /* finished setup */
- obd_recovering:1,/* there are recoverable clients */
- obd_abort_recovery:1,/* recovery expired */
  obd_version_recov:1, /* obd uses version checking */
  obd_replayable:1,/* recovery is enabled; inform 
clients */
  obd_no_transno:1,/* no committed-transno notification 
*/
@@ -769,31 +767,6 @@ struct obd_device {
struct obd_notify_upcall obd_upcall;
struct obd_export   *obd_self_export;
 
-   int   obd_max_recoverable_clients;
-   atomic_t obd_connected_clients;
-   int   obd_stale_clients;
-   int   obd_delayed_clients;
-   /* this lock protects all recovery list_heads, timer and
-* obd_next_recovery_transno value */
-   spinlock_t   obd_recovery_task_lock;
-   __u64   obd_next_recovery_transno;
-   int   obd_replayed_requests;
-   int   obd_requests_queued_for_recovery;
-   wait_queue_head_t obd_next_transno_waitq;
-   /* protected by obd_recovery_task_lock */
-   int   obd_recovery_timeout;
-
-   /* new recovery stuff from CMD2 */
-   struct target_recovery_data  obd_recovery_data;
-   int   obd_replayed_locks;
-   atomic_t obd_req_replay_clients;
-   atomic_t obd_lock_replay_clients;
-   /* all lists are protected by obd_recovery_task_lock */
-   struct list_head   obd_req_replay_queue;
-   struct list_head   obd_lock

Re: [PATCH staging 2/3] wilc1000 : Remove leftover comment delimiters

2015-09-28 Thread Anish Bhatt
On Mon, Sep 28, 2015 at 5:42 PM, Greg KH  wrote:
> On Fri, Sep 25, 2015 at 12:45:16AM -0700, Anish Bhatt wrote:
>> Remove leftover comment delimiters that were only partially removed
>> in a previous cleanup.
>
> You also changed code formatting, which isn't ok to do in the same
> patch, please break it up into different patches.
>
> thanks,
>
> greg k-h

If I don't add the line break though, checkpatch will complain as the line is
far longer than 80 characters. Are checkpatch warnings preferred over
adding a new line while making changes ?
-Anish
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH staging 2/3] wilc1000 : Remove leftover comment delimiters

2015-09-28 Thread Greg KH
On Mon, Sep 28, 2015 at 11:25:04PM -0700, Anish Bhatt wrote:
> On Mon, Sep 28, 2015 at 5:42 PM, Greg KH  wrote:
> > On Fri, Sep 25, 2015 at 12:45:16AM -0700, Anish Bhatt wrote:
> >> Remove leftover comment delimiters that were only partially removed
> >> in a previous cleanup.
> >
> > You also changed code formatting, which isn't ok to do in the same
> > patch, please break it up into different patches.
> >
> > thanks,
> >
> > greg k-h
> 
> If I don't add the line break though, checkpatch will complain as the line is
> far longer than 80 characters. Are checkpatch warnings preferred over
> adding a new line while making changes ?

Do only one logical thing at a time please.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


  1   2   >