Re: [PATCH 00/21] add and use devm_irq_of_parse_and_map()

2014-06-16 Thread Andreas Larsson

On 2014-06-16 10:36, Nikita Yushchenko wrote:

SPARC does not use OF_IRQ and has a different implementation of
irq_of_parse_and_map than the one in drivers/of/irq.c. All code
converted from irq_of_parse_and_map to devm_irq_of_parse_and_map in this
patch set will be unlinkable for SPARC. This includes SPI in general and
many drivers that are used for SPARC (of which several are currently
only used on SPARC platforms).


Can this be fixed by adding a copy of devm_irq_of_parse_and_map() to
arch/sparc/kernel/of_device_common.c ?


Not a copy of the version in irq.c no. On SPARC, IRQ_DOMAIN is not
selected in general.

However, there is no technical problem that I can see with having a
SPARC version of devm_irq_of_parse_and_map that just calls
irq_of_parse_and_map as there are no mappings that needs to be disposed
of. (The empty dummy for irq_dispose_mapping is used if any
irq_dispose_mapping calls are made from drivers).


Ok, I will post an updated patchset that adds sparc
devm_irq_of_parse_and_map() that just calls irq_of_parse_and_map(), and
devm_irq_dispose_mapping() that does nothing.


You have already added the needed empty devm_irq_dispose_mapping in 
include/linux/irqdomain.h.


Note that the IRQ_DOMAIN *can* be used under SPARC (GPIO_GRGPIO is one 
example that selects it), but it is not used at the top level so to 
speak. There should not be a SPARC specific empty version of 
devm_irq_dispose_mapping - CONF_IRQ_DOMAIN or not takes care of that.




Also, you mentioned that some drivers that my original patchset touches
are sparc-only?  Then, maybe better not convert these to devm_? Could
you please give a list of such drivers?


The drivers that I know of off hand is not necessarily SPARC only. Some 
are currently only found in SPARC environments, but that could change in 
the future. I personally don't see a problem with using 
devm_of_parse_and_map solution as long as there is a SPARC-specific one 
as discussed above.


Best regards,
Andreas Larsson
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/21] add and use devm_irq_of_parse_and_map()

2014-06-16 Thread Andreas Larsson

On 2014-06-12 21:02, Nikita Yushchenko wrote:

Currently many device tree aware drivers use irq_of_parse_and_map() to
get
IRQ number and then devm_request_irq() to set up IRQ handler.

This causes a problem for exit path and for error paths: undo action for
irq_of_parse_and_map() is irq_dispose_mapping() that must not be called
while IRQ handler is defined, but devres moves free_irq() out of driver
so driver does not have safe place to call irq_dispose_mapping().

So many drivers do not call irq_dispose_mapping() at all, others call it
while IRQ handler is defined (which is incorrect and causes error
messages
in logs), even others refuse to use devres for managing IRQ handlers.

This patchset adds devres version of irq_of_parse_and_map(), and updates
in-tree users of both devres and irq_of_parse_and_map() to use
devm_irq_of_parse_and_map() instead.



SPARC does not use OF_IRQ and has a different implementation of
irq_of_parse_and_map than the one in drivers/of/irq.c. All code
converted from irq_of_parse_and_map to devm_irq_of_parse_and_map in this
patch set will be unlinkable for SPARC. This includes SPI in general and
many drivers that are used for SPARC (of which several are currently
only used on SPARC platforms).


Can this be fixed by adding a copy of devm_irq_of_parse_and_map() to
arch/sparc/kernel/of_device_common.c ?


Not a copy of the version in irq.c no. On SPARC, IRQ_DOMAIN is not 
selected in general.


However, there is no technical problem that I can see with having a 
SPARC version of devm_irq_of_parse_and_map that just calls 
irq_of_parse_and_map as there are no mappings that needs to be disposed 
of. (The empty dummy for irq_dispose_mapping is used if any 
irq_dispose_mapping calls are made from drivers).


Best regards,
Andreas Larsson
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/21] add and use devm_irq_of_parse_and_map()

