Thread (4 messages) 4 messages, 3 authors, 2009-09-09

RE: [Uclinux-dist-devel] [PATCH v2]add analog devices AD714Xcaptouch input driver

From: Song, Barry <hidden>
Date: 2009-09-09 07:16:34

Possibly related (same subject, not in this thread)

 
-----Original Message-----
From: Mike Frysinger [mailto:vapier.adi@gmail.com] 
Sent: Wednesday, September 09, 2009 2:06 PM
To: Song, Barry
Cc: David Brownell; dmitry.torokhov@gmail.com; 
uclinux-dist-devel@blackfin.uclinux.org; linux-input@vger.kernel.org
Subject: Re: [Uclinux-dist-devel] [PATCH v2]add analog devices 
AD714Xcaptouch input driver

On Tue, Sep 8, 2009 at 23:33, Song, Barry wrote:
quoted
+static inline int ad714x_spi_register_driver(struct 
spi_driver *spi_drv)
quoted
+{
+       return spi_register_driver(spi_drv);
+}
+
+static inline void ad714x_spi_unregister_driver(struct 
spi_driver *spi_drv)
quoted
+{
+       spi_unregister_driver(spi_drv);
+}
+
+#else
+#define ad714x_spi_register_driver(p) 0
+#define ad714x_spi_unregister_driver(p)
 #endif
i dont think you need the ifdef protection that far up.  what about
using the ifdef in this one place:
static inline int ad714x_spi_register_driver(struct spi_driver 
*spi_drv)
{
#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)
   return spi_register_driver(spi_drv);
#else
   return 0;
#endif
}

then i imagine you can have all the other pieces always enabled.  gcc
will see that everything is marked static and not used, so it'll cull
things.
In fact, I have tried to do like this before changing like I sent in the last mail. In fact, it will get compiling error if I always enable all spi and i2c functions without a #ifdef protection.
So since there are far #ifdef, I think it shoud be better to place related codes to existed #ifdef.
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help