add and use devm_irq_of_parse_and_map()
Subsystems (40)
cover add and use devm_irq_of_parse_and_map()
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.
[PATCH 01/21] irq: add devres version of OF IRQ mapping routines [PATCH 02/21] ata: use devm_irq_of_parse_and_map() where appropriate [PATCH 03/21] exynos5440-cpufreq: use devm_irq_of_parse_and_map() [PATCH 04/21] omap-sham: use devm_irq_of_parse_and_map() [PATCH 05/21] dma: use devm_irq_of_parse_and_map() where appropriate [PATCH 06/21] mpc85xx_edac: use devm_irq_of_parse_and_map() [PATCH 07/21] gpio: use devm_irq_of_parse_and_map() where [PATCH 08/21] i2c: use devm_irq_of_parse_and_map() where appropriate [PATCH 09/21] apbps2: use devm_irq_of_parse_and_map() [PATCH 10/21] media: use devm_irq_of_parse_and_map() where [PATCH 11/21] mfd: use devm_irq_of_parse_and_map() where appropriate [PATCH 12/21] mpc5121_nfc: use devm_irq_of_parse_and_map() [PATCH 13/21] net/can: use devm_irq_of_parse_and_map() where [PATCH 14/21] net/ethernet: use devm_irq_of_parse_and_map() where [PATCH 15/21] pinctrl: use devm_irq_of_parse_and_map() where [PATCH 16/21] bq24190_charger: use devm_irq_of_parse_and_map() [PATCH 17/21] rtc-mpc5121: use devm_irq_of_parse_and_map() [PATCH 18/21] spi: use devm_irq_of_parse_and_map() where appropriate [PATCH 19/21] exynos_tmu: use devm_irq_of_parse_and_map() [PATCH 20/21] usb: use devm_irq_of_parse_and_map() where appropriate [PATCH 21/21] at91sam9_wdt: use devm_irq_of_parse_and_map()
drivers/ata/pata_mpc52xx.c | 24 +++++----- drivers/ata/sata_mv.c | 5 ++- drivers/cpufreq/exynos5440-cpufreq.c | 4 +- drivers/crypto/omap-sham.c | 4 +- drivers/dma/moxart-dma.c | 4 +- drivers/dma/mpc512x_dma.c | 14 ++---- drivers/dma/mv_xor.c | 18 +++----- drivers/dma/sirf-dma.c | 23 ++++------ drivers/edac/mpc85xx_edac.c | 41 ++++++++++++----- drivers/gpio/gpio-adnp.c | 4 +- drivers/gpio/gpio-mcp23s08.c | 5 ++- drivers/i2c/busses/i2c-mpc.c | 12 ++--- drivers/i2c/busses/i2c-mv64xxx.c | 2 +- drivers/i2c/busses/i2c-st.c | 6 +-- drivers/i2c/busses/i2c-wmt.c | 6 +-- drivers/input/serio/apbps2.c | 6 ++- drivers/media/platform/exynos4-is/fimc-is.c | 14 +++--- drivers/media/platform/fsl-viu.c | 25 ++++------- drivers/mfd/max8997.c | 4 +- drivers/mfd/max8998.c | 4 +- drivers/mtd/nand/mpc5121_nfc.c | 6 +-- drivers/net/can/grcan.c | 11 ++--- drivers/net/can/mscan/mpc5xxx_can.c | 11 ++--- drivers/net/can/sja1000/sja1000_platform.c | 2 +- drivers/net/ethernet/allwinner/sun4i-emac.c | 6 +-- drivers/net/ethernet/arc/emac_main.c | 6 +-- drivers/net/ethernet/marvell/mvneta.c | 15 +++---- drivers/net/ethernet/moxa/moxart_ether.c | 4 +- .../net/ethernet/samsung/sxgbe/sxgbe_platform.c | 24 ++++------ drivers/of/irq.c | 24 ++++++++++ drivers/pinctrl/pinctrl-bcm2835.c | 6 ++- drivers/pinctrl/pinctrl-exynos.c | 11 ++--- drivers/pinctrl/pinctrl-exynos5440.c | 2 +- drivers/pinctrl/pinctrl-rockchip.c | 6 ++- drivers/pinctrl/pinctrl-s3c24xx.c | 6 +-- drivers/pinctrl/pinctrl-s3c64xx.c | 6 +-- drivers/pinctrl/pinctrl-single.c | 6 ++- drivers/pinctrl/pinctrl-sunxi.c | 6 +-- drivers/power/bq24190_charger.c | 2 +- drivers/rtc/rtc-mpc5121.c | 38 ++++++++-------- drivers/spi/spi-bcm2835.c | 2 +- drivers/spi/spi-mpc512x-psc.c | 9 +++- drivers/spi/spi.c | 8 +++- drivers/thermal/samsung/exynos_tmu.c | 2 +- drivers/usb/gadget/gr_udc.c | 17 ++++--- drivers/usb/host/ehci-grlib.c | 11 ++--- drivers/usb/host/ehci-orion.c | 3 +- drivers/usb/host/ehci-ppc-of.c | 11 ++--- drivers/usb/host/ehci-xilinx-of.c | 8 ++-- drivers/usb/host/ohci-ppc-of.c | 7 +-- drivers/watchdog/at91sam9_wdt.c | 12 ++--- include/linux/irqdomain.h | 3 ++ include/linux/of_irq.h | 12 +++++ kernel/irq/irqdomain.c | 47 ++++++++++++++++++++
PATCH 1/21 irq: add devres version of OF IRQ mapping routines
From: Nikita Yushchenko <[email protected]>
Many drivers use devres to manage their resources, and at the same time use irq_of_parse_and_map() / irq_dispose_mapping(). This creates problem on driver unload paths and on error paths:
- it is invalid to call irq_dispose_mapping() while IRQ handler is still installed,
- devres moves removal of IRQ handler out of driver,
- without explicit devres support for IRQ mapping, irq_dispose_mapping() stays in driver and thus gets called while IRQ handler is still installed.
This patch adds devm_irq_create_of_mapping() and devm_irq_of_parse_and_map() routines to be used by drivers for correct release of resources.
--- drivers/of/irq.c | 24 +++++++++++++++++++++++ include/linux/irqdomain.h | 3 +++ include/linux/of_irq.h | 12 ++++++++++++ kernel/irq/irqdomain.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+)
drivers/of/irq.c +24 -0
@@ -46,6 +46,30 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index)EXPORT_SYMBOL_GPL (irq_of_parse_and_map);/** +* devm_irq_of_parse_and_map - Parse and map an interrupt into linux virq space +* @dev: Device interrupt will be used for +* @dn: Device node of the device whose interrupt is to be mapped +* @index: Index of the interrupt to map +* +* This function does the same as irq_of_parse_and_map(), but ensures that +* irq_dispose_mapping() will be called automatically at driver detatch. +* +* If IRQ mapping created by this function needs to be removed manually, +* devm_irq_dispose_mapping() must be called instead of irq_dispose_mapping(). +*/ +int devm_irq_of_parse_and_map (struct device *dev,struct device_node *dn, +int index) +{ +struct of_phandle_args oirq; + +if (of_irq_parse_one (dn, index, &oirq)) +return 0 ; + +return devm_irq_create_of_mapping (dev, &oirq); +} +EXPORT_SYMBOL_GPL (devm_irq_of_parse_and_map); + +/** * of_irq_find_parent - Given a device node, find its interrupt parent node * @child: pointer to device node *
include/linux/irqdomain.h +3 -0
@@ -176,6 +176,7 @@ extern void irq_domain_associate_many(struct irq_domain *domain,extern unsigned int irq_create_mapping (struct irq_domain *host,irq_hw_number_t hwirq);extern void irq_dispose_mapping (unsigned int virq); +extern void devm_irq_dispose_mapping (struct device *dev,unsigned int virq);/** * irq_linear_revmap() - Find a linux irq from a hw irq number.
@@ -220,6 +221,8 @@ int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr,#else /* CONFIG_IRQ_DOMAIN */ static inline void irq_dispose_mapping (unsigned int virq) { } +static inline void devm_irq_dispose_mapping (struct device *dev, +unsigned int virq) { }#endif /* !CONFIG_IRQ_DOMAIN */ #endif /* _LINUX_IRQDOMAIN_H */
include/linux/of_irq.h +12 -0
@@ -35,6 +35,8 @@ extern int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)extern int of_irq_parse_one (struct device_node *device,int index,struct of_phandle_args *out_irq);extern unsigned int irq_create_of_mapping (struct of_phandle_args *irq_data); +extern int devm_irq_create_of_mapping (struct device *dev, +struct of_phandle_args *irq_data);extern int of_irq_to_resource (struct device_node *dev,int index,struct resource *r); extern int of_irq_to_resource_table(struct device_node *dev,
@@ -63,6 +65,9 @@ static inline int of_irq_get(struct device_node *dev, int index)* so declare it here regardless of the CONFIG_OF_IRQ setting. */ extern unsigned int irq_of_parse_and_map (struct device_node *node,int index); +extern int devm_irq_of_parse_and_map (struct device *dev, +struct device_node *node, +int index);extern struct device_node *of_irq_find_parent (struct device_node *child);#else /* !CONFIG_OF */
@@ -72,6 +77,13 @@ static inline unsigned int irq_of_parse_and_map(struct device_node *dev,return 0 ; } +static inline int devm_irq_of_parse_and_map (struct device *dev, +struct device_node *node, +int index) +{ +return 0 ; +} +static inline void *of_irq_find_parent (struct device_node *child) {return NULL ;
kernel/irq/irqdomain.c +47 -0
65 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Re: [PATCH 01/21] irq: add devres version of OF IRQ mapping routines
Quoted 12 lines · On Wed, 4 Jun 2014, [email protected] wrote:
From: Nikita Yushchenko <[email protected]>
Many drivers use devres to manage their resources, and at the same time use
irq_of_parse_and_map()/irq_dispose_mapping(). This creates problem on driver unload paths and on error paths:
- it is invalid to callirq_dispose_mapping()while IRQ handler is still installed,
- devres moves removal of IRQ handler out of driver,
- without explicit devres support for IRQ mapping,irq_dispose_mapping()stays in driver and thus gets called while IRQ handler is still installed.
Quoted 4 lines
This patch adds
devm_irq_create_of_mapping()anddevm_irq_of_parse_and_map()routines to be used by drivers for correct release of resources.Signed-off-by Nikita Yushchenko <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/21 ata: use devm_irq_of_parse_and_map() where appropriate
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
pata_mpc52xx's task_irq is special case since it is managed by betstcomm DMA driver. Do not use devres for it.
--- drivers/ata/pata_mpc52xx.c | 24 ++++++++++-------------- drivers/ata/sata_mv.c | 5 ++++- 2 files changed, 14 insertions(+), 15 deletions(-)
drivers/ata/pata_mpc52xx.c +10 -14
@@ -729,18 +729,17 @@ static int mpc52xx_ata_probe(struct platform_device *op)if ((prop) && (proplen >=4 )) udma_mask =ATA_UDMA2 & ((1 << (*prop +1 )) -1 ); - ata_irq =irq_of_parse_and_map (op->dev.of_node,0 ); -if (ata_irq ==NO_IRQ ) { + ata_irq =devm_irq_of_parse_and_map (&op->dev, op->dev.of_node,0 ); +if (ata_irq <=0 ) {dev_err (&op->dev,"error mapping irq\n" ); -return -EINVAL ; +return ata_irq ? ata_irq : -EINVAL ; }/* Prepare our private structure */ priv =devm_kzalloc (&op->dev,sizeof (*priv),GFP_ATOMIC );if (!priv) {dev_err (&op->dev,"error allocating private structure\n" ); - rv = -ENOMEM ; - goto err1; +return -ENOMEM ; } priv->ipb_period =1000000000 / (ipb_freq /1000 );
@@ -762,16 +761,14 @@ static int mpc52xx_ata_probe(struct platform_device *op) dmatsk =bcom_ata_init (MAX_DMA_BUFFERS ,MAX_DMA_BUFFER_SIZE );if (!dmatsk) {dev_err (&op->dev,"bestcomm initialization failed\n" ); - rv = -ENOMEM ; - goto err1; +return -ENOMEM ; } task_irq =bcom_get_task_irq (dmatsk); - rv =devm_request_irq (&op->dev, task_irq, &mpc52xx_ata_task_irq,0 , -"ATA task" , priv); + rv =request_irq (task_irq, &mpc52xx_ata_task_irq,0 ,"ATA task" , priv);if (rv) {dev_err (&op->dev,"error requesting DMA IRQ\n" ); - goto err2; + goto err1; } priv->dmatsk = dmatsk;
@@ -793,10 +790,10 @@ static int mpc52xx_ata_probe(struct platform_device *op)return 0 ; err2: -irq_dispose_mapping (task_irq); +free_irq (task_irq, priv); + err1:bcom_ata_release (dmatsk); err1: -irq_dispose_mapping (ata_irq);return rv; }
@@ -812,9 +809,8 @@ mpc52xx_ata_remove(struct platform_device *op)/* Clean up DMA */ task_irq =bcom_get_task_irq (priv->dmatsk); -irq_dispose_mapping (task_irq); +free_irq (task_irq, priv);bcom_ata_release (priv->dmatsk); -irq_dispose_mapping (priv->ata_irq);return 0 ; }
drivers/ata/sata_mv.c +4 -1
@@ -4081,7 +4081,10 @@ static int mv_platform_probe(struct platform_device *pdev)/* allocate host */ if (pdev->dev.of_node) {of_property_read_u32 (pdev->dev.of_node,"nr-ports" , &n_ports); - irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); + irq =devm_irq_of_parse_and_map (&pdev->dev, + pdev->dev.of_node,0 ); +if (irq <=0 ) +return -EINVAL ; }else { mv_platform_data =dev_get_platdata (&pdev->dev); n_ports = mv_platform_data->n_ports;
Signature · 1 line
1.7.10.4
PATCH 3/21 exynos5440-cpufreq: use devm_irq_of_parse_and_map()
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/cpufreq/exynos5440-cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/exynos5440-cpufreq.c +2 -2
@@ -353,8 +353,8 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) goto err_put_node; } - dvfs_info->irq =irq_of_parse_and_map (np,0 ); -if (!dvfs_info->irq) { + dvfs_info->irq =devm_irq_of_parse_and_map (dvfs_info->dev, np,0 ); +if (dvfs_info->irq <=0 ) {dev_err (dvfs_info->dev,"No cpufreq irq found\n" ); ret = -ENODEV ; goto err_put_node;
Signature · 1 line
1.7.10.4
PATCH 4/21 omap-sham: use devm_irq_of_parse_and_map()
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/crypto/omap-sham.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/omap-sham.c +2 -2
@@ -1830,8 +1830,8 @@ static int omap_sham_get_res_of(struct omap_sham_dev *dd, goto err; } - dd->irq =irq_of_parse_and_map (node,0 ); -if (!dd->irq) { + dd->irq =devm_irq_of_parse_and_map (dev, node,0 ); +if (dd->irq <=0 ) {dev_err (dev,"can't translate OF irq value\n" ); err = -EINVAL ; goto err;
Signature · 1 line
1.7.10.4
PATCH 5/21 dma: use devm_irq_of_parse_and_map() where appropriate
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/dma/moxart-dma.c | 4 ++-- drivers/dma/mpc512x_dma.c | 14 ++++---------- drivers/dma/mv_xor.c | 18 +++++++----------- drivers/dma/sirf-dma.c | 23 ++++++++--------------- 4 files changed, 21 insertions(+), 38 deletions(-)
drivers/dma/moxart-dma.c +2 -2
@@ -598,8 +598,8 @@ static int moxart_probe(struct platform_device *pdev)return -ENOMEM ; } - irq =irq_of_parse_and_map (node,0 ); -if (irq ==NO_IRQ ) { + irq =devm_irq_of_parse_and_map (dev, node,0 ); +if (irq <=0 ) {dev_err (dev,"no IRQ resource\n" );return -EINVAL ; }
drivers/dma/mpc512x_dma.c +4 -10
@@ -652,16 +652,16 @@ static int mpc_dma_probe(struct platform_device *op)return -ENOMEM ; } - mdma->irq =irq_of_parse_and_map (dn,0 ); -if (mdma->irq ==NO_IRQ ) { + mdma->irq =devm_irq_of_parse_and_map (dev, dn,0 ); +if (mdma->irq <=0 ) {dev_err (dev,"Error mapping IRQ!\n" );return -EINVAL ; }if (of_device_is_compatible (dn,"fsl,mpc8308-dma" )) { mdma->is_mpc8308 =1 ; - mdma->irq2 =irq_of_parse_and_map (dn,1 ); -if (mdma->irq2 ==NO_IRQ ) { + mdma->irq2 =devm_irq_of_parse_and_map (dev, dn,1 ); +if (mdma->irq2 <=0 ) {dev_err (dev,"Error mapping IRQ!\n" );return -EINVAL ; }
@@ -785,10 +785,6 @@ static int mpc_dma_probe(struct platform_device *op)/* Register DMA engine */ dev_set_drvdata (dev, mdma); retval =dma_async_device_register (dma); -if (retval) { -devm_free_irq (dev, mdma->irq, mdma); -irq_dispose_mapping (mdma->irq); - }return retval; }
@@ -799,8 +795,6 @@ static int mpc_dma_remove(struct platform_device *op)struct mpc_dma *mdma =dev_get_drvdata (dev);dma_async_device_unregister (&mdma->dma); -devm_free_irq (dev, mdma->irq, mdma); -irq_dispose_mapping (mdma->irq);return 0 ; }
drivers/dma/mv_xor.c +7 -11
@@ -1063,8 +1063,9 @@ mv_xor_channel_add(struct mv_xor_device *xordev,/* clear errors before enabling interrupts */ mv_xor_device_clear_err_status (mv_chan); - ret =request_irq (mv_chan->irq, mv_xor_interrupt_handler, -0 ,dev_name (&pdev->dev), mv_chan); + ret =devm_request_irq (&pdev->dev, mv_chan->irq, + mv_xor_interrupt_handler, +0 ,dev_name (&pdev->dev), mv_chan);if (ret) goto err_free_dma;
@@ -1085,14 +1086,14 @@ mv_xor_channel_add(struct mv_xor_device *xordev, ret =mv_xor_memcpy_self_test (mv_chan);dev_dbg (&pdev->dev,"memcpy self test returned %d\n" , ret);if (ret) - goto err_free_irq; + goto err_free_dma; }if (dma_has_cap (DMA_XOR , dma_dev->cap_mask)) { ret =mv_xor_xor_self_test (mv_chan);dev_dbg (&pdev->dev,"xor self test returned %d\n" , ret);if (ret) - goto err_free_irq; + goto err_free_dma; } dev_info(&pdev->dev, "Marvell XOR: ( %s%s%s)\n",
@@ -1103,8 +1104,6 @@ mv_xor_channel_add(struct mv_xor_device *xordev,dma_async_device_register (dma_dev);return mv_chan; -err_free_irq: -free_irq (mv_chan->irq, mv_chan); err_free_dma:dma_free_coherent (&pdev->dev,MV_XOR_POOL_SIZE , mv_chan->dma_desc_pool_virt, mv_chan->dma_desc_pool);
@@ -1209,8 +1208,8 @@ static int mv_xor_probe(struct platform_device *pdev)if (of_property_read_bool (np,"dmacap,interrupt" ))dma_cap_set (DMA_INTERRUPT , cap_mask); - irq =irq_of_parse_and_map (np,0 ); -if (!irq) { + irq =devm_irq_of_parse_and_map (&pdev->dev, np,0 ); +if (irq <=0 ) { ret = -ENODEV ; goto err_channel_add; }
@@ -1219,7 +1218,6 @@ static int mv_xor_probe(struct platform_device *pdev) cap_mask, irq);if (IS_ERR (chan)) { ret =PTR_ERR (chan); -irq_dispose_mapping (irq); goto err_channel_add; }
@@ -1261,8 +1259,6 @@ err_channel_add:for (i =0 ; i <MV_XOR_MAX_CHANNELS ; i++)if (xordev->channels[i]) {mv_xor_channel_remove (xordev->channels[i]); -if (pdev->dev.of_node) -irq_dispose_mapping (xordev->channels[i]->irq); }if (!IS_ERR (xordev->clk)) {
drivers/dma/sirf-dma.c +8 -15
@@ -698,8 +698,8 @@ static int sirfsoc_dma_probe(struct platform_device *op)return -ENODEV ; } - sdma->irq =irq_of_parse_and_map (dn,0 ); -if (sdma->irq ==NO_IRQ ) { + sdma->irq =devm_irq_of_parse_and_map (dev, dn,0 ); +if (sdma->irq <=0 ) {dev_err (dev,"Error mapping IRQ!\n" );return -EINVAL ; }
@@ -713,7 +713,7 @@ static int sirfsoc_dma_probe(struct platform_device *op) ret =of_address_to_resource (dn,0 , &res);if (ret) {dev_err (dev,"Error parsing memory region!\n" ); - goto irq_dispose; +return ret; } regs_start = res.start;
@@ -722,15 +722,14 @@ static int sirfsoc_dma_probe(struct platform_device *op) sdma->base =devm_ioremap (dev, regs_start, regs_size);if (!sdma->base) {dev_err (dev,"Error mapping memory region!\n" ); - ret = -ENOMEM ; - goto irq_dispose; +return -ENOMEM ; } - ret =request_irq (sdma->irq, &sirfsoc_dma_irq,0 ,DRV_NAME , sdma); + ret =devm_request_irq (dev, sdma->irq, &sirfsoc_dma_irq,0 ,DRV_NAME , + sdma);if (ret) {dev_err (dev,"Error requesting IRQ!\n" ); - ret = -EINVAL ; - goto irq_dispose; +return -EINVAL ; } dma = &sdma->dma;
@@ -775,7 +774,7 @@ static int sirfsoc_dma_probe(struct platform_device *op) ret =dma_async_device_register (dma);if (ret) - goto free_irq; +return ret;/* Device-tree DMA controller registration */ ret =of_dma_controller_register (dn, of_dma_sirfsoc_xlate, sdma);
@@ -791,10 +790,6 @@ static int sirfsoc_dma_probe(struct platform_device *op) unreg_dma_dev:dma_async_device_unregister (dma); -free_irq: -free_irq (sdma->irq, sdma); -irq_dispose: -irq_dispose_mapping (sdma->irq);return ret; }
@@ -805,8 +800,6 @@ static int sirfsoc_dma_remove(struct platform_device *op)of_dma_controller_free (op->dev.of_node);dma_async_device_unregister (&sdma->dma); -free_irq (sdma->irq, sdma); -irq_dispose_mapping (sdma->irq);pm_runtime_disable (&op->dev);if (!pm_runtime_status_suspended (&op->dev))sirfsoc_dma_runtime_suspend (&op->dev);
Signature · 1 line
1.7.10.4
PATCH 6/21 mpc85xx_edac: use devm_irq_of_parse_and_map()
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids calls to irq_dispose_mapping() while IRQ handler is still installed.
--- drivers/edac/mpc85xx_edac.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-)
drivers/edac/mpc85xx_edac.c +29 -12
@@ -354,7 +354,15 @@ int mpc85xx_pci_err_probe(struct platform_device *op) }if (edac_op_state ==EDAC_OPSTATE_INT ) { - pdata->irq =irq_of_parse_and_map (op->dev.of_node,0 ); + pdata->irq =devm_irq_of_parse_and_map (&op->dev, + op->dev.of_node,0 ); +if (pdata->irq <=0 ) { +printk (KERN_ERR +"%s: Unable to locate irq for MPC85xx PCI err\n" , + __func__); + res = -ENODEV ; + goto err2; + } res = devm_request_irq(&op->dev, pdata->irq, mpc85xx_pci_isr, IRQF_SHARED,
@@ -363,7 +371,6 @@ int mpc85xx_pci_err_probe(struct platform_device *op)printk (KERN_ERR "%s: Unable to request irq %d for " "MPC85xx PCI err\n" , __func__, pdata->irq); -irq_dispose_mapping (pdata->irq); res = -ENODEV ; goto err2; }
@@ -631,7 +638,15 @@ static int mpc85xx_l2_err_probe(struct platform_device *op) }if (edac_op_state ==EDAC_OPSTATE_INT ) { - pdata->irq =irq_of_parse_and_map (op->dev.of_node,0 ); + pdata->irq =devm_irq_of_parse_and_map (&op->dev, + op->dev.of_node,0 ); +if (pdata->irq <=0 ) { +printk (KERN_ERR +"%s: Unable to locate irq for MPC85xx L2 err\n" , + __func__); + res = -ENODEV ; + goto err2; + } res =devm_request_irq (&op->dev, pdata->irq, mpc85xx_l2_isr,0 ,"[EDAC] L2 err" , edac_dev);
@@ -639,7 +654,6 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)printk (KERN_ERR "%s: Unable to request irq %d for " "MPC85xx L2 err\n" , __func__, pdata->irq); -irq_dispose_mapping (pdata->irq); res = -ENODEV ; goto err2; }
@@ -674,10 +688,8 @@ static int mpc85xx_l2_err_remove(struct platform_device *op)edac_dbg (0 ,"\n" ); -if (edac_op_state ==EDAC_OPSTATE_INT ) { +if (edac_op_state ==EDAC_OPSTATE_INT )out_be32 (pdata->l2_vbase +MPC85XX_L2_ERRINTEN ,0 ); -irq_dispose_mapping (pdata->irq); - }out_be32 (pdata->l2_vbase +MPC85XX_L2_ERRDIS , orig_l2_err_disable);edac_device_del_device (&op->dev);
@@ -1130,7 +1142,15 @@ static int mpc85xx_mc_err_probe(struct platform_device *op)out_be32 (pdata->mc_vbase +MPC85XX_MC_ERR_SBE ,0x10000 );/* register interrupts */ - pdata->irq =irq_of_parse_and_map (op->dev.of_node,0 ); + pdata->irq =devm_irq_of_parse_and_map (&op->dev, + op->dev.of_node,0 ); +if (pdata->irq <=0 ) { +printk (KERN_ERR +"%s: Unable to locate irq for MPC85xx DRAM ERR\n" , + __func__); + res = -ENODEV ; + goto err2; + } res = devm_request_irq(&op->dev, pdata->irq, mpc85xx_mc_isr, IRQF_SHARED,
@@ -1138,7 +1158,6 @@ static int mpc85xx_mc_err_probe(struct platform_device *op)if (res <0 ) {printk (KERN_ERR "%s: Unable to request irq %d for " "MPC85xx DRAM ERR\n" , __func__, pdata->irq); -irq_dispose_mapping (pdata->irq); res = -ENODEV ; goto err2; }
@@ -1168,10 +1187,8 @@ static int mpc85xx_mc_err_remove(struct platform_device *op)edac_dbg (0 ,"\n" ); -if (edac_op_state ==EDAC_OPSTATE_INT ) { +if (edac_op_state ==EDAC_OPSTATE_INT )out_be32 (pdata->mc_vbase +MPC85XX_MC_ERR_INT_EN ,0 ); -irq_dispose_mapping (pdata->irq); - }out_be32 (pdata->mc_vbase +MPC85XX_MC_ERR_DISABLE , orig_ddr_err_disable);
Signature · 1 line
1.7.10.4
PATCH 7/21 gpio: use devm_irq_of_parse_and_map() where appropriate
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/gpio/gpio-adnp.c | 4 ++-- drivers/gpio/gpio-mcp23s08.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpio/gpio-adnp.c +2 -2
@@ -546,8 +546,8 @@ static int adnp_i2c_probe(struct i2c_client *client,if (err <0 )return err; - client->irq =irq_of_parse_and_map (np,0 ); -if (!client->irq) + client->irq =devm_irq_of_parse_and_map (&client->dev, np,0 ); +if (client->irq <=0 )return -EPROBE_DEFER ; adnp =devm_kzalloc (&client->dev,sizeof (*adnp),GFP_KERNEL );
drivers/gpio/gpio-mcp23s08.c +4 -1
@@ -779,7 +779,10 @@ static int mcp230xx_probe(struct i2c_client *client,if (match || !pdata) { base =-1 ; pullups =0 ; - client->irq =irq_of_parse_and_map (client->dev.of_node,0 ); + client->irq =devm_irq_of_parse_and_map (&client->dev, + client->dev.of_node,0 ); +if (client->irq <0 ) +return client->irq; }else {if (!gpio_is_valid (pdata->base)) {dev_dbg (&client->dev,"invalid platform data\n" );
Signature · 1 line
1.7.10.4
PATCH 8/21 i2c: use devm_irq_of_parse_and_map() where appropriate
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/i2c/busses/i2c-mpc.c | 12 ++++-------- drivers/i2c/busses/i2c-mv64xxx.c | 2 +- drivers/i2c/busses/i2c-st.c | 6 +++--- drivers/i2c/busses/i2c-wmt.c | 6 +++--- 4 files changed, 11 insertions(+), 15 deletions(-)
drivers/i2c/busses/i2c-mpc.c +4 -8
@@ -647,9 +647,11 @@ static int fsl_i2c_probe(struct platform_device *op) goto fail_map; } - i2c->irq =irq_of_parse_and_map (op->dev.of_node,0 ); + i2c->irq =devm_irq_of_parse_and_map (&op->dev, op->dev.of_node,0 ); +if (i2c->irq <0 ) +return i2c->irq;if (i2c->irq) {/* no i2c->irq implies polling */ - result =request_irq (i2c->irq, mpc_i2c_isr, + result =devm_request_irq (&op->dev, i2c->irq, mpc_i2c_isr,IRQF_SHARED ,"i2c-mpc" , i2c);if (result <0 ) {dev_err (i2c->dev,"failed to attach interrupt\n" );
@@ -719,9 +721,7 @@ static int fsl_i2c_probe(struct platform_device *op) fail_add:if (i2c->clk_per)clk_disable_unprepare (i2c->clk_per); -free_irq (i2c->irq, i2c); fail_request: -irq_dispose_mapping (i2c->irq);iounmap (i2c->base); fail_map:kfree (i2c);
@@ -737,10 +737,6 @@ static int fsl_i2c_remove(struct platform_device *op)if (i2c->clk_per)clk_disable_unprepare (i2c->clk_per); -if (i2c->irq) -free_irq (i2c->irq, i2c); - -irq_dispose_mapping (i2c->irq);iounmap (i2c->base);kfree (i2c);return 0 ;
drivers/i2c/busses/i2c-mv64xxx.c +1 -1
@@ -755,7 +755,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, rc = -EINVAL ; goto out; } - drv_data->irq =irq_of_parse_and_map (np,0 ); + drv_data->irq =devm_irq_of_parse_and_map (dev, np,0 ); drv_data->rstc =devm_reset_control_get_optional (dev,NULL );if (IS_ERR (drv_data->rstc)) {
drivers/i2c/busses/i2c-st.c +3 -3
@@ -778,10 +778,10 @@ static int st_i2c_probe(struct platform_device *pdev)if (IS_ERR (i2c_dev->base))return PTR_ERR (i2c_dev->base); - i2c_dev->irq =irq_of_parse_and_map (np,0 ); -if (!i2c_dev->irq) { + i2c_dev->irq =devm_irq_of_parse_and_map (&pdev->dev, np,0 ); +if (i2c_dev->irq <=0 ) {dev_err (&pdev->dev,"IRQ missing or invalid\n" ); -return -EINVAL ; +return i2c_dev->irq ? i2c_dev->irq : -EINVAL ; } i2c_dev->clk =of_clk_get_by_name (np,"ssc" );
drivers/i2c/busses/i2c-wmt.c +3 -3
@@ -389,10 +389,10 @@ static int wmt_i2c_probe(struct platform_device *pdev)if (IS_ERR (i2c_dev->base))return PTR_ERR (i2c_dev->base); - i2c_dev->irq =irq_of_parse_and_map (np,0 ); -if (!i2c_dev->irq) { + i2c_dev->irq =devm_irq_of_parse_and_map (&pdev->dev, np,0 ); +if (i2c_dev->irq <=0 ) {dev_err (&pdev->dev,"irq missing or invalid\n" ); -return -EINVAL ; +return i2c_dev->irq ? i2c_dev->irq : -EINVAL ; } i2c_dev->clk =of_clk_get (np,0 );
Signature · 1 line
1.7.10.4
PATCH 9/21 apbps2: use devm_irq_of_parse_and_map()
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/input/serio/apbps2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/input/serio/apbps2.c +5 -1
@@ -155,7 +155,11 @@ static int apbps2_of_probe(struct platform_device *ofdev)iowrite32be (0 , &priv->regs->ctrl);/* IRQ */ - irq =irq_of_parse_and_map (ofdev->dev.of_node,0 ); + irq =devm_irq_of_parse_and_map (&ofdev->dev, ofdev->dev.of_node,0 ); +if (irq <=0 ) { +dev_err (&ofdev->dev,"unable to locate IRQ\n" ); +return irq ? irq : -EINVAL ; + } err =devm_request_irq (&ofdev->dev, irq, apbps2_isr,IRQF_SHARED ,"apbps2" , priv);if (err) {
Signature · 1 line
1.7.10.4
PATCH 10/21 media: use devm_irq_of_parse_and_map() where appropriate
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/media/platform/exynos4-is/fimc-is.c | 14 ++++++-------- drivers/media/platform/fsl-viu.c | 25 +++++++++---------------- 2 files changed, 15 insertions(+), 24 deletions(-)
drivers/media/platform/exynos4-is/fimc-is.c +6 -8
@@ -810,10 +810,10 @@ static int fimc_is_probe(struct platform_device *pdev)if (!is->pmu_regs)return -ENOMEM ; - is->irq =irq_of_parse_and_map (dev->of_node,0 ); -if (is->irq <0 ) { + is->irq =devm_irq_of_parse_and_map (dev, dev->of_node,0 ); +if (is->irq <=0 ) {dev_err (dev,"no irq found\n" ); -return is->irq; +return is->irq ? is->irq : -EINVAL ; } ret =fimc_is_get_clocks (is);
@@ -822,7 +822,8 @@ static int fimc_is_probe(struct platform_device *pdev)platform_set_drvdata (pdev, is); - ret =request_irq (is->irq, fimc_is_irq_handler,0 ,dev_name (dev), is); + ret =devm_request_irq (dev, is->irq, fimc_is_irq_handler,0 , +dev_name (dev), is);if (ret <0 ) {dev_err (dev,"irq request failed\n" ); goto err_clk;
@@ -832,7 +833,7 @@ static int fimc_is_probe(struct platform_device *pdev)if (!pm_runtime_enabled (dev)) { ret =fimc_is_runtime_resume (dev);if (ret <0 ) - goto err_irq; + goto err_clk; } ret =pm_runtime_get_sync (dev);
@@ -874,8 +875,6 @@ err_vb: err_pm:if (!pm_runtime_enabled (dev))fimc_is_runtime_suspend (dev); -err_irq: -free_irq (is->irq, is); err_clk:fimc_is_put_clocks (is);return ret;
@@ -929,7 +928,6 @@ static int fimc_is_remove(struct platform_device *pdev)pm_runtime_set_suspended (dev);if (!pm_runtime_status_suspended (dev))fimc_is_runtime_suspend (dev); -free_irq (is->irq, is);fimc_is_unregister_subdevs (is);vb2_dma_contig_cleanup_ctx (is->alloc_ctx);fimc_is_put_clocks (is);
drivers/media/platform/fsl-viu.c +9 -16
@@ -1495,34 +1495,31 @@ static int viu_of_probe(struct platform_device *op)return -ENODEV ; } - viu_irq =irq_of_parse_and_map (op->dev.of_node,0 ); -if (viu_irq ==NO_IRQ ) { + viu_irq =devm_irq_of_parse_and_map (&op->dev, op->dev.of_node,0 ); +if (viu_irq <=0 ) {dev_err (&op->dev,"Error while mapping the irq\n" ); -return -EINVAL ; +return viu_irq ? viu_irq : -EINVAL ; }/* request mem region */ if (!devm_request_mem_region (&op->dev, r.start,sizeof (struct viu_reg ),DRV_NAME )) {dev_err (&op->dev,"Error while requesting mem region\n" ); - ret = -EBUSY ; - goto err; +return -EBUSY ; }/* remap registers */ viu_regs =devm_ioremap (&op->dev, r.start,sizeof (struct viu_reg ));if (!viu_regs) {dev_err (&op->dev,"Can't map register set\n" ); - ret = -ENOMEM ; - goto err; +return -ENOMEM ; }/* Prepare our private structure */ viu_dev =devm_kzalloc (&op->dev,sizeof (struct viu_dev ),GFP_ATOMIC );if (!viu_dev) {dev_err (&op->dev,"Can't allocate private structure\n" ); - ret = -ENOMEM ; - goto err; +return -ENOMEM ; } viu_dev->vr = viu_regs;
@@ -1538,7 +1535,7 @@ static int viu_of_probe(struct platform_device *op) ret =v4l2_device_register (viu_dev->dev, &viu_dev->v4l2_dev);if (ret <0 ) {dev_err (&op->dev,"v4l2_device_register() failed: %d\n" , ret); - goto err; +return ret; } ad =i2c_get_adapter (0 );
@@ -1597,7 +1594,8 @@ static int viu_of_probe(struct platform_device *op)viu_reset (viu_dev->vr);/* install interrupt handler */ -if (request_irq (viu_dev->irq, viu_intr,0 ,"viu" , (void *)viu_dev)) { +if (devm_request_irq (&op->dev, viu_dev->irq, viu_intr,0 ,"viu" , + (void *)viu_dev)) {dev_err (&op->dev,"Request VIU IRQ failed.\n" ); ret = -ENODEV ; goto err_irq;
@@ -1616,8 +1614,6 @@ err_vdev:mutex_unlock (&viu_dev->lock);i2c_put_adapter (ad);v4l2_device_unregister (&viu_dev->v4l2_dev); -err: -irq_dispose_mapping (viu_irq);return ret; }
@@ -1629,9 +1625,6 @@ static int viu_of_remove(struct platform_device *op) struct v4l2_subdev, list);struct i2c_client *client =v4l2_get_subdevdata (sdev); -free_irq (dev->irq, (void *)dev); -irq_dispose_mapping (dev->irq); -clk_disable_unprepare (dev->clk);video_unregister_device (dev->vdev);
Signature · 1 line
1.7.10.4
PATCH 11/21 mfd: use devm_irq_of_parse_and_map() where appropriate
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/mfd/max8997.c | 4 +++- drivers/mfd/max8998.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/mfd/max8997.c +3 -1
@@ -153,7 +153,9 @@ static struct max8997_platform_data *max8997_i2c_parse_dt_pdata(return ERR_PTR (-ENOMEM ); } - pd->ono =irq_of_parse_and_map (dev->of_node,1 ); + pd->ono =devm_irq_of_parse_and_map (dev, dev->of_node,1 ); +if (pd->ono <0 ) +return ERR_PTR (pd->ono);/* * ToDo: the 'wakeup' member in the platform data is more of a linux
drivers/mfd/max8998.c +3 -1
@@ -159,7 +159,9 @@ static struct max8998_platform_data *max8998_i2c_parse_dt_pdata(if (!pd)return ERR_PTR (-ENOMEM ); - pd->ono =irq_of_parse_and_map (dev->of_node,1 ); + pd->ono =devm_irq_of_parse_and_map (dev, dev->of_node,1 ); +if (pd->ono <0 ) +return ERR_PTR (pd->ono);/* * ToDo: the 'wakeup' member in the platform data is more of a linux
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Lee Jones
AppliedRe: [PATCH 11/21] mfd: use devm_irq_of_parse_and_map() where appropriate
Quoted 11 lines
From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use
devm_request_irq()without facing unmap-while-handler-installed issues.Signed-off-by Nikita Yushchenko <[email protected]>--- drivers/mfd/max8997.c | 4 +++- drivers/mfd/max8998.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
Applied, thanks.
Quoted 30 lines
drivers/mfd/max8997.c +3
-1@@ -153,7 +153,9 @@ static struct max8997_platform_data *max8997_i2c_parse_dt_pdata(return ERR_PTR (-ENOMEM ); } - pd->ono =irq_of_parse_and_map (dev->of_node,1 ); + pd->ono =devm_irq_of_parse_and_map (dev, dev->of_node,1 ); +if (pd->ono <0 ) +return ERR_PTR (pd->ono);/* * ToDo: the 'wakeup' member in the platform data is more of a linux drivers/mfd/max8998.c +3
-1@@ -159,7 +159,9 @@ static struct max8998_platform_data *max8998_i2c_parse_dt_pdata(if (!pd)return ERR_PTR (-ENOMEM ); - pd->ono =irq_of_parse_and_map (dev->of_node,1 ); + pd->ono =devm_irq_of_parse_and_map (dev, dev->of_node,1 ); +if (pd->ono <0 ) +return ERR_PTR (pd->ono);/* * ToDo: the 'wakeup' member in the platform data is more of a linux
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 11/21] mfd: use devm_irq_of_parse_and_map() where appropriate
17.06.2014 19:12, Lee Jones пишет:
Quoted 6 lines
Quoted 6 lines
From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use
devm_request_irq()without facing unmap-while-handler-installed issues.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Nikita Yushchenko <[email protected]>--- drivers/mfd/max8997.c | 4 +++- drivers/mfd/max8998.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)Applied, thanks.
Hmm... probably it was too early to apply this? I was just going to prepare v2, based on discussion...
Also, applying only 11/21, without 01/21, will just cause build errors ...
Confused.
Nikita
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 11/21] mfd: use devm_irq_of_parse_and_map() where appropriate
Quoted 13 lines · Nikita Yushchenko
17.06.2014 19:12, Lee Jones пишет:
Quoted 12 lines
Quoted 11 lines
From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use
devm_request_irq()without facing unmap-while-handler-installed issues.Signed-off-by Nikita Yushchenko <[email protected]>--- drivers/mfd/max8997.c | 4 +++- drivers/mfd/max8998.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
Quoted 4 lines
Quoted 1 line
Applied, thanks.
Hmm... probably it was too early to apply this? I was just going to prepare v2, based on discussion...
Which discussion?
Quoted 1 line
Also, applying only 11/21, without 01/21, will just cause build errors ...
CC'ing me on this patch alone when you know you have build dependencies on other patches in the set is a bad idea. Failing to mention that you wanted the patch to be handled in a special and/or unconventional way is an even worse idea.
How are you expecting this patch(-set) to be handled?
Quoted 1 line
Confused.
Likewise!
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 11/21] mfd: use devm_irq_of_parse_and_map() where appropriate
Quoted 4 lines
Quoted 2 lines
Hmm... probably it was too early to apply this? I was just going to prepare v2, based on discussion...
Which discussion?
One you are replying in?
https://lkml.org/lkml/2014/6/4/136
Quoted 8 lines
Quoted 1 line
Also, applying only 11/21, without 01/21, will just cause build errors ...
CC'ing me on this patch alone when you know you have build dependencies on other patches in the set is a bad idea. Failing to mention that you wanted the patch to be handled in a special and/or unconventional way is an even worse idea.
How are you expecting this patch(-set) to be handled?
Sorry but I did not CC you this patch.
I sent entire patchset to mailing lists and to maintainers of IRQ and device tree subsystems.
I used git send-email, and all mails went out to the same recipients.
Recipient addresses extracted using scripts/get_maintainer.pl applied to the "main" patch of the patchset.
I did not sent entire patchset to maintainers of individual changed drivers because this makes recipient address too big and too much looks like spamming. I did not send individual patches to individual addresses to avoid cases of partially-applied patchset that will just break things (actually this is what happened with 11/21)
I'm quite sorry if I did things wrong, it was my first attempt to sent patchset with tree-wide fixes. However, I don't see what I've done wrong... any hints on that will be appreciated.
Nikita
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 11/21] mfd: use devm_irq_of_parse_and_map() where appropriate
Quoted 8 lines · Nikita Yushchenko
Quoted 4 lines
Quoted 2 lines
Hmm... probably it was too early to apply this? I was just going to prepare v2, based on discussion...
Which discussion?
One you are replying in?
I only see what's in my mailbox. If you didn't send me any other patches, which were subsequently commented on, I wouldn't have seen said comments/discussion.
Quoted 23 lines
Quoted 8 lines
Quoted 1 line
Also, applying only 11/21, without 01/21, will just cause build errors ...
CC'ing me on this patch alone when you know you have build dependencies on other patches in the set is a bad idea. Failing to mention that you wanted the patch to be handled in a special and/or unconventional way is an even worse idea.
How are you expecting this patch(-set) to be handled?
Sorry but I did not CC you this patch.
I sent entire patchset to mailing lists and to maintainers of IRQ and device tree subsystems.
I used git send-email, and all mails went out to the same recipients. Recipient addresses extracted usingscripts/get_maintainer.plapplied to the "main" patch of the patchset.
I did not sent entire patchset to maintainers of individual changed drivers because this makes recipient address too big and too much looks like spamming.
I did not send individual patches to individual addresses to avoid cases of partially-applied patchset that will just break things (actually this is what happened with 11/21)
Quoted 3 lines
I'm quite sorry if I did things wrong, it was my first attempt to sent patchset with tree-wide fixes. However, I don't see what I've done wrong... any hints on that will be appreciated.
This is quite tricky due to the size of the set and the number of subsystems it touches. The optimum method is to have the smallest patch-set and touch only the very least amount of subsystems as possible. This is almost always feasible, however in the small cases that it's not, the alternative is to let the maintainers know what your plans are i.e. if you're only looking for Acks and that you (or another maintainer) will send out a pull-request to all of the other maintainers to suck into their trees. This is required to prevent conflicts during the merge-window. If you want to send such messages to all of the parties without spamming them with the rest of the set, you can do so in the commit message (which you can then keep in Git for subsequent revisions).
For example:
Quoted 21 lines
From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use
devm_request_irq()without facing unmap-while-handler-installed issues.Signed-off-by Nikita Yushchenko <[email protected]>---
My intention is to take this entire set through the <SUBSYSTEM> tree. To facilitate this I'm collecting maintainer Acks. Once applied to the <SUBSYSTEM> tree a pull-request will be sent out in order to avoid merge conflicts at pull-time.--- drivers/mfd/max8997.c | 4 +++- drivers/mfd/max8998.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)drivers/mfd/max8997.c +0
-0
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH 12/21 mpc5121_nfc: use devm_irq_of_parse_and_map()
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/mtd/nand/mpc5121_nfc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/mpc5121_nfc.c +3 -3
@@ -669,10 +669,10 @@ static int mpc5121_nfc_probe(struct platform_device *op)return retval; } - prv->irq =irq_of_parse_and_map (dn,0 ); -if (prv->irq ==NO_IRQ ) { + prv->irq =devm_irq_of_parse_and_map (dev, dn,0 ); +if (prv->irq <=0 ) {dev_err (dev,"Error mapping IRQ!\n" ); -return -EINVAL ; +return prv->irq ? prv->irq : -EINVAL ; } retval =of_address_to_resource (dn,0 , &res);
Signature · 1 line
1.7.10.4
PATCH 13/21 net/can: use devm_irq_of_parse_and_map() where appropriate
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/net/can/grcan.c | 11 ++++------- drivers/net/can/mscan/mpc5xxx_can.c | 11 ++++------- drivers/net/can/sja1000/sja1000_platform.c | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-)
drivers/net/can/grcan.c +4 -7
@@ -1687,10 +1687,10 @@ static int grcan_probe(struct platform_device *ofdev) goto exit_error; } - irq =irq_of_parse_and_map (np,GRCAN_IRQIX_IRQ ); -if (!irq) { + irq =devm_irq_of_parse_and_map (&ofdev->dev, np,GRCAN_IRQIX_IRQ ); +if (irq <=0 ) {dev_err (&ofdev->dev,"no irq found\n" ); - err = -ENODEV ; + err = irq ? irq : -ENODEV ; goto exit_error; }
@@ -1698,12 +1698,10 @@ static int grcan_probe(struct platform_device *ofdev) err =grcan_setup_netdev (ofdev, base, irq, ambafreq, txbug);if (err) - goto exit_dispose_irq; + goto exit_error;return 0 ; -exit_dispose_irq: -irq_dispose_mapping (irq); exit_error: dev_err(&ofdev->dev, "%s socket CAN driver initialization failed with error %d\n",
@@ -1718,7 +1716,6 @@ static int grcan_remove(struct platform_device *ofdev)unregister_candev (dev);/* Will in turn call grcan_close */ -irq_dispose_mapping (dev->irq);netif_napi_del (&priv->napi);free_candev (dev);
drivers/net/can/mscan/mpc5xxx_can.c +4 -7
@@ -306,16 +306,16 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)return err; } - irq =irq_of_parse_and_map (np,0 ); -if (!irq) { + irq =devm_irq_of_parse_and_map (&ofdev->dev, np,0 ); +if (irq <=0 ) {dev_err (&ofdev->dev,"no irq found\n" ); - err = -ENODEV ; + err = irq ? irq : -ENODEV ; goto exit_unmap_mem; } dev =alloc_mscandev ();if (!dev) - goto exit_dispose_irq; + goto exit_unmap_mem;platform_set_drvdata (ofdev, dev);SET_NETDEV_DEV (dev, &ofdev->dev);
@@ -348,8 +348,6 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev) exit_free_mscan:free_candev (dev); -exit_dispose_irq: -irq_dispose_mapping (irq); exit_unmap_mem:iounmap (base);
@@ -370,7 +368,6 @@ static int mpc5xxx_can_remove(struct platform_device *ofdev)if (data && data->put_clock) data->put_clock (ofdev);iounmap (priv->reg_base); -irq_dispose_mapping (dev->irq);free_candev (dev);return 0 ;
drivers/net/can/sja1000/sja1000_platform.c +1 -1
@@ -184,7 +184,7 @@ static int sp_probe(struct platform_device *pdev)return -ENOMEM ;if (of) - irq =irq_of_parse_and_map (of,0 ); + irq =devm_irq_of_parse_and_map (&pdev->dev, of,0 );else res_irq =platform_get_resource (pdev,IORESOURCE_IRQ ,0 );
Signature · 1 line
1.7.10.4
PATCH 14/21 net/ethernet: use devm_irq_of_parse_and_map() where appropriate
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/net/ethernet/allwinner/sun4i-emac.c | 6 ++--- drivers/net/ethernet/arc/emac_main.c | 6 ++--- drivers/net/ethernet/marvell/mvneta.c | 15 +++++------- drivers/net/ethernet/moxa/moxart_ether.c | 4 ++-- .../net/ethernet/samsung/sxgbe/sxgbe_platform.c | 24 ++++++++------------ 5 files changed, 23 insertions(+), 32 deletions(-)
drivers/net/ethernet/allwinner/sun4i-emac.c +3 -3
@@ -839,10 +839,10 @@ static int emac_probe(struct platform_device *pdev)/* fill in parameters for net-dev structure */ ndev->base_addr = (unsigned long )db->membase; - ndev->irq =irq_of_parse_and_map (np,0 ); -if (ndev->irq == -ENXIO ) { + ndev->irq =devm_irq_of_parse_and_map (&pdev->dev, np,0 ); +if (ndev->irq <=0 ) {netdev_err (ndev,"No irq resource\n" ); - ret = ndev->irq; + ret = ndev->irq ? ndev->irq : -EINVAL ; goto out; }
drivers/net/ethernet/arc/emac_main.c +3 -3
@@ -650,10 +650,10 @@ static int arc_emac_probe(struct platform_device *pdev) }/* Get IRQ from device tree */ - irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); -if (!irq) { + irq =devm_irq_of_parse_and_map (&pdev->dev, pdev->dev.of_node,0 ); +if (irq <=0 ) {dev_err (&pdev->dev,"failed to retrieve <irq> value from device tree\n" ); -return -ENODEV ; +return irq ? irq : -ENODEV ; } ndev =alloc_etherdev (sizeof (struct arc_emac_priv ));
drivers/net/ethernet/marvell/mvneta.c +6 -9
@@ -2789,9 +2789,9 @@ static int mvneta_probe(struct platform_device *pdev)if (!dev)return -ENOMEM ; - dev->irq =irq_of_parse_and_map (dn,0 ); -if (dev->irq ==0 ) { - err = -EINVAL ; + dev->irq =devm_irq_of_parse_and_map (&pdev->dev, dn,0 ); +if (dev->irq <=0 ) { + err = dev->irq ? dev->irq : -EINVAL ; goto err_free_netdev; }
@@ -2799,14 +2799,14 @@ static int mvneta_probe(struct platform_device *pdev)if (!phy_node) {dev_err (&pdev->dev,"no associated PHY\n" ); err = -ENODEV ; - goto err_free_irq; + goto err_free_netdev; } phy_mode =of_get_phy_mode (dn);if (phy_mode <0 ) {dev_err (&pdev->dev,"incorrect phy-mode\n" ); err = -EINVAL ; - goto err_free_irq; + goto err_free_netdev; } dev->tx_queue_len =MVNETA_MAX_TXD ;
@@ -2824,7 +2824,7 @@ static int mvneta_probe(struct platform_device *pdev) pp->clk =devm_clk_get (&pdev->dev,NULL );if (IS_ERR (pp->clk)) { err =PTR_ERR (pp->clk); - goto err_free_irq; + goto err_free_netdev; }clk_prepare_enable (pp->clk);
@@ -2906,8 +2906,6 @@ err_free_stats:free_percpu (pp->stats); err_clk:clk_disable_unprepare (pp->clk); -err_free_irq: -irq_dispose_mapping (dev->irq); err_free_netdev:free_netdev (dev);return err;
@@ -2923,7 +2921,6 @@ static int mvneta_remove(struct platform_device *pdev)mvneta_deinit (pp);clk_disable_unprepare (pp->clk);free_percpu (pp->stats); -irq_dispose_mapping (dev->irq);free_netdev (dev);return 0 ;
drivers/net/ethernet/moxa/moxart_ether.c +2 -2
@@ -443,10 +443,10 @@ static int moxart_mac_probe(struct platform_device *pdev)if (!ndev)return -ENOMEM ; - irq =irq_of_parse_and_map (node,0 ); + irq =devm_irq_of_parse_and_map (p_dev, node,0 );if (irq <=0 ) {netdev_err (ndev,"irq_of_parse_and_map failed\n" ); - ret = -EINVAL ; + ret = irq ? irq : -EINVAL ; goto irq_map_fail; }
drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c +9 -15
@@ -122,7 +122,7 @@ static int sxgbe_platform_probe(struct platform_device *pdev) }/* Get the SXGBE common INT information */ - priv->irq =irq_of_parse_and_map (node,0 ); + priv->irq =devm_irq_of_parse_and_map (dev, node,0 );if (priv->irq <=0 ) {dev_err (dev,"sxgbe common irq parsing failed\n" ); goto err_drv_remove;
@@ -130,25 +130,27 @@ static int sxgbe_platform_probe(struct platform_device *pdev)/* Get the TX/RX IRQ numbers */ for (i =0 , chan =1 ; i <SXGBE_TX_QUEUES ; i++) { - priv->txq[i]->irq_no =irq_of_parse_and_map (node, chan++); + priv->txq[i]->irq_no =devm_irq_of_parse_and_map (dev, + node, chan++);if (priv->txq[i]->irq_no <=0 ) {dev_err (dev,"sxgbe tx irq parsing failed\n" ); - goto err_tx_irq_unmap; + goto err_drv_remove; } }for (i =0 ; i <SXGBE_RX_QUEUES ; i++) { - priv->rxq[i]->irq_no =irq_of_parse_and_map (node, chan++); + priv->rxq[i]->irq_no =devm_irq_of_parse_and_map (dev, + node, chan++);if (priv->rxq[i]->irq_no <=0 ) {dev_err (dev,"sxgbe rx irq parsing failed\n" ); - goto err_rx_irq_unmap; + goto err_drv_remove; } } - priv->lpi_irq =irq_of_parse_and_map (node, chan); + priv->lpi_irq =devm_irq_of_parse_and_map (dev, node, chan);if (priv->lpi_irq <=0 ) {dev_err (dev,"sxgbe lpi irq parsing failed\n" ); - goto err_rx_irq_unmap; + goto err_drv_remove; }platform_set_drvdata (pdev, priv->dev);
@@ -157,14 +159,6 @@ static int sxgbe_platform_probe(struct platform_device *pdev)return 0 ; -err_rx_irq_unmap: -while (--i) -irq_dispose_mapping (priv->rxq[i]->irq_no); - i =SXGBE_TX_QUEUES ; -err_tx_irq_unmap: -while (--i) -irq_dispose_mapping (priv->txq[i]->irq_no); -irq_dispose_mapping (priv->irq); err_drv_remove:sxgbe_drv_remove (ndev); err_out:
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 15/21 pinctrl: use devm_irq_of_parse_and_map() where appropriate
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/pinctrl/pinctrl-bcm2835.c | 6 +++++- drivers/pinctrl/pinctrl-exynos.c | 11 ++++++----- drivers/pinctrl/pinctrl-exynos5440.c | 2 +- drivers/pinctrl/pinctrl-rockchip.c | 6 +++++- drivers/pinctrl/pinctrl-s3c24xx.c | 6 +++--- drivers/pinctrl/pinctrl-s3c64xx.c | 6 +++--- drivers/pinctrl/pinctrl-single.c | 6 +++++- drivers/pinctrl/pinctrl-sunxi.c | 6 +++--- 8 files changed, 31 insertions(+), 18 deletions(-)
drivers/pinctrl/pinctrl-bcm2835.c +5 -1
@@ -1012,7 +1012,11 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)for_each_set_bit (offset, &events,32 )bcm2835_gpio_wr (pc,GPEDS0 + i *4 ,BIT (offset)); - pc->irq[i] =irq_of_parse_and_map (np, i); + pc->irq[i] =devm_irq_of_parse_and_map (dev, np, i); +if (pc->irq[i] <=0 ) { +dev_err (dev,"unable to locate IRQ for bank %d\n" , i); +return pc->irq[i] ? pc->irq[i] : -EINVAL ; + } pc->irq_data[i].pc = pc; pc->irq_data[i].bank = i;spin_lock_init (&pc->irq_lock[i]);
drivers/pinctrl/pinctrl-exynos.c +6 -5
@@ -549,8 +549,9 @@ static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) }for (idx =0 ; idx < bank->nr_pins; ++idx) { - irq =irq_of_parse_and_map (bank->of_node, idx); -if (!irq) { + irq =devm_irq_of_parse_and_map (dev, bank->of_node, + idx); +if (irq <=0 ) {dev_err (dev,"irq number for eint-%s-%d not found\n" , bank->name, idx);continue ;
@@ -565,10 +566,10 @@ static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)if (!muxed_banks)return 0 ; - irq =irq_of_parse_and_map (wkup_np,0 ); -if (!irq) { + irq =devm_irq_of_parse_and_map (dev, wkup_np,0 ); +if (irq <=0 ) {dev_err (dev,"irq number for muxed EINTs not found\n" ); -return 0 ; +return irq ? irq : -EINVAL ; } muxed_data = devm_kzalloc(dev, sizeof(*muxed_data)
drivers/pinctrl/pinctrl-exynos5440.c +1 -1
@@ -966,7 +966,7 @@ static int exynos5440_gpio_irq_init(struct platform_device *pdev, }for (i =0 ; i <EXYNOS5440_MAX_GPIO_INT ; i++) { - irq =irq_of_parse_and_map (dev->of_node, i); + irq =devm_irq_of_parse_and_map (dev, dev->of_node, i);if (irq <=0 ) {dev_err (dev,"irq parsing failed\n" );return -EINVAL ;
drivers/pinctrl/pinctrl-rockchip.c +5 -1
@@ -1398,7 +1398,11 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank, bank->bank_type =COMMON_BANK ; } - bank->irq =irq_of_parse_and_map (bank->of_node,0 ); + bank->irq =devm_irq_of_parse_and_map (dev, bank->of_node,0 ); +if (bank->irq <0 ) { +dev_err (dev,"cannot find IRQ for bank\n" ); +return bank->irq; + } bank->clk =of_clk_get (bank->of_node,0 );if (IS_ERR (bank->clk))
drivers/pinctrl/pinctrl-s3c24xx.c +3 -3
@@ -507,10 +507,10 @@ static int s3c24xx_eint_init(struct samsung_pinctrl_drv_data *d)for (i =0 ; i <NUM_EINT_IRQ ; ++i) {unsigned int irq; - irq =irq_of_parse_and_map (eint_np, i); -if (!irq) { + irq =devm_irq_of_parse_and_map (dev, eint_np, i); +if (irq <=0 ) {dev_err (dev,"failed to get wakeup EINT IRQ %d\n" , i); -return -ENXIO ; +return irq ? irq : -ENXIO ; } eint_data->parents[i] = irq;
drivers/pinctrl/pinctrl-s3c64xx.c +3 -3
@@ -725,10 +725,10 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d)for (i =0 ; i <NUM_EINT0_IRQ ; ++i) {unsigned int irq; - irq =irq_of_parse_and_map (eint0_np, i); -if (!irq) { + irq =devm_irq_of_parse_and_map (dev, eint0_np, i); +if (irq <=0 ) {dev_err (dev,"failed to get wakeup EINT IRQ %d\n" , i); -return -ENXIO ; +return irq ? irq : -ENXIO ; }irq_set_chained_handler (irq, s3c64xx_eint0_handlers[i]);
drivers/pinctrl/pinctrl-single.c +5 -1
@@ -1988,7 +1988,11 @@ static int pcs_probe(struct platform_device *pdev)if (ret <0 ) goto free; - pcs->socdata.irq =irq_of_parse_and_map (np,0 ); + pcs->socdata.irq =devm_irq_of_parse_and_map (&pdev->dev, np,0 ); +if (pcs->socdata.irq <0 ) { + ret = pcs->socdata.irq; + goto free; + }if (pcs->socdata.irq) pcs->flags |=PCS_FEAT_IRQ ;
drivers/pinctrl/pinctrl-sunxi.c +3 -3
@@ -886,9 +886,9 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)clk_prepare_enable (clk); - pctl->irq =irq_of_parse_and_map (node,0 ); -if (!pctl->irq) { - ret = -EINVAL ; + pctl->irq =devm_irq_of_parse_and_map (&pdev->dev, node,0 ); +if (pctl->irq <=0 ) { + ret = pctl->irq ? pctl->irq : -EINVAL ; goto gpiochip_error; }
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 16/21 bq24190_charger: use devm_irq_of_parse_and_map()
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/power/bq24190_charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/bq24190_charger.c +1 -1
@@ -1315,7 +1315,7 @@ out:#ifdef CONFIG_OF static int bq24190_setup_dt (struct bq24190_dev_info *bdi) { - bdi->irq =irq_of_parse_and_map (bdi->dev->of_node,0 ); + bdi->irq =devm_irq_of_parse_and_map (bdi->dev, bdi->dev->of_node,0 );if (bdi->irq <=0 )return -1 ;
Signature · 1 line
1.7.10.4
PATCH 17/21 rtc-mpc5121: use devm_irq_of_parse_and_map()
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/rtc/rtc-mpc5121.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-)
drivers/rtc/rtc-mpc5121.c +20 -18
@@ -328,22 +328,34 @@ static int mpc5121_rtc_probe(struct platform_device *op)platform_set_drvdata (op, rtc); - rtc->irq =irq_of_parse_and_map (op->dev.of_node,1 ); - err =request_irq (rtc->irq, mpc5121_rtc_handler,0 , + rtc->irq =devm_irq_of_parse_and_map (&op->dev, op->dev.of_node,1 ); +if (rtc->irq <=0 ) { +dev_err (&op->dev,"%s: could not locate irq\n" , __func__); + err = rtc->irq ? rtc->irq : -EINVAL ; + goto out; + } + err =devm_request_irq (&op->dev, rtc->irq, mpc5121_rtc_handler,0 ,"mpc5121-rtc" , &op->dev);if (err) {dev_err (&op->dev,"%s: could not request irq: %i\n" , __func__, rtc->irq); - goto out_dispose; + goto out; } - rtc->irq_periodic =irq_of_parse_and_map (op->dev.of_node,0 ); - err =request_irq (rtc->irq_periodic, mpc5121_rtc_handler_upd, + rtc->irq_periodic =devm_irq_of_parse_and_map (&op->dev, + op->dev.of_node,0 ); +if (rtc->irq_periodic <=0 ) { +dev_err (&op->dev,"%s: could not locate irq\n" , __func__); + err = rtc->irq_periodic ? rtc->irq_periodic : -EINVAL ; + goto out; + } + err =devm_request_irq (&op->dev, rtc->irq_periodic, + mpc5121_rtc_handler_upd,0 ,"mpc5121-rtc_upd" , &op->dev);if (err) {dev_err (&op->dev,"%s: could not request irq: %i\n" , __func__, rtc->irq_periodic); - goto out_dispose2; + goto out; }if (of_device_is_compatible (op->dev.of_node,"fsl,mpc5121-rtc" )) {
@@ -364,19 +376,13 @@ static int mpc5121_rtc_probe(struct platform_device *op)if (IS_ERR (rtc->rtc)) { err =PTR_ERR (rtc->rtc); - goto out_free_irq; + goto out; } rtc->rtc->uie_unsupported =1 ;return 0 ; -out_free_irq: -free_irq (rtc->irq_periodic, &op->dev); -out_dispose2: -irq_dispose_mapping (rtc->irq_periodic); -free_irq (rtc->irq, &op->dev); -out_dispose: -irq_dispose_mapping (rtc->irq); +out:iounmap (rtc->regs);return err;
@@ -392,10 +398,6 @@ static int mpc5121_rtc_remove(struct platform_device *op)out_8 (®s->int_enable,in_8 (®s->int_enable) & ~0x1 );iounmap (rtc->regs); -free_irq (rtc->irq, &op->dev); -free_irq (rtc->irq_periodic, &op->dev); -irq_dispose_mapping (rtc->irq); -irq_dispose_mapping (rtc->irq_periodic);return 0 ; }
Signature · 1 line
1.7.10.4
PATCH 18/21 spi: use devm_irq_of_parse_and_map() where appropriate
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/spi/spi-bcm2835.c | 2 +- drivers/spi/spi-mpc512x-psc.c | 9 ++++++++- drivers/spi/spi.c | 8 +++++++- 3 files changed, 16 insertions(+), 3 deletions(-)
drivers/spi/spi-bcm2835.c +1 -1
@@ -337,7 +337,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev) goto out_master_put; } - bs->irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); + bs->irq =devm_irq_of_parse_and_map (&pdev->dev, pdev->dev.of_node,0 );if (bs->irq <=0 ) {dev_err (&pdev->dev,"could not get IRQ: %d\n" , bs->irq); err = bs->irq ? bs->irq : -ENODEV ;
drivers/spi/spi-mpc512x-psc.c +8 -1
@@ -571,6 +571,7 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *op) {const u32 *regaddr_p;u64 regaddr64, size64; +int irq; regaddr_p =of_get_address (op->dev.of_node,0 , &size64,NULL );if (!regaddr_p) {
@@ -579,8 +580,14 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *op) } regaddr64 =of_translate_address (op->dev.of_node, regaddr_p); + irq =devm_irq_of_parse_and_map (&op->dev, op->dev.of_node,0 ); +if (irq <=0 ) { +dev_err (&op->dev,"could not locate irq\n" ); +return irq ? irq : -EINVAL ; + } +return mpc512x_psc_spi_do_probe (&op->dev, (u32 ) regaddr64, (u32 ) size64, -irq_of_parse_and_map (op->dev.of_node,0 )); + irq); }static int mpc512x_psc_spi_of_remove (struct platform_device *op)
drivers/spi/spi.c +7 -1
@@ -1306,7 +1306,13 @@ static void of_register_spi_devices(struct spi_master *master) spi->max_speed_hz = value;/* IRQ */ - spi->irq =irq_of_parse_and_map (nc,0 ); + spi->irq =devm_irq_of_parse_and_map (&master->dev, nc,0 ); +if (spi->irq <0 ) { +dev_err (&master->dev,"could not locate irq for %s (%d)\n" , + nc->full_name, spi->irq); +spi_dev_put (spi); +continue ; + }/* Store a pointer to the node in the device structure */ of_node_get (nc);
Signature · 1 line
1.7.10.4
PATCH 19/21 exynos_tmu: use devm_irq_of_parse_and_map()
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/thermal/samsung/exynos_tmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/samsung/exynos_tmu.c +1 -1
@@ -553,7 +553,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)if (data->id <0 ) data->id =0 ; - data->irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); + data->irq =devm_irq_of_parse_and_map (&pdev->dev, pdev->dev.of_node,0 );if (data->irq <=0 ) {dev_err (&pdev->dev,"failed to get IRQ\n" );return -ENODEV ;
Signature · 1 line
1.7.10.4
PATCH 20/21 usb: use devm_irq_of_parse_and_map() where appropriate
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/usb/gadget/gr_udc.c | 17 +++++++++++------ drivers/usb/host/ehci-grlib.c | 11 ++++------- drivers/usb/host/ehci-orion.c | 3 ++- drivers/usb/host/ehci-ppc-of.c | 11 ++++------- drivers/usb/host/ehci-xilinx-of.c | 8 ++++---- drivers/usb/host/ohci-ppc-of.c | 7 ++----- 6 files changed, 27 insertions(+), 30 deletions(-)
drivers/usb/gadget/gr_udc.c +11 -6
@@ -2108,19 +2108,24 @@ static int gr_probe(struct platform_device *ofdev)if (IS_ERR (regs))return PTR_ERR (regs); - dev->irq =irq_of_parse_and_map (dev->dev->of_node,0 ); -if (!dev->irq) { + dev->irq =devm_irq_of_parse_and_map (dev->dev, dev->dev->of_node,0 ); +if (dev->irq <=0 ) {dev_err (dev->dev,"No irq found\n" );return -ENODEV ; }/* Some core configurations has separate irqs for IN and OUT events */ - dev->irqi =irq_of_parse_and_map (dev->dev->of_node,1 ); + dev->irqi =devm_irq_of_parse_and_map (dev->dev, dev->dev->of_node,1 ); +if (dev->irqi <0 ) { +dev_err (dev->dev,"could not locate irq\n" ); +return dev->irqi; + }if (dev->irqi) { - dev->irqo =irq_of_parse_and_map (dev->dev->of_node,2 ); -if (!dev->irqo) { + dev->irqo =devm_irq_of_parse_and_map (dev->dev, + dev->dev->of_node,2 ); +if (dev->irqo <=0 ) {dev_err (dev->dev,"Found irqi but not irqo\n" ); -return -ENODEV ; +return dev->irqo ? dev->irqo : -ENODEV ; } }
drivers/usb/host/ehci-grlib.c +4 -7
@@ -111,11 +111,11 @@ static int ehci_hcd_grlib_probe(struct platform_device *op) hcd->rsrc_start = res.start; hcd->rsrc_len =resource_size (&res); - irq =irq_of_parse_and_map (dn,0 ); -if (irq ==NO_IRQ ) { -dev_err (&op->dev,"%s: irq_of_parse_and_map failed\n" , + irq =devm_irq_of_parse_and_map (&op->dev, dn,0 ); +if (irq <=0 ) { +dev_err (&op->dev,"%s: devm_irq_of_parse_and_map failed\n" , __FILE__); - rv = -EBUSY ; + rv = irq ? irq : -EINVAL ; goto err_irq; }
@@ -145,7 +145,6 @@ static int ehci_hcd_grlib_probe(struct platform_device *op)return 0 ; err_ioremap: -irq_dispose_mapping (irq); err_irq:usb_put_hcd (hcd);
@@ -161,8 +160,6 @@ static int ehci_hcd_grlib_remove(struct platform_device *op)usb_remove_hcd (hcd); -irq_dispose_mapping (hcd->irq); -usb_put_hcd (hcd);return 0 ;
drivers/usb/host/ehci-orion.c +2 -1
@@ -155,7 +155,8 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)pr_debug ("Initializing Orion-SoC USB Host Controller\n" );if (pdev->dev.of_node) - irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); + irq =devm_irq_of_parse_and_map (&pdev->dev, + pdev->dev.of_node,0 );else irq =platform_get_irq (pdev,0 );if (irq <=0 ) {
drivers/usb/host/ehci-ppc-of.c +4 -7
@@ -117,11 +117,11 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op) hcd->rsrc_start = res.start; hcd->rsrc_len =resource_size (&res); - irq =irq_of_parse_and_map (dn,0 ); -if (irq ==NO_IRQ ) { -dev_err (&op->dev,"%s: irq_of_parse_and_map failed\n" , + irq =devm_irq_of_parse_and_map (&op->dev, dn,0 ); +if (irq <=0 ) { +dev_err (&op->dev,"%s: devm_irq_of_parse_and_map failed\n" , __FILE__); - rv = -EBUSY ; + rv = irq ? irq : -EINVAL ; goto err_irq; }
@@ -174,7 +174,6 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op)return 0 ; err_ioremap: -irq_dispose_mapping (irq); err_irq:usb_put_hcd (hcd);
@@ -194,8 +193,6 @@ static int ehci_hcd_ppc_of_remove(struct platform_device *op)usb_remove_hcd (hcd); -irq_dispose_mapping (hcd->irq); -/* use request_mem_region to test if the ohci driver is loaded. if so * ensure the ohci core is operational. */
drivers/usb/host/ehci-xilinx-of.c +4 -4
@@ -153,11 +153,11 @@ static int ehci_hcd_xilinx_of_probe(struct platform_device *op) hcd->rsrc_start = res.start; hcd->rsrc_len =resource_size (&res); - irq =irq_of_parse_and_map (dn,0 ); -if (!irq) { -dev_err (&op->dev,"%s: irq_of_parse_and_map failed\n" , + irq =devm_irq_of_parse_and_map (&op->dev, dn,0 ); +if (irq <=0 ) { +dev_err (&op->dev,"%s: devm_irq_of_parse_and_map failed\n" , __FILE__); - rv = -EBUSY ; + rv = irq ? irq : -EINVAL ; goto err_irq; }
drivers/usb/host/ohci-ppc-of.c +2 -5
@@ -121,11 +121,11 @@ static int ohci_hcd_ppc_of_probe(struct platform_device *op) goto err_rmr; } - irq =irq_of_parse_and_map (dn,0 ); + irq =devm_irq_of_parse_and_map (*op->dev, dn,0 );if (irq ==NO_IRQ ) {dev_err (&op->dev,"%s: irq_of_parse_and_map failed\n" , __FILE__); - rv = -EBUSY ; + rv = irq ? irq : -EINVAL ; goto err_rmr; }
@@ -170,7 +170,6 @@ static int ohci_hcd_ppc_of_probe(struct platform_device *op)pr_debug ("%s: cannot get ehci offset from fdt\n" , __FILE__); } -irq_dispose_mapping (irq); err_rmr:usb_put_hcd (hcd);
@@ -185,8 +184,6 @@ static int ohci_hcd_ppc_of_remove(struct platform_device *op)usb_remove_hcd (hcd); -irq_dispose_mapping (hcd->irq); -usb_put_hcd (hcd);return 0 ;
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 20/21] usb: use devm_irq_of_parse_and_map() where appropriate
Quoted 58 lines · On 2014-06-04 13:13, [email protected] wrote:
From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use
devm_request_irq()without facing unmap-while-handler-installed issues.Signed-off-by Nikita Yushchenko <[email protected]>--- drivers/usb/gadget/gr_udc.c | 17 +++++++++++------ drivers/usb/host/ehci-grlib.c | 11 ++++------- drivers/usb/host/ehci-orion.c | 3 ++- drivers/usb/host/ehci-ppc-of.c | 11 ++++------- drivers/usb/host/ehci-xilinx-of.c | 8 ++++---- drivers/usb/host/ohci-ppc-of.c | 7 ++----- 6 files changed, 27 insertions(+), 30 deletions(-)drivers/usb/gadget/gr_udc.c +11
-6@@ -2108,19 +2108,24 @@ static int gr_probe(struct platform_device *ofdev)if (IS_ERR (regs))return PTR_ERR (regs); - dev->irq =irq_of_parse_and_map (dev->dev->of_node,0 ); -if (!dev->irq) { + dev->irq =devm_irq_of_parse_and_map (dev->dev, dev->dev->of_node,0 ); +if (dev->irq <=0 ) {dev_err (dev->dev,"No irq found\n" );return -ENODEV ; }/* Some core configurations has separate irqs for IN and OUT events */ - dev->irqi =irq_of_parse_and_map (dev->dev->of_node,1 ); + dev->irqi =devm_irq_of_parse_and_map (dev->dev, dev->dev->of_node,1 ); +if (dev->irqi <0 ) { +dev_err (dev->dev,"could not locate irq\n" ); +return dev->irqi; + }if (dev->irqi) { - dev->irqo =irq_of_parse_and_map (dev->dev->of_node,2 ); -if (!dev->irqo) { + dev->irqo =devm_irq_of_parse_and_map (dev->dev, + dev->dev->of_node,2 ); +if (dev->irqo <=0 ) {dev_err (dev->dev,"Found irqi but not irqo\n" ); -return -ENODEV ; +return dev->irqo ? dev->irqo : -ENODEV ; } }drivers/usb/host/ehci-grlib.c +0
-0@@ -111,11 +111,11 @@ static int ehci_hcd_grlib_probe(struct platform_device *op) hcd->rsrc_start = res.start; hcd->rsrc_len =resource_size (&res);
drivers/usb/host/ehci-grlib.c static int ehci_hcd_grlib_probe(struct platform_device *op) · line 118
Quoted 10 lines
drivers/usb/host/ehci-grlib.c +4
-4- irq =irq_of_parse_and_map (dn,0 ); -if (irq ==NO_IRQ ) { -dev_err (&op->dev,"%s: irq_of_parse_and_map failed\n" , + irq =devm_irq_of_parse_and_map (&op->dev, dn,0 ); +if (irq <=0 ) { +dev_err (&op->dev,"%s: devm_irq_of_parse_and_map failed\n" , __FILE__); - rv = -EBUSY ; + rv = irq ? irq : -EINVAL ;
Here and in more places below you change the return value from -EBUSY to -EINVAL when irq == 0. These changes and the reason for them is not something that is commented upon in the commit message. Maybe these changes were not intended or should be in a separate patch?
Quoted 119 lines
drivers/usb/host/ehci-grlib.c +0
-3goto err_irq; }@@ -145,7 +145,6 @@ static int ehci_hcd_grlib_probe(struct platform_device *op)return 0 ; err_ioremap: -irq_dispose_mapping (irq); err_irq:usb_put_hcd (hcd);@@ -161,8 +160,6 @@ static int ehci_hcd_grlib_remove(struct platform_device *op)usb_remove_hcd (hcd); -irq_dispose_mapping (hcd->irq); -usb_put_hcd (hcd);return 0 ;drivers/usb/host/ehci-orion.c +2
-1@@ -155,7 +155,8 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)pr_debug ("Initializing Orion-SoC USB Host Controller\n" );if (pdev->dev.of_node) - irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); + irq =devm_irq_of_parse_and_map (&pdev->dev, + pdev->dev.of_node,0 );else irq =platform_get_irq (pdev,0 );if (irq <=0 ) {drivers/usb/host/ehci-ppc-of.c +4
-7@@ -117,11 +117,11 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op) hcd->rsrc_start = res.start; hcd->rsrc_len =resource_size (&res); - irq =irq_of_parse_and_map (dn,0 ); -if (irq ==NO_IRQ ) { -dev_err (&op->dev,"%s: irq_of_parse_and_map failed\n" , + irq =devm_irq_of_parse_and_map (&op->dev, dn,0 ); +if (irq <=0 ) { +dev_err (&op->dev,"%s: devm_irq_of_parse_and_map failed\n" , __FILE__); - rv = -EBUSY ; + rv = irq ? irq : -EINVAL ; goto err_irq; }@@ -174,7 +174,6 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op)return 0 ; err_ioremap: -irq_dispose_mapping (irq); err_irq:usb_put_hcd (hcd);@@ -194,8 +193,6 @@ static int ehci_hcd_ppc_of_remove(struct platform_device *op)usb_remove_hcd (hcd); -irq_dispose_mapping (hcd->irq); -/* use request_mem_region to test if the ohci driver is loaded. if so * ensure the ohci core is operational. */ drivers/usb/host/ehci-xilinx-of.c +4
-4@@ -153,11 +153,11 @@ static int ehci_hcd_xilinx_of_probe(struct platform_device *op) hcd->rsrc_start = res.start; hcd->rsrc_len =resource_size (&res); - irq =irq_of_parse_and_map (dn,0 ); -if (!irq) { -dev_err (&op->dev,"%s: irq_of_parse_and_map failed\n" , + irq =devm_irq_of_parse_and_map (&op->dev, dn,0 ); +if (irq <=0 ) { +dev_err (&op->dev,"%s: devm_irq_of_parse_and_map failed\n" , __FILE__); - rv = -EBUSY ; + rv = irq ? irq : -EINVAL ; goto err_irq; }drivers/usb/host/ohci-ppc-of.c +2
-3@@ -121,11 +121,11 @@ static int ohci_hcd_ppc_of_probe(struct platform_device *op) goto err_rmr; } - irq =irq_of_parse_and_map (dn,0 ); + irq =devm_irq_of_parse_and_map (*op->dev, dn,0 );if (irq ==NO_IRQ ) {dev_err (&op->dev,"%s: irq_of_parse_and_map failed\n" , __FILE__); - rv = -EBUSY ; + rv = irq ? irq : -EINVAL ; goto err_rmr; }@@ -170,7 +170,6 @@ static int ohci_hcd_ppc_of_probe(struct platform_device *op)pr_debug ("%s: cannot get ehci offset from fdt\n" , __FILE__); } -irq_dispose_mapping (irq); err_rmr:usb_put_hcd (hcd);
drivers/usb/host/ohci-ppc-of.c static int ohci_hcd_ppc_of_remove(struct platform_device *op) · line 189
Quoted 8 lines
drivers/usb/host/ohci-ppc-of.c +0
-2@@ -185,8 +184,6 @@ static int ohci_hcd_ppc_of_remove(struct platform_device *op)usb_remove_hcd (hcd); -irq_dispose_mapping (hcd->irq); -usb_put_hcd (hcd);return 0 ;
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 20/21] usb: use devm_irq_of_parse_and_map() where appropriate
Quoted 10 lines
Quoted 10 lines
drivers/usb/host/ehci-grlib.c +0
-0@@ -111,11 +111,11 @@ static int ehci_hcd_grlib_probe(struct platform_device *op) hcd->rsrc_start = res.start; hcd->rsrc_len =resource_size (&res);
Quoted 14 lines
drivers/usb/host/ehci-grlib.c static int ehci_hcd_grlib_probe(struct platform_device *op) · line 118
Quoted 9 lines
drivers/usb/host/ehci-grlib.c +4
-4- irq =irq_of_parse_and_map (dn,0 ); -if (irq ==NO_IRQ ) { -dev_err (&op->dev,"%s: irq_of_parse_and_map failed\n" , + irq =devm_irq_of_parse_and_map (&op->dev, dn,0 ); +if (irq <=0 ) { +dev_err (&op->dev,"%s: devm_irq_of_parse_and_map failed\n" , __FILE__); - rv = -EBUSY ; + rv = irq ? irq : -EINVAL ;Here and in more places below you change the return value from
-EBUSYto-EINVALwhen irq == 0. These changes and the reason for them is not something that is commented upon in the commit message. Maybe these changes were not intended or should be in a separate patch?
Although errno codes are quite unspecific, I can't think a valid reason to return -EBUSY on [devm_]irq_of_parse_and_map() failure. It could be -EINVAL or -ENODEV, but not -EBUSY ...
Since changing line that sets error code anyway, I decided to change -EBUST to -ENODEV.
But I agree that this is not the topic of the patch.
IS it better to remove this change from changeset alltogether, or to mention it in commit's log message?
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 20/21] usb: use devm_irq_of_parse_and_map() where appropriate
Quoted 29 lines · Nikita Yushchenko
Quoted 10 lines
Quoted 10 lines
drivers/usb/host/ehci-grlib.c +0
-0@@ -111,11 +111,11 @@ static int ehci_hcd_grlib_probe(struct platform_device *op) hcd->rsrc_start = res.start; hcd->rsrc_len =resource_size (&res);Quoted 14 lines
drivers/usb/host/ehci-grlib.c static int ehci_hcd_grlib_probe(struct platform_device *op) · line 118
Quoted 9 lines
drivers/usb/host/ehci-grlib.c +4
-4- irq =irq_of_parse_and_map (dn,0 ); -if (irq ==NO_IRQ ) { -dev_err (&op->dev,"%s: irq_of_parse_and_map failed\n" , + irq =devm_irq_of_parse_and_map (&op->dev, dn,0 ); +if (irq <=0 ) { +dev_err (&op->dev,"%s: devm_irq_of_parse_and_map failed\n" , __FILE__); - rv = -EBUSY ; + rv = irq ? irq : -EINVAL ;Here and in more places below you change the return value from
-EBUSYto-EINVALwhen irq == 0. These changes and the reason for them is not something that is commented upon in the commit message. Maybe these changes were not intended or should be in a separate patch?Although errno codes are quite unspecific, I can't think a valid reason to return
-EBUSYon [devm_]irq_of_parse_and_map() failure. It could be-EINVALor-ENODEV, but not-EBUSY...
Quoted 7 lines
Since changing line that sets error code anyway, I decided to change
-EBUSTto-ENODEV.But I agree that this is not the topic of the patch.
IS it better to remove this change from changeset alltogether, or to mention it in commit's log message?
Given that there are a lot of -EBUSY being returned in drivers/usb/host - not just in these error cases, maybe it is better to not touch this in this patch set.
Best regards,
Andreas Larsson
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 21/21 at91sam9_wdt: use devm_irq_of_parse_and_map()
In reply to [email protected]From: Nikita Yushchenko <[email protected]>
This avoids leak of IRQ mapping on error paths, and makes it possible to use devm_request_irq() without facing unmap-while-handler-installed issues.
--- drivers/watchdog/at91sam9_wdt.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/watchdog/at91sam9_wdt.c +7 -5
@@ -207,9 +207,9 @@ static int at91_wdt_init(struct platform_device *pdev, struct at91wdt *wdt) "min heartbeat and max heartbeat might be too close for the system to handle it correctly\n");if ((tmp &AT91_WDT_WDFIEN ) && wdt->irq) { - err =request_irq (wdt->irq, wdt_interrupt, -IRQF_SHARED |IRQF_IRQPOLL , - pdev->name, wdt); + err =devm_request_irq (dev, wdt->irq, wdt_interrupt, +IRQF_SHARED |IRQF_IRQPOLL , + pdev->name, wdt);if (err)return err; }
@@ -270,9 +270,11 @@ static int of_at91wdt_init(struct device_node *np, struct at91wdt *wdt)const char *tmp;/* Get the interrupts property */ - wdt->irq =irq_of_parse_and_map (np,0 ); -if (!wdt->irq) + wdt->irq =devm_irq_of_parse_and_map (wdt->wdd.parent, np,0 ); +if (wdt->irq <=0 ) {dev_warn (wdt->wdd.parent,"failed to get IRQ from DT\n" ); + wdt->irq =NO_IRQ ; + }if (!of_property_read_u32_index (np,"atmel,max-heartbeat-sec" ,0 , &max)) {
Signature · 1 line
1.7.10.4
Quoted 8 lines · On 2014-06-04 13:13, [email protected] wrote:
Currently many device tree aware drivers use
irq_of_parse_and_map()to get IRQ number and thendevm_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()isirq_dispose_mapping()that must not be called while IRQ handler is defined, but devres movesfree_irq()out of driver so driver does not have safe place to callirq_dispose_mapping().
Quoted 7 lines
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 andirq_of_parse_and_map()to usedevm_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
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 19 lines
Quoted 9 lines
Currently many device tree aware drivers use
irq_of_parse_and_map()to get
IRQ number and thendevm_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()isirq_dispose_mapping()that must not be called while IRQ handler is defined, but devres movesfree_irq()out of driver so driver does not have safe place to callirq_dispose_mapping().Quoted 8 lines
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 andirq_of_parse_and_map()to usedevm_irq_of_parse_and_map()instead.
Quoted 6 lines
SPARC does not use
OF_IRQand has a different implementation ofirq_of_parse_and_mapthan the one indrivers/of/irq.c. All code converted fromirq_of_parse_and_maptodevm_irq_of_parse_and_mapin 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
Quoted 26 lines · Nikita Yushchenko
Quoted 19 lines
Quoted 9 lines
Currently many device tree aware drivers use
irq_of_parse_and_map()to get
IRQ number and thendevm_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()isirq_dispose_mapping()that must not be called while IRQ handler is defined, but devres movesfree_irq()out of driver so driver does not have safe place to callirq_dispose_mapping().Quoted 8 lines
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 andirq_of_parse_and_map()to usedevm_irq_of_parse_and_map()instead.Quoted 6 lines
SPARC does not use
OF_IRQand has a different implementation ofirq_of_parse_and_mapthan the one indrivers/of/irq.c. All code converted fromirq_of_parse_and_maptodevm_irq_of_parse_and_mapin 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).
Quoted 2 lines
Can this be fixed by adding a copy of
devm_irq_of_parse_and_map()toarch/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
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
SPARC does not use
OF_IRQand has a different implementation ofirq_of_parse_and_mapthan the one indrivers/of/irq.c. All code converted fromirq_of_parse_and_maptodevm_irq_of_parse_and_mapin 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()toarch/sparc/kernel/of_device_common.c?
Quoted 8 lines
Not a copy of the version in
irq.cno. On SPARC,IRQ_DOMAINis 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_mapthat just callsirq_of_parse_and_mapas there are no mappings that needs to be disposed of. (The empty dummy forirq_dispose_mappingis used if anyirq_dispose_mappingcalls 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 devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 19 lines · Nikita Yushchenko
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
SPARC does not use
OF_IRQand has a different implementation ofirq_of_parse_and_mapthan the one indrivers/of/irq.c. All code converted fromirq_of_parse_and_maptodevm_irq_of_parse_and_mapin 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()toarch/sparc/kernel/of_device_common.c?Quoted 8 lines
Not a copy of the version in
irq.cno. On SPARC,IRQ_DOMAINis 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_mapthat just callsirq_of_parse_and_mapas there are no mappings that needs to be disposed of. (The empty dummy forirq_dispose_mappingis used if anyirq_dispose_mappingcalls are made from drivers).
Quoted 3 lines
Ok, I will post an updated patchset that adds sparc
devm_irq_of_parse_and_map()that just callsirq_of_parse_and_map(), anddevm_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.
Quoted 3 lines
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