2014-06-16 Thread Nikita Yushchenko
>>> SPARC does not use OF_IRQ and has a different implementation of
>>> irq_of_parse_and_map than the one in drivers/of/irq.c. All code
>>> converted from irq_of_parse_and_map to devm_irq_of_parse_and_map in this
>>> patch set will be unlinkable for SPARC. This includes SPI in general and
>>> many drivers that are used for SPARC (of which several are currently
>>> only used on SPARC platforms).
>>
>> Can this be fixed by adding a copy of devm_irq_of_parse_and_map() to
>> arch/sparc/kernel/of_device_common.c ?
> 
> Not a copy of the version in irq.c no. On SPARC, IRQ_DOMAIN is not
> selected in general.
> 
> However, there is no technical problem that I can see with having a
> SPARC version of devm_irq_of_parse_and_map that just calls
> irq_of_parse_and_map as there are no mappings that needs to be disposed
> of. (The empty dummy for irq_dispose_mapping is used if any
> irq_dispose_mapping calls are made from drivers).

Ok, I will post an updated patchset that adds sparc
devm_irq_of_parse_and_map() that just calls irq_of_parse_and_map(), and
devm_irq_dispose_mapping() that does nothing.

Also, you mentioned that some drivers that my original patchset touches
are sparc-only?  Then, maybe better not convert these to devm_? Could
you please give a list of such drivers?

Nikita

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/21] add and use devm_irq_of_parse_and_map()

2014-06-16 Thread Nikita Yushchenko
 SPARC does not use OF_IRQ and has a different implementation of
 irq_of_parse_and_map than the one in drivers/of/irq.c. All code
 converted from irq_of_parse_and_map to devm_irq_of_parse_and_map in this
 patch set will be unlinkable for SPARC. This includes SPI in general and
 many drivers that are used for SPARC (of which several are currently
 only used on SPARC platforms).

 Can this be fixed by adding a copy of devm_irq_of_parse_and_map() to
 arch/sparc/kernel/of_device_common.c ?
 
 Not a copy of the version in irq.c no. On SPARC, IRQ_DOMAIN is not
 selected in general.
 
 However, there is no technical problem that I can see with having a
 SPARC version of devm_irq_of_parse_and_map that just calls
 irq_of_parse_and_map as there are no mappings that needs to be disposed
 of. (The empty dummy for irq_dispose_mapping is used if any
 irq_dispose_mapping calls are made from drivers).

Ok, I will post an updated patchset that adds sparc
devm_irq_of_parse_and_map() that just calls irq_of_parse_and_map(), and
devm_irq_dispose_mapping() that does nothing.

Also, you mentioned that some drivers that my original patchset touches
are sparc-only?  Then, maybe better not convert these to devm_? Could
you please give a list of such drivers?

Nikita

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/21] add and use devm_irq_of_parse_and_map()

2014-06-16 Thread Andreas Larsson

On 2014-06-12 21:02, Nikita Yushchenko wrote:

Currently many device tree aware drivers use irq_of_parse_and_map() to
get
IRQ number and then devm_request_irq() to set up IRQ handler.

This causes a problem for exit path and for error paths: undo action for
irq_of_parse_and_map() is irq_dispose_mapping() that must not be called
while IRQ handler is defined, but devres moves free_irq() out of driver
so driver does not have safe place to call irq_dispose_mapping().

So many drivers do not call irq_dispose_mapping() at all, others call it
while IRQ handler is defined (which is incorrect and causes error
messages
in logs), even others refuse to use devres for managing IRQ handlers.

This patchset adds devres version of irq_of_parse_and_map(), and updates
in-tree users of both devres and irq_of_parse_and_map() to use
devm_irq_of_parse_and_map() instead.



SPARC does not use OF_IRQ and has a different implementation of
irq_of_parse_and_map than the one in drivers/of/irq.c. All code
converted from irq_of_parse_and_map to devm_irq_of_parse_and_map in this
patch set will be unlinkable for SPARC. This includes SPI in general and
many drivers that are used for SPARC (of which several are currently
only used on SPARC platforms).


Can this be fixed by adding a copy of devm_irq_of_parse_and_map() to
arch/sparc/kernel/of_device_common.c ?


Not a copy of the version in irq.c no. On SPARC, IRQ_DOMAIN is not 
selected in general.


