public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: gpio: Remove unneeded CONFIG_OF
@ 2013-12-07 14:48 Ezequiel Garcia
  2013-12-07 14:54 ` Alexander Shiyan
  0 siblings, 1 reply; 6+ messages in thread
From: Ezequiel Garcia @ 2013-12-07 14:48 UTC (permalink / raw)
  To: linux-mtd; +Cc: Alexander Shiyan, Ezequiel Garcia

Since the of_mtd header provides dummy stubs for !CONFIG_OF, it's safe
to remove the #ifdef CONFIG_OF. Build tested only.

Cc: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 drivers/mtd/nand/gpio.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/mtd/nand/gpio.c b/drivers/mtd/nand/gpio.c
index e826f89..8010975 100644
--- a/drivers/mtd/nand/gpio.c
+++ b/drivers/mtd/nand/gpio.c
@@ -94,7 +94,6 @@ static int gpio_nand_devready(struct mtd_info *mtd)
 	return gpio_get_value(gpiomtd->plat.gpio_rdy);
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id gpio_nand_id_table[] = {
 	{ .compatible = "gpio-control-nand" },
 	{}
@@ -145,19 +144,6 @@ static struct resource *gpio_nand_get_io_sync_of(struct platform_device *pdev)
 
 	return r;
 }
-#else /* CONFIG_OF */
-static inline int gpio_nand_get_config_of(const struct device *dev,
-					  struct gpio_nand_platdata *plat)
-{
-	return -ENOSYS;
-}
-
-static inline struct resource *
-gpio_nand_get_io_sync_of(struct platform_device *pdev)
-{
-	return NULL;
-}
-#endif /* CONFIG_OF */
 
 static inline int gpio_nand_get_config(const struct device *dev,
 				       struct gpio_nand_platdata *plat)
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mtd: nand: gpio: Remove unneeded CONFIG_OF
  2013-12-07 14:48 [PATCH] mtd: nand: gpio: Remove unneeded CONFIG_OF Ezequiel Garcia
@ 2013-12-07 14:54 ` Alexander Shiyan
  2013-12-07 15:33   ` Ezequiel Garcia
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Shiyan @ 2013-12-07 14:54 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: linux-mtd

Hello.

> Since the of_mtd header provides dummy stubs for !CONFIG_OF, it's safe
> to remove the #ifdef CONFIG_OF. Build tested only.
> 
> Cc: Alexander Shiyan <shc_work@mail.ru>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
...
> -#ifdef CONFIG_OF
>  static const struct of_device_id gpio_nand_id_table[] = {

You should add "__maybe_unused" attribute here in this case.
This will avoid warning when you build driver without OF.

---

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mtd: nand: gpio: Remove unneeded CONFIG_OF
  2013-12-07 14:54 ` Alexander Shiyan
@ 2013-12-07 15:33   ` Ezequiel Garcia
  2013-12-07 15:35     ` Alexander Shiyan
  0 siblings, 1 reply; 6+ messages in thread
From: Ezequiel Garcia @ 2013-12-07 15:33 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: linux-mtd

On Sat, Dec 07, 2013 at 06:54:32PM +0400, Alexander Shiyan wrote:
> Hello.
> 
> > Since the of_mtd header provides dummy stubs for !CONFIG_OF, it's safe
> > to remove the #ifdef CONFIG_OF. Build tested only.
> > 
> > Cc: Alexander Shiyan <shc_work@mail.ru>
> > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ...
> > -#ifdef CONFIG_OF
> >  static const struct of_device_id gpio_nand_id_table[] = {
> 
> You should add "__maybe_unused" attribute here in this case.
> This will avoid warning when you build driver without OF.
> 
> ---

I don't get such warning, maybe because the GCC is smart enough
to remove the symbol?

Actually, I realise now we don't need to of_match_ptr, so let
me push a v2.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mtd: nand: gpio: Remove unneeded CONFIG_OF
  2013-12-07 15:33   ` Ezequiel Garcia
@ 2013-12-07 15:35     ` Alexander Shiyan
  2013-12-07 15:40       ` Ezequiel Garcia
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Shiyan @ 2013-12-07 15:35 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: linux-mtd

> On Sat, Dec 07, 2013 at 06:54:32PM +0400, Alexander Shiyan wrote:
> > Hello.
> > 
> > > Since the of_mtd header provides dummy stubs for !CONFIG_OF, it's safe
> > > to remove the #ifdef CONFIG_OF. Build tested only.
> > > 
> > > Cc: Alexander Shiyan <shc_work@mail.ru>
> > > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> > ...
> > > -#ifdef CONFIG_OF
> > >  static const struct of_device_id gpio_nand_id_table[] = {
> > 
> > You should add "__maybe_unused" attribute here in this case.
> > This will avoid warning when you build driver without OF.
> > 
> > ---
> 
> I don't get such warning, maybe because the GCC is smart enough
> to remove the symbol?
> 
> Actually, I realise now we don't need to of_match_ptr, so let
> me push a v2.

And without of_match_ptr() we do not need to define "__maybe_unused" for this :)

---

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mtd: nand: gpio: Remove unneeded CONFIG_OF
  2013-12-07 15:35     ` Alexander Shiyan
@ 2013-12-07 15:40       ` Ezequiel Garcia
  2013-12-07 15:43         ` Alexander Shiyan
  0 siblings, 1 reply; 6+ messages in thread
From: Ezequiel Garcia @ 2013-12-07 15:40 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: linux-mtd

On Sat, Dec 07, 2013 at 07:35:49PM +0400, Alexander Shiyan wrote:
> > On Sat, Dec 07, 2013 at 06:54:32PM +0400, Alexander Shiyan wrote:
> > > Hello.
> > > 
> > > > Since the of_mtd header provides dummy stubs for !CONFIG_OF, it's safe
> > > > to remove the #ifdef CONFIG_OF. Build tested only.
> > > > 
> > > > Cc: Alexander Shiyan <shc_work@mail.ru>
> > > > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> > > ...
> > > > -#ifdef CONFIG_OF
> > > >  static const struct of_device_id gpio_nand_id_table[] = {
> > > 
> > > You should add "__maybe_unused" attribute here in this case.
> > > This will avoid warning when you build driver without OF.
> > > 
> > > ---
> > 
> > I don't get such warning, maybe because the GCC is smart enough
> > to remove the symbol?
> > 
> > Actually, I realise now we don't need to of_match_ptr, so let
> > me push a v2.
> 
> And without of_match_ptr() we do not need to define "__maybe_unused" for this :)
> 

Yup :-)

Care to give the v2 a test? I've just submitted it.

Thanks!
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mtd: nand: gpio: Remove unneeded CONFIG_OF
  2013-12-07 15:40       ` Ezequiel Garcia
@ 2013-12-07 15:43         ` Alexander Shiyan
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2013-12-07 15:43 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: linux-mtd

> > > > > Since the of_mtd header provides dummy stubs for !CONFIG_OF, it's safe
> > > > > to remove the #ifdef CONFIG_OF. Build tested only.
...
> > > Actually, I realise now we don't need to of_match_ptr, so let
> > > me push a v2.
> > 
> > And without of_match_ptr() we do not need to define "__maybe_unused" for this :)
> > 
> Yup :-)
> 
> Care to give the v2 a test? I've just submitted it.

I see. Looks good, compile test is enough for such changes.

---

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-12-07 15:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-07 14:48 [PATCH] mtd: nand: gpio: Remove unneeded CONFIG_OF Ezequiel Garcia
2013-12-07 14:54 ` Alexander Shiyan
2013-12-07 15:33   ` Ezequiel Garcia
2013-12-07 15:35     ` Alexander Shiyan
2013-12-07 15:40       ` Ezequiel Garcia
2013-12-07 15:43         ` Alexander Shiyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox