linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] irqdomain: Add documentation for irq_create_of_mapping()
@ 2020-12-15 20:07 Christophe JAILLET
  2020-12-15 20:39 ` Kari Argillander
  2020-12-18 18:59 ` Marc Zyngier
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2020-12-15 20:07 UTC (permalink / raw)
  To: maz, tglx, mripard, dan.carpenter
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET

Add a description for 'irq_create_of_mapping()' and make explicit the fact
that the resources allocated by this function can be freed by calling
'irq_dispose_mapping()' when needed (i.e. error handling path, remove
function, ...)

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
The wording can certainly be improved.

My goal is only to make clear if patches such as:
   https://lore.kernel.org/lkml/20201214202117.146293-1-christophe.jaillet@wanadoo.fr/
are needed or not.
---
 kernel/irq/irqdomain.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 6aacd342cd14..d761ece8d43e 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -858,6 +858,15 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
 }
 EXPORT_SYMBOL_GPL(irq_create_fwspec_mapping);
 
+/**
+ * irq_create_of_mapping() - Map an interrupt
+ * @irq_data: structure of_phandle_args returned by a previous
+ * of_irq_parse_xxx() call
+ *
+ * The resources allocated by this function should be freed by
+ * calling irq_dispose_mapping() when the mapping if not useful
+ * anymore.
+ */
 unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data)
 {
 	struct irq_fwspec fwspec;
-- 
2.27.0


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

* Re: [PATCH] irqdomain: Add documentation for irq_create_of_mapping()
  2020-12-15 20:07 [PATCH] irqdomain: Add documentation for irq_create_of_mapping() Christophe JAILLET
@ 2020-12-15 20:39 ` Kari Argillander
  2020-12-18 18:59 ` Marc Zyngier
  1 sibling, 0 replies; 4+ messages in thread
From: Kari Argillander @ 2020-12-15 20:39 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: maz, tglx, mripard, dan.carpenter, linux-kernel, kernel-janitors

On Tue, Dec 15, 2020 at 09:07:47PM +0100, Christophe JAILLET wrote:
> +++ b/kernel/irq/irqdomain.c
> @@ -858,6 +858,15 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
>  }
>  EXPORT_SYMBOL_GPL(irq_create_fwspec_mapping) 
> +/**
> + * irq_create_of_mapping() - Map an interrupt
> + * @irq_data: structure of_phandle_args returned by a previous
> + * of_irq_parse_xxx() call

Start with upper case and use periods. Also next line should align.

> + * 
> + * The resources allocated by this function should be freed by
> + * calling irq_dispose_mapping() when the mapping if not useful
> + * anymore.
> + */

Maybe "mapping is not" or "if the mappign is not". There could be lot 
better wording formatting also but everyone would still understand. So
it is ok. 

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

* Re: [PATCH] irqdomain: Add documentation for irq_create_of_mapping()
  2020-12-15 20:07 [PATCH] irqdomain: Add documentation for irq_create_of_mapping() Christophe JAILLET
  2020-12-15 20:39 ` Kari Argillander
@ 2020-12-18 18:59 ` Marc Zyngier
  2020-12-19 21:34   ` Marion & Christophe JAILLET
  1 sibling, 1 reply; 4+ messages in thread
From: Marc Zyngier @ 2020-12-18 18:59 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: tglx, mripard, dan.carpenter, linux-kernel, kernel-janitors

Hi Christophe,

On Tue, 15 Dec 2020 20:07:47 +0000,
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> 
> Add a description for 'irq_create_of_mapping()' and make explicit the fact
> that the resources allocated by this function can be freed by calling
> 'irq_dispose_mapping()' when needed (i.e. error handling path, remove
> function, ...)
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> The wording can certainly be improved.
> 
> My goal is only to make clear if patches such as:
>    https://lore.kernel.org/lkml/20201214202117.146293-1-christophe.jaillet@wanadoo.fr/
> are needed or not.
> ---
>  kernel/irq/irqdomain.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index 6aacd342cd14..d761ece8d43e 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -858,6 +858,15 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
>  }
>  EXPORT_SYMBOL_GPL(irq_create_fwspec_mapping);
>  
> +/**
> + * irq_create_of_mapping() - Map an interrupt

I think this deserves a bit more work. My immediate questions when
reading this are "map where? and to what?".

> + * @irq_data: structure of_phandle_args returned by a previous
> + * of_irq_parse_xxx() call

That's not strictly true. A of_phandle_args structure can be created
from scratch (and numerous drivers do that).

> + *
> + * The resources allocated by this function should be freed by
> + * calling irq_dispose_mapping() when the mapping if not useful
> + * anymore.

This really is a bit of documentation for irq_dispose_mapping(), isn't it?

> + */
>  unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data)
>  {
>  	struct irq_fwspec fwspec;

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

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

* Re: [PATCH] irqdomain: Add documentation for irq_create_of_mapping()
  2020-12-18 18:59 ` Marc Zyngier
@ 2020-12-19 21:34   ` Marion & Christophe JAILLET
  0 siblings, 0 replies; 4+ messages in thread
From: Marion & Christophe JAILLET @ 2020-12-19 21:34 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: tglx, mripard, dan.carpenter, linux-kernel, kernel-janitors


Le 18/12/2020 à 19:59, Marc Zyngier a écrit :
> Hi Christophe,
>
> On Tue, 15 Dec 2020 20:07:47 +0000,
> Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
>> Add a description for 'irq_create_of_mapping()' and make explicit the fact
>> that the resources allocated by this function can be freed by calling
>> 'irq_dispose_mapping()' when needed (i.e. error handling path, remove
>> function, ...)
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> The wording can certainly be improved.
>>
>> My goal is only to make clear if patches such as:
>>     https://lore.kernel.org/lkml/20201214202117.146293-1-christophe.jaillet@wanadoo.fr/
>> are needed or not.
>> ---
>>   kernel/irq/irqdomain.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
>> index 6aacd342cd14..d761ece8d43e 100644
>> --- a/kernel/irq/irqdomain.c
>> +++ b/kernel/irq/irqdomain.c
>> @@ -858,6 +858,15 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
>>   }
>>   EXPORT_SYMBOL_GPL(irq_create_fwspec_mapping);
>>   
>> +/**
>> + * irq_create_of_mapping() - Map an interrupt
> I think this deserves a bit more work. My immediate questions when
> reading this are "map where? and to what?".

I won't be of great help here.
I don't know this code enough to be able to provide an accurate description.

>> + * @irq_data: structure of_phandle_args returned by a previous
>> + * of_irq_parse_xxx() call
> That's not strictly true. A of_phandle_args structure can be created
> from scratch (and numerous drivers do that).
>
>> + *
>> + * The resources allocated by this function should be freed by
>> + * calling irq_dispose_mapping() when the mapping if not useful
>> + * anymore.
> This really is a bit of documentation for irq_dispose_mapping(), isn't it?

Well, I don't agree.

I think it is easier to see that some resources need to be freed with a 
dedicated function if it is explained in the description of the function 
which allocates the resource.

CJ

>
>> + */
>>   unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data)
>>   {
>>   	struct irq_fwspec fwspec;
> Thanks,
>
> 	M.
>

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

end of thread, other threads:[~2020-12-19 21:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 20:07 [PATCH] irqdomain: Add documentation for irq_create_of_mapping() Christophe JAILLET
2020-12-15 20:39 ` Kari Argillander
2020-12-18 18:59 ` Marc Zyngier
2020-12-19 21:34   ` Marion & Christophe JAILLET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).