fix usage of __{,dev}exit_p
Subsystems (27)
cover fix usage of __{,dev}exit_p
Hello,
I already sent a similar series in January[1]. Apart from a general Ack by Sam there was no reaction.
Now that there exists scripts/get_maintainer.pl, I resend an updated series to an wider audience in the hope to get more feedback.
Best regards
Uwe
[1] http://thread.gmane.org/gmane.linux.kernel/779241
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/34 move asic3_remove to .devexit.text
The function asic3_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/mfd/asic3.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/asic3.c +1 -1
@@ -908,7 +908,7 @@ static int __init asic3_probe(struct platform_device *pdev)return ret; } -static int asic3_remove (struct platform_device *pdev) +static int __devexit asic3_remove(struct platform_device *pdev) {int ret;struct asic3 *asic =platform_get_drvdata (pdev);
Signature · 1 line
1.6.4.3
Samuel Ortiz
AppliedRe: [PATCH 01/34] move asic3_remove to .devexit.text
Hi Uwe,
Quoted 2 lines · Uwe Kleine-König
The function
asic3_removeis used only wrapped by__devexit_pso define it using__devexit.
Applied to the mfd tree, thanks.
Cheers,
Samuel.
Quoted 27 lines
Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>Cc Samuel Ortiz <[email protected]>Cc Philipp Zabel <[email protected]>Cc Yinghai Lu <[email protected]>Cc Russell King <[email protected]>--- drivers/mfd/asic3.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/mfd/asic3.c +1
-1@@ -908,7 +908,7 @@ static int __init asic3_probe(struct platform_device *pdev)return ret; } -static int asic3_remove (struct platform_device *pdev) +static int __devexit asic3_remove(struct platform_device *pdev) {int ret;struct asic3 *asic =platform_get_drvdata (pdev);Signature · 1 line
1.6.4.3
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
PATCH 2/34 move atp870u_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function atp870u_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/scsi/atp870u.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/atp870u.c +1 -1
@@ -3143,7 +3143,7 @@ static int atp870u_biosparam(struct scsi_device *disk, struct block_device *dev,return 0 ; } -static void atp870u_remove (struct pci_dev *pdev) +static void __devexit atp870u_remove (struct pci_dev *pdev) {struct atp_unit *devext =pci_get_drvdata (pdev);struct Scsi_Host *pshost = devext->host;
Signature · 1 line
1.6.4.3
Re: [PATCH 02/34] move atp870u_remove to .devexit.text
Quoted 2 lines · Uwe Kleine-König
The function
atp870u_removeis used only wrapped by__devexit_pso define it using__devexit.
What's the justification for this?
Given that practically every kernel on the planet is hotplug enabled these days and that the savings on the very few that aren't from discarding the devexit section is at most a page or two (and even arm says they don't care about that), there doesn't seem to be any point making these changes. In fact, I think we can just kill devinit and devexit as section markers.
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 02/34] move atp870u_remove to .devexit.text
Hello,
Quoted 6 lines · James Bottomley
Given that practically every kernel on the planet is hotplug enabled these days and that the savings on the very few that aren't from discarding the devexit section is at most a page or two (and even arm says they don't care about that), there doesn't seem to be any point making these changes. In fact, I think we can just kill devinit and devexit as section markers.
IMHO you should better kill CONFIG_HOTPLUG completely then.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 3/34 move bbc_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function bbc_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/input/misc/sparcspkr.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/input/misc/sparcspkr.c +1 -1
@@ -230,7 +230,7 @@ out_err:return err; } -static int bbc_remove (struct of_device *op) +static int __devexit bbc_remove(struct of_device *op) {struct sparcspkr_state *state =dev_get_drvdata (&op->dev);struct input_dev *input_dev = state->input_dev;
Signature · 1 line
1.6.4.3
PATCH 4/34 don't use __devexit_p to wrap excite_nand_remove
In reply to Uwe Kleine-KönigThe function excite_nand_remove is defined using __exit, so don't use __devexit_p but __exit_p to wrap it.
--- drivers/mtd/nand/excite_nandflash.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/excite_nandflash.c +1 -1
@@ -224,7 +224,7 @@ static struct platform_driver excite_nand_driver = { .owner = THIS_MODULE, }, .probe = excite_nand_probe, - .remove = __devexit_p(excite_nand_remove) + .remove = __exit_p(excite_nand_remove) };static int __init excite_nand_init (void )
Signature · 1 line
1.6.4.3
PATCH 5/34 move grover_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function grover_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/input/misc/sparcspkr.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/input/misc/sparcspkr.c +1 -1
@@ -308,7 +308,7 @@ out_err:return err; } -static int grover_remove (struct of_device *op) +static int __devexit grover_remove(struct of_device *op) {struct sparcspkr_state *state =dev_get_drvdata (&op->dev);struct grover_beep_info *info = &state->u.grover;
Signature · 1 line
1.6.4.3
Dmitry Torokhov
maintainerRe: [PATCH 05/34] move grover_remove to .devexit.text
Quoted 5 lines · Uwe Kleine-König
The function
grover_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>
Folded together with your other patch to sparkspkr and applied.
Thanks Uwe.
Signature · 1 line
Dmitry
PATCH 6/34 don't use __devexit_p to wrap hal2_remove
In reply to Uwe Kleine-KönigThe function hal2_remove is defined using __exit, so don't use __devexit_p but __exit_p to wrap it.
--- sound/mips/hal2.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
sound/mips/hal2.c +1 -1
@@ -926,7 +926,7 @@ static int __exit hal2_remove(struct platform_device *pdev)static struct platform_driver hal2_driver = { .probe = hal2_probe, - .remove =__devexit_p (hal2_remove), + .remove =__exit_p (hal2_remove), .driver = { .name ="sgihal2" , .owner =THIS_MODULE ,
Signature · 1 line
1.6.4.3
Re: [PATCH 06/34] don't use __devexit_p to wrap hal2_remove
At Thu, 1 Oct 2009 10:28:10 +0200,
Quoted 3 lines · Uwe Kleine-König
The function
hal2_removeis defined using__exit, so don't use__devexit_pbut__exit_pto wrap it.
I think it's the other way round. We should replace __exit with __devexit. Ditto for sound/mips/sgio2audio.c.
thanks,
Takashi
Quoted 26 lines
Signed-off-by Uwe Kleine-König <[email protected]>Cc Takashi Iwai <[email protected]>Cc Jaroslav Kysela <[email protected]>--- sound/mips/hal2.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)sound/mips/hal2.c +1
-1@@ -926,7 +926,7 @@ static int __exit hal2_remove(struct platform_device *pdev)static struct platform_driver hal2_driver = { .probe = hal2_probe, - .remove =__devexit_p (hal2_remove), + .remove =__exit_p (hal2_remove), .driver = { .name ="sgihal2" , .owner =THIS_MODULE ,Signature · 1 line
1.6.4.3
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 06/34] don't use __devexit_p to wrap hal2_remove
Quoted 8 lines · Takashi Iwai
At Thu, 1 Oct 2009 10:28:10 +0200,
Quoted 3 lines · Uwe Kleine-König
The function
hal2_removeis defined using__exit, so don't use__devexit_pbut__exit_pto wrap it.I think it's the other way round. We should replace
__exitwith__devexit. Ditto forsound/mips/sgio2audio.c.
Actually both ways are possible. I choosed the alternative that doesn't add bloat to the kernel. The cost is that the device isn't hotplugable, but you can still unload the module to unbind the driver.
I don't care much, but prefer slightly my approach as changing the patch is work for me :-)
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 06/34] don't use __devexit_p to wrap hal2_remove
At Thu, 1 Oct 2009 10:53:55 +0200,
Quoted 5 lines · Uwe Kleine-König
Quoted 3 lines · Takashi Iwai
At Thu, 1 Oct 2009 10:28:10 +0200,
Quoted 1 line · Uwe Kleine-König
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
The function
hal2_removeis defined using__exit, so don't use__devexit_pbut__exit_pto wrap it.I think it's the other way round. We should replace
__exitwith__devexit. Ditto forsound/mips/sgio2audio.c.Actually both ways are possible. I choosed the alternative that doesn't add bloat to the kernel. The cost is that the device isn't hotplugable, but you can still unload the module to unbind the driver.
Hm, is it really safe to set remove=NULL although the driver needs some work at unbinding? It looks like that unbind is allowed no matter whether remove is NULL or not. So, it would jus keeps stray resources, and it might conflict at the next bind.
Quoted 2 lines
I don't care much, but prefer slightly my approach as changing the patch is work for me :-)
I prefer rather symmetry and safety :)
I'm going to change to __devexit.
thanks,
Takashi
Re: [PATCH 06/34] don't use __devexit_p to wrap hal2_remove
Hello,
Quoted 12 lines · Takashi Iwai
At Thu, 1 Oct 2009 10:53:55 +0200,
Quoted 10 lines · Uwe Kleine-König
Quoted 8 lines · Takashi Iwai
At Thu, 1 Oct 2009 10:28:10 +0200,
Quoted 3 lines · Uwe Kleine-König
The function
hal2_removeis defined using__exit, so don't use__devexit_pbut__exit_pto wrap it.I think it's the other way round. We should replace
__exitwith__devexit. Ditto forsound/mips/sgio2audio.c.
Quoted 8 lines
Quoted 3 lines
Actually both ways are possible. I choosed the alternative that doesn't add bloat to the kernel. The cost is that the device isn't hotplugable, but you can still unload the module to unbind the driver.
Hm, is it really safe to set remove=NULL although the driver needs some work at unbinding? It looks like that unbind is allowed no matter whether remove is NULL or not. So, it would jus keeps stray resources, and it might conflict at the next bind.
I just tried that and you're right. IMHO that's a bug. Greg?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 06/34] don't use __devexit_p to wrap hal2_remove
At Fri, 2 Oct 2009 11:20:25 +0200,
Quoted 20 lines · Uwe Kleine-König
Hello,
Quoted 16 lines · Takashi Iwai
At Thu, 1 Oct 2009 10:53:55 +0200,
Quoted 13 lines · Uwe Kleine-König
Quoted 8 lines · Takashi Iwai
At Thu, 1 Oct 2009 10:28:10 +0200,
Quoted 3 lines · Uwe Kleine-König
The function
hal2_removeis defined using__exit, so don't use__devexit_pbut__exit_pto wrap it.I think it's the other way round. We should replace
__exitwith__devexit. Ditto forsound/mips/sgio2audio.c.Actually both ways are possible. I choosed the alternative that doesn't add bloat to the kernel. The cost is that the device isn't hotplugable, but you can still unload the module to unbind the driver.
Quoted 5 lines
Quoted 4 lines
Hm, is it really safe to set remove=NULL although the driver needs some work at unbinding? It looks like that unbind is allowed no matter whether remove is NULL or not. So, it would jus keeps stray resources, and it might conflict at the next bind.
I just tried that and you're right. IMHO that's a bug. Greg?
I suppose it's a bug of the driver, not the core :)
If the driver doesn't need to release resources, it would work fine with remove = NULL. Also, the bus can provide a common remove callback (even it's over the driver's remove callback). So, in theory, it can be NULL.
But, it must be really rare, and non-NULL remove is very likely a bug if the driver is built with CONFIG_HOTPLUG=y...
thanks,
Takashi
PATCH 7/34 move ilo_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function ilo_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/misc/hpilo.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/misc/hpilo.c +1 -1
@@ -715,7 +715,7 @@ out:return error; } -static void ilo_remove (struct pci_dev *pdev) +static void __devexit ilo_remove(struct pci_dev *pdev) {int i, minor;struct ilo_hwinfo *ilo_hw =pci_get_drvdata (pdev);
Signature · 1 line
1.6.4.3
RE: [PATCH 07/34] move ilo_remove to .devexit.text
Quoted 3 lines
The function
ilo_removeis used only wrapped by__devexit_pso define it using__devexit.
Looks good to me. Not sure if this is needed or not...
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Re: [PATCH 07/34] move ilo_remove to .devexit.text
Hello David,
Quoted 4 lines · David
Quoted 2 lines
The function
ilo_removeis used only wrapped by__devexit_pso define it using__devexit.Looks good to me. Not sure if this is needed or not...
it fixes at least a warning if you compile the driver as built-in with CONFIG_HOTPLUG=n about ilo_remove not being used.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
RE: [PATCH 07/34] move ilo_remove to .devexit.text
Quoted 2 lines
Quoted 1 line
Looks good to me. Not sure if this is needed or not...
it fixes at least a warning
Sorry for any confusion, I was referring to my specific Acked-by, I didn't know if you needed that from me.
PATCH 8/34 move initio_remove_one to .devexit.text
In reply to Uwe Kleine-KönigThe function initio_remove_one is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/scsi/initio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/initio.c +1 -1
@@ -2964,7 +2964,7 @@ out_disable_device:* finished being used. */ -static void initio_remove_one (struct pci_dev *pdev) +static void __devexit initio_remove_one(struct pci_dev *pdev) {struct Scsi_Host *host =pci_get_drvdata (pdev);struct initio_host *s = (struct initio_host *)host->hostdata;
Signature · 1 line
1.6.4.3
PATCH 9/34 don't use __devexit_p to wrap iodev_remove
In reply to Uwe Kleine-KönigThe function iodev_remove is defined using __exit, so don't use __devexit_p but __exit_p to wrap it.
--- arch/mips/basler/excite/excite_iodev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/mips/basler/excite/excite_iodev.c +1 -1
@@ -71,7 +71,7 @@ static struct platform_driver iodev_driver = { .owner = THIS_MODULE, }, .probe = iodev_probe, - .remove = __devexit_p(iodev_remove), + .remove = __exit_p(iodev_remove), };
Signature · 1 line
1.6.4.3
PATCH 10/34 don't use __devexit_p to wrap lasi700_driver_remove
In reply to Uwe Kleine-KönigThe function lasi700_driver_remove is defined using __exit, so don't use __devexit_p but __exit_p to wrap it.
--- drivers/scsi/lasi700.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/lasi700.c +1 -1
@@ -167,7 +167,7 @@ static struct parisc_driver lasi700_driver = { .name = "lasi_scsi", .id_table = lasi700_ids, .probe = lasi700_probe, - .remove = __devexit_p(lasi700_driver_remove), + .remove = __exit_p(lasi700_driver_remove), }; static int __init
Signature · 6 lines
1.6.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 11/34 move mcf_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function mcf_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/serial/mcf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/mcf.c +1 -1
@@ -602,7 +602,7 @@ static int __devinit mcf_probe(struct platform_device *pdev)/****************************************************************************/ -static int mcf_remove (struct platform_device *pdev) +static int __devexit mcf_remove(struct platform_device *pdev) {struct uart_port *port;int i;
Signature · 1 line
1.6.4.3
Re: [PATCH 11/34] move mcf_remove to .devexit.text
Hi Uwe,
Quoted 18 lines · Uwe Kleine-König
The function
mcf_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Cc Greg Ungerer <[email protected]>Cc Len Sorensen <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Alan Cox <[email protected]>--- drivers/serial/mcf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/serial/mcf.c +0
-0
drivers/serial/mcf.c static int __devinit mcf_probe(struct platform_device *pdev) · line 608
Quoted 8 lines
drivers/serial/mcf.c +1
-1@@ -602,7 +602,7 @@ static int __devinit mcf_probe(struct platform_device *pdev)/****************************************************************************/ -static int mcf_remove (struct platform_device *pdev) +static int __devexit mcf_remove(struct platform_device *pdev) {struct uart_port *port;int i;
Looks good. I'll add that to the m68knommu git, for-linus branch.
Thanks
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 825 Stanley St, FAX: +61 7 3891 3630 Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
PATCH 12/34 move megaraid_detach_one to .devexit.text
In reply to Uwe Kleine-KönigThe function megaraid_detach_one is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/scsi/megaraid/megaraid_mbox.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_mbox.c +2 -2
@@ -76,7 +76,7 @@ static int megaraid_init(void);static void megaraid_exit (void );static int megaraid_probe_one (struct pci_dev *,const struct pci_device_id *); -static void megaraid_detach_one (struct pci_dev *); +static void __devexit megaraid_detach_one(struct pci_dev *);static void megaraid_mbox_shutdown (struct pci_dev *);static int megaraid_io_attach (adapter_t *);
@@ -551,7 +551,7 @@ out_probe_one:* * This routine is also called from the PCI hotplug system. */ -static void +static void __devexitmegaraid_detach_one (struct pci_dev *pdev) {adapter_t *adapter;
Signature · 6 lines
1.6.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 13/34 don't use __devexit_p to wrap meth_remove
In reply to Uwe Kleine-KönigThe function meth_remove is defined using __exit, so don't use __devexit_p but __exit_p to wrap it.
--- drivers/net/meth.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/meth.c +1 -1
@@ -828,7 +828,7 @@ static int __exit meth_remove(struct platform_device *pdev)static struct platform_driver meth_driver = { .probe = meth_probe, - .remove =__devexit_p (meth_remove), + .remove =__exit_p (meth_remove), .driver = { .name ="meth" , .owner =THIS_MODULE ,
Signature · 1 line
1.6.4.3
PATCH 14/34 don't wrap mlx4_remove_one in __devexit_p
In reply to Uwe Kleine-KönigThe function mlx4_remove_one is defined in .text, so there is no need to wrap it with __devexit_p.
--- drivers/net/mlx4/main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/mlx4/main.c +1 -1
@@ -1291,7 +1291,7 @@ static struct pci_driver mlx4_driver = { .name = DRV_NAME, .id_table = mlx4_pci_table, .probe = mlx4_init_one, - .remove = __devexit_p(mlx4_remove_one) + .remove = mlx4_remove_one };static int __init mlx4_verify_params (void )
Signature · 1 line
1.6.4.3
PATCH 15/34 move mpc85xx_pci_err_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function mpc85xx_pci_err_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/edac/mpc85xx_edac.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/edac/mpc85xx_edac.c +1 -1
@@ -304,7 +304,7 @@ err:return res; } -static int mpc85xx_pci_err_remove (struct of_device *op) +static int __devexit mpc85xx_pci_err_remove(struct of_device *op) {struct edac_pci_ctl_info *pci =dev_get_drvdata (&op->dev);struct mpc85xx_pci_pdata *pdata = pci->pvt_info;
Signature · 1 line
1.6.4.3
PATCH 16/34 move mv64x60_pci_err_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function mv64x60_pci_err_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/edac/mv64x60_edac.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/edac/mv64x60_edac.c +1 -1
@@ -206,7 +206,7 @@ err:return res; } -static int mv64x60_pci_err_remove (struct platform_device *pdev) +static int __devexit mv64x60_pci_err_remove(struct platform_device *pdev) {struct edac_pci_ctl_info *pci =platform_get_drvdata (pdev);
Signature · 1 line
1.6.4.3
PATCH 17/34 move mxcnd_remove to .exit.text
In reply to Uwe Kleine-KönigThe function mxcnd_remove is used only wrapped by __exit_p so define it using __exit.
--- drivers/mtd/nand/mxc_nand.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/mxc_nand.c +1 -1
@@ -1052,7 +1052,7 @@ eclk:return err; } -static int __devexit mxcnd_remove(struct platform_device *pdev) +static int __exit mxcnd_remove(struct platform_device *pdev) {struct mxc_nand_host *host =platform_get_drvdata (pdev);
Signature · 1 line
1.6.4.3
PATCH 18/34 don't use __devexit_p to wrap NCR_Q720_remove
In reply to Uwe Kleine-KönigThe function NCR_Q720_remove is defined using __exit, so don't use __devexit_p but __exit_p to wrap it.
--- drivers/scsi/NCR_Q720.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/NCR_Q720.c +1 -1
@@ -350,7 +350,7 @@ static struct mca_driver NCR_Q720_driver = { .name = "NCR_Q720", .bus = &mca_bus_type, .probe = NCR_Q720_probe, - .remove = __devexit_p(NCR_Q720_remove), + .remove = __exit_p(NCR_Q720_remove), }, };
Signature · 6 lines
1.6.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 19/34 move s3c_adc_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function s3c_adc_remove is used only wrapped by __devexit_p so define it using __devexit.
--- arch/arm/plat-s3c24xx/adc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-s3c24xx/adc.c +1 -1
@@ -364,7 +364,7 @@ static int s3c_adc_probe(struct platform_device *pdev)return ret; } -static int s3c_adc_remove (struct platform_device *pdev) +static int __devexit s3c_adc_remove(struct platform_device *pdev) {struct adc_device *adc =platform_get_drvdata (pdev);
Signature · 1 line
1.6.4.3
Re: [PATCH 19/34] move s3c_adc_remove to .devexit.text
Quoted 7 lines · Uwe Kleine-König
The function
s3c_adc_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>Cc Russell King <[email protected]>Cc Ben Dooks <[email protected]>
Quoted 3 lines
Signature · 3 lines
Ben Dooks, Software Engineer, Simtec Electronics http://www.simtec.co.uk/
PATCH 20/34 move s3c_pwm_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function s3c_pwm_remove is used only wrapped by __devexit_p so define it using __devexit.
--- arch/arm/plat-s3c/pwm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-s3c/pwm.c +1 -1
@@ -368,7 +368,7 @@ static int s3c_pwm_probe(struct platform_device *pdev)return ret; } -static int s3c_pwm_remove (struct platform_device *pdev) +static int __devexit s3c_pwm_remove(struct platform_device *pdev) {struct pwm_device *pwm =platform_get_drvdata (pdev);
Signature · 1 line
1.6.4.3
PATCH 21/34 wrap sc26xx_driver_remove by __exit_p
In reply to Uwe Kleine-Königsc26xx_driver_remove is defined using __exit, so wrap it's usage by __exit_p. This fixes compiling as builtin.
--- drivers/serial/sc26xx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/sc26xx.c +1 -1
@@ -729,7 +729,7 @@ static int __exit sc26xx_driver_remove(struct platform_device *dev)static struct platform_driver sc26xx_driver = { .probe = sc26xx_probe, - .remove =__devexit_p (sc26xx_driver_remove), + .remove =__exit_p (sc26xx_driver_remove), .driver = { .name ="SC26xx" , .owner =THIS_MODULE ,
Signature · 1 line
1.6.4.3
PATCH 22/34 don't use __devexit_p to wrap sgiseeq_remove
In reply to Uwe Kleine-KönigThe function sgiseeq_remove is defined using __exit, so don't use __devexit_p but __exit_p to wrap it.
--- drivers/net/sgiseeq.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/sgiseeq.c +1 -1
@@ -826,7 +826,7 @@ static int __exit sgiseeq_remove(struct platform_device *pdev)static struct platform_driver sgiseeq_driver = { .probe = sgiseeq_probe, - .remove =__devexit_p (sgiseeq_remove), + .remove =__exit_p (sgiseeq_remove), .driver = { .name ="sgiseeq" , .owner =THIS_MODULE ,
Signature · 1 line
1.6.4.3
PATCH 23/34 don't use __devexit_p to wrap sgiwd93_remove
In reply to Uwe Kleine-KönigThe function sgiwd93_remove is defined using __exit, so don't use __devexit_p but __exit_p to wrap it.
--- drivers/scsi/sgiwd93.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/sgiwd93.c +1 -1
@@ -312,7 +312,7 @@ static int __exit sgiwd93_remove(struct platform_device *pdev)static struct platform_driver sgiwd93_driver = { .probe = sgiwd93_probe, - .remove =__devexit_p (sgiwd93_remove), + .remove =__exit_p (sgiwd93_remove), .driver = { .name ="sgiwd93" , .owner =THIS_MODULE ,
Signature · 6 lines
1.6.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 24/34 don't use __devexit_p to wrap snd_sgio2audio_remove
In reply to Uwe Kleine-KönigThe function snd_sgio2audio_remove is defined using __exit, so don't use __devexit_p but __exit_p to wrap it.
--- sound/mips/sgio2audio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
sound/mips/sgio2audio.c +1 -1
@@ -984,7 +984,7 @@ static int __exit snd_sgio2audio_remove(struct platform_device *pdev)static struct platform_driver sgio2audio_driver = { .probe = snd_sgio2audio_probe, - .remove =__devexit_p (snd_sgio2audio_remove), + .remove =__exit_p (snd_sgio2audio_remove), .driver = { .name ="sgio2audio" , .owner =THIS_MODULE ,
Signature · 1 line
1.6.4.3
PATCH 25/34 don't use __devexit_p to wrap snirm710_driver_remove
In reply to Uwe Kleine-KönigThe function snirm710_driver_remove is defined using __exit, so don't use __devexit_p but __exit_p to wrap it.
--- drivers/scsi/sni_53c710.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/sni_53c710.c +1 -1
@@ -133,7 +133,7 @@ static int __exit snirm710_driver_remove(struct platform_device *dev)static struct platform_driver snirm710_driver = { .probe = snirm710_probe, - .remove =__devexit_p (snirm710_driver_remove), + .remove =__exit_p (snirm710_driver_remove), .driver = { .name ="snirm_53c710" , .owner =THIS_MODULE ,
Signature · 6 lines
1.6.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 26/34 move spidev_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function spidev_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/spi/spidev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spidev.c +1 -1
@@ -610,7 +610,7 @@ static int spidev_probe(struct spi_device *spi)return status; } -static int spidev_remove (struct spi_device *spi) +static int __devexit spidev_remove(struct spi_device *spi) {struct spidev_data *spidev =spi_get_drvdata (spi);
Signature · 13 lines
1.6.4.3 ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ spi-devel-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spi-devel-general
PATCH 27/34 move stex_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function stex_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/scsi/stex.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/stex.c +1 -1
@@ -1679,7 +1679,7 @@ static void stex_hba_free(struct st_hba *hba) hba->dma_mem, hba->dma_handle); } -static void stex_remove (struct pci_dev *pdev) +static void __devexit stex_remove(struct pci_dev *pdev) {struct st_hba *hba =pci_get_drvdata (pdev);
Signature · 1 line
1.6.4.3
PATCH 28/34 move vhci_hcd_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function vhci_hcd_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/staging/usbip/vhci_hcd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/usbip/vhci_hcd.c +1 -1
@@ -1131,7 +1131,7 @@ static int vhci_hcd_probe(struct platform_device *pdev) } -static int vhci_hcd_remove (struct platform_device *pdev) +static int __devexit vhci_hcd_remove(struct platform_device *pdev) {struct usb_hcd *hcd;
Signature · 1 line
1.6.4.3
PATCH 29/34 move virtballoon_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function virtballoon_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/virtio/virtio_balloon.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/virtio/virtio_balloon.c +1 -1
@@ -248,7 +248,7 @@ out:return err; } -static void virtballoon_remove (struct virtio_device *vdev) +static void __devexit virtballoon_remove(struct virtio_device *vdev) {struct virtio_balloon *vb = vdev->priv;
Signature · 1 line
1.6.4.3
Re: [PATCH 29/34] move virtballoon_remove to .devexit.text
Quoted 8 lines · Uwe Kleine-König
The function
virtballoon_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>Cc Rusty Russell <[email protected]>Cc Michael S. Tsirkin <[email protected]>
Generally I think all remove pointers on virtio bus are devexit. How do you find all these, and remember to mark new ones properly? Can we annotate the remove pointer in struct virtio_driver so that sparse can find them?
Quoted 19 lines
--- drivers/virtio/virtio_balloon.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/virtio/virtio_balloon.c +1
-1@@ -248,7 +248,7 @@ out:return err; } -static void virtballoon_remove (struct virtio_device *vdev) +static void __devexit virtballoon_remove(struct virtio_device *vdev) {struct virtio_balloon *vb = vdev->priv;Signature · 1 line
1.6.4.3
Re: [PATCH 29/34] move virtballoon_remove to .devexit.text
Hello Michael,
Quoted 10 lines · Michael S. Tsirkin
Quoted 8 lines · Uwe Kleine-König
The function
virtballoon_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>Cc Rusty Russell <[email protected]>Cc Michael S. Tsirkin <[email protected]>
Quoted 3 lines
Generally I think all remove pointers on virtio bus are devexit.
That means I missed something?
Quoted 2 lines
How do
you find all these,
I have a script that only generates few false-positives (and an unknown number of false-negatives).
Quoted 1 line
and remember to mark new ones properly?
I don't understand that question. You need to have understood how these markings work and do it right.
Quoted 3 lines
Can we
annotate the remove pointer in structvirtio_driverso that sparse can find them?
I already thought about a runtime check. I didn't implement anything yet though.
I can give you my script that finds problems for platform_drivers. You should be able to adapt it for other types of drivers easily. When most platform_driver patches are in, I plan to look at pci.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Michael S. Tsirkin
maintainerRe: [PATCH 29/34] move virtballoon_remove to .devexit.text
Quoted 13 lines · Uwe Kleine-König
Hello Michael,
Quoted 10 lines · Michael S. Tsirkin
Quoted 8 lines · Uwe Kleine-König
The function
virtballoon_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>Cc Rusty Russell <[email protected]>Cc Michael S. Tsirkin <[email protected]>
Quoted 4 lines
Quoted 3 lines
Generally I think all remove pointers on virtio bus are devexit.
That means I missed something?
I meant to say, they *should* be devexit.
Rusty Russell
AppliedRe: [PATCH 29/34] move virtballoon_remove to .devexit.text
In reply to Uwe Kleine-KönigQuoted 2 lines · Uwe Kleine-König
The function
virtballoon_removeis used only wrapped by__devexit_pso define it using__devexit.
Thanks, applied!
Rusty.
PATCH 30/34 move virtnet_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function virtnet_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/net/virtio_net.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/virtio_net.c +1 -1
@@ -948,7 +948,7 @@ free:return err; } -static void virtnet_remove (struct virtio_device *vdev) +static void __devexit virtnet_remove(struct virtio_device *vdev) {struct virtnet_info *vi = vdev->priv;struct sk_buff *skb;
Signature · 1 line
1.6.4.3
PATCH 31/34 move virtrng_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function virtrng_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/char/hw_random/virtio-rng.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/hw_random/virtio-rng.c +1 -1
@@ -117,7 +117,7 @@ static int virtrng_probe(struct virtio_device *vdev)return 0 ; } -static void virtrng_remove (struct virtio_device *vdev) +static void __devexit virtrng_remove(struct virtio_device *vdev) { vdev->config->reset (vdev);hwrng_unregister (&virtio_hwrng);
Signature · 1 line
1.6.4.3
Re: [PATCH 31/34] move virtrng_remove to .devexit.text
Am Donnerstag 01 Oktober 2009 10:28:35 schrieb Uwe Kleine-König:
Quoted 8 lines
The function
virtrng_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>Cc Rusty Russell <[email protected]>Cc Michael S. Tsirkin <[email protected]>Cc Christian Borntraeger <[email protected]>
It seems that there are similar changes possible in other virtio drivers (e.g. virtio_net).
[...]
Quoted 2 lines
drivers/char/hw_random/virtio-rng.c +1
-1-static void virtrng_remove (struct virtio_device *vdev) +static void __devexit virtrng_remove(struct virtio_device *vdev)
[...]
Re: [PATCH 31/34] move virtrng_remove to .devexit.text
Quoted 11 lines · Christian Borntraeger
Am Donnerstag 01 Oktober 2009 10:28:35 schrieb Uwe Kleine-König:
Quoted 8 lines
The function
virtrng_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>Cc Rusty Russell <[email protected]>Cc Michael S. Tsirkin <[email protected]>Cc Christian Borntraeger <[email protected]>
Thanks
Quoted 2 lines
It seems that there are similar changes possible in other virtio drivers (e.g.
virtio_net).
I think I once had a patch for that, but while updating the series it was dropped. I'll recheck for the next iteration.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 31/34] move virtrng_remove to .devexit.text
In reply to Christian BorntraegerQuoted 11 lines · Christian Borntraeger
Am Donnerstag 01 Oktober 2009 10:28:35 schrieb Uwe Kleine-König:
Quoted 8 lines
The function
virtrng_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>Cc Rusty Russell <[email protected]>Cc Michael S. Tsirkin <[email protected]>Cc Christian Borntraeger <[email protected]>
FWIW
Quoted 2 lines
It seems that there are similar changes possible in other virtio drivers (e.g.
virtio_net).
Yes, and more importantly drivers/virtio/virtio.c as well.
Quoted 5 lines
[...]
Quoted 2 lines
drivers/char/hw_random/virtio-rng.c +1
-1-static void virtrng_remove (struct virtio_device *vdev) +static void __devexit virtrng_remove(struct virtio_device *vdev)[...]
Re: [PATCH 31/34] move virtrng_remove to .devexit.text
Hello,
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Christian Borntraeger
Am Donnerstag 01 Oktober 2009 10:28:35 schrieb Uwe Kleine-König:
Quoted 8 lines
The function
virtrng_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>Cc Rusty Russell <[email protected]>Cc Michael S. Tsirkin <[email protected]>Cc Christian Borntraeger <[email protected]>
Quoted 4 lines
Quoted 1 line
FWIW
ok
Quoted 2 lines
Quoted 2 lines
It seems that there are similar changes possible in other virtio drivers (e.g.
virtio_net).
http://thread.gmane.org/gmane.linux.kernel/896297/focus=896309
Quoted 1 line
Yes, and more importantly
drivers/virtio/virtio.cas well.
Hm, I don't see it:
$ git grep -E '__(dev)?exit_p' linus/master:drivers/virtio/virtio.c
$
Well, you could add something, but adding __devexit is a noop for most kernels. It matters only if you don't have CONFIG_HOTPLUG.
In this series I only addressed drivers that use __{,dev}exit and __{,dev}exit_p inconsistenly. I.e. my script greps for __{,dev}exit_p and checks the prototype of the wrapped function. I have another script that does a similar check for platform_devices in general. This one also notices if you have a __devexit function that isn't wrapped by __devexit_p.
So if you want to see drivers/virtio/virtio.c improving, send patches yourself :-)
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Michael S. Tsirkin
maintainerRe: [PATCH 31/34] move virtrng_remove to .devexit.text
Quoted 25 lines · Uwe Kleine-König
Hello,
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Christian Borntraeger
Am Donnerstag 01 Oktober 2009 10:28:35 schrieb Uwe Kleine-König:
Quoted 8 lines
The function
virtrng_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>Cc Rusty Russell <[email protected]>Cc Michael S. Tsirkin <[email protected]>Cc Christian Borntraeger <[email protected]>Quoted 4 lines
Quoted 1 line
FWIW
ok
Quoted 2 lines
Quoted 2 lines
It seems that there are similar changes possible in other virtio drivers (e.g.
virtio_net).http://thread.gmane.org/gmane.linux.kernel/896297/focus=896309
Quoted 1 line
Yes, and more importantly
drivers/virtio/virtio.cas well.
Quoted 8 lines
Hm, I don't see it:
$ git grep -E '__(dev)?exit_p' linus/master:drivers/virtio/virtio.c$Well, you could add something, but adding
__devexitis a noop for most kernels. It matters only if you don't haveCONFIG_HOTPLUG.
And MODULE.
Quoted 6 lines
In this series I only addressed drivers that use __{,dev}exit and __{,dev}exit_p inconsistenly. I.e. my script greps for __{,dev}exit_p and checks the prototype of the wrapped function. I have another script that does a similar check for
platform_devicesin general. This one also notices if you have a__devexitfunction that isn't wrapped by__devexit_p.
Can we teach sparse about this?
Quoted 2 lines
So if you want to see
drivers/virtio/virtio.cimproving, send patches yourself :-)
Here's my reasoning:include/linux/virtio.h defines virtio_driver, and remove pointer there is only used on hot-unplug or module removal.
This is the only reason I see that we can make device removal as devexit. So we can make all of them devexit then?
Quoted 6 lines
Best regards
UweSignature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 31/34] move virtrng_remove to .devexit.text
Hello,
Quoted 28 lines · Michael S. Tsirkin
Quoted 27 lines · Uwe Kleine-König
Hello,
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Christian Borntraeger
Am Donnerstag 01 Oktober 2009 10:28:35 schrieb Uwe Kleine-König:
Quoted 8 lines
The function
virtrng_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>Cc Rusty Russell <[email protected]>Cc Michael S. Tsirkin <[email protected]>Cc Christian Borntraeger <[email protected]>Quoted 4 lines
Quoted 1 line
FWIW
ok
Quoted 2 lines
Quoted 2 lines
It seems that there are similar changes possible in other virtio drivers (e.g.
virtio_net).http://thread.gmane.org/gmane.linux.kernel/896297/focus=896309
Quoted 1 line
Yes, and more importantly
drivers/virtio/virtio.cas well.Hm, I don't see it:
Quoted 8 lines
Quoted 6 lines
$ git grep -E '__(dev)?exit_p' linus/master:drivers/virtio/virtio.c$Well, you could add something, but adding
__devexitis a noop for most kernels. It matters only if you don't haveCONFIG_HOTPLUG.And MODULE.
Well, discarding does not really depend on CONFIG_MODULE. .devexit sections are only discarded from vmlinux (and not modules) and only if CONFIG_HOTPLUG=n. So my statement could be extended to:
Adding __devexit is a noop for most kernels. It matters only if you don't have CONFIG_HOTPLUG and then only for code that is not compiled as a module.
Quoted 8 lines
Quoted 6 lines
In this series I only addressed drivers that use __{,dev}exit and __{,dev}exit_p inconsistenly. I.e. my script greps for __{,dev}exit_p and checks the prototype of the wrapped function. I have another script that does a similar check for
platform_devicesin general. This one also notices if you have a__devexitfunction that isn't wrapped by__devexit_p.Can we teach sparse about this?
I don't know much about sparse, better ask on linux-sparse.
Quoted 8 lines
Quoted 2 lines
So if you want to see
drivers/virtio/virtio.cimproving, send patches yourself :-)Here's my reasoning:
include/linux/virtio.hdefinesvirtio_driver, and remove pointer there is only used on hot-unplug or module removal.
This is the only reason I see that we can make device removal as devexit. So we can make all of them devexit then?
Exactly the same applies to platform_drivers. The remove callback is only called if the driver is unregistered or the device is unbound.
But note it's not an error in general to use a .text function as remove callback. E.g. take drivers/gpio/twl4030-gpio.c. gpio_twl4030_remove is used in gpio_twl4030_probe which is defined using __devinit. So using __devexit for gpio_twl4030_remove is wrong. (So there is a bug, as gpio_twl4030_remove uses __devexit.) I didn't try, but as far as I understand this will result in a compile error if the driver is built-in with HOTPLUG=n.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Michael S. Tsirkin
maintainerRe: [PATCH 31/34] move virtrng_remove to .devexit.text
Quoted 68 lines · Uwe Kleine-König
Hello,
Quoted 28 lines · Michael S. Tsirkin
Quoted 27 lines · Uwe Kleine-König
Hello,
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Christian Borntraeger
Am Donnerstag 01 Oktober 2009 10:28:35 schrieb Uwe Kleine-König:
Quoted 8 lines
The function
virtrng_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Sam Ravnborg <[email protected]>Cc Rusty Russell <[email protected]>Cc Michael S. Tsirkin <[email protected]>Cc Christian Borntraeger <[email protected]>Quoted 4 lines
Quoted 1 line
FWIW
ok
Quoted 2 lines
Quoted 2 lines
It seems that there are similar changes possible in other virtio drivers (e.g.
virtio_net).http://thread.gmane.org/gmane.linux.kernel/896297/focus=896309
Quoted 1 line
Yes, and more importantly
drivers/virtio/virtio.cas well.Hm, I don't see it:
Quoted 8 lines
Quoted 6 lines
$ git grep -E '__(dev)?exit_p' linus/master:drivers/virtio/virtio.c$Well, you could add something, but adding
__devexitis a noop for most kernels. It matters only if you don't haveCONFIG_HOTPLUG.And MODULE.
Well, discarding does not really depend on
CONFIG_MODULE. .devexit sections are only discarded from vmlinux (and not modules) and only ifCONFIG_HOTPLUG=n. So my statement could be extended to:Adding
__devexitis a noop for most kernels. It matters only if you don't haveCONFIG_HOTPLUGand then only for code that is not compiled as a module.Quoted 8 lines
Quoted 6 lines
In this series I only addressed drivers that use __{,dev}exit and __{,dev}exit_p inconsistenly. I.e. my script greps for __{,dev}exit_p and checks the prototype of the wrapped function. I have another script that does a similar check for
platform_devicesin general. This one also notices if you have a__devexitfunction that isn't wrapped by__devexit_p.Can we teach sparse about this?
I don't know much about sparse, better ask on linux-sparse.
Quoted 8 lines
Quoted 2 lines
So if you want to see
drivers/virtio/virtio.cimproving, send patches yourself :-)Here's my reasoning:
include/linux/virtio.hdefinesvirtio_driver, and remove pointer there is only used on hot-unplug or module removal.
This is the only reason I see that we can make device removal as devexit. So we can make all of them devexit then?Exactly the same applies to
platform_drivers. The remove callback is only called if the driver is unregistered or the device is unbound.
Quoted 7 lines
But note it's not an error in general to use a .text function as remove callback. E.g. take
drivers/gpio/twl4030-gpio.c.gpio_twl4030_removeis used ingpio_twl4030_probewhich is defined using__devinit. So using__devexitforgpio_twl4030_removeis wrong. (So there is a bug, asgpio_twl4030_removeuses__devexit.) I didn't try, but as far as I understand this will result in a compile error if the driver is built-in with HOTPLUG=n.
Wait a second.
As far as I understand, __devexit makes it possible to remove code if hotplug is off.
At least for static functions, it's enough to mark their only use as _devexit_p, and compiler will remove the text as it's unused.
Isn't that right?
If so, what, again, was the motivation for the patches that added __devexit to functions that were already used with __devexit_p?
Quoted 6 lines
Best regards
UweSignature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 31/34] move virtrng_remove to .devexit.text
Hello Michael,
Quoted 11 lines
Quoted 7 lines
But note it's not an error in general to use a .text function as remove callback. E.g. take
drivers/gpio/twl4030-gpio.c.gpio_twl4030_removeis used ingpio_twl4030_probewhich is defined using__devinit. So using__devexitforgpio_twl4030_removeis wrong. (So there is a bug, asgpio_twl4030_removeuses__devexit.) I didn't try, but as far as I understand this will result in a compile error if the driver is built-in with HOTPLUG=n.Wait a second.
As far as I understand,__devexitmakes it possible to remove code if hotplug is off.
right.
Quoted 4 lines
At least for static functions, it's enough to mark their only use as
_devexit_p, and compiler will remove the text as it's unused.Isn't that right?
hmm, I don't know. I'll try, one moment. OK, you're right. The function is discarded with a compiler warning.
Quoted 2 lines
If so, what, again, was the motivation for the patches that added
__devexitto functions that were already used with__devexit_p?
I thought it saves some memory, but as it looks now it only fixes a compiler warning.
Note there are two types of errors fixed in this series. One is:
-static int func(void arg)
+static int __devexit func(void arg)
if the only usage of func() is wraped by __devexit_p. This is (as seen above) not that critical, there is only a warning fixed.
The other type results in a build failure:
-remove = __devexit_p(another_func), +remove = __exit_p(another_func),
with another_func being defined using __exit. In the case defined(MODULE) && defined(CONFIG_HOTPLUG) another_func is discarded, but __devexit_p(another_func) evaluates to another_func and thus the module doesn't link.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Michael S. Tsirkin
maintainerRe: [PATCH 31/34] move virtrng_remove to .devexit.text
Quoted 18 lines · Uwe Kleine-König
Hello Michael,
Quoted 11 lines
Quoted 7 lines
But note it's not an error in general to use a .text function as remove callback. E.g. take
drivers/gpio/twl4030-gpio.c.gpio_twl4030_removeis used ingpio_twl4030_probewhich is defined using__devinit. So using__devexitforgpio_twl4030_removeis wrong. (So there is a bug, asgpio_twl4030_removeuses__devexit.) I didn't try, but as far as I understand this will result in a compile error if the driver is built-in with HOTPLUG=n.Wait a second.
As far as I understand,__devexitmakes it possible to remove code if hotplug is off.right.
Quoted 3 lines
At least for static functions, it's enough to mark their only use as
_devexit_p, and compiler will remove the text as it's unused.
Quoted 8 lines
Quoted 1 line
Isn't that right?
hmm, I don't know. I'll try, one moment. OK, you're right. The function is discarded with a compiler warning.
Quoted 2 lines
If so, what, again, was the motivation for the patches that added
__devexitto functions that were already used with__devexit_p?I thought it saves some memory, but as it looks now it only fixes a compiler warning.
We can redefine __devexit_p(x) to something like #define __devexit_p(x) ((typeof(x) *)NULL)
and this will shut down the warning without need to fix the code.
Using _devexit_p for static functions is also safer than __devexit since if you define a function as __devexit and by mistake call it from another context, it won't link.
Makes sense?
Quoted 10 lines
Note there are two types of errors fixed in this series. One is:
-static int func(void arg)
+static int__devexitfunc(void arg)if the only usage of
func()is wraped by__devexit_p. This is (as seen above) not that critical, there is only a warning fixed.The other type results in a build failure:
Quoted 7 lines
-remove = __devexit_p(another_func), +remove = __exit_p(another_func),with
another_funcbeing defined using__exit. In the case defined(MODULE) &&defined(CONFIG_HOTPLUG)another_funcis discarded, but__devexit_p(another_func)evaluates toanother_funcand thus the module doesn't link.
Yes, calling __exit function from non- __exit is always a bug. I think there's a make flag to warn about this, not sure why it's not the default.
Quoted 6 lines
Best regards
UweSignature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH 31/34] move virtrng_remove to .devexit.text
Hello Michael,
Quoted 23 lines · Michael S. Tsirkin
Quoted 22 lines · Uwe Kleine-König
Hello Michael,
Quoted 11 lines
Quoted 7 lines
But note it's not an error in general to use a .text function as remove callback. E.g. take
drivers/gpio/twl4030-gpio.c.gpio_twl4030_removeis used ingpio_twl4030_probewhich is defined using__devinit. So using__devexitforgpio_twl4030_removeis wrong. (So there is a bug, asgpio_twl4030_removeuses__devexit.) I didn't try, but as far as I understand this will result in a compile error if the driver is built-in with HOTPLUG=n.Wait a second.
As far as I understand,__devexitmakes it possible to remove code if hotplug is off.right.
Quoted 4 lines
At least for static functions, it's enough to mark their only use as
_devexit_p, and compiler will remove the text as it's unused.Isn't that right?
hmm, I don't know. I'll try, one moment. OK, you're right. The function is discarded with a compiler warning.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
If so, what, again, was the motivation for the patches that added
__devexitto functions that were already used with__devexit_p?I thought it saves some memory, but as it looks now it only fixes a compiler warning.
We can redefine
__devexit_p(x)to something like #define__devexit_p(x)((typeof(x) *)NULL)
and this will shut down the warning without need to fix the code.
Mmmmh, don't know. A definitive advantage is that there is only a single point in the code that defines if a function is discarded or not. Nothing that needs to be consistent.
For me it feels somehow wrong anyhow, but that might be only because I'm used to the current model.
Quoted 13 lines
Quoted 13 lines
Note there are two types of errors fixed in this series. One is:
-static int func(void arg)
+static int__devexitfunc(void arg)if the only usage of
func()is wraped by__devexit_p. This is (as seen above) not that critical, there is only a warning fixed.The other type results in a build failure:
-remove = __devexit_p(another_func), +remove = __exit_p(another_func),
Quoted 8 lines
Quoted 4 lines
with
another_funcbeing defined using__exit. In the case defined(MODULE) &&defined(CONFIG_HOTPLUG)another_funcis discarded, but__devexit_p(another_func)evaluates toanother_funcand thus the module doesn't link.Yes, calling
__exitfunction from non-__exitis always a bug. I think there's a make flag to warn about this, not sure why it's not the default.
I think it was disabled because there were too many warnings :-)
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 32/34 don't use __devexit_p to wrap zalon_remove
In reply to Uwe Kleine-KönigThe function zalon_remove is defined using __exit, so don't use __devexit_p but __exit_p to wrap it.
--- drivers/scsi/zalon.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/zalon.c +1 -1
@@ -182,7 +182,7 @@ static struct parisc_driver zalon_driver = { .name = "zalon", .id_table = zalon_tbl, .probe = zalon_probe, - .remove = __devexit_p(zalon_remove), + .remove = __exit_p(zalon_remove), };static int __init zalon7xx_init (void )
Signature · 6 lines
1.6.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 33/34 move lis3l02dq_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function lis3l02dq_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/staging/iio/accel/lis3l02dq_core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/iio/accel/lis3l02dq_core.c +1 -1
@@ -871,7 +871,7 @@ err_ret: }/* fixme, confirm ordering in this function */ -static int lis3l02dq_remove (struct spi_device *spi) +static int __devexit lis3l02dq_remove(struct spi_device *spi) {int ret;struct lis3l02dq_state *st =spi_get_drvdata (spi);
Signature · 1 line
1.6.4.3
Re: [PATCH 33/34] move lis3l02dq_remove to .devexit.text
Thanks Uwe
Quoted 24 lines
The function
lis3l02dq_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Greg Kroah-Hartman <[email protected]>--- drivers/staging/iio/accel/lis3l02dq_core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/staging/iio/accel/lis3l02dq_core.c +1
-1@@ -871,7 +871,7 @@ err_ret: }/* fixme, confirm ordering in this function */ -static int lis3l02dq_remove (struct spi_device *spi) +static int __devexit lis3l02dq_remove(struct spi_device *spi) {int ret;struct lis3l02dq_state *st =spi_get_drvdata (spi);
PATCH 34/34 move sca3000_remove to .devexit.text
In reply to Uwe Kleine-KönigThe function sca3000_remove is used only wrapped by __devexit_p so define it using __devexit.
--- drivers/staging/iio/accel/sca3000_core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/iio/accel/sca3000_core.c +1 -1
@@ -1393,7 +1393,7 @@ error_ret: } -static int sca3000_remove (struct spi_device *spi) +static int __devexit sca3000_remove(struct spi_device *spi) {struct sca3000_state *st =spi_get_drvdata (spi);struct iio_dev *indio_dev = st->indio_dev;
Signature · 1 line
1.6.4.3
Re: [PATCH 34/34] move sca3000_remove to .devexit.text
Hi Uwe,
Thanks,
Quoted 24 lines
The function
sca3000_removeis used only wrapped by__devexit_pso define it using__devexit.Signed-off-by Uwe Kleine-König <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Greg Kroah-Hartman <[email protected]>--- drivers/staging/iio/accel/sca3000_core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/staging/iio/accel/sca3000_core.c +1
-1@@ -1393,7 +1393,7 @@ error_ret: } -static int sca3000_remove (struct spi_device *spi) +static int __devexit sca3000_remove(struct spi_device *spi) {struct sca3000_state *st =spi_get_drvdata (spi);struct iio_dev *indio_dev = st->indio_dev;