All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] ALSA: asihpi - fix return type of hpios_locked_mem_alloc()
@ 2012-03-28  6:57 ` Dan Carpenter
  0 siblings, 0 replies; 13+ messages in thread
From: Dan Carpenter @ 2012-03-28  6:57 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Takashi Iwai, Eliot Blennerhassett, alsa-devel, kernel-janitors

This function returns zero or -ENOMEM, but because it's type is u16, the
-ENOMEM gets changed to 65524.  None of the callers care, but lets fix
it anyway as a cleanup.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
index 4cc315d..8c63200 100644
--- a/sound/pci/asihpi/hpi_internal.h
+++ b/sound/pci/asihpi/hpi_internal.h
@@ -42,7 +42,7 @@ On error *pLockedMemHandle marked invalid, non-zero returned.
 If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
 HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
 */
-u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
+int hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
 							   /**< memory handle */
 	u32 size, /**< Size in bytes to allocate */
 	struct pci_dev *p_os_reference
diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c
index 2d7d1c2..87f4385 100644
--- a/sound/pci/asihpi/hpios.c
+++ b/sound/pci/asihpi/hpios.c
@@ -43,7 +43,7 @@ void hpios_delay_micro_seconds(u32 num_micro_sec)
 
 On error, return -ENOMEM, and *pMemArea.size = 0
 */
-u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
+int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
 	struct pci_dev *pdev)
 {
 	/*?? any benefit in using managed dmam_alloc_coherent? */

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [patch] ALSA: asihpi - fix return type of hpios_locked_mem_alloc()
@ 2012-03-28  6:57 ` Dan Carpenter
  0 siblings, 0 replies; 13+ messages in thread
From: Dan Carpenter @ 2012-03-28  6:57 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Takashi Iwai, Eliot Blennerhassett, alsa-devel, kernel-janitors

This function returns zero or -ENOMEM, but because it's type is u16, the
-ENOMEM gets changed to 65524.  None of the callers care, but lets fix
it anyway as a cleanup.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
index 4cc315d..8c63200 100644
--- a/sound/pci/asihpi/hpi_internal.h
+++ b/sound/pci/asihpi/hpi_internal.h
@@ -42,7 +42,7 @@ On error *pLockedMemHandle marked invalid, non-zero returned.
 If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
 HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
 */
-u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
+int hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
 							   /**< memory handle */
 	u32 size, /**< Size in bytes to allocate */
 	struct pci_dev *p_os_reference
diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c
index 2d7d1c2..87f4385 100644
--- a/sound/pci/asihpi/hpios.c
+++ b/sound/pci/asihpi/hpios.c
@@ -43,7 +43,7 @@ void hpios_delay_micro_seconds(u32 num_micro_sec)
 
 On error, return -ENOMEM, and *pMemArea.size = 0
 */