However, there is no technical problem that I can see with having a 
SPARC version of devm_irq_of_parse_and_map that just calls 
irq_of_parse_and_map as there are no mappings that needs to be disposed 
of. (The empty dummy for irq_dispose_mapping is used if any 
irq_dispose_mapping calls are made from drivers).


Best regards,
Andreas Larsson
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/21] add and use devm_irq_of_parse_and_map()

2014-06-16 Thread Andreas Larsson

On 2014-06-16 10:36, Nikita Yushchenko wrote:

SPARC does not use OF_IRQ and has a different implementation of
irq_of_parse_and_map than the one in drivers/of/irq.c. All code
converted from irq_of_parse_and_map to devm_irq_of_parse_and_map in this
patch set will be unlinkable for SPARC. This includes SPI in general and
many drivers that are used for SPARC (of which several are currently
only used on SPARC platforms).


Can this be fixed by adding a copy of devm_irq_of_parse_and_map() to
arch/sparc/kernel/of_device_common.c ?


Not a copy of the version in irq.c no. On SPARC, IRQ_DOMAIN is not
selected in general.

However, there is no technical problem that I can see with having a
SPARC version of devm_irq_of_parse_and_map that just calls
irq_of_parse_and_map as there are no mappings that needs to be disposed
of. (The empty dummy for irq_dispose_mapping is used if any
irq_dispose_mapping calls are made from drivers).


Ok, I will post an updated patchset that adds sparc
devm_irq_of_parse_and_map() that just calls irq_of_parse_and_map(), and
devm_irq_dispose_mapping() that does nothing.


You have already added the needed empty devm_irq_dispose_mapping in 
include/linux/irqdomain.h.


Note that the IRQ_DOMAIN *can* be used under SPARC (GPIO_GRGPIO is one 
example that selects it), but it is not used at the top level so to 
speak. There should not be a SPARC specific empty version of 
devm_irq_dispose_mapping - CONF_IRQ_DOMAIN or not takes care of that.




Also, you mentioned that some drivers that my original patchset touches
are sparc-only?  Then, maybe better not convert these to devm_? Could
you please give a list of such drivers?


The drivers that I know of off hand is not necessarily SPARC only. Some 
are currently only found in SPARC environments, but that could change in 
the future. I personally don't see a problem with using 
devm_of_parse_and_map solution as long as there is a SPARC-specific one 
as discussed above.


Best regards,
Andreas Larsson
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/21] add and use devm_irq_of_parse_and_map()

2014-06-12 Thread Nikita Yushchenko
>> Currently many device tree aware drivers use irq_of_parse_and_map() to
>> get
>> IRQ number and then devm_request_irq() to set up IRQ handler.
>>
>> This causes a problem for exit path and for error paths: undo action for
>> irq_of_parse_and_map() is irq_dispose_mapping() that must not be called
>> while IRQ handler is defined, but devres moves free_irq() out of driver
>> so driver does not have safe place to call irq_dispose_mapping().
>>
>> So many drivers do not call irq_dispose_mapping() at all, others call it
>> while IRQ handler is defined (which is incorrect and causes error
>> messages
>> in logs), even others refuse to use devres for managing IRQ handlers.
>>
>> This patchset adds devres version of irq_of_parse_and_map(), and updates
>> in-tree users of both devres and irq_of_parse_and_map() to use
>> devm_irq_of_parse_and_map() instead.
> 
> 
> SPARC does not use OF_IRQ and has a different implementation of
> irq_of_parse_and_map than the one in drivers/of/irq.c. All code
> converted from irq_of_parse_and_map to devm_irq_of_parse_and_map in this
> patch set will be unlinkable for SPARC. This includes SPI in general and
> many drivers that are used for SPARC (of which several are currently
> only used on SPARC platforms).

Can this be fixed by adding a copy of devm_irq_of_parse_and_map() to
arch/sparc/kernel/of_device_common.c ?

Or there are some deep reasons why irq_of_parse_and_map() can't be
devm'd for sparc at all?

Nikita

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/21] add and use devm_irq_of_parse_and_map()

2014-06-12 Thread Andreas Larsson

