Skip to contentSkip to conversation

mmc: dw_mmc-socfpga: Staticize dw_mci_socfpga_probe()

PATCH In review Jingoo Han 4 participants 6 messages Aug 1, 2013 – Aug 9, 2013

Subsystems (2)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/2 mmc: dw_mmc-socfpga: Staticize dw_mci_socfpga_probe()

dw_mci_socfpga_probe() is used only in this file.
Fix the following sparse warning:

drivers/mmc/host/dw_mmc-socfpga.c:116:5: warning: symbol 'dw_mci_socfpga_probe' was not declared. Should it be static?

---
 drivers/mmc/host/dw_mmc-socfpga.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/dw_mmc-socfpga.c +1 -1
index 14b5961..35aebb8 100644
@@ -113,7 +113,7 @@ static const struct of_device_id dw_mci_socfpga_match[] = {
 };
 MODULE_DEVICE_TABLE(of, dw_mci_socfpga_match);
 
-int dw_mci_socfpga_probe(struct platform_device *pdev)
+static int dw_mci_socfpga_probe(struct platform_device *pdev)
 {
 	const struct dw_mci_drv_data *drv_data;
 	const struct of_device_id *match;
Signature · 1 line
1.7.10.4
#1 lore raw

Hi,

Quoted 15 lines · Jingoo Han

dw_mci_socfpga_probe() is used only in this file.
Fix the following sparse warning:

drivers/mmc/host/dw_mmc-socfpga.c:116:5: warning: symbol 'dw_mci_socfpga_probe' was not declared. Should it be static?

---
 drivers/mmc/host/dw_mmc-socfpga.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/dw_mmc-socfpga.c +0 -0
index 14b5961..35aebb8 100644

drivers/mmc/host/dw_mmc-socfpga.c static const struct of_device_id dw_mci_socfpga_match[] = { · line 119

Quoted 8 lines
drivers/mmc/host/dw_mmc-socfpga.c +1 -1
@@ -113,7 +113,7 @@ static const struct of_device_id dw_mci_socfpga_match[] = {
 };
 MODULE_DEVICE_TABLE(of, dw_mci_socfpga_match);
 
-int dw_mci_socfpga_probe(struct platform_device *pdev)
+static int dw_mci_socfpga_probe(struct platform_device *pdev)
 {
 	const struct dw_mci_drv_data *drv_data;
 	const struct of_device_id *match;

This looks good but do you care to fix the other sparse warnings for dw_mmc-pltfm.c too?

drivers/mmc/host/dw_mmc-pltfm.c:58:24: warning: incorrect type in argument 1 (different address spaces)
drivers/mmc/host/dw_mmc-pltfm.c:58:24: expected void const *ptr
drivers/mmc/host/dw_mmc-pltfm.c:58:24: got void [noderef]
<asn:2>*regs
drivers/mmc/host/dw_mmc-pltfm.c:59:36: warning: incorrect type in argument 1 (different address spaces)
drivers/mmc/host/dw_mmc-pltfm.c:59:36: expected void const *ptr
drivers/mmc/host/dw_mmc-pltfm.c:59:36: got void [noderef]
<asn:2>*regs
drivers/mmc/host/dw_mmc-pltfm.c:36:5: warning: symbol 'dw_mci_pltfm_register' was not declared. Should it be static? drivers/mmc/host/dw_mmc-pltfm.c:94:1: warning: symbol 'dw_mci_pltfm_pmops' was not declared. Should it be static?

Dinh

author
#2 lore raw
Quoted 20 lines · Dinh Nguyen
Quoted 4 lines · Jingoo Han

dw_mci_socfpga_probe() is used only in this file.
Fix the following sparse warning:

drivers/mmc/host/dw_mmc-socfpga.c:116:5: warning: symbol 'dw_mci_socfpga_probe' was not declared.

Should it be static?

Quoted 14 lines
---
 drivers/mmc/host/dw_mmc-socfpga.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/dw_mmc-socfpga.c +0 -0
index 14b5961..35aebb8 100644
@@ -113,7 +113,7 @@ static const struct of_device_id dw_mci_socfpga_match[] = {
 };
 MODULE_DEVICE_TABLE(of, dw_mci_socfpga_match);
 
Quoted 8 lines

drivers/mmc/host/dw_mmc-socfpga.c static const struct of_device_id dw_mci_socfpga_match[] = { · line 119

Quoted 5 lines
drivers/mmc/host/dw_mmc-socfpga.c +1 -1
-int dw_mci_socfpga_probe(struct platform_device *pdev)
+static int dw_mci_socfpga_probe(struct platform_device *pdev)
 {
 	const struct dw_mci_drv_data *drv_data;
 	const struct of_device_id *match;

This looks good but do you care to fix the other sparse warnings for dw_mmc-pltfm.c too?

+CC Dan Carpenter,

I will not care fix the other sparse warnings for dw_mmc-pltfm.c.

Quoted 11 lines

drivers/mmc/host/dw_mmc-pltfm.c:58:24: warning: incorrect type in argument 1 (different address spaces)
drivers/mmc/host/dw_mmc-pltfm.c:58:24: expected void const *ptr
drivers/mmc/host/dw_mmc-pltfm.c:58:24: got void [noderef]
<asn:2>*regs
drivers/mmc/host/dw_mmc-pltfm.c:59:36: warning: incorrect type in argument 1 (different address spaces)
drivers/mmc/host/dw_mmc-pltfm.c:59:36: expected void const *ptr
drivers/mmc/host/dw_mmc-pltfm.c:59:36: got void [noderef]
<asn:2>*regs

You mean the following.

58 if (IS_ERR(host->regs))
59 return PTR_ERR(host->regs);

Quoted 1 line

From v3.11-rc1, it does not make sparse warnings,

because of the commit e7152b9 "err.h: IS_ERR() can accept __user pointers" submitted by Dan Carpenter.

Quoted 4 lines

drivers/mmc/host/dw_mmc-pltfm.c:36:5: warning: symbol 'dw_mci_pltfm_register' was not declared. Should it be static? drivers/mmc/host/dw_mmc-pltfm.c:94:1: warning: symbol 'dw_mci_pltfm_pmops' was not declared. Should it be static?

'dw_mci_pltfm_register' and 'dw_mci_pltfm_pmops' are exported as below:

70: EXPORT_SYMBOL_GPL(dw_mci_pltfm_register);
95: EXPORT_SYMBOL_GPL(dw_mci_pltfm_pmops);

So, I am not sure whether these can be static or not. :( Dan, if you know how to handle this, please let me know.

Best regards,
Jingoo Han

#3 lore raw
Quoted 12 lines · Jingoo Han
Quoted 10 lines · Dinh Nguyen

drivers/mmc/host/dw_mmc-pltfm.c:58:24: warning: incorrect type in argument 1 (different address spaces)
drivers/mmc/host/dw_mmc-pltfm.c:58:24: expected void const *ptr
drivers/mmc/host/dw_mmc-pltfm.c:58:24: got void [noderef]
<asn:2>*regs
drivers/mmc/host/dw_mmc-pltfm.c:59:36: warning: incorrect type in argument 1 (different address spaces)
drivers/mmc/host/dw_mmc-pltfm.c:59:36: expected void const *ptr
drivers/mmc/host/dw_mmc-pltfm.c:59:36: got void [noderef]
<asn:2>*regs

Quoted 8 lines

You mean the following.

58 if (IS_ERR(host->regs))
59 return PTR_ERR(host->regs);

Quoted 1 line

From v3.11-rc1, it does not make sparse warnings,

because of the commit e7152b9 "err.h: IS_ERR() can accept __user pointers" submitted by Dan Carpenter.

You have to upgrade to a later version of Sparse as well.

Quoted 7 lines
Quoted 6 lines

drivers/mmc/host/dw_mmc-pltfm.c:36:5: warning: symbol 'dw_mci_pltfm_register' was not declared. Should it be static? drivers/mmc/host/dw_mmc-pltfm.c:94:1: warning: symbol 'dw_mci_pltfm_pmops' was not declared. Should it be static?

Quoted 7 lines

'dw_mci_pltfm_register' and 'dw_mci_pltfm_pmops' are exported as below:

70: EXPORT_SYMBOL_GPL(dw_mci_pltfm_register);
95: EXPORT_SYMBOL_GPL(dw_mci_pltfm_pmops);

So, I am not sure whether these can be static or not. :( Dan, if you know how to handle this, please let me know.

No, don't make these static. The way to silence this warning is to include "dw_mmc-pltfm.h".

regards,
dan carpenter

author
#4 lore raw
Quoted 2 lines · Dan Carpenter
Quoted 1 line · Jingoo Han

On Friday, August 02, 2013 1:19 AM, Dinh Nguyen wrote:

[...]

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

drivers/mmc/host/dw_mmc-pltfm.c:36:5: warning: symbol 'dw_mci_pltfm_register' was not declared. Should it be static? drivers/mmc/host/dw_mmc-pltfm.c:94:1: warning: symbol 'dw_mci_pltfm_pmops' was not declared. Should it be static?

'dw_mci_pltfm_register' and 'dw_mci_pltfm_pmops' are exported as below:

Quoted 8 lines
Quoted 5 lines

70: EXPORT_SYMBOL_GPL(dw_mci_pltfm_register);
95: EXPORT_SYMBOL_GPL(dw_mci_pltfm_pmops);

So, I am not sure whether these can be static or not. :( Dan, if you know how to handle this, please let me know.

No, don't make these static. The way to silence this warning is to include "dw_mmc-pltfm.h".

I really appreciate your answer. :)
Then, I will send the patch to include "dw_mmc-pltfm.h".

Best regards,
Jingoo Han