Commit bce83697 authored by David Vrabel's avatar David Vrabel

uwb: use dev_dbg() for debug messages

Instead of the home-grown d_fnstart(), d_fnend() and d_printf() macros,
use dev_dbg() or remove the message entirely.
Signed-off-by: default avatarDavid Vrabel <david.vrabel@csr.com>
parent 02f11ee1
......@@ -62,16 +62,12 @@
#include "../wusbcore/wa-hc.h"
#include "../wusbcore/wusbhc.h"
#define D_LOCAL 0
#include <linux/uwb/debug.h>
struct hwahc {
struct wusbhc wusbhc; /* has to be 1st */
struct wahc wa;
u8 buffer[16]; /* for misc usb transactions */
};
/**
/*
* FIXME should be wusbhc
*
* NOTE: we need to cache the Cluster ID because later...there is no
......@@ -125,7 +121,6 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd)
struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);
struct device *dev = &hwahc->wa.usb_iface->dev;
d_fnstart(4, dev, "(hwahc %p)\n", hwahc);
mutex_lock(&wusbhc->mutex);
wa_nep_disarm(&hwahc->wa);
result = __wa_set_feature(&hwahc->wa, WA_RESET);
......@@ -133,7 +128,6 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd)
dev_err(dev, "error commanding HC to reset: %d\n", result);
goto error_unlock;
}
d_printf(3, dev, "reset: waiting for device to change state\n");
result = __wa_wait_status(&hwahc->wa, WA_STATUS_RESETTING, 0);
if (result < 0) {
dev_err(dev, "error waiting for HC to reset: %d\n", result);
......@@ -141,7 +135,6 @@ static int hwahc_op_reset(struct usb_hcd *usb_hcd)
}
error_unlock:
mutex_unlock(&wusbhc->mutex);
d_fnend(4, dev, "(hwahc %p) = %d\n", hwahc, result);
return result;
}
......@@ -154,15 +147,9 @@ static int hwahc_op_start(struct usb_hcd *usb_hcd)
int result;
struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd);
struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);
struct device *dev = &hwahc->wa.usb_iface->dev;
/* Set up a Host Info WUSB Information Element */
d_fnstart(4, dev, "(hwahc %p)\n", hwahc);
result = -ENOSPC;
mutex_lock(&wusbhc->mutex);
/* Start the numbering from the top so that the bottom
* range of the unauth addr space is used for devices,
* the top for HCs; use 0xfe - RC# */
addr = wusb_cluster_id_get();
if (addr == 0)
goto error_cluster_id_get;
......@@ -176,7 +163,6 @@ static int hwahc_op_start(struct usb_hcd *usb_hcd)
result = 0;
out:
mutex_unlock(&wusbhc->mutex);
d_fnend(4, dev, "(hwahc %p) = %d\n", hwahc, result);
return result;
error_set_cluster_id:
......@@ -213,18 +199,11 @@ static int hwahc_op_resume(struct usb_hcd *usb_hcd)
*/
static void hwahc_op_stop(struct usb_hcd *usb_hcd)
{
int result;
struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd);
struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);
struct wahc *wa = &hwahc->wa;
struct device *dev = &wa->usb_iface->dev;
d_fnstart(4, dev, "(hwahc %p)\n", hwahc);
mutex_lock(&wusbhc->mutex);
wusb_cluster_id_put(wusbhc->cluster_id);
mutex_unlock(&wusbhc->mutex);
d_fnend(4, dev, "(hwahc %p) = %d\n", hwahc, result);
return;
}
static int hwahc_op_get_frame_number(struct usb_hcd *usb_hcd)
......@@ -573,11 +552,11 @@ static int wa_fill_descr(struct wahc *wa)
itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength);
while (itr_size >= sizeof(*hdr)) {
hdr = (struct usb_descriptor_header *) itr;
d_printf(3, dev, "Extra device descriptor: "
"type %02x/%u bytes @ %zu (%zu left)\n",
hdr->bDescriptorType, hdr->bLength,
(itr - usb_dev->rawdescriptors[actconfig_idx]),
itr_size);
dev_dbg(dev, "Extra device descriptor: "
"type %02x/%u bytes @ %zu (%zu left)\n",
hdr->bDescriptorType, hdr->bLength,
(itr - usb_dev->rawdescriptors[actconfig_idx]),
itr_size);
if (hdr->bDescriptorType == USB_DT_WIRE_ADAPTER)
goto found;
itr += hdr->bLength;
......@@ -786,7 +765,6 @@ static void hwahc_destroy(struct hwahc *hwahc)
{
struct wusbhc *wusbhc = &hwahc->wusbhc;
d_fnstart(1, NULL, "(hwahc %p)\n", hwahc);
mutex_lock(&wusbhc->mutex);
__wa_destroy(&hwahc->wa);
wusbhc_destroy(&hwahc->wusbhc);
......@@ -796,7 +774,6 @@ static void hwahc_destroy(struct hwahc *hwahc)
usb_put_intf(hwahc->wa.usb_iface);
usb_put_dev(hwahc->wa.usb_dev);
mutex_unlock(&wusbhc->mutex);
d_fnend(1, NULL, "(hwahc %p) = void\n", hwahc);
}
static void hwahc_init(struct hwahc *hwahc)
......@@ -813,7 +790,6 @@ static int hwahc_probe(struct usb_interface *usb_iface,
struct hwahc *hwahc;
struct device *dev = &usb_iface->dev;
d_fnstart(4, dev, "(%p, %p)\n", usb_iface, id);
result = -ENOMEM;
usb_hcd = usb_create_hcd(&hwahc_hc_driver, &usb_iface->dev, "wusb-hwa");
if (usb_hcd == NULL) {
......@@ -840,7 +816,6 @@ static int hwahc_probe(struct usb_interface *usb_iface,
dev_err(dev, "Cannot setup phase B of WUSBHC: %d\n", result);
goto error_wusbhc_b_create;
}
d_fnend(4, dev, "(%p, %p) = 0\n", usb_iface, id);
return 0;
error_wusbhc_b_create:
......@@ -850,7 +825,6 @@ error_add_hcd:
error_hwahc_create:
usb_put_hcd(usb_hcd);
error_alloc:
d_fnend(4, dev, "(%p, %p) = %d\n", usb_iface, id, result);
return result;
}
......@@ -864,16 +838,12 @@ static void hwahc_disconnect(struct usb_interface *usb_iface)
wusbhc = usb_hcd_to_wusbhc(usb_hcd);
hwahc = container_of(wusbhc, struct hwahc, wusbhc);
d_fnstart(1, NULL, "(hwahc %p [usb_iface %p])\n", hwahc, usb_iface);
wusbhc_b_destroy(&hwahc->wusbhc);
usb_remove_hcd(usb_hcd);
hwahc_destroy(hwahc);
usb_put_hcd(usb_hcd);
d_fnend(1, NULL, "(hwahc %p [usb_iface %p]) = void\n", hwahc,
usb_iface);
}
/** USB device ID's that we handle */
static struct usb_device_id hwahc_id_table[] = {
/* FIXME: use class labels for this */
{ USB_INTERFACE_INFO(0xe0, 0x02, 0x01), },
......@@ -890,18 +860,7 @@ static struct usb_driver hwahc_driver = {
static int __init hwahc_driver_init(void)
{
int result;
result = usb_register(&hwahc_driver);
if (result < 0) {
printk(KERN_ERR "WA-CDS: Cannot register USB driver: %d\n",
result);
goto error_usb_register;
}
return 0;
error_usb_register:
return result;
return usb_register(&hwahc_driver);
}
module_init(hwahc_driver_init);
......
......@@ -51,7 +51,6 @@
#include <linux/uwb.h>
#include <linux/usb/wusb.h>
#include <linux/scatterlist.h>
#define D_LOCAL 0
#include <linux/uwb/debug.h>
static int debug_crypto_verify = 0;
......@@ -207,9 +206,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
const u8 bzero[16] = { 0 };
size_t zero_padding;
d_fnstart(3, NULL, "(tfm_cbc %p, tfm_aes %p, mic %p, "
"n %p, a %p, b %p, blen %zu)\n",
tfm_cbc, tfm_aes, mic, n, a, b, blen);
/*
* These checks should be compile time optimized out
* ensure @a fills b1's mac_header and following fields
......@@ -251,16 +247,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
b1.la = cpu_to_be16(blen + 14);
memcpy(&b1.mac_header, a, sizeof(*a));
d_printf(4, NULL, "I: B0 (%zu bytes)\n", sizeof(b0));
d_dump(4, NULL, &b0, sizeof(b0));
d_printf(4, NULL, "I: B1 (%zu bytes)\n", sizeof(b1));
d_dump(4, NULL, &b1, sizeof(b1));
d_printf(4, NULL, "I: B (%zu bytes)\n", blen);
d_dump(4, NULL, b, blen);
d_printf(4, NULL, "I: B 0-padding (%zu bytes)\n", zero_padding);
d_printf(4, NULL, "D: IV before crypto (%zu)\n", ivsize);
d_dump(4, NULL, iv, ivsize);
sg_init_table(sg, ARRAY_SIZE(sg));
sg_set_buf(&sg[0], &b0, sizeof(b0));
sg_set_buf(&sg[1], &b1, sizeof(b1));
......@@ -277,8 +263,6 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
result);
goto error_cbc_crypt;
}
d_printf(4, NULL, "D: MIC tag\n");
d_dump(4, NULL, iv, ivsize);
/* Now we crypt the MIC Tag (*iv) with Ax -- values per WUSB1.0[6.5]
* The procedure is to AES crypt the A0 block and XOR the MIC
......@@ -293,17 +277,10 @@ static int wusb_ccm_mac(struct crypto_blkcipher *tfm_cbc,
ax.counter = 0;
crypto_cipher_encrypt_one(tfm_aes, (void *)&ax, (void *)&ax);
bytewise_xor(mic, &ax, iv, 8);
d_printf(4, NULL, "D: CTR[MIC]\n");
d_dump(4, NULL, &ax, 8);
d_printf(4, NULL, "D: CCM-MIC tag\n");
d_dump(4, NULL, mic, 8);
result = 8;
error_cbc_crypt:
kfree(dst_buf);
error_dst_buf:
d_fnend(3, NULL, "(tfm_cbc %p, tfm_aes %p, mic %p, "
"n %p, a %p, b %p, blen %zu)\n",
tfm_cbc, tfm_aes, mic, n, a, b, blen);
return result;
}
......@@ -325,10 +302,6 @@ ssize_t wusb_prf(void *out, size_t out_size,
u64 sfn = 0;
__le64 sfn_le;
d_fnstart(3, NULL, "(out %p, out_size %zu, key %p, _n %p, "
"a %p, b %p, blen %zu, len %zu)\n", out, out_size,
key, _n, a, b, blen, len);
tfm_cbc = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm_cbc)) {
result = PTR_ERR(tfm_cbc);
......@@ -370,9 +343,6 @@ error_alloc_aes:
error_setkey_cbc:
crypto_free_blkcipher(tfm_cbc);
error_alloc_cbc:
d_fnend(3, NULL, "(out %p, out_size %zu, key %p, _n %p, "
"a %p, b %p, blen %zu, len %zu) = %d\n", out, out_size,
key, _n, a, b, blen, len, (int)bytes);
return result;
}
......
......@@ -28,10 +28,6 @@
#include <linux/workqueue.h>
#include "wusbhc.h"
#undef D_LOCAL
#define D_LOCAL 4
#include <linux/uwb/debug.h>
static ssize_t wusb_disconnect_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
......
......@@ -91,10 +91,6 @@
#include <linux/workqueue.h>
#include "wusbhc.h"
#undef D_LOCAL
#define D_LOCAL 1
#include <linux/uwb/debug.h>
static void wusbhc_devconnect_acked_work(struct work_struct *work);
static void wusb_dev_free(struct wusb_dev *wusb_dev)
......@@ -234,6 +230,7 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc,
list_add_tail(&wusb_dev->cack_node, &wusbhc->cack_list);
wusbhc->cack_count++;
wusbhc_fill_cack_ie(wusbhc);
return wusb_dev;
}
......@@ -244,12 +241,9 @@ static struct wusb_dev *wusbhc_cack_add(struct wusbhc *wusbhc,
*/
static void wusbhc_cack_rm(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
{
struct device *dev = wusbhc->dev;
d_fnstart(3, dev, "(wusbhc %p wusb_dev %p)\n", wusbhc, wusb_dev);
list_del_init(&wusb_dev->cack_node);
wusbhc->cack_count--;
wusbhc_fill_cack_ie(wusbhc);
d_fnend(3, dev, "(wusbhc %p wusb_dev %p) = void\n", wusbhc, wusb_dev);
}
/*
......@@ -257,14 +251,11 @@ static void wusbhc_cack_rm(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
static
void wusbhc_devconnect_acked(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
{
struct device *dev = wusbhc->dev;
d_fnstart(3, dev, "(wusbhc %p wusb_dev %p)\n", wusbhc, wusb_dev);
wusbhc_cack_rm(wusbhc, wusb_dev);
if (wusbhc->cack_count)
wusbhc_mmcie_set(wusbhc, 0, 0, &wusbhc->cack_ie.hdr);
else
wusbhc_mmcie_rm(wusbhc, &wusbhc->cack_ie.hdr);
d_fnend(3, dev, "(wusbhc %p wusb_dev %p) = void\n", wusbhc, wusb_dev);
}
static void wusbhc_devconnect_acked_work(struct work_struct *work)
......@@ -314,7 +305,6 @@ void wusbhc_devconnect_ack(struct wusbhc *wusbhc, struct wusb_dn_connect *dnc,
struct wusb_port *port;
unsigned idx, devnum;
d_fnstart(3, dev, "(%p, %p, %s)\n", wusbhc, dnc, pr_cdid);
mutex_lock(&wusbhc->mutex);
/* Check we are not handling it already */
......@@ -367,7 +357,6 @@ void wusbhc_devconnect_ack(struct wusbhc *wusbhc, struct wusb_dn_connect *dnc,
*/
error_unlock:
mutex_unlock(&wusbhc->mutex);
d_fnend(3, dev, "(%p, %p, %s) = void\n", wusbhc, dnc, pr_cdid);
return;
}
......@@ -390,10 +379,8 @@ error_unlock:
static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc,
struct wusb_port *port)
{
struct device *dev = wusbhc->dev;
struct wusb_dev *wusb_dev = port->wusb_dev;
d_fnstart(3, dev, "(wusbhc %p, port %p)\n", wusbhc, port);
port->status &= ~(USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE
| USB_PORT_STAT_SUSPEND | USB_PORT_STAT_RESET
| USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED);
......@@ -410,7 +397,6 @@ static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc,
* section 6.2.11.2). */
wusbhc_gtk_rekey(wusbhc);
d_fnend(3, dev, "(wusbhc %p, port %p) = void\n", wusbhc, port);
/* The Wireless USB part has forgotten about the device already; now
* khubd's timer will pick up the disconnection and remove the USB
* device from the system
......@@ -535,10 +521,6 @@ static struct wusb_dev *wusbhc_find_dev_by_addr(struct wusbhc *wusbhc, u8 addr)
*/
static void wusbhc_handle_dn_alive(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
{
struct device *dev = wusbhc->dev;
d_printf(2, dev, "DN ALIVE: device 0x%02x pong\n", wusb_dev->addr);
mutex_lock(&wusbhc->mutex);
wusb_dev->entry_ts = jiffies;
__wusbhc_keep_alive(wusbhc);
......@@ -571,11 +553,10 @@ static void wusbhc_handle_dn_connect(struct wusbhc *wusbhc,
"no-beacon"
};
d_fnstart(3, dev, "(%p, %p, %zu)\n", wusbhc, dn_hdr, size);
if (size < sizeof(*dnc)) {
dev_err(dev, "DN CONNECT: short notification (%zu < %zu)\n",
size, sizeof(*dnc));
goto out;
return;
}
dnc = container_of(dn_hdr, struct wusb_dn_connect, hdr);
......@@ -587,10 +568,6 @@ static void wusbhc_handle_dn_connect(struct wusbhc *wusbhc,
wusb_dn_connect_new_connection(dnc) ? "connect" : "reconnect");
/* ACK the connect */
wusbhc_devconnect_ack(wusbhc, dnc, pr_cdid);
out:
d_fnend(3, dev, "(%p, %p, %zu) = void\n",
wusbhc, dn_hdr, size);
return;
}
/*
......@@ -631,19 +608,17 @@ void wusbhc_handle_dn(struct wusbhc *wusbhc, u8 srcaddr,
struct device *dev = wusbhc->dev;
struct wusb_dev *wusb_dev;
d_fnstart(3, dev, "(%p, %p)\n", wusbhc, dn_hdr);
if (size < sizeof(struct wusb_dn_hdr)) {
dev_err(dev, "DN data shorter than DN header (%d < %d)\n",
(int)size, (int)sizeof(struct wusb_dn_hdr));
goto out;
return;
}
wusb_dev = wusbhc_find_dev_by_addr(wusbhc, srcaddr);
if (wusb_dev == NULL && dn_hdr->bType != WUSB_DN_CONNECT) {
dev_dbg(dev, "ignoring DN %d from unconnected device %02x\n",
dn_hdr->bType, srcaddr);
goto out;
return;
}
switch (dn_hdr->bType) {
......@@ -668,9 +643,6 @@ void wusbhc_handle_dn(struct wusbhc *wusbhc, u8 srcaddr,
dev_warn(dev, "unknown DN %u (%d octets) from %u\n",
dn_hdr->bType, (int)size, srcaddr);
}
out:
d_fnend(3, dev, "(%p, %p) = void\n", wusbhc, dn_hdr);
return;
}
EXPORT_SYMBOL_GPL(wusbhc_handle_dn);
......@@ -700,59 +672,30 @@ void __wusbhc_dev_disable(struct wusbhc *wusbhc, u8 port_idx)
struct wusb_dev *wusb_dev;
struct wuie_disconnect *ie;
d_fnstart(3, dev, "(%p, %u)\n", wusbhc, port_idx);
result = 0;
wusb_dev = wusb_port_by_idx(wusbhc, port_idx)->wusb_dev;
if (wusb_dev == NULL) {
/* reset no device? ignore */
dev_dbg(dev, "DISCONNECT: no device at port %u, ignoring\n",
port_idx);
goto error;
return;
}
__wusbhc_dev_disconnect(wusbhc, wusb_port_by_idx(wusbhc, port_idx));
result = -ENOMEM;
ie = kzalloc(sizeof(*ie), GFP_KERNEL);
if (ie == NULL)
goto error;
return;
ie->hdr.bLength = sizeof(*ie);
ie->hdr.bIEIdentifier = WUIE_ID_DEVICE_DISCONNECT;
ie->bDeviceAddress = wusb_dev->addr;
result = wusbhc_mmcie_set(wusbhc, 0, 0, &ie->hdr);
if (result < 0) {
if (result < 0)
dev_err(dev, "DISCONNECT: can't set MMC: %d\n", result);
goto error_kfree;
else {
/* At least 6 MMCs, assuming at least 1 MMC per zone. */
msleep(7*4);
wusbhc_mmcie_rm(wusbhc, &ie->hdr);
}
/* 120ms, hopefully 6 MMCs */
msleep(100);
wusbhc_mmcie_rm(wusbhc, &ie->hdr);
error_kfree:
kfree(ie);
error:
d_fnend(3, dev, "(%p, %u) = %d\n", wusbhc, port_idx, result);
return;
}
static void wusb_cap_descr_printf(const unsigned level, struct device *dev,
const struct usb_wireless_cap_descriptor *wcd)
{
d_printf(level, dev,
"WUSB Capability Descriptor\n"
" bDevCapabilityType 0x%02x\n"
" bmAttributes 0x%02x\n"
" wPhyRates 0x%04x\n"
" bmTFITXPowerInfo 0x%02x\n"
" bmFFITXPowerInfo 0x%02x\n"
" bmBandGroup 0x%04x\n"
" bReserved 0x%02x\n",
wcd->bDevCapabilityType,
wcd->bmAttributes,
le16_to_cpu(wcd->wPHYRates),
wcd->bmTFITXPowerInfo,
wcd->bmFFITXPowerInfo,
wcd->bmBandGroup,
wcd->bReserved);
}
/*
......@@ -795,8 +738,6 @@ static int wusb_dev_bos_grok(struct usb_device *usb_dev,
}
cap_size = cap_hdr->bLength;
cap_type = cap_hdr->bDevCapabilityType;
d_printf(4, dev, "BOS Capability: 0x%02x (%zu bytes)\n",
cap_type, cap_size);
if (cap_size == 0)
break;
if (cap_size > top - itr) {
......@@ -808,7 +749,6 @@ static int wusb_dev_bos_grok(struct usb_device *usb_dev,
result = -EBADF;
goto error_bad_cap;
}
d_dump(3, dev, itr, cap_size);
switch (cap_type) {
case USB_CAP_TYPE_WIRELESS_USB:
if (cap_size != sizeof(*wusb_dev->wusb_cap_descr))
......@@ -816,10 +756,8 @@ static int wusb_dev_bos_grok(struct usb_device *usb_dev,
"descriptor is %zu bytes vs %zu "
"needed\n", cap_size,
sizeof(*wusb_dev->wusb_cap_descr));
else {
else
wusb_dev->wusb_cap_descr = itr;
wusb_cap_descr_printf(3, dev, itr);
}
break;
default:
dev_err(dev, "BUG? Unknown BOS capability 0x%02x "
......@@ -884,9 +822,7 @@ static int wusb_dev_bos_add(struct usb_device *usb_dev,
"%zu bytes): %zd\n", desc_size, result);
goto error_get_descriptor;
}
d_printf(2, dev, "Got BOS descriptor %zd bytes, %u capabilities\n",
result, bos->bNumDeviceCaps);
d_dump(2, dev, bos, result);
result = wusb_dev_bos_grok(usb_dev, wusb_dev, bos, result);
if (result < 0)
goto error_bad_bos;
......@@ -952,8 +888,6 @@ static void wusb_dev_add_ncb(struct usb_device *usb_dev)
if (usb_dev->wusb == 0 || usb_dev->devnum == 1)
return; /* skip non wusb and wusb RHs */
d_fnstart(3, dev, "(usb_dev %p)\n", usb_dev);
wusbhc = wusbhc_get_by_usb_dev(usb_dev);
if (wusbhc == NULL)
goto error_nodev;
......@@ -983,7 +917,6 @@ out:
wusb_dev_put(wusb_dev);
wusbhc_put(wusbhc);
error_nodev:
d_fnend(3, dev, "(usb_dev %p) = void\n", usb_dev);
return;
wusb_dev_sysfs_rm(wusb_dev);
......@@ -1070,11 +1003,10 @@ EXPORT_SYMBOL_GPL(__wusb_dev_get_by_usb_dev);
void wusb_dev_destroy(struct kref *_wusb_dev)
{
struct wusb_dev *wusb_dev
= container_of(_wusb_dev, struct wusb_dev, refcnt);
struct wusb_dev *wusb_dev = container_of(_wusb_dev, struct wusb_dev, refcnt);
list_del_init(&wusb_dev->cack_node);
wusb_dev_free(wusb_dev);
d_fnend(1, NULL, "%s (wusb_dev %p) = void\n", __func__, wusb_dev);
}
EXPORT_SYMBOL_GPL(wusb_dev_destroy);
......@@ -1086,8 +1018,6 @@ EXPORT_SYMBOL_GPL(wusb_dev_destroy);
*/
int wusbhc_devconnect_create(struct wusbhc *wusbhc)
{
d_fnstart(3, wusbhc->dev, "(wusbhc %p)\n", wusbhc);
wusbhc->keep_alive_ie.hdr.bIEIdentifier = WUIE_ID_KEEP_ALIVE;
wusbhc->keep_alive_ie.hdr.bLength = sizeof(wusbhc->keep_alive_ie.hdr);
INIT_DELAYED_WORK(&wusbhc->keep_alive_timer, wusbhc_keep_alive_run);
......@@ -1096,7 +1026,6 @@ int wusbhc_devconnect_create(struct wusbhc *wusbhc)
wusbhc->cack_ie.hdr.bLength = sizeof(wusbhc->cack_ie.hdr);
INIT_LIST_HEAD(&wusbhc->cack_list);
d_fnend(3, wusbhc->dev, "(wusbhc %p) = void\n", wusbhc);
return 0;
}
......@@ -1105,8 +1034,7 @@ int wusbhc_devconnect_create(struct wusbhc *wusbhc)
*/
void wusbhc_devconnect_destroy(struct wusbhc *wusbhc)
{
d_fnstart(3, wusbhc->dev, "(wusbhc %p)\n", wusbhc);
d_fnend(3, wusbhc->dev, "(wusbhc %p) = void\n", wusbhc);
/* no op */
}
/*
......
......@@ -71,9 +71,6 @@
*/
#include "wusbhc.h"
#define D_LOCAL 0
#include <linux/uwb/debug.h>
/*
* Reset a fake port
*
......@@ -142,7 +139,6 @@ int wusbhc_rh_status_data(struct usb_hcd *usb_hcd, char *_buf)
size_t cnt, size;
unsigned long *buf = (unsigned long *) _buf;
d_fnstart(1, wusbhc->dev, "(wusbhc %p)\n", wusbhc);
/* WE DON'T LOCK, see comment */
size = wusbhc->ports_max + 1 /* hub bit */;
size = (size + 8 - 1) / 8; /* round to bytes */
......@@ -151,8 +147,6 @@ int wusbhc_rh_status_data(struct usb_hcd *usb_hcd, char *_buf)
set_bit(cnt + 1, buf);
else
clear_bit(cnt + 1, buf);
d_fnend(1, wusbhc->dev, "(wusbhc %p) %u, buffer:\n", wusbhc, (int)size);
d_dump(1, wusbhc->dev, _buf, size);
return size;
}
EXPORT_SYMBOL_GPL(wusbhc_rh_status_data);
......@@ -201,9 +195,7 @@ static int wusbhc_rh_get_hub_descr(struct wusbhc *wusbhc, u16 wValue,
static int wusbhc_rh_clear_hub_feat(struct wusbhc *wusbhc, u16 feature)
{
int result;
struct device *dev = wusbhc->dev;
d_fnstart(4, dev, "(%p, feature 0x%04u)\n", wusbhc, feature);
switch (feature) {
case C_HUB_LOCAL_POWER:
/* FIXME: maybe plug bit 0 to the power input status,
......@@ -215,7 +207,6 @@ static int wusbhc_rh_clear_hub_feat(struct wusbhc *wusbhc, u16 feature)
default:
result = -EPIPE;
}
d_fnend(4, dev, "(%p, feature 0x%04u), %d\n", wusbhc, feature, result);
return result;
}
......@@ -242,14 +233,10 @@ static int wusbhc_rh_get_hub_status(struct wusbhc *wusbhc, u32 *buf,
static int wusbhc_rh_set_port_feat(struct wusbhc *wusbhc, u16 feature,
u8 selector, u8 port_idx)
{
int result = -EINVAL;
struct device *dev = wusbhc->dev;
d_fnstart(4, dev, "(feat 0x%04u, selector 0x%u, port_idx %d)\n",
feature, selector, port_idx);
if (port_idx > wusbhc->ports_max)
goto error;
return -EINVAL;
switch (feature) {
/* According to USB2.0[11.24.2.13]p2, these features
......@@ -259,35 +246,27 @@ static int wusbhc_rh_set_port_feat(struct wusbhc *wusbhc, u16 feature,
case USB_PORT_FEAT_C_SUSPEND:
case USB_PORT_FEAT_C_CONNECTION:
case USB_PORT_FEAT_C_RESET:
result = 0;
break;
return 0;
case USB_PORT_FEAT_POWER:
/* No such thing, but we fake it works */
mutex_lock(&wusbhc->mutex);
wusb_port_by_idx(wusbhc, port_idx)->status |= USB_PORT_STAT_POWER;
mutex_unlock(&wusbhc->mutex);
result = 0;
break;
return 0;
case USB_PORT_FEAT_RESET:
result = wusbhc_rh_port_reset(wusbhc, port_idx);
break;
return wusbhc_rh_port_reset(wusbhc, port_idx);
case USB_PORT_FEAT_ENABLE:
case USB_PORT_FEAT_SUSPEND:
dev_err(dev, "(port_idx %d) set feat %d/%d UNIMPLEMENTED\n",
port_idx, feature, selector);
result = -ENOSYS;
break;
return -ENOSYS;
default:
dev_err(dev, "(port_idx %d) set feat %d/%d UNKNOWN\n",
port_idx, feature, selector);
result = -EPIPE;
break;
return -EPIPE;
}
error:
d_fnend(4, dev, "(feat 0x%04u, selector 0x%u, port_idx %d) = %d\n",
feature, selector, port_idx, result);
return result;
return 0;
}
/*
......@@ -298,17 +277,13 @@ error:
static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature,
u8 selector, u8 port_idx)
{
int result = -EINVAL;
int result = 0;
struct device *dev = wusbhc->dev;
d_fnstart(4, dev, "(wusbhc %p feat 0x%04x selector %d port_idx %d)\n",
wusbhc, feature, selector, port_idx);
if (port_idx > wusbhc->ports_max)
goto error;
return -EINVAL;
mutex_lock(&wusbhc->mutex);
result = 0;
switch (feature) {
case USB_PORT_FEAT_POWER: /* fake port always on */
/* According to USB2.0[11.24.2.7.1.4], no need to implement? */
......@@ -328,10 +303,8 @@ static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature,
break;
case USB_PORT_FEAT_SUSPEND:
case USB_PORT_FEAT_C_SUSPEND:
case 0xffff: /* ??? FIXME */
dev_err(dev, "(port_idx %d) Clear feat %d/%d UNIMPLEMENTED\n",
port_idx, feature, selector);
/* dump_stack(); */
result = -ENOSYS;
break;
default:
......@@ -341,9 +314,7 @@ static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature,
break;
}
mutex_unlock(&wusbhc->mutex);
error:
d_fnend(4, dev, "(wusbhc %p feat 0x%04x selector %d port_idx %d) = "
"%d\n", wusbhc, feature, selector, port_idx, result);
return result;
}
......@@ -355,22 +326,17 @@ error:
static int wusbhc_rh_get_port_status(struct wusbhc *wusbhc, u16 port_idx,
u32 *_buf, u16 wLength)
{
int result = -EINVAL;
u16 *buf = (u16 *) _buf;
d_fnstart(1, wusbhc->dev, "(wusbhc %p port_idx %u wLength %u)\n",
wusbhc, port_idx, wLength);
if (port_idx > wusbhc->ports_max)
goto error;
return -EINVAL;
mutex_lock(&wusbhc->mutex);
buf[0] = cpu_to_le16(wusb_port_by_idx(wusbhc, port_idx)->status);
buf[1] = cpu_to_le16(wusb_port_by_idx(wusbhc, port_idx)->change);
result = 0;
mutex_unlock(&wusbhc->mutex);
error:
d_fnend(1, wusbhc->dev, "(wusbhc %p) = %d, buffer:\n", wusbhc, result);
d_dump(1, wusbhc->dev, _buf, wLength);