diff mbox

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

Message ID 002b01cfc65d$569ef570$03dce050$%han@samsung.com (mailing list archive)
State Accepted
Commit ef4172daee43ddcef99ecbe2e605d7aca0339b9b
Headers show

Commit Message

Jingoo Han Sept. 2, 2014, 3:24 a.m. UTC
Remove unnecessary  #if defined(CONFIG_OF), because this is
already handled by the of_match_ptr macro.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/spi/spi-atmel.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Nicolas Ferre Sept. 2, 2014, 7:49 a.m. UTC | #1
On 02/09/2014 05:24, Jingoo Han :
> Remove unnecessary  #if defined(CONFIG_OF), because this is
> already handled by the of_match_ptr macro.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

Ok:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  drivers/spi/spi-atmel.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
> index 113c83f44b5c..9f5066fa1473 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -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		= {
>
Mark Brown Sept. 2, 2014, 10:50 a.m. UTC | #2
On Tue, Sep 02, 2014 at 12:24:00PM +0900, Jingoo Han wrote:
> Remove unnecessary  #if defined(CONFIG_OF), because this is
> already handled by the of_match_ptr macro.

Applied, thanks.
Geert Uytterhoeven Sept. 2, 2014, 12:15 p.m. UTC | #3
On Tue, Sep 2, 2014 at 12:50 PM, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Sep 02, 2014 at 12:24:00PM +0900, Jingoo Han wrote:
>> 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 -- geert@linux-m68k.org

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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown Sept. 2, 2014, 4:36 p.m. UTC | #4
On Tue, Sep 02, 2014 at 02:15:09PM +0200, Geert Uytterhoeven wrote:
> On Tue, Sep 2, 2014 at 12:50 PM, Mark Brown <broonie@kernel.org> wrote:
> > On Tue, Sep 02, 2014 at 12:24:00PM +0900, Jingoo Han wrote:
> >> 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.
Jingoo Han Sept. 3, 2014, 1:25 a.m. UTC | #5
On Wednesday, September 03, 2014 1:37 AM, Mark Brown wrote:
> On Tue, Sep 02, 2014 at 02:15:09PM +0200, Geert Uytterhoeven wrote:
> > On Tue, Sep 2, 2014 at 12:50 PM, Mark Brown <broonie@kernel.org> wrote:
> > > On Tue, Sep 02, 2014 at 12:24:00PM +0900, Jingoo Han wrote:
> > >> 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.

(+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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown Sept. 3, 2014, 2:42 p.m. UTC | #6
On Wed, Sep 03, 2014 at 10:25:02AM +0900, Jingoo Han wrote:

> 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.
diff mbox

Patch

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 113c83f44b5c..9f5066fa1473 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -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		= {