-u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
+int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
 	struct pci_dev *pdev)
 {
 	/*?? any benefit in using managed dmam_alloc_coherent? */

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [patch] ALSA: asihpi - fix return type of hpios_locked_mem_alloc()
  2012-03-28  6:57 ` Dan Carpenter
@ 2012-03-28 14:38   ` Takashi Iwai
  -1 siblings, 0 replies; 13+ messages in thread
From: Takashi Iwai @ 2012-03-28 14:38 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Eliot Blennerhassett, alsa-devel, kernel-janitors

At Wed, 28 Mar 2012 09:57:02 +0300,
Dan Carpenter wrote:
> 
> This function returns zero or -ENOMEM, but because it's type is u16, the
> -ENOMEM gets changed to 65524.  None of the callers care, but lets fix
> it anyway as a cleanup.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied it now.  Thanks.


Takashi


> diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
> index 4cc315d..8c63200 100644
> --- a/sound/pci/asihpi/hpi_internal.h
> +++ b/sound/pci/asihpi/hpi_internal.h
> @@ -42,7 +42,7 @@ On error *pLockedMemHandle marked invalid, non-zero returned.
>  If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
>  HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
>  */
> -u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
> +int hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
>  							   /**< memory handle */
>  	u32 size, /**< Size in bytes to allocate */
>  	struct pci_dev *p_os_reference
> diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c
> index 2d7d1c2..87f4385 100644
> --- a/sound/pci/asihpi/hpios.c
> +++ b/sound/pci/asihpi/hpios.c
> @@ -43,7 +43,7 @@ void hpios_delay_micro_seconds(u32 num_micro_sec)
>  
>  On error, return -ENOMEM, and *pMemArea.size = 0
>  */
> -u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
> +int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
>  	struct pci_dev *pdev)
>  {
>  	/*?? any benefit in using managed dmam_alloc_coherent? */
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch] ALSA: asihpi - fix return type of hpios_locked_mem_alloc()
@ 2012-03-28 14:38   ` Takashi Iwai
  0 siblings, 0 replies; 13+ messages in thread
From: Takashi Iwai @ 2012-03-28 14:38 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Eliot Blennerhassett, alsa-devel, kernel-janitors

At Wed, 28 Mar 2012 09:57:02 +0300,
Dan Carpenter wrote:
> 
> This function returns zero or -ENOMEM, but because it's type is u16, the
> -ENOMEM gets changed to 65524.  None of the callers care, but lets fix
> it anyway as a cleanup.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied it now.  Thanks.


Takashi


> diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
> index 4cc315d..8c63200 100644
> --- a/sound/pci/asihpi/hpi_internal.h
> +++ b/sound/pci/asihpi/hpi_internal.h
> @@ -42,7 +42,7 @@ On error *pLockedMemHandle marked invalid, non-zero returned.
>  If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
>  HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
>  */
> -u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
> +int hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
>  							   /**< memory handle */
>  	u32 size, /**< Size in bytes to allocate */
>  	struct pci_dev *p_os_reference
> diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c
> index 2d7d1c2..87f4385 100644
> --- a/sound/pci/asihpi/hpios.c
> +++ b/sound/pci/asihpi/hpios.c
> @@ -43,7 +43,7 @@ void hpios_delay_micro_seconds(u32 num_micro_sec)
>  
>  On error, return -ENOMEM, and *pMemArea.size = 0
>  */
> -u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
> +int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
>  	struct pci_dev *pdev)
>  {
>  	/*?? any benefit in using managed dmam_alloc_coherent? */
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch] ALSA: asihpi - fix return type of hpios_locked_mem_alloc()
  2012-03-28  6:57 ` Dan Carpenter
  (?)
  (?)
@ 2012-03-28 21:43 ` Eliot Blennerhassett
  2012-03-29  5:33     ` Takashi Iwai
  -1 siblings, 1 reply; 13+ messages in thread
From: Eliot Blennerhassett @ 2012-03-28 21:43 UTC (permalink / raw)
  To: kernel-janitors

On 29/03/12 03:38, Takashi Iwai wrote:
> At Wed, 28 Mar 2012 09:57:02 +0300,
> Dan Carpenter wrote:
>>
>> This function returns zero or -ENOMEM, but because it's type is u16, the
>> -ENOMEM gets changed to 65524.  None of the callers care, but lets fix
>> it anyway as a cleanup.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Applied it now.  Thanks.

Hmm. I guess it is too late to NAK this change?

I'd prefer changing the return value to HPI_ERROR_MEMORY_ALLOC and
leaving the function signature alone.

Any chance to make this change?

--
Eliot



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch] ALSA: asihpi - fix return type of hpios_locked_mem_alloc()
  2012-03-28 21:43 ` Eliot Blennerhassett
@ 2012-03-29  5:33     ` Takashi Iwai
  0 siblings, 0 replies; 13+ messages in thread
From: Takashi Iwai @ 2012-03-29  5:33 UTC (permalink / raw)
  To: Eliot Blennerhassett; +Cc: alsa-devel, kernel-janitors, Dan Carpenter

At Thu, 29 Mar 2012 10:43:20 +1300,
Eliot Blennerhassett wrote:
> 
> On 29/03/12 03:38, Takashi Iwai wrote:
> > At Wed, 28 Mar 2012 09:57:02 +0300,
> > Dan Carpenter wrote:
> >>
> >> This function returns zero or -ENOMEM, but because it's type is u16, the
> >> -ENOMEM gets changed to 65524.  None of the callers care, but lets fix
> >> it anyway as a cleanup.
> >>
> >> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > Applied it now.  Thanks.
> 
> Hmm. I guess it is too late to NAK this change?

