Skip to contentSkip to conversation

spi: altera: remove unnecessary #ifdef CONFIG_OF

PATCH Applied Jingoo Han 6 participants 14 messages Sep 2, 2014 – Sep 3, 2014 8 messages not in the archive

Subsystems (4)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/4 spi: altera: remove unnecessary #ifdef CONFIG_OF

Remove unnecessary #ifdef CONFIG_OF, because this is already handled by the of_match_ptr macro.

---
 drivers/spi/spi-altera.c | 2 --
 1 file changed, 2 deletions(-)
drivers/spi/spi-altera.c +0 -2
index 5b5709a5c957..588d428f47c8 100644
@@ -268,14 +268,12 @@ static int altera_spi_remove(struct platform_device *dev)
 	return 0;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id altera_spi_match[] = {
 	{ .compatible = "ALTR,spi-1.0", },
 	{ .compatible = "altr,spi-1.0", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, altera_spi_match);
-#endif /* CONFIG_OF */
 
 static struct platform_driver altera_spi_driver = {
 	.probe = altera_spi_probe,
Signature · 7 lines
2.0.0


--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 002a01cfc65d$2dc86640$895932c0$%[email protected]

author
#2 lore raw

PATCH 2/4 spi: atmel: remove unnecessary #if defined(CONFIG_OF)

Remove unnecessary #if defined(CONFIG_OF), because this is already handled by the of_match_ptr macro.

---
 drivers/spi/spi-atmel.c | 2 --
 1 file changed, 2 deletions(-)
drivers/spi/spi-atmel.c +0 -2
index 113c83f44b5c..9f5066fa1473 100644
@@ -1481,14 +1481,12 @@ static SIMPLE_DEV_PM_OPS(atmel_spi_pm_ops, atmel_spi_suspend, atmel_spi_resume);
 #define ATMEL_SPI_PM_OPS	NULL
 #endif
 
-#if defined(CONFIG_OF)
 static const struct of_device_id atmel_spi_dt_ids[] = {
 	{ .compatible = "atmel,at91rm9200-spi" },
 	{ /* sentinel */ }
 };
 
 MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
-#endif
 
 static struct platform_driver atmel_spi_driver = {
 	.driver		= {
Signature · 7 lines
2.0.0


--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 002b01cfc65d$569ef570$03dce050$%[email protected]

Acked-by
#4 lore raw

Re: [PATCH 2/4] spi: atmel: remove unnecessary #if defined(CONFIG_OF)

On 02/09/2014 05:24, Jingoo Han :

Quoted 4 lines

Remove unnecessary #if defined(CONFIG_OF), because this is already handled by the of_match_ptr macro.

Ok:

Quoted 24 lines
---
 drivers/spi/spi-atmel.c | 2 --
 1 file changed, 2 deletions(-)
drivers/spi/spi-atmel.c +0 -2
index 113c83f44b5c..9f5066fa1473 100644
@@ -1481,14 +1481,12 @@ static SIMPLE_DEV_PM_OPS(atmel_spi_pm_ops, atmel_spi_suspend, atmel_spi_resume);
 #define ATMEL_SPI_PM_OPS	NULL
 #endif
 
-#if defined(CONFIG_OF)
 static const struct of_device_id atmel_spi_dt_ids[] = {
 	{ .compatible = "atmel,at91rm9200-spi" },
 	{ /* sentinel */ }
 };
 
 MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
-#endif
 
 static struct platform_driver atmel_spi_driver = {
 	.driver		= {
Signature · 5 lines
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Applied
#5 lore raw

Re: [PATCH 2/4] spi: atmel: remove unnecessary #if defined(CONFIG_OF)

In reply to a message not in the archive
Quoted 2 lines · Jingoo Han

Remove unnecessary #if defined(CONFIG_OF), because this is already handled by the of_match_ptr macro.

Applied, thanks.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

Re: [PATCH 2/4] spi: atmel: remove unnecessary #if defined(CONFIG_OF)

Quoted 5 lines · Mark Brown
Quoted 2 lines · Jingoo Han

Remove unnecessary #if defined(CONFIG_OF), because this is already handled by the of_match_ptr macro.

Applied, thanks.

If CONFIG_OF is not set, binary size is increased, as the OF match table is still emitted, while it's no longer in use:

m68k allmodconfig:

text data bss dec hex filename

   7318    373      0   7691   1e0b drivers/spi/spi-atmel.o.old
   7710    373      0   8083   1f93 drivers/spi/spi-atmel.o.new
  10037    781      0  10818   2a42 drivers/spi/spi-atmel.ko.old
  10465    781      0  11246   2bee drivers/spi/spi-atmel.ko.new

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CAMuHMdU2S_vwv3=CUtgGjqnq-nbh=up42gDWzR35ai6s4ZVaWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#9 lore raw

Re: [PATCH 2/4] spi: atmel: remove unnecessary #if defined(CONFIG_OF)

Quoted 9 lines · Geert Uytterhoeven
Quoted 5 lines · Mark Brown
Quoted 2 lines · Jingoo Han

Remove unnecessary #if defined(CONFIG_OF), because this is already handled by the of_match_ptr macro.

Applied, thanks.

If CONFIG_OF is not set, binary size is increased, as the OF match table is still emitted, while it's no longer in use:

OK, I've discarded the series.

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#11 lore raw

Re: [PATCH 2/4] spi: atmel: remove unnecessary #if defined(CONFIG_OF)

Quoted 6 lines · Mark Brown
Quoted 4 lines · Geert Uytterhoeven
Quoted 3 lines · Mark Brown
Quoted 2 lines · Jingoo Han

Remove unnecessary #if defined(CONFIG_OF), because this is already handled by the of_match_ptr macro.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Applied, thanks.

If CONFIG_OF is not set, binary size is increased, as the OF match table is still emitted, while it's no longer in use:

OK, I've discarded the series.

(+cc Axel Lin, Max Filippov)

OK, I see. I appreciate Geert's feedback. :-)

However, personally I don't like #ifdef guards. I think that #ifdef guards can be removed for the same binary, regardless of kernel config options.

In this case, the binary size is more important than #ifdef guards, right?

Best regards,
Jingoo Han

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 009801cfc715$e27d8030$a7788090$%[email protected]

#13 lore raw

Re: [PATCH 2/4] spi: atmel: remove unnecessary #if defined(CONFIG_OF)

Quoted 6 lines · Jingoo Han

However, personally I don't like #ifdef guards. I think that #ifdef guards can be removed for the same binary, regardless of kernel config options.

In this case, the binary size is more important than #ifdef guards, right?

Right. The ideal thing would be to teach the module table stuff to disable itself when the relevant support isn't in the kernel but that's probably going to be hard to do in a tasteful fashion; perhaps wrappers (OF_MODULE_TABLE) might be OK.

author
#14 lore raw

PATCH 3/4 spi: oc-tiny: remove unnecessary #ifdef CONFIG_OF

In reply to a message not in the archive

Remove unnecessary #ifdef CONFIG_OF, because this is already handled by the of_match_ptr macro.

---
 drivers/spi/spi-oc-tiny.c | 2 --
 1 file changed, 2 deletions(-)
drivers/spi/spi-oc-tiny.c +0 -2
index 8998d11c7238..baac441fa6f6 100644
@@ -338,13 +338,11 @@ static int tiny_spi_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id tiny_spi_match[] = {
 	{ .compatible = "opencores,tiny-spi-rtlsvn2", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, tiny_spi_match);
-#endif /* CONFIG_OF */
 
 static struct platform_driver tiny_spi_driver = {
 	.probe = tiny_spi_probe,
Signature · 7 lines
2.0.0


--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#15 lore raw

PATCH 4/4 spi: xtensa-xtfpga: remove unnecessary #ifdef CONFIG_OF

In reply to a message not in the archive

Remove unnecessary #ifdef CONFIG_OF, because this is already handled by the of_match_ptr macro.

---
 drivers/spi/spi-xtensa-xtfpga.c | 2 --
 1 file changed, 2 deletions(-)
drivers/spi/spi-xtensa-xtfpga.c +0 -2
index 41e158187f9d..553b5e189273 100644
@@ -146,13 +146,11 @@ static int xtfpga_spi_remove(struct platform_device *pdev)
 
 MODULE_ALIAS("platform:" XTFPGA_SPI_NAME);
 
-#ifdef CONFIG_OF
 static const struct of_device_id xtfpga_spi_of_match[] = {
 	{ .compatible = "cdns,xtfpga-spi", },
 	{}
 };
 MODULE_DEVICE_TABLE(of, xtfpga_spi_of_match);
-#endif
 
 static struct platform_driver xtfpga_spi_driver = {
 	.probe = xtfpga_spi_probe,
Signature · 7 lines
2.0.0


--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 002d01cfc65d$9fa78d90$def6a8b0$%[email protected]

Acked-by
#17 lore raw

Re: [PATCH 4/4] spi: xtensa-xtfpga: remove unnecessary #ifdef CONFIG_OF

Quoted 7 lines · Jingoo Han

Remove unnecessary #ifdef CONFIG_OF, because this is already handled by the of_match_ptr macro.

---
 drivers/spi/spi-xtensa-xtfpga.c | 2 --
 1 file changed, 2 deletions(-)
Signature · 6 lines
Thanks.
-- Max
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Applied
#18 lore raw

Re: [PATCH 4/4] spi: xtensa-xtfpga: remove unnecessary #ifdef CONFIG_OF

In reply to a message not in the archive
Quoted 2 lines · Jingoo Han

Remove unnecessary #ifdef CONFIG_OF, because this is already handled by the of_match_ptr macro.

Applied, thanks.

#19 lore raw
In reply to a message not in the archive

2014-09-02 11:22 GMT+08:00 Jingoo Han <[email protected]>:

Quoted 14 lines

Remove unnecessary #ifdef CONFIG_OF, because this is already handled by the of_match_ptr macro.

---
 drivers/spi/spi-altera.c | 2 --
 1 file changed, 2 deletions(-)
drivers/spi/spi-altera.c +0 -0
index 5b5709a5c957..588d428f47c8 100644
@@ -268,14 +268,12 @@ static int altera_spi_remove(struct platform_device *dev)
        return 0;

drivers/spi/spi-altera.c static int altera_spi_remove(struct platform_device *dev) · line 278

Quoted 10 lines
drivers/spi/spi-altera.c +0 -2
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id altera_spi_match[] = {
        { .compatible = "ALTR,spi-1.0", },
        { .compatible = "altr,spi-1.0", },
        {},
 };
 MODULE_DEVICE_TABLE(of, altera_spi_match);
-#endif /* CONFIG_OF */

For !CONFIG_OF case:

        #define of_match_ptr(_ptr)      NULL

Can you explain how of_match_ptr() handle this?

Thanks,
Axel
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CAFRkauAD7upo4e1Vc08FAMFamv=Lwy2whzJz3vADtse18kjriA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#21 lore raw
Quoted 10 lines · Axel Lin

drivers/spi/spi-altera.c static int altera_spi_remove(struct platform_device *dev) · line 278

Quoted 8 lines
drivers/spi/spi-altera.c +0 -2
-#ifdef CONFIG_OF
 static const struct of_device_id altera_spi_match[] = {
        { .compatible = "ALTR,spi-1.0", },
        { .compatible = "altr,spi-1.0", },
        {},
 };
 MODULE_DEVICE_TABLE(of, altera_spi_match);
-#endif /* CONFIG_OF */

For !CONFIG_OF case:

Quoted 2 lines
        #define of_match_ptr(_ptr)      NULL

Can you explain how of_match_ptr() handle this?

Unless MODULE_DEVICE_TABLE knows about OF that's not going to trigger the dead code elimination.