On 2014-06-04 13:13, nyushche...@dev.rtsoft.ru wrote:

Currently many device tree aware drivers use irq_of_parse_and_map() to get
IRQ number and then devm_request_irq() to set up IRQ handler.

This causes a problem for exit path and for error paths: undo action for
irq_of_parse_and_map() is irq_dispose_mapping() that must not be called
while IRQ handler is defined, but devres moves free_irq() out of driver
so driver does not have safe place to call irq_dispose_mapping().

So many drivers do not call irq_dispose_mapping() at all, others call it
while IRQ handler is defined (which is incorrect and causes error messages
in logs), even others refuse to use devres for managing IRQ handlers.

This patchset adds devres version of irq_of_parse_and_map(), and updates
in-tree users of both devres and irq_of_parse_and_map() to use
devm_irq_of_parse_and_map() instead.



SPARC does not use OF_IRQ and has a different implementation of 
irq_of_parse_and_map than the one in drivers/of/irq.c. All code 
converted from irq_of_parse_and_map to devm_irq_of_parse_and_map in this 
patch set will be unlinkable for SPARC. This includes SPI in general and 
many drivers that are used for SPARC (of which several are currently 
only used on SPARC platforms).


Best regards,
Andreas Larsson
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/21] add and use devm_irq_of_parse_and_map()

2014-06-12 Thread Andreas Larsson

On 2014-06-04 13:13, nyushche...@dev.rtsoft.ru wrote:

Currently many device tree aware drivers use irq_of_parse_and_map() to get
IRQ number and then devm_request_irq() to set up IRQ handler.

This causes a problem for exit path and for error paths: undo action for
irq_of_parse_and_map() is irq_dispose_mapping() that must not be called
while IRQ handler is defined, but devres moves free_irq() out of driver
so driver does not have safe place to call irq_dispose_mapping().

So many drivers do not call irq_dispose_mapping() at all, others call it
while IRQ handler is defined (which is incorrect and causes error messages
in logs), even others refuse to use devres for managing IRQ handlers.

This patchset adds devres version of irq_of_parse_and_map(), and updates
in-tree users of both devres and irq_of_parse_and_map() to use
devm_irq_of_parse_and_map() instead.



SPARC does not use OF_IRQ and has a different implementation of 
irq_of_parse_and_map than the one in drivers/of/irq.c. All code 
converted from irq_of_parse_and_map to devm_irq_of_parse_and_map in this 
patch set will be unlinkable for SPARC. This includes SPI in general and 
many drivers that are used for SPARC (of which several are currently 
only used on SPARC platforms).


Best regards,
Andreas Larsson
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/21] add and use devm_irq_of_parse_and_map()

2014-06-12 Thread Nikita Yushchenko
 Currently many device tree aware drivers use irq_of_parse_and_map() to
 get
 IRQ number and then devm_request_irq() to set up IRQ handler.

 This causes a problem for exit path and for error paths: undo action for
 irq_of_parse_and_map() is irq_dispose_mapping() that must not be called
 while IRQ handler is defined, but devres moves free_irq() out of driver
 so driver does not have safe place to call irq_dispose_mapping().

 So many drivers do not call irq_dispose_mapping() at all, others call it
 while IRQ handler is defined (which is incorrect and causes error
 messages
 in logs), even others refuse to use devres for managing IRQ handlers.

 This patchset adds devres version of irq_of_parse_and_map(), and updates
 in-tree users of both devres and irq_of_parse_and_map() to use
 devm_irq_of_parse_and_map() instead.
 
 
 SPARC does not use OF_IRQ and has a different implementation of
 irq_of_parse_and_map than the one in drivers/of/irq.c. All code
 converted from irq_of_parse_and_map to devm_irq_of_parse_and_map in this
 patch set will be unlinkable for SPARC. This includes SPI in general and
 many drivers that are used for SPARC (of which several are currently
 only used on SPARC platforms).

Can this be fixed by adding a copy of devm_irq_of_parse_and_map() to
arch/sparc/kernel/of_device_common.c ?

Or there are some deep reasons why irq_of_parse_and_map() can't be
devm'd for sparc at all?

Nikita

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/