Yes, Dan's fix itself is correct, so no big reason to revert.

> I'd prefer changing the return value to HPI_ERROR_MEMORY_ALLOC and
> leaving the function signature alone.

It's fine to change to HPI_ERROR_MEMORY_ALLOC.  Just write another
patch to change it appropriately and submit.

But, if we change in that way, we should think again over the return
type of these functions, too.  If functions are supposed to return
these specific error numbers, they should return rather enum
HPI_ERROR_CODES type instead of u16.  Otherwise it's misleading and an
error like this can happen again.

Or, follow the common style, returning int with 0 or a negative error
number.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch] ALSA: asihpi - fix return type of hpios_locked_mem_alloc()
@ 2012-03-29  5:33     ` Takashi Iwai
  0 siblings, 0 replies; 13+ messages in thread
From: Takashi Iwai @ 2012-03-29  5:33 UTC (permalink / raw)
  To: Eliot Blennerhassett; +Cc: alsa-devel, kernel-janitors, Dan Carpenter

At Thu, 29 Mar 2012 10:43:20 +1300,
Eliot Blennerhassett wrote:
> 
> On 29/03/12 03:38, Takashi Iwai wrote:
> > At Wed, 28 Mar 2012 09:57:02 +0300,
> > Dan Carpenter wrote:
> >>
> >> This function returns zero or -ENOMEM, but because it's type is u16, the
> >> -ENOMEM gets changed to 65524.  None of the callers care, but lets fix
> >> it anyway as a cleanup.
> >>
> >> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > Applied it now.  Thanks.
> 
> Hmm. I guess it is too late to NAK this change?

Yes, Dan's fix itself is correct, so no big reason to revert.

> I'd prefer changing the return value to HPI_ERROR_MEMORY_ALLOC and
> leaving the function signature alone.

It's fine to change to HPI_ERROR_MEMORY_ALLOC.  Just write another
patch to change it appropriately and submit.

But, if we change in that way, we should think again over the return
type of these functions, too.  If functions are supposed to return
these specific error numbers, they should return rather enum
HPI_ERROR_CODES type instead of u16.  Otherwise it's misleading and an
error like this can happen again.

Or, follow the common style, returning int with 0 or a negative error
number.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch] ALSA: asihpi - fix return type of hpios_locked_mem_alloc()
  2012-03-29  5:33     ` Takashi Iwai
@ 2012-03-29  5:56       ` Dan Carpenter
  -1 siblings, 0 replies; 13+ messages in thread
From: Dan Carpenter @ 2012-03-29  5:56 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Eliot Blennerhassett, alsa-devel, kernel-janitors

I'm obviously in favour of using standard error codes where ever
possible.  But when I'm writing a change like this, then I do look
at the surrounding context because there are places the use custom
error codes (SCSI is an example).  In this case, I was confused
because there aren't any other error codes in this file, and also
the comment says that it should return -ENOMEM.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch] ALSA: asihpi - fix return type of hpios_locked_mem_alloc()
@ 2012-03-29  5:56       ` Dan Carpenter
  0 siblings, 0 replies; 13+ messages in thread
From: Dan Carpenter @ 2012-03-29  5:56 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Eliot Blennerhassett, alsa-devel, kernel-janitors

I'm obviously in favour of using standard error codes where ever
possible.  But when I'm writing a change like this, then I do look
at the surrounding context because there are places the use custom
error codes (SCSI is an example).  In this case, I was confused
because there aren't any other error codes in this file, and also
the comment says that it should return -ENOMEM.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] ALSA: asihpi - fix return value of hpios_locked_mem_alloc()
  2012-03-29  5:33     ` Takashi Iwai
@ 2012-03-29 20:52       ` linux
  -1 siblings, 0 replies; 13+ messages in thread
From: linux @ 2012-03-29 20:52 UTC (permalink / raw)
  To: tiwai; +Cc: Eliot Blennerhassett, alsa-devel, kernel-janitors, dan.carpenter

From: Eliot Blennerhassett <eblennerhassett@audioscience.com>

Make this function consistent with others in this module by
returning 1 for error, instead of -ENOMEM
(reverts function signature change from a938fb1e)

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
---
 sound/pci/asihpi/hpi_internal.h |    4 ++--
 sound/pci/asihpi/hpios.c        |   10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
index 8c63200..bc86cb7 100644
--- a/sound/pci/asihpi/hpi_internal.h
+++ b/sound/pci/asihpi/hpi_internal.h
@@ -1,7 +1,7 @@
 /******************************************************************************
 
     AudioScience HPI driver
-    Copyright (C) 1997-2011  AudioScience Inc. <support@audioscience.com>
+    Copyright (C) 1997-2012  AudioScience Inc. <support@audioscience.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of version 2 of the GNU General Public License as
@@ -42,7 +42,7 @@ On error *pLockedMemHandle marked invalid, non-zero returned.
 If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
 HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
 */
-int hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
+u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
 							   /**< memory handle */
 	u32 size, /**< Size in bytes to allocate */
 	struct pci_dev *p_os_reference
diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c
index 87f4385..5ef4fe9 100644
--- a/sound/pci/asihpi/hpios.c
+++ b/sound/pci/asihpi/hpios.c
@@ -1,7 +1,7 @@
 /******************************************************************************
 
     AudioScience HPI driver
-    Copyright (C) 1997-2011  AudioScience Inc. <support@audioscience.com>
+    Copyright (C) 1997-2012  AudioScience Inc. <support@audioscience.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of version 2 of the GNU General Public License as
@@ -39,11 +39,11 @@ void hpios_delay_micro_seconds(u32 num_micro_sec)
 
 }
 
-/** Allocated an area of locked memory for bus master DMA operations.
+/** Allocate an area of locked memory for bus master DMA operations.
 
-On error, return -ENOMEM, and *pMemArea.size = 0
+If allocation fails, return 1, and *pMemArea.size = 0
 */
-int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
+u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
 	struct pci_dev *pdev)
 {
 	/*?? any benefit in using managed dmam_alloc_coherent? */
@@ -62,7 +62,7 @@ int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
 		HPI_DEBUG_LOG(WARNING,
 			"failed to allocate %d bytes locked memory\n", size);
 		p_mem_area->size = 0;
-		return -ENOMEM;
+		return 1;
 	}
 }
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH] ALSA: asihpi - fix return value of hpios_locked_mem_alloc()
@ 2012-03-29 20:52       ` linux
  0 siblings, 0 replies; 13+ messages in thread
From: linux @ 2012-03-29 20:52 UTC (permalink / raw)
  To: tiwai; +Cc: Eliot Blennerhassett, alsa-devel, kernel-janitors, dan.carpenter

From: Eliot Blennerhassett <eblennerhassett@audioscience.com>

Make this function consistent with others in this module by
returning 1 for error, instead of -ENOMEM
(reverts function signature change from a938fb1e)

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
---
 sound/pci/asihpi/hpi_internal.h |    4 ++--
 sound/pci/asihpi/hpios.c        |   10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
index 8c63200..bc86cb7 100644
--- a/sound/pci/asihpi/hpi_internal.h
+++ b/sound/pci/asihpi/hpi_internal.h
@@ -1,7 +1,7 @@
 /******************************************************************************
 
     AudioScience HPI driver
-    Copyright (C) 1997-2011  AudioScience Inc. <support@audioscience.com>
+    Copyright (C) 1997-2012  AudioScience Inc. <support@audioscience.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of version 2 of the GNU General Public License as
@@ -42,7 +42,7 @@ On error *pLockedMemHandle marked invalid, non-zero returned.
 If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
 HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
 */
-int hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
+u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
 							   /**< memory handle */
 	u32 size, /**< Size in bytes to allocate */
 	struct pci_dev *p_os_reference
diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c
index 87f4385..5ef4fe9 100644
--- a/sound/pci/asihpi/hpios.c
+++ b/sound/pci/asihpi/hpios.c
@@ -1,7 +1,7 @@
 /******************************************************************************
 
     AudioScience HPI driver
-    Copyright (C) 1997-2011  AudioScience Inc. <support@audioscience.com>
+    Copyright (C) 1997-2012  AudioScience Inc. <support@audioscience.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of version 2 of the GNU General Public License as
@@ -39,11 +39,11 @@ void hpios_delay_micro_seconds(u32 num_micro_sec)
 
 }
 
-/** Allocated an area of locked memory for bus master DMA operations.
+/** Allocate an area of locked memory for bus master DMA operations.
 
-On error, return -ENOMEM, and *pMemArea.size = 0
+If allocation fails, return 1, and *pMemArea.size = 0
 */
-int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
+u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
 	struct pci_dev *pdev)
 {
 	/*?? any benefit in using managed dmam_alloc_coherent? */
@@ -62,7 +62,7 @@ int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
 		HPI_DEBUG_LOG(WARNING,
 			"failed to allocate %d bytes locked memory\n", size);
 		p_mem_area->size = 0;
-		return -ENOMEM;
+		return 1;
 	}
 }
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] ALSA: asihpi - fix return value of hpios_locked_mem_alloc()
  2012-03-29 20:52       ` linux
@ 2012-03-30 14:25         ` Takashi Iwai
  -1 siblings, 0 replies; 13+ messages in thread
From: Takashi Iwai @ 2012-03-30 14:25 UTC (permalink / raw)
  To: linux; +Cc: Eliot Blennerhassett, alsa-devel, kernel-janitors, dan.carpenter

At Fri, 30 Mar 2012 09:52:25 +1300,
linux@audioscience.com wrote:
> 
> From: Eliot Blennerhassett <eblennerhassett@audioscience.com>
> 
> Make this function consistent with others in this module by
> returning 1 for error, instead of -ENOMEM
> (reverts function signature change from a938fb1e)
> 
> Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>

Hm, u16 is not ideal, but OK if it's needed for easier maintenance.
Applied now.


thanks,

Takashi


> ---
>  sound/pci/asihpi/hpi_internal.h |    4 ++--
>  sound/pci/asihpi/hpios.c        |   10 +++++-----
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
> index 8c63200..bc86cb7 100644
> --- a/sound/pci/asihpi/hpi_internal.h
> +++ b/sound/pci/asihpi/hpi_internal.h
> @@ -1,7 +1,7 @@
>  /******************************************************************************
>  
>      AudioScience HPI driver
> -    Copyright (C) 1997-2011  AudioScience Inc. <support@audioscience.com>
> +    Copyright (C) 1997-2012  AudioScience Inc. <support@audioscience.com>
>  
>      This program is free software; you can redistribute it and/or modify
>      it under the terms of version 2 of the GNU General Public License as
> @@ -42,7 +42,7 @@ On error *pLockedMemHandle marked invalid, non-zero returned.
>  If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
>  HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
>  */
> -int hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
> +u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
>  							   /**< memory handle */
>  	u32 size, /**< Size in bytes to allocate */
>  	struct pci_dev *p_os_reference
> diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c
> index 87f4385..5ef4fe9 100644
> --- a/sound/pci/asihpi/hpios.c
> +++ b/sound/pci/asihpi/hpios.c
> @@ -1,7 +1,7 @@
>  /******************************************************************************
>  
>      AudioScience HPI driver
> -    Copyright (C) 1997-2011  AudioScience Inc. <support@audioscience.com>
> +    Copyright (C) 1997-2012  AudioScience Inc. <support@audioscience.com>
>  
>      This program is free software; you can redistribute it and/or modify
>      it under the terms of version 2 of the GNU General Public License as
> @@ -39,11 +39,11 @@ void hpios_delay_micro_seconds(u32 num_micro_sec)
>  
>  }
>  
> -/** Allocated an area of locked memory for bus master DMA operations.
> +/** Allocate an area of locked memory for bus master DMA operations.
>  
> -On error, return -ENOMEM, and *pMemArea.size = 0
> +If allocation fails, return 1, and *pMemArea.size = 0
>  */
> -int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
> +u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
>  	struct pci_dev *pdev)
>  {
>  	/*?? any benefit in using managed dmam_alloc_coherent? */
> @@ -62,7 +62,7 @@ int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
>  		HPI_DEBUG_LOG(WARNING,
>  			"failed to allocate %d bytes locked memory\n", size);
>  		p_mem_area->size = 0;
> -		return -ENOMEM;
> +		return 1;
>  	}
>  }
>  
> -- 
> 1.7.0.4
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] ALSA: asihpi - fix return value of hpios_locked_mem_alloc()
@ 2012-03-30 14:25         ` Takashi Iwai
  0 siblings, 0 replies; 13+ messages in thread
From: Takashi Iwai @ 2012-03-30 14:25 UTC (permalink / raw)
  To: linux; +Cc: Eliot Blennerhassett, alsa-devel, kernel-janitors, dan.carpenter

At Fri, 30 Mar 2012 09:52:25 +1300,
linux@audioscience.com wrote:
> 
> From: Eliot Blennerhassett <eblennerhassett@audioscience.com>
> 
> Make this function consistent with others in this module by
> returning 1 for error, instead of -ENOMEM
> (reverts function signature change from a938fb1e)
> 
> Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>

Hm, u16 is not ideal, but OK if it's needed for easier maintenance.
Applied now.


thanks,

Takashi


> ---
>  sound/pci/asihpi/hpi_internal.h |    4 ++--
>  sound/pci/asihpi/hpios.c        |   10 +++++-----
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
> index 8c63200..bc86cb7 100644
> --- a/sound/pci/asihpi/hpi_internal.h
> +++ b/sound/pci/asihpi/hpi_internal.h
> @@ -1,7 +1,7 @@
>  /******************************************************************************
>  
>      AudioScience HPI driver
> -    Copyright (C) 1997-2011  AudioScience Inc. <support@audioscience.com>
> +    Copyright (C) 1997-2012  AudioScience Inc. <support@audioscience.com>
>  
>      This program is free software; you can redistribute it and/or modify
>      it under the terms of version 2 of the GNU General Public License as
> @@ -42,7 +42,7 @@ On error *pLockedMemHandle marked invalid, non-zero returned.
>  If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
>  HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
>  */
> -int hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
> +u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
>  							   /**< memory handle */
>  	u32 size, /**< Size in bytes to allocate */
>  	struct pci_dev *p_os_reference
> diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c
> index 87f4385..5ef4fe9 100644
> --- a/sound/pci/asihpi/hpios.c
> +++ b/sound/pci/asihpi/hpios.c
> @@ -1,7 +1,7 @@
>  /******************************************************************************
>  
>      AudioScience HPI driver
> -    Copyright (C) 1997-2011  AudioScience Inc. <support@audioscience.com>
> +    Copyright (C) 1997-2012  AudioScience Inc. <support@audioscience.com>
>  
>      This program is free software; you can redistribute it and/or modify
>      it under the terms of version 2 of the GNU General Public License as
> @@ -39,11 +39,11 @@ void hpios_delay_micro_seconds(u32 num_micro_sec)
>  
>  }
>  
> -/** Allocated an area of locked memory for bus master DMA operations.
> +/** Allocate an area of locked memory for bus master DMA operations.
>  
> -On error, return -ENOMEM, and *pMemArea.size = 0
> +If allocation fails, return 1, and *pMemArea.size = 0
>  */
> -int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
> +u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
>  	struct pci_dev *pdev)
>  {
>  	/*?? any benefit in using managed dmam_alloc_coherent? */
> @@ -62,7 +62,7 @@ int hpios_locked_mem_alloc(struct consistent_dma_area *p_mem_area, u32 size,
>  		HPI_DEBUG_LOG(WARNING,
>  			"failed to allocate %d bytes locked memory\n", size);
>  		p_mem_area->size = 0;
> -		return -ENOMEM;
> +		return 1;
>  	}
>  }
>  
> -- 
> 1.7.0.4
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-03-30 14:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-28  6:57 [patch] ALSA: asihpi - fix return type of hpios_locked_mem_alloc() Dan Carpenter
2012-03-28  6:57 ` Dan Carpenter
2012-03-28 14:38 ` Takashi Iwai
2012-03-28 14:38   ` Takashi Iwai
2012-03-28 21:43 ` Eliot Blennerhassett
2012-03-29  5:33   ` Takashi Iwai
2012-03-29  5:33     ` Takashi Iwai
2012-03-29  5:56     ` Dan Carpenter
2012-03-29  5:56       ` Dan Carpenter
2012-03-29 20:52     ` [PATCH] ALSA: asihpi - fix return value " linux
2012-03-29 20:52       ` linux
2012-03-30 14:25       ` Takashi Iwai
2012-03-30 14:25         ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.