if (retval >= 0)
return;
error:
- pr_info("Vendor request \"stall\" failed\n");
+ dev_err(&dev->dev, "Vendor request \"stall\" failed\n");
}
/**
unsigned int sub_size = cfg->subbuffer_size;
if (!sub_size) {
- pr_info("Misconfig: Subbuffer size zero.\n");
+ pr_warn("Misconfig: Subbuffer size zero.\n");
return frame_size;
}
switch (cfg->data_type) {
break;
case MOST_CH_SYNC:
if (cfg->packets_per_xact == 0) {
- pr_info("Misconfig: Packets per XACT zero\n");
+ pr_warn("Misconfig: Packets per XACT zero\n");
frame_size = 0;
} else if (cfg->packets_per_xact == 0xFF)
frame_size = (USB_MTU / sub_size) * sub_size;
{
struct most_dev *mdev;
+ mdev = to_mdev(iface);
if (unlikely(!iface)) {
- pr_info("Poison: Bad interface.\n");
+ dev_warn(&mdev->usb_device->dev, "Poison: Bad interface.\n");
return -EIO;
}
if (unlikely((channel < 0) || (channel >= iface->num_channels))) {
- pr_info("Channel ID out of range.\n");
+ dev_warn(&mdev->usb_device->dev, "Channel ID out of range.\n");
return -ECHRNG;
}
- mdev = to_mdev(iface);
mdev->is_channel_healthy[channel] = false;
mutex_lock(&mdev->io_mutex);
num_frames = mbo->buffer_length / frame_size;
if (num_frames < 1) {
- pr_err("Missed minimal transfer unit.\n");
+ dev_err(&mdev->usb_device->dev,
+ "Missed minimal transfer unit.\n");
return -EIO;
}
struct mbo *mbo;
struct buf_anchor *anchor;
struct most_dev *mdev;
+ struct device *dev;
unsigned int channel;
unsigned long flags;
anchor = mbo->priv;
mdev = to_mdev(mbo->ifp);
channel = mbo->hdm_channel_id;
+ dev = &mdev->usb_device->dev;
if ((urb->status == -ENOENT) || (urb->status == -ECONNRESET) ||
(mdev->is_channel_healthy[channel] == false)) {
mbo->processed_length = 0;
switch (urb->status) {
case -EPIPE:
- pr_info("Broken OUT pipe detected\n");
+ dev_warn(dev, "Broken OUT pipe detected\n");
most_stop_enqueue(&mdev->iface, channel);
mbo->status = MBO_E_INVAL;
usb_unlink_urb(urb);
struct mbo *mbo;
struct buf_anchor *anchor;
struct most_dev *mdev;
+ struct device *dev;
unsigned long flags;
unsigned int channel;
struct most_channel_config *conf;
anchor = mbo->priv;
mdev = to_mdev(mbo->ifp);
channel = mbo->hdm_channel_id;
+ dev = &mdev->usb_device->dev;
if ((urb->status == -ENOENT) || (urb->status == -ECONNRESET) ||
(mdev->is_channel_healthy[channel] == false)) {
mbo->processed_length = 0;
switch (urb->status) {
case -EPIPE:
- pr_info("Broken IN pipe detected\n");
+ dev_warn(dev, "Broken IN pipe detected\n");
mbo->status = MBO_E_INVAL;
usb_unlink_urb(urb);
INIT_WORK(&anchor->clear_work_obj, wq_clear_halt);
mbo->status = MBO_E_CLOSE;
break;
case -EOVERFLOW:
- pr_info("Babble on IN pipe detected\n");
+ dev_warn(dev, "Babble on IN pipe detected\n");
default:
mbo->status = MBO_E_INVAL;
break;
struct most_dev *mdev;
struct buf_anchor *anchor;
struct most_channel_config *conf;
+ struct device *dev;
int retval = 0;
struct urb *urb;
unsigned long flags;
unsigned long length;
void *virt_address;
- if (unlikely(!iface || !mbo)) {
- pr_info("Bad interface or MBO\n");
+ if (unlikely(!iface || !mbo))
return -EIO;
- }
- if (unlikely(iface->num_channels <= channel) || (channel < 0)) {
- pr_info("Channel ID out of range\n");
+ if (unlikely(iface->num_channels <= channel) || (channel < 0))
return -ECHRNG;
- }
mdev = to_mdev(iface);
conf = &mdev->conf[channel];
+ dev = &mdev->usb_device->dev;
if (!mdev->usb_device)
return -ENODEV;
urb = usb_alloc_urb(NO_ISOCHRONOUS_URB, GFP_ATOMIC);
if (!urb) {
- pr_info("Failed to allocate URB\n");
+ dev_err(dev, "Failed to allocate URB\n");
return -ENOMEM;
}
retval = usb_submit_urb(urb, GFP_KERNEL);
if (retval) {
- pr_info("URB submit failed with error %d.\n", retval);
+ dev_err(dev, "URB submit failed with error %d.\n", retval);
goto _error_1;
}
return 0;
unsigned int temp_size;
unsigned int tail_space;
struct most_dev *mdev;
+ struct device *dev;
+
+ mdev = to_mdev(iface);
+ mdev->is_channel_healthy[channel] = true;
+ dev = &mdev->usb_device->dev;
if (unlikely(!iface || !conf)) {
- pr_info("Bad interface or config pointer.\n");
+ dev_err(dev, "Bad interface or config pointer.\n");
return -EINVAL;
}
if (unlikely((channel < 0) || (channel >= iface->num_channels))) {
- pr_info("Channel ID out of range.\n");
+ dev_err(dev, "Channel ID out of range.\n");
return -EINVAL;
}
if ((!conf->num_buffers) || (!conf->buffer_size)) {
- pr_info("Misconfig: buffer size or number of buffers zero.\n");
+ dev_err(dev, "Misconfig: buffer size or #buffers zero.\n");
return -EINVAL;
}
- mdev = to_mdev(iface);
- mdev->is_channel_healthy[channel] = true;
-
if (!(conf->data_type == MOST_CH_SYNC) &&
!((conf->data_type == MOST_CH_ISOC_AVP) &&
(conf->packets_per_xact != 0xFF))) {
if ((conf->data_type != MOST_CH_SYNC) &&
(conf->data_type != MOST_CH_ISOC_AVP)) {
- pr_info("Unsupported data type\n");
+ dev_warn(dev, "Unsupported data type\n");
return -EINVAL;
}
frame_size = get_stream_frame_size(conf);
if ((frame_size == 0) || (frame_size > USB_MTU)) {
- pr_info("Misconfig: frame size wrong\n");
+ dev_warn(dev, "Misconfig: frame size wrong\n");
return -EINVAL;
}
tmp_val = conf->buffer_size / frame_size;
conf->buffer_size = tmp_val * frame_size;
- pr_info("Channel %d - rouding buffer size to %d bytes,"
- " channel config says %d bytes",
- channel,
- conf->buffer_size,
- temp_size);
+ dev_notice(dev,
+ "Channel %d - rouding buffer size to %d bytes, "
+ "channel config says %d bytes\n",
+ channel,
+ conf->buffer_size,
+ temp_size);
}
num_frames = conf->buffer_size / frame_size;
*/
int hdm_update_netinfo(struct most_dev *mdev)
{
+ struct device *dev = &mdev->usb_device->dev;
int i;
u16 link;
u8 addr[6];
if (!is_valid_ether_addr(mdev->hw_addr)) {
if (0 > drci_rd_reg(mdev->usb_device,
DRCI_REG_HW_ADDR_HI, addr)) {
- pr_info("Vendor request \"hw_addr_hi\" failed\n");
+ dev_err(dev, "Vendor request \"hw_addr_hi\" failed\n");
return -1;
}
if (0 > drci_rd_reg(mdev->usb_device,
DRCI_REG_HW_ADDR_MI, addr + 2)) {
- pr_info("Vendor request \"hw_addr_mid\" failed\n");
+ dev_err(dev, "Vendor request \"hw_addr_mid\" failed\n");
return -1;
}
if (0 > drci_rd_reg(mdev->usb_device,
DRCI_REG_HW_ADDR_LO, addr + 4)) {
- pr_info("Vendor request \"hw_addr_low\" failed\n");
+ dev_err(dev, "Vendor request \"hw_addr_low\" failed\n");
return -1;
}
mutex_lock(&mdev->io_mutex);
}
if (0 > drci_rd_reg(mdev->usb_device, DRCI_REG_NI_STATE, &link)) {
- pr_info("Vendor request \"link status\" failed\n");
+ dev_err(dev, "Vendor request \"link status\" failed\n");
return -1;
}
le16_to_cpus(&link);
channel = mbo->hdm_channel_id;
if (usb_clear_halt(urb->dev, urb->pipe))
- pr_info("Failed to reset endpoint.\n");
+ dev_warn(&mdev->usb_device->dev, "Failed to reset endpoint.\n");
usb_free_urb(urb);
spin_lock_irqsave(&mdev->anchor_list_lock[channel], flags);
struct most_channel_capability *tmp_cap;
struct most_dev *mdev;
struct usb_device *usb_dev;
+ struct device *dev;
struct usb_host_interface *usb_iface_desc;
struct usb_endpoint_descriptor *ep_desc;
int ret = 0;
usb_iface_desc = interface->cur_altsetting;
usb_dev = interface_to_usbdev(interface);
+ dev = &usb_dev->dev;
mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
if (!mdev)
goto exit_ENOMEM;
INIT_LIST_HEAD(&mdev->anchor_list[i]);
spin_lock_init(&mdev->anchor_list_lock[i]);
}
- pr_info("claimed gadget: Vendor=%4.4x ProdID=%4.4x Bus=%02x Device=%02x If#=%d Alt=%d\n",
- le16_to_cpu(usb_dev->descriptor.idVendor),
- le16_to_cpu(usb_dev->descriptor.idProduct),
- usb_dev->bus->busnum,
- usb_dev->devnum,
- usb_iface_desc->desc.bInterfaceNumber,
- usb_iface_desc->desc.bAlternateSetting);
-
- pr_info("device path: /sys/bus/usb/devices/%d-%s:%d.%d\n",
- usb_dev->bus->busnum,
- usb_dev->devpath,
- usb_dev->config->desc.bConfigurationValue,
- usb_iface_desc->desc.bInterfaceNumber);
+ dev_notice(dev, "claimed gadget: Vendor=%4.4x ProdID=%4.4x Bus=%02x Device=%02x\n",
+ le16_to_cpu(usb_dev->descriptor.idVendor),
+ le16_to_cpu(usb_dev->descriptor.idProduct),
+ usb_dev->bus->busnum,
+ usb_dev->devnum);
+
+ dev_notice(dev, "device path: /sys/bus/usb/devices/%d-%s:%d.%d\n",
+ usb_dev->bus->busnum,
+ usb_dev->devpath,
+ usb_dev->config->desc.bConfigurationValue,
+ usb_iface_desc->desc.bInterfaceNumber);
mdev->parent = most_register_interface(&mdev->iface);
if (IS_ERR(mdev->parent)) {
exit_ENOMEM:
if (ret == 0 || ret == -ENOMEM) {
ret = -ENOMEM;
- pr_info("out of memory\n");
+ dev_err(dev, "out of memory\n");
}
return ret;
}
struct most_dev *mdev;
mdev = usb_get_intfdata(interface);
- if (unlikely(!mdev)) {
- pr_info("failed to retrieve interface data\n");
- return;
- }
-
mutex_lock(&mdev->io_mutex);
usb_set_intfdata(interface, NULL);
mdev->usb_device = NULL;
{
pr_info("hdm_usb_init()\n");
if (usb_register(&hdm_usb)) {
- pr_info("could not register hdm_usb driver\n");
+ pr_err("could not register hdm_usb driver\n");
return -EIO;
}
schedule_usb_work = create_workqueue("hdmu_work");
if (schedule_usb_work == NULL) {
- pr_info("could not create workqueue\n");
+ pr_err("could not create workqueue\n");
usb_deregister(&hdm_usb);
return -ENOMEM;
}