Skip to contentSkip to conversation

check_signature depends on CONFIG_CHECK_SIGNATURE

PATCH In review Jean Delvare 2 participants 3 messages May 20, 2011 – May 21, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 check_signature depends on CONFIG_CHECK_SIGNATURE

check_signature() is only available if CONFIG_CHECK_SIGNATURE has been selected. Don't declare the function if it won't be available at link time. That way, any failure to select CONFIG_CHECK_SIGNATURE as needed will show up immediately at build time.

---
 include/linux/io.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/io.h +4 -1
@@ -63,8 +63,11 @@ void __iomem *devm_ioremap(struct device
 void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
 				    unsigned long size);
 void devm_iounmap(struct device *dev, void __iomem *addr);
+void devm_ioremap_release(struct device *dev, void *res);
+
+#ifdef CONFIG_CHECK_SIGNATURE
 int check_signature(const volatile void __iomem *io_addr,
 			const unsigned char *signature, int length);
-void devm_ioremap_release(struct device *dev, void *res);
+#endif
 
 #endif /* _LINUX_IO_H */
Signature · 1 line
Jean Delvare
#1 lore raw
Quoted 13 lines · On Fri, 20 May 2011 16:14:48 +0200 Jean Delvare <[email protected]> wrote:

check_signature() is only available if CONFIG_CHECK_SIGNATURE has been selected. Don't declare the function if it won't be available at link time. That way, any failure to select CONFIG_CHECK_SIGNATURE as needed will show up immediately at build time.

---
 include/linux/io.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

include/linux/io.h void __iomem *devm_ioremap(struct device · line 71

Quoted 10 lines
include/linux/io.h +4 -1
@@ -63,8 +63,11 @@ void __iomem *devm_ioremap(struct device
 void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
 				    unsigned long size);
 void devm_iounmap(struct device *dev, void __iomem *addr);
+void devm_ioremap_release(struct device *dev, void *res);
+
+#ifdef CONFIG_CHECK_SIGNATURE
 int check_signature(const volatile void __iomem *io_addr,
 			const unsigned char *signature, int length);
-void devm_ioremap_release(struct device *dev, void *res);
+#endif

We usually avoid doing this. Detecting the error at link time is sufficient.

Yes, that will very occasionally cost a small number of people a little additional time. But we must balance that against permanently messing up the header files.

#2 lore raw

Hi Andrew,

Quoted 30 lines · Andrew Morton
Quoted 13 lines · On Fri, 20 May 2011 16:14:48 +0200 Jean Delvare <[email protected]> wrote:

check_signature() is only available if CONFIG_CHECK_SIGNATURE has been selected. Don't declare the function if it won't be available at link time. That way, any failure to select CONFIG_CHECK_SIGNATURE as needed will show up immediately at build time.

---
 include/linux/io.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

include/linux/io.h void __iomem *devm_ioremap(struct device · line 71

Quoted 10 lines
include/linux/io.h +4 -1
@@ -63,8 +63,11 @@ void __iomem *devm_ioremap(struct device
 void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
 				    unsigned long size);
 void devm_iounmap(struct device *dev, void __iomem *addr);
+void devm_ioremap_release(struct device *dev, void *res);
+
+#ifdef CONFIG_CHECK_SIGNATURE
 int check_signature(const volatile void __iomem *io_addr,
 			const unsigned char *signature, int length);
-void devm_ioremap_release(struct device *dev, void *res);
+#endif

We usually avoid doing this. Detecting the error at link time is sufficient.

Quoted 3 lines

Yes, that will very occasionally cost a small number of people a little additional time. But we must balance that against permanently messing up the header files.

OK, fair enough. Patch deleted.

Signature · 1 line
Jean Delvare