From: Randy Dunlap <rdunlap@xenotime.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org,
Stephen Rothwell <sfr@canb.auug.org.au>,
Frank Mori Hess <fmhess@users.sourceforge.net>,
linux-usb@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Ian Abbott <abbotti@mev.co.uk>,
linux-next@vger.kernel.org
Subject: [PATCH -next] usb: add usb.h stubs for CONFIG_USB not enabled
Date: Fri, 18 May 2012 19:04:47 -0700 [thread overview]
Message-ID: <4FB6FFBF.6000509@xenotime.net> (raw)
In-Reply-To: <20120519005031.GA27613@kroah.com>
From: Randy Dunlap <rdunlap@xenotime.net>
Add stubs for some usb core functions when CONFIG_USB
is not enabled. This fixes these comedi build errors:
ERROR: "usb_deregister" [drivers/staging/comedi/comedi.ko] undefined!
ERROR: "usb_register_driver" [drivers/staging/comedi/comedi.ko] undefined!
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
---
I am only adding the stubs that are needed for comedi to build.
I expect that more stubs will be needed as more build errors are
found. It seems to me that linux/usb.h might need more (major)
moving of lines to support more stubs in the future.
Documentation/usb/error-codes.txt | 2 ++
include/linux/usb.h | 24 +++++++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
--- linux-next-20120518.orig/include/linux/usb.h
+++ linux-next-20120518/include/linux/usb.h
@@ -10,7 +10,7 @@
#ifdef __KERNEL__
-#include <linux/errno.h> /* for -ENODEV */
+#include <linux/errno.h> /* for -ENODEV, -ENOSYS */
#include <linux/delay.h> /* for mdelay() */
#include <linux/interrupt.h> /* for in_interrupt() */
#include <linux/list.h> /* for struct list_head */
@@ -515,6 +515,8 @@ static inline struct usb_device *interfa
return to_usb_device(intf->dev.parent);
}
+#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
+
extern struct usb_device *usb_get_dev(struct usb_device *dev);
extern void usb_put_dev(struct usb_device *dev);
@@ -976,6 +978,26 @@ extern void usb_deregister_dev(struct us
extern int usb_disabled(void);
+#else /* stubs for USB not enabled */
+
+static inline int usb_register(struct usb_driver *driver)
+{
+ return -ENOSYS;
+}
+
+static inline int usb_register_driver(struct usb_driver *driver,
+ struct module *mod,
+ const char *modname)
+{
+ return -ENOSYS;
+}
+
+static inline void usb_deregister(struct usb_driver *driver)
+{
+}
+
+#endif
+
/* ----------------------------------------------------------------------- */
/*
--- linux-next-20120518.orig/Documentation/usb/error-codes.txt
+++ linux-next-20120518/Documentation/usb/error-codes.txt
@@ -167,6 +167,8 @@ processing, devices may receive such fau
usb_register():
-EINVAL error during registering new driver
+-ENOSYS CONFIG_USB is not enabled, so the function stub
+ returns an error.
usb_get_*/usb_set_*():
usb_control_msg():
WARNING: multiple messages have this Message-ID (diff)
From: Randy Dunlap <rdunlap@xenotime.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
linux-next@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Ian Abbott <abbotti@mev.co.uk>,
Frank Mori Hess <fmhess@users.sourceforge.net>,
devel@driverdev.osuosl.org, linux-usb@vger.kernel.org
Subject: [PATCH -next] usb: add usb.h stubs for CONFIG_USB not enabled
Date: Fri, 18 May 2012 19:04:47 -0700 [thread overview]
Message-ID: <4FB6FFBF.6000509@xenotime.net> (raw)
In-Reply-To: <20120519005031.GA27613@kroah.com>
From: Randy Dunlap <rdunlap@xenotime.net>
Add stubs for some usb core functions when CONFIG_USB
is not enabled. This fixes these comedi build errors:
ERROR: "usb_deregister" [drivers/staging/comedi/comedi.ko] undefined!
ERROR: "usb_register_driver" [drivers/staging/comedi/comedi.ko] undefined!
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
---
I am only adding the stubs that are needed for comedi to build.
I expect that more stubs will be needed as more build errors are
found. It seems to me that linux/usb.h might need more (major)
moving of lines to support more stubs in the future.
Documentation/usb/error-codes.txt | 2 ++
include/linux/usb.h | 24 +++++++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
--- linux-next-20120518.orig/include/linux/usb.h
+++ linux-next-20120518/include/linux/usb.h
@@ -10,7 +10,7 @@
#ifdef __KERNEL__
-#include <linux/errno.h> /* for -ENODEV */
+#include <linux/errno.h> /* for -ENODEV, -ENOSYS */
#include <linux/delay.h> /* for mdelay() */
#include <linux/interrupt.h> /* for in_interrupt() */
#include <linux/list.h> /* for struct list_head */
@@ -515,6 +515,8 @@ static inline struct usb_device *interfa
return to_usb_device(intf->dev.parent);
}
+#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
+
extern struct usb_device *usb_get_dev(struct usb_device *dev);
extern void usb_put_dev(struct usb_device *dev);
@@ -976,6 +978,26 @@ extern void usb_deregister_dev(struct us
extern int usb_disabled(void);
+#else /* stubs for USB not enabled */
+
+static inline int usb_register(struct usb_driver *driver)
+{
+ return -ENOSYS;
+}
+
+static inline int usb_register_driver(struct usb_driver *driver,
+ struct module *mod,
+ const char *modname)
+{
+ return -ENOSYS;
+}
+
+static inline void usb_deregister(struct usb_driver *driver)
+{
+}
+
+#endif
+
/* ----------------------------------------------------------------------- */
/*
--- linux-next-20120518.orig/Documentation/usb/error-codes.txt
+++ linux-next-20120518/Documentation/usb/error-codes.txt
@@ -167,6 +167,8 @@ processing, devices may receive such fau
usb_register():
-EINVAL error during registering new driver
+-ENOSYS CONFIG_USB is not enabled, so the function stub
+ returns an error.
usb_get_*/usb_set_*():
usb_control_msg():
next prev parent reply other threads:[~2012-05-19 2:04 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-18 8:49 linux-next: Tree for May 18 Stephen Rothwell
2012-05-19 0:46 ` [PATCH -next] comedi: fix build when USB is not enabled Randy Dunlap
2012-05-19 0:50 ` Greg Kroah-Hartman
2012-05-19 0:51 ` Randy Dunlap
2012-05-19 2:04 ` Randy Dunlap [this message]
2012-05-19 2:04 ` [PATCH -next] usb: add usb.h stubs for CONFIG_USB " Randy Dunlap
[not found] ` <4FB6FFBF.6000509-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.org>
2012-05-19 14:16 ` Sergei Shtylyov
2012-05-19 14:16 ` Sergei Shtylyov
2012-05-19 15:45 ` Randy Dunlap
2012-05-19 16:12 ` Greg Kroah-Hartman
2012-05-19 16:12 ` Greg Kroah-Hartman
2012-05-19 16:31 ` [PATCH -next v2] " Randy Dunlap
2012-05-21 16:48 ` H Hartley Sweeten
2012-05-19 14:30 ` [PATCH -next] " Alan Stern
2012-05-19 14:30 ` Alan Stern
2012-05-19 15:48 ` Randy Dunlap
[not found] ` <4FB7C0E4.4000008-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.org>
2012-06-11 23:07 ` Greg Kroah-Hartman
2012-06-11 23:07 ` Greg Kroah-Hartman
2012-06-11 23:35 ` [PATCH] staging/comedi: fix build for USB " Randy Dunlap
2012-05-19 1:02 ` linux-next: Tree for May 18 (drm drivers and vgacon) Randy Dunlap
2012-05-19 15:40 ` Dave Airlie
2012-05-19 2:16 ` linux-next: Tree for May 18 (edac) Randy Dunlap
2012-05-19 12:03 ` Mauro Carvalho Chehab
2012-05-19 15:50 ` Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FB6FFBF.6000509@xenotime.net \
--to=rdunlap@xenotime.net \
--cc=abbotti@mev.co.uk \
--cc=devel@driverdev.osuosl.org \
--cc=fmhess@users.sourceforge.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.