From: Felipe Balbi <balbi@ti.com>
To: Linux USB Mailing List <linux-usb@vger.kernel.org>
Cc: Greg KH <gregkh@linuxfoundation.org>,
cbou@mail.ru, dwmw2@infradead.org, stern@rowland.harvard.edu,
swarren@wwwdotorg.org, arnd@arndb.de,
linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org,
Felipe Balbi <balbi@ti.com>
Subject: [PATCH 02/10] usb: otg: move usb_otg_state_string to usb-common.c
Date: Thu, 7 Mar 2013 11:36:01 +0200 [thread overview]
Message-ID: <1362648969-13737-3-git-send-email-balbi@ti.com> (raw)
In-Reply-To: <1362648969-13737-1-git-send-email-balbi@ti.com>
otg.c only had a single function definition
which might make more sense to be placed in
usb-common.c. While doing that, we also delete
otg.c since it's now empty.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/usb/otg/Makefile | 3 ---
drivers/usb/otg/otg.c | 47 -----------------------------------------------
drivers/usb/usb-common.c | 26 ++++++++++++++++++++++++++
include/linux/usb/otg.h | 7 -------
4 files changed, 26 insertions(+), 57 deletions(-)
delete mode 100644 drivers/usb/otg/otg.c
diff --git a/drivers/usb/otg/Makefile b/drivers/usb/otg/Makefile
index a844b8d..6abc453 100644
--- a/drivers/usb/otg/Makefile
+++ b/drivers/usb/otg/Makefile
@@ -5,9 +5,6 @@
ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
ccflags-$(CONFIG_USB_GADGET_DEBUG) += -DDEBUG
-# infrastructure
-obj-$(CONFIG_USB_OTG_UTILS) += otg.o
-
# transceiver drivers
obj-$(CONFIG_USB_GPIO_VBUS) += gpio_vbus.o
obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
deleted file mode 100644
index fd9a4b7..0000000
--- a/drivers/usb/otg/otg.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * otg.c -- USB OTG utility code
- *
- * Copyright (C) 2004 Texas Instruments
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-#include <linux/export.h>
-#include <linux/usb/otg.h>
-
-const char *usb_otg_state_string(enum usb_otg_state state)
-{
- switch (state) {
- case OTG_STATE_A_IDLE:
- return "a_idle";
- case OTG_STATE_A_WAIT_VRISE:
- return "a_wait_vrise";
- case OTG_STATE_A_WAIT_BCON:
- return "a_wait_bcon";
- case OTG_STATE_A_HOST:
- return "a_host";
- case OTG_STATE_A_SUSPEND:
- return "a_suspend";
- case OTG_STATE_A_PERIPHERAL:
- return "a_peripheral";
- case OTG_STATE_A_WAIT_VFALL:
- return "a_wait_vfall";
- case OTG_STATE_A_VBUS_ERR:
- return "a_vbus_err";
- case OTG_STATE_B_IDLE:
- return "b_idle";
- case OTG_STATE_B_SRP_INIT:
- return "b_srp_init";
- case OTG_STATE_B_PERIPHERAL:
- return "b_peripheral";
- case OTG_STATE_B_WAIT_ACON:
- return "b_wait_acon";
- case OTG_STATE_B_HOST:
- return "b_host";
- default:
- return "UNDEFINED";
- }
-}
-EXPORT_SYMBOL(usb_otg_state_string);
diff --git a/drivers/usb/usb-common.c b/drivers/usb/usb-common.c
index 070b681..0db0a91 100644
--- a/drivers/usb/usb-common.c
+++ b/drivers/usb/usb-common.c
@@ -14,6 +14,32 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/usb/ch9.h>
+#include <linux/usb/otg.h>
+
+const char *usb_otg_state_string(enum usb_otg_state state)
+{
+ static const char *const names[] = {
+ [OTG_STATE_A_IDLE] = "a_idle",
+ [OTG_STATE_A_WAIT_VRISE] = "a_wait_vrise",
+ [OTG_STATE_A_WAIT_BCON] = "a_wait_bcon",
+ [OTG_STATE_A_HOST] = "a_host",
+ [OTG_STATE_A_SUSPEND] = "a_suspend",
+ [OTG_STATE_A_PERIPHERAL] = "a_peripheral",
+ [OTG_STATE_A_WAIT_VFALL] = "a_wait_vfall",
+ [OTG_STATE_A_VBUS_ERR] = "a_vbus_err",
+ [OTG_STATE_B_IDLE] = "b_idle",
+ [OTG_STATE_B_SRP_INIT] = "b_srp_init",
+ [OTG_STATE_B_PERIPHERAL] = "b_peripheral",
+ [OTG_STATE_B_WAIT_ACON] = "b_wait_acon",
+ [OTG_STATE_B_HOST] = "b_host",
+ };
+
+ if (state < 0 || state >= ARRAY_SIZE(names))
+ return "UNDEFINED";
+
+ return names[state];
+}
+EXPORT_SYMBOL_GPL(usb_otg_state_string);
const char *usb_speed_string(enum usb_device_speed speed)
{
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 9f9fb39..291e01b 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -36,14 +36,7 @@ struct usb_otg {
};
-#ifdef CONFIG_USB_OTG_UTILS
extern const char *usb_otg_state_string(enum usb_otg_state state);
-#else
-static inline const char *usb_otg_state_string(enum usb_otg_state state)
-{
- return NULL;
-}
-#endif
/* Context: can sleep */
static inline int
--
1.8.1.rc1.5.g7e0651a
next prev parent reply other threads:[~2013-03-07 9:36 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-07 9:35 [PATCH 00/10] usb: phy: cleanups to Kconfig and directories Felipe Balbi
2013-03-07 9:36 ` [PATCH 01/10] usb: otg: prefix otg_state_string with usb_ Felipe Balbi
2013-03-07 9:36 ` Felipe Balbi [this message]
2013-03-07 9:36 ` [PATCH 03/10] usb: phy: convert EXPORT_SYMBOL to EXPORT_SYMBOL_GPL Felipe Balbi
2013-03-07 9:36 ` [PATCH 04/10] usb: phy: move all PHY drivers to drivers/usb/phy/ Felipe Balbi
2013-03-07 9:36 ` [PATCH 05/10] usb: phy: make it a menuconfig Felipe Balbi
2013-03-07 9:36 ` [PATCH 07/10] usb: gadget: mv_udc_core: check against CONFIG_USB_PHY Felipe Balbi
2013-03-07 9:36 ` [PATCH 09/10] usb: ehci: tegra: " Felipe Balbi
[not found] ` <1362648969-13737-10-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2013-03-07 20:54 ` Stephen Warren
2013-03-08 7:10 ` Felipe Balbi
2013-03-07 9:36 ` [PATCH 10/10] usb: phy: remove CONFIG_USB_OTG_UTILS Felipe Balbi
[not found] ` <1362648969-13737-11-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2013-03-07 14:41 ` [PATCH v2] " Felipe Balbi
2013-03-07 16:01 ` [PATCH 00/10] usb: phy: cleanups to Kconfig and directories Alan Stern
[not found] ` <Pine.LNX.4.44L0.1303071101190.1646-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-03-07 16:41 ` Felipe Balbi
[not found] ` <1362648969-13737-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2013-03-07 9:36 ` [PATCH 06/10] usb: power: pda_power: check against CONFIG_USB_PHY Felipe Balbi
2013-03-07 9:36 ` [PATCH 08/10] usb: ehci: marvel: " Felipe Balbi
2013-03-07 21:20 ` [PATCH 00/10] usb: phy: cleanups to Kconfig and directories Stephen Warren
[not found] ` <513904A4.7040101-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-03-08 7:14 ` Felipe Balbi
[not found] ` <20130308071453.GD21589-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2013-03-08 17:14 ` Stephen Warren
[not found] ` <513A1C63.9050704-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-03-08 18:26 ` Felipe Balbi
[not found] ` <20130308182623.GD900-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2013-03-08 18:37 ` Stephen Warren
[not found] ` <513A2FDD.2040800-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-03-08 23:08 ` Arnd Bergmann
[not found] ` <201303082308.31499.arnd-r2nGTMty4D4@public.gmane.org>
2013-03-08 23:23 ` Stephen Warren
[not found] ` <513A72E8.2070707-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-03-08 23:56 ` Arnd Bergmann
[not found] ` <201303082356.35033.arnd-r2nGTMty4D4@public.gmane.org>
2013-03-09 0:10 ` Stephen Warren
2013-03-14 11:01 ` Felipe Balbi
[not found] ` <20130314110129.GI32369-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2013-03-15 20:50 ` Stephen Warren
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=1362648969-13737-3-git-send-email-balbi@ti.com \
--to=balbi@ti.com \
--cc=arnd@arndb.de \
--cc=cbou@mail.ru \
--cc=dwmw2@infradead.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=swarren@wwwdotorg.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox