提交 fb1c6348 编写于 作者: L Linus Torvalds

Merge branch 'staging-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6

* 'staging-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (26 commits)
  staging: r8712u: Add new device IDs
  staging: brcm80211: fix suspend/resume issue in brcmsmac
  staging: brcm80211: remove assert to avoid panic since 2.6.37 kernel
  Staging: iio: Aditional fixpoint formatted output bugfix
  staging: usbip: vhci: use urb->dev->portnum to find port
  staging: usbip: vhci: handle EAGAIN from SO_RCVTIMEO
  staging: usbip: vhci: friendly log messages for connection errors
  staging: usbip: vhci: refuse to enqueue for dead connections
  staging: usbip: vhci: give back URBs from in-flight unlink requests
  staging: usbip: vhci: update reference count for usb_device
  staging: usbip: stub: update refcounts for devices and interfaces
  staging: tidspbridge: replace mbox callback with notifier_call
  staging: comedi: ni_labpc: Use shared IRQ for PCMCIA card
  Staging: speakup: &&/|| confusion in silent_store()
  iio: Fixpoint formatted output bugfix
  staging: rt2860: Fix incorrect netif_stop_queue usage warning
  staging: r8712u: Fix memory leak in firmware loading
  staging: tidspbridge: configure full L1 MMU range
  staging: rt2870sta: Add ID for Linksys WUSB100v2
  Staging: xgfib: put parenthesis in the right place
  ...
......@@ -360,8 +360,8 @@ int PSSendOps(void *arg)
status = 1;
goto complete;
}
len = (firmware->size > MAX_BDADDR_FORMAT_LENGTH)? MAX_BDADDR_FORMAT_LENGTH: firmware->size;
memcpy(config_bdaddr, firmware->data,len);
len = min(firmware->size, MAX_BDADDR_FORMAT_LENGTH - 1);
memcpy(config_bdaddr, firmware->data, len);
config_bdaddr[len] = '\0';
write_bdaddr(hdev,config_bdaddr,BDADDR_TYPE_STRING);
A_RELEASE_FIRMWARE(firmware);
......
......@@ -209,11 +209,8 @@ static void wl_ops_stop(struct ieee80211_hw *hw)
struct wl_info *wl = hw->priv;
ASSERT(wl);
WL_LOCK(wl);
wl_down(wl);
ieee80211_stop_queues(hw);
WL_UNLOCK(wl);
return;
}
static int
......@@ -246,7 +243,14 @@ wl_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
static void
wl_ops_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
return;
struct wl_info *wl;
wl = HW_TO_WL(hw);
/* put driver in down state */
WL_LOCK(wl);
wl_down(wl);
WL_UNLOCK(wl);
}
static int
......@@ -779,7 +783,7 @@ static struct wl_info *wl_attach(u16 vendor, u16 device, unsigned long regs,
wl_found++;
return wl;
fail:
fail:
wl_free(wl);
fail1:
return NULL;
......@@ -1090,7 +1094,6 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0;
}
#ifdef LINUXSTA_PS
static int wl_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct wl_info *wl;
......@@ -1105,11 +1108,12 @@ static int wl_suspend(struct pci_dev *pdev, pm_message_t state)
return -ENODEV;
}
/* only need to flag hw is down for proper resume */
WL_LOCK(wl);
wl_down(wl);
wl->pub->hw_up = false;
WL_UNLOCK(wl);
pci_save_state(pdev, wl->pci_psstate);
pci_save_state(pdev);
pci_disable_device(pdev);
return pci_set_power_state(pdev, PCI_D3hot);
}
......@@ -1133,7 +1137,7 @@ static int wl_resume(struct pci_dev *pdev)
if (err)
return err;
pci_restore_state(pdev, wl->pci_psstate);
pci_restore_state(pdev);
err = pci_enable_device(pdev);
if (err)
......@@ -1145,13 +1149,12 @@ static int wl_resume(struct pci_dev *pdev)
if ((val & 0x0000ff00) != 0)
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
WL_LOCK(wl);
err = wl_up(wl);
WL_UNLOCK(wl);
/*
* done. driver will be put in up state
* in wl_ops_add_interface() call.
*/
return err;
}
#endif /* LINUXSTA_PS */
static void wl_remove(struct pci_dev *pdev)
{
......@@ -1184,14 +1187,12 @@ static void wl_remove(struct pci_dev *pdev)
}
static struct pci_driver wl_pci_driver = {
.name = "brcm80211",
.probe = wl_pci_probe,
#ifdef LINUXSTA_PS
.suspend = wl_suspend,
.resume = wl_resume,
#endif /* LINUXSTA_PS */
.remove = __devexit_p(wl_remove),
.id_table = wl_id_table,
.name = "brcm80211",
.probe = wl_pci_probe,
.suspend = wl_suspend,
.resume = wl_resume,
.remove = __devexit_p(wl_remove),
.id_table = wl_id_table,
};
/**
......
......@@ -5126,7 +5126,6 @@ wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu,
fifo = prio2fifo[prio];
ASSERT((uint) skb_headroom(sdu) >= TXOFF);
ASSERT(!(sdu->cloned));
ASSERT(!(sdu->next));
ASSERT(!(sdu->prev));
ASSERT(fifo < NFIFO);
......
......@@ -575,7 +575,8 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase,
/* grab our IRQ */
if (irq) {
isr_flags = 0;
if (thisboard->bustype == pci_bustype)
if (thisboard->bustype == pci_bustype
|| thisboard->bustype == pcmcia_bustype)
isr_flags |= IRQF_SHARED;
if (request_irq(irq, labpc_interrupt, isr_flags,
driver_labpc.driver_name, dev)) {
......
......@@ -368,6 +368,7 @@ static int blkvsc_probe(struct device *device)
blkdev->gd->first_minor = 0;
blkdev->gd->fops = &block_ops;
blkdev->gd->private_data = blkdev;
blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device);
sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum);
blkvsc_do_inquiry(blkdev);
......
......@@ -1279,7 +1279,7 @@ static void netvsc_channel_cb(void *context)
/* ASSERT(device); */
packet = kzalloc(NETVSC_PACKET_SIZE * sizeof(unsigned char),
GFP_KERNEL);
GFP_ATOMIC);
if (!packet)
return;
buffer = packet;
......
......@@ -358,7 +358,6 @@ static int netvsc_probe(struct device *device)
/* Set initial state */
netif_carrier_off(net);
netif_stop_queue(net);
net_device_ctx = netdev_priv(net);
net_device_ctx->device_ctx = device_ctx;
......
......@@ -68,7 +68,7 @@ static ssize_t ad7476_show_scale(struct device *dev,
/* Corresponds to Vref / 2^(bits) */
unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits;
return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000);
return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000);
}
static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7476_show_scale, NULL, 0);
......
......@@ -68,7 +68,7 @@ static ssize_t ad7887_show_scale(struct device *dev,
/* Corresponds to Vref / 2^(bits) */
unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits;
return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000);
return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000);
}
static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7887_show_scale, NULL, 0);
......
......@@ -432,7 +432,7 @@ static ssize_t ad799x_show_scale(struct device *dev,
/* Corresponds to Vref / 2^(bits) */
unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits;
return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000);
return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000);
}
static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad799x_show_scale, NULL, 0);
......
......@@ -87,7 +87,7 @@ static ssize_t ad5446_show_scale(struct device *dev,
/* Corresponds to Vref / 2^(bits) */
unsigned int scale_uv = (st->vref_mv * 1000) >> st->chip_info->bits;
return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000);
return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000);
}
static IIO_DEVICE_ATTR(out_scale, S_IRUGO, ad5446_show_scale, NULL, 0);
......
......@@ -484,8 +484,6 @@ struct net_device *RtmpPhyNetDevInit(struct rt_rtmp_adapter *pAd,
net_dev->ml_priv = (void *)pAd;
pAd->net_dev = net_dev;
netif_stop_queue(net_dev);
return net_dev;
}
......
......@@ -106,6 +106,7 @@ struct usb_device_id rtusb_usb_id[] = {
{USB_DEVICE(0x0411, 0x016f)}, /* MelCo.,Inc. WLI-UC-G301N */
{USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */
{USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */
{USB_DEVICE(0x1737, 0x0078)}, /* Linksys WUSB100v2 */
{USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */
{USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */
{USB_DEVICE(0x100D, 0x9031)}, /* Motorola 2770 */
......
......@@ -128,12 +128,13 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter)
u8 *ptmpchar = NULL, *ppayload, *ptr;
struct tx_desc *ptx_desc;
u32 txdscp_sz = sizeof(struct tx_desc);
u8 ret = _FAIL;
ulfilelength = rtl871x_open_fw(padapter, &phfwfile_hdl, &pmappedfw);
if (pmappedfw && (ulfilelength > 0)) {
update_fwhdr(&fwhdr, pmappedfw);
if (chk_fwhdr(&fwhdr, ulfilelength) == _FAIL)
goto exit_fail;
goto firmware_rel;
fill_fwpriv(padapter, &fwhdr.fwpriv);
/* firmware check ok */
maxlen = (fwhdr.img_IMEM_size > fwhdr.img_SRAM_size) ?
......@@ -141,7 +142,7 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter)
maxlen += txdscp_sz;
ptmpchar = _malloc(maxlen + FWBUFF_ALIGN_SZ);
if (ptmpchar == NULL)
return _FAIL;
goto firmware_rel;
ptx_desc = (struct tx_desc *)(ptmpchar + FWBUFF_ALIGN_SZ -
((addr_t)(ptmpchar) & (FWBUFF_ALIGN_SZ - 1)));
......@@ -273,11 +274,13 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter)
goto exit_fail;
} else
goto exit_fail;
return _SUCCESS;
ret = _SUCCESS;
exit_fail:
kfree(ptmpchar);
return _FAIL;
firmware_rel:
release_firmware((struct firmware *)phfwfile_hdl);
return ret;
}
uint rtl8712_hal_init(struct _adapter *padapter)
......
......@@ -47,54 +47,123 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
static void r871xu_dev_remove(struct usb_interface *pusb_intf);
static struct usb_device_id rtl871x_usb_id_tbl[] = {
/*92SU
* Realtek */
{USB_DEVICE(0x0bda, 0x8171)},
{USB_DEVICE(0x0bda, 0x8172)},
/* RTL8188SU */
/* Realtek */
{USB_DEVICE(0x0BDA, 0x8171)},
{USB_DEVICE(0x0bda, 0x8173)},
{USB_DEVICE(0x0bda, 0x8174)},
{USB_DEVICE(0x0bda, 0x8712)},
{USB_DEVICE(0x0bda, 0x8713)},
{USB_DEVICE(0x0bda, 0xC512)},
/* Abocom */
/* Abocom */
{USB_DEVICE(0x07B8, 0x8188)},
/* ASUS */
{USB_DEVICE(0x0B05, 0x1786)},
{USB_DEVICE(0x0B05, 0x1791)}, /* 11n mode disable */
/* Belkin */
{USB_DEVICE(0x050D, 0x945A)},
/* Corega */
{USB_DEVICE(0x07aa, 0x0047)},
/* Dlink */
{USB_DEVICE(0x07d1, 0x3303)},
{USB_DEVICE(0x07d1, 0x3302)},
{USB_DEVICE(0x07d1, 0x3300)},
/* Dlink for Skyworth */
{USB_DEVICE(0x14b2, 0x3300)},
{USB_DEVICE(0x14b2, 0x3301)},
{USB_DEVICE(0x14b2, 0x3302)},
{USB_DEVICE(0x07AA, 0x0047)},
/* D-Link */
{USB_DEVICE(0x2001, 0x3306)},
{USB_DEVICE(0x07D1, 0x3306)}, /* 11n mode disable */
/* Edimax */
{USB_DEVICE(0x7392, 0x7611)},
/* EnGenius */
{USB_DEVICE(0x1740, 0x9603)},
{USB_DEVICE(0x1740, 0x9605)},
/* Hawking */
{USB_DEVICE(0x0E66, 0x0016)},
/* Hercules */
{USB_DEVICE(0x06F8, 0xE034)},
{USB_DEVICE(0x06F8, 0xE032)},
/* Logitec */
{USB_DEVICE(0x0789, 0x0167)},
/* PCI */
{USB_DEVICE(0x2019, 0xAB28)},
{USB_DEVICE(0x2019, 0xED16)},
/* Sitecom */
{USB_DEVICE(0x0DF6, 0x0057)},
{USB_DEVICE(0x0DF6, 0x0045)},
{USB_DEVICE(0x0DF6, 0x0059)}, /* 11n mode disable */
{USB_DEVICE(0x0DF6, 0x004B)},
{USB_DEVICE(0x0DF6, 0x0063)},
/* Sweex */
{USB_DEVICE(0x177F, 0x0154)},
/* Thinkware */
{USB_DEVICE(0x0BDA, 0x5077)},
/* Toshiba */
{USB_DEVICE(0x1690, 0x0752)},
/* - */
{USB_DEVICE(0x20F4, 0x646B)},
{USB_DEVICE(0x083A, 0xC512)},
/* RTL8191SU */
/* Realtek */
{USB_DEVICE(0x0BDA, 0x8172)},
/* Amigo */
{USB_DEVICE(0x0EB0, 0x9061)},
/* ASUS/EKB */
{USB_DEVICE(0x0BDA, 0x8172)},
{USB_DEVICE(0x13D3, 0x3323)},
{USB_DEVICE(0x13D3, 0x3311)}, /* 11n mode disable */
{USB_DEVICE(0x13D3, 0x3342)},
/* ASUS/EKBLenovo */
{USB_DEVICE(0x13D3, 0x3333)},
{USB_DEVICE(0x13D3, 0x3334)},
{USB_DEVICE(0x13D3, 0x3335)}, /* 11n mode disable */
{USB_DEVICE(0x13D3, 0x3336)}, /* 11n mode disable */
/* ASUS/Media BOX */
{USB_DEVICE(0x13D3, 0x3309)},
/* Belkin */
{USB_DEVICE(0x050d, 0x815F)},
{USB_DEVICE(0x050d, 0x945A)},
{USB_DEVICE(0x050d, 0x845A)},
/* Guillemot */
{USB_DEVICE(0x06f8, 0xe031)},
{USB_DEVICE(0x050D, 0x815F)},
/* D-Link */
{USB_DEVICE(0x07D1, 0x3302)},
{USB_DEVICE(0x07D1, 0x3300)},
{USB_DEVICE(0x07D1, 0x3303)},
/* Edimax */
{USB_DEVICE(0x7392, 0x7611)},
{USB_DEVICE(0x7392, 0x7612)},
{USB_DEVICE(0x7392, 0x7622)},
/* Sitecom */
{USB_DEVICE(0x0DF6, 0x0045)},
/* EnGenius */
{USB_DEVICE(0x1740, 0x9605)},
/* Guillemot */
{USB_DEVICE(0x06F8, 0xE031)},
/* Hawking */
{USB_DEVICE(0x0E66, 0x0015)},
{USB_DEVICE(0x0E66, 0x0016)},
{USB_DEVICE(0x0b05, 0x1786)},
{USB_DEVICE(0x0b05, 0x1791)}, /* 11n mode disable */
/* Mediao */
{USB_DEVICE(0x13D3, 0x3306)},
{USB_DEVICE(0x13D3, 0x3309)},
/* PCI */
{USB_DEVICE(0x2019, 0xED18)},
{USB_DEVICE(0x2019, 0x4901)},
/* Sitecom */
{USB_DEVICE(0x0DF6, 0x0058)},
{USB_DEVICE(0x0DF6, 0x0049)},
{USB_DEVICE(0x0DF6, 0x004C)},
{USB_DEVICE(0x0DF6, 0x0064)},
/* Skyworth */
{USB_DEVICE(0x14b2, 0x3300)},
{USB_DEVICE(0x14b2, 0x3301)},
{USB_DEVICE(0x14B2, 0x3302)},
/* - */
{USB_DEVICE(0x04F2, 0xAFF2)},
{USB_DEVICE(0x04F2, 0xAFF5)},
{USB_DEVICE(0x04F2, 0xAFF6)},
{USB_DEVICE(0x13D3, 0x3339)},
{USB_DEVICE(0x13D3, 0x3340)}, /* 11n mode disable */
{USB_DEVICE(0x13D3, 0x3341)}, /* 11n mode disable */
{USB_DEVICE(0x13D3, 0x3310)},
{USB_DEVICE(0x13D3, 0x3311)}, /* 11n mode disable */
{USB_DEVICE(0x13D3, 0x3325)},
{USB_DEVICE(0x083A, 0xC512)},
/* RTL8192SU */
/* Realtek */
{USB_DEVICE(0x0BDA, 0x8174)},
{USB_DEVICE(0x0BDA, 0x8174)},
/* Belkin */
{USB_DEVICE(0x050D, 0x845A)},
/* Corega */
{USB_DEVICE(0x07AA, 0x0051)},
/* Edimax */
{USB_DEVICE(0x7392, 0x7622)},
/* NEC */
{USB_DEVICE(0x0409, 0x02B6)},
{}
};
......@@ -103,8 +172,20 @@ MODULE_DEVICE_TABLE(usb, rtl871x_usb_id_tbl);
static struct specific_device_id specific_device_id_tbl[] = {
{.idVendor = 0x0b05, .idProduct = 0x1791,
.flags = SPEC_DEV_ID_DISABLE_HT},
{.idVendor = 0x0df6, .idProduct = 0x0059,
.flags = SPEC_DEV_ID_DISABLE_HT},
{.idVendor = 0x13d3, .idProduct = 0x3306,
.flags = SPEC_DEV_ID_DISABLE_HT},
{.idVendor = 0x13D3, .idProduct = 0x3311,
.flags = SPEC_DEV_ID_DISABLE_HT},
{.idVendor = 0x13d3, .idProduct = 0x3335,
.flags = SPEC_DEV_ID_DISABLE_HT},
{.idVendor = 0x13d3, .idProduct = 0x3336,
.flags = SPEC_DEV_ID_DISABLE_HT},
{.idVendor = 0x13d3, .idProduct = 0x3340,
.flags = SPEC_DEV_ID_DISABLE_HT},
{.idVendor = 0x13d3, .idProduct = 0x3341,
.flags = SPEC_DEV_ID_DISABLE_HT},
{}
};
......
......@@ -332,7 +332,7 @@ static ssize_t silent_store(struct kobject *kobj, struct kobj_attribute *attr,
unsigned long flags;
len = strlen(buf);
if (len > 0 || len < 3) {
if (len > 0 && len < 3) {
ch = buf[0];
if (ch == '\n')
ch = '0';
......
......@@ -986,12 +986,6 @@ static int __devinit synaptics_rmi4_probe
input_set_abs_params(rmi4_data->input_dev, ABS_MT_TOUCH_MAJOR, 0,
MAX_TOUCH_MAJOR, 0, 0);
retval = input_register_device(rmi4_data->input_dev);
if (retval) {
dev_err(&client->dev, "%s:input register failed\n", __func__);
goto err_input_register;
}
/* Clear interrupts */
synaptics_rmi4_i2c_block_read(rmi4_data,
rmi4_data->fn01_data_base_addr + 1, intr_status,
......@@ -1003,15 +997,20 @@ static int __devinit synaptics_rmi4_probe
if (retval) {
dev_err(&client->dev, "%s:Unable to get attn irq %d\n",
__func__, platformdata->irq_number);
goto err_request_irq;
goto err_unset_clientdata;
}
retval = input_register_device(rmi4_data->input_dev);
if (retval) {
dev_err(&client->dev, "%s:input register failed\n", __func__);
goto err_free_irq;
}
return retval;
err_request_irq:
err_free_irq:
free_irq(platformdata->irq_number, rmi4_data);
input_unregister_device(rmi4_data->input_dev);
err_input_register:
err_unset_clientdata:
i2c_set_clientdata(client, NULL);
err_query_dev:
if (platformdata->regulator_en) {
......
......@@ -949,7 +949,7 @@ void io_dpc(unsigned long ref_data)
* Calls the Bridge's CHNL_ISR to determine if this interrupt is ours, then
* schedules a DPC to dispatch I/O.
*/
void io_mbox_msg(u32 msg)
int io_mbox_msg(struct notifier_block *self, unsigned long len, void *msg)
{
struct io_mgr *pio_mgr;
struct dev_object *dev_obj;
......@@ -959,9 +959,9 @@ void io_mbox_msg(u32 msg)
dev_get_io_mgr(dev_obj, &pio_mgr);
if (!pio_mgr)
return;
return NOTIFY_BAD;
pio_mgr->intr_val = (u16)msg;
pio_mgr->intr_val = (u16)((u32)msg);
if (pio_mgr->intr_val & MBX_PM_CLASS)
io_dispatch_pm(pio_mgr);
......@@ -973,7 +973,7 @@ void io_mbox_msg(u32 msg)
spin_unlock_irqrestore(&pio_mgr->dpc_lock, flags);
tasklet_schedule(&pio_mgr->dpc_tasklet);
}
return;
return NOTIFY_OK;
}
/*
......
......@@ -223,6 +223,10 @@ static struct bridge_drv_interface drv_interface_fxns = {
bridge_msg_set_queue_id,
};
static struct notifier_block dsp_mbox_notifier = {
.notifier_call = io_mbox_msg,
};
static inline void flush_all(struct bridge_dev_context *dev_context)
{
if (dev_context->dw_brd_state == BRD_DSP_HIBERNATION ||
......@@ -553,7 +557,7 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt,
* Enable Mailbox events and also drain any pending
* stale messages.
*/
dev_context->mbox = omap_mbox_get("dsp");
dev_context->mbox = omap_mbox_get("dsp", &dsp_mbox_notifier);
if (IS_ERR(dev_context->mbox)) {
dev_context->mbox = NULL;
pr_err("%s: Failed to get dsp mailbox handle\n",
......@@ -563,8 +567,6 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt,
}
if (!status) {
dev_context->mbox->rxq->callback = (int (*)(void *))io_mbox_msg;
/*PM_IVA2GRPSEL_PER = 0xC0;*/
temp = readl(resources->dw_per_pm_base + 0xA8);
temp = (temp & 0xFFFFFF30) | 0xC0;
......@@ -685,7 +687,7 @@ static int bridge_brd_stop(struct bridge_dev_context *dev_ctxt)
/* Disable the mailbox interrupts */
if (dev_context->mbox) {
omap_mbox_disable_irq(dev_context->mbox, IRQ_RX);
omap_mbox_put(dev_context->mbox);
omap_mbox_put(dev_context->mbox, &dsp_mbox_notifier);
dev_context->mbox = NULL;
}
/* Reset IVA2 clocks*/
......@@ -786,10 +788,7 @@ static int bridge_dev_create(struct bridge_dev_context
pt_attrs = kzalloc(sizeof(struct pg_table_attrs), GFP_KERNEL);
if (pt_attrs != NULL) {
/* Assuming that we use only DSP's memory map
* until 0x4000:0000 , we would need only 1024
* L1 enties i.e L1 size = 4K */
pt_attrs->l1_size = 0x1000;
pt_attrs->l1_size = SZ_16K; /* 4096 entries of 32 bits */
align_size = pt_attrs->l1_size;
/* Align sizes are expected to be power of 2 */
/* we like to get aligned on L1 table size */
......
......@@ -72,22 +72,17 @@ extern void io_dpc(unsigned long ref_data);
/*
* ======== io_mbox_msg ========
* Purpose:
* Main interrupt handler for the shared memory Bridge channel manager.
* Calls the Bridge's chnlsm_isr to determine if this interrupt is ours,
* then schedules a DPC to dispatch I/O.
* Main message handler for the shared memory Bridge channel manager.
* Determine if this message is ours, then schedules a DPC to
* dispatch I/O.
* Parameters:
* ref_data: Pointer to the channel manager object for this board.
* Set in an initial call to ISR_Install().
* self: Pointer to its own notifier_block struct.
* len: Length of message.
* msg: Message code received.
* Returns:
* TRUE if interrupt handled; FALSE otherwise.
* Requires:
* Must be in locked memory if executing in kernel mode.
* Must only call functions which are in locked memory if Kernel mode.
* Must only call asynchronous services.
* Interrupts are disabled and EOI for this interrupt has been sent.
* Ensures:
* NOTIFY_OK if handled; NOTIFY_BAD otherwise.
*/
void io_mbox_msg(u32 msg);
int io_mbox_msg(struct notifier_block *self, unsigned long len, void *msg);
/*
* ======== io_request_chnl ========
......
......@@ -32,6 +32,7 @@
struct stub_device {
struct usb_interface *interface;
struct usb_device *udev;
struct list_head list;
struct usbip_device ud;
......
......@@ -258,10 +258,11 @@ static void stub_shutdown_connection(struct usbip_device *ud)
static void stub_device_reset(struct usbip_device *ud)
{
struct stub_device *sdev = container_of(ud, struct stub_device, ud);
struct usb_device *udev = interface_to_usbdev(sdev->interface);
struct usb_device *udev = sdev->udev;
int ret;
usbip_udbg("device reset");
ret = usb_lock_device_for_reset(udev, sdev->interface);
if (ret < 0) {
dev_err(&udev->dev, "lock for reset\n");
......@@ -309,7 +310,8 @@ static void stub_device_unusable(struct usbip_device *ud)
*
* Allocates and initializes a new stub_device struct.
*/
static struct stub_device *stub_device_alloc(struct usb_interface *interface)
static struct stub_device *stub_device_alloc(struct usb_device *udev,
struct usb_interface *interface)
{
struct stub_device *sdev;
int busnum = interface_to_busnum(interface);
......@@ -324,7 +326,8 @@ static struct stub_device *stub_device_alloc(struct usb_interface *interface)
return NULL;
}
sdev->interface = interface;
sdev->interface = usb_get_intf(interface);
sdev->udev = usb_get_dev(udev);
/*
* devid is defined with devnum when this driver is first allocated.
......@@ -450,11 +453,12 @@ static int stub_probe(struct usb_interface *interface,
return err;
}
usb_get_intf(interface);
return 0;
}
/* ok. this is my device. */
sdev = stub_device_alloc(interface);
sdev = stub_device_alloc(udev, interface);
if (!sdev)
return -ENOMEM;
......@@ -476,6 +480,8 @@ static int stub_probe(struct usb_interface *interface,
dev_err(&interface->dev, "create sysfs files for %s\n",
udev_busid);
usb_set_intfdata(interface, NULL);
usb_put_intf(interface);
busid_priv->interf_count = 0;
busid_priv->sdev = NULL;
......@@ -545,6 +551,7 @@ static void stub_disconnect(struct usb_interface *interface)
if (busid_priv->interf_count > 1) {
busid_priv->interf_count--;
shutdown_busid(busid_priv);
usb_put_intf(interface);
return;
}
......@@ -554,6 +561,9 @@ static void stub_disconnect(struct usb_interface *interface)
/* 1. shutdown the current connection */
shutdown_busid(busid_priv);
usb_put_dev(sdev->udev);
usb_put_intf(interface);
/* 3. free sdev */
busid_priv->sdev = NULL;
stub_device_free(sdev);
......
......@@ -364,7 +364,7 @@ static struct stub_priv *stub_priv_alloc(struct stub_device *sdev,
static int get_pipe(struct stub_device *sdev, int epnum, int dir)
{
struct usb_device *udev = interface_to_usbdev(sdev->interface);
struct usb_device *udev = sdev->udev;
struct usb_host_endpoint *ep;
struct usb_endpoint_descriptor *epd = NULL;
......@@ -484,7 +484,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
int ret;
struct stub_priv *priv;
struct usbip_device *ud = &sdev->ud;
struct usb_device *udev = interface_to_usbdev(sdev->interface);
struct usb_device *udev = sdev->udev;
int pipe = get_pipe(sdev, pdu->base.ep, pdu->base.direction);
......
......@@ -100,9 +100,6 @@ struct vhci_hcd {
* But, the index of this array begins from 0.
*/
struct vhci_device vdev[VHCI_NPORTS];
/* vhci_device which has not been assiged its address yet */
int pending_port;
};
......@@ -119,6 +116,9 @@ void rh_port_disconnect(int rhport);
void vhci_rx_loop(struct usbip_task *ut);
void vhci_tx_loop(struct usbip_task *ut);
struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev,
__u32 seqnum);
#define hardware (&the_controller->pdev.dev)
static inline struct vhci_device *port_to_vdev(__u32 port)
......
......@@ -138,8 +138,6 @@ void rh_port_connect(int rhport, enum usb_device_speed speed)
* the_controller->vdev[rhport].ud.status = VDEV_CONNECT;
* spin_unlock(&the_controller->vdev[rhport].ud.lock); */
the_controller->pending_port = rhport;
spin_unlock_irqrestore(&the_controller->lock, flags);
usb_hcd_poll_rh_status(vhci_to_hcd(the_controller));
......@@ -559,6 +557,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
struct device *dev = &urb->dev->dev;
int ret = 0;
unsigned long flags;
struct vhci_device *vdev;
usbip_dbg_vhci_hc("enter, usb_hcd %p urb %p mem_flags %d\n",
hcd, urb, mem_flags);
......@@ -574,6 +573,18 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
return urb->status;
}
vdev = port_to_vdev(urb->dev->portnum-1);
/* refuse enqueue for dead connection */
spin_lock(&vdev->ud.lock);
if (vdev->ud.status == VDEV_ST_NULL || vdev->ud.status == VDEV_ST_ERROR) {
usbip_uerr("enqueue for inactive port %d\n", vdev->rhport);
spin_unlock(&vdev->ud.lock);
spin_unlock_irqrestore(&the_controller->lock, flags);
return -ENODEV;
}
spin_unlock(&vdev->ud.lock);
ret = usb_hcd_link_urb_to_ep(hcd, urb);
if (ret)
goto no_need_unlink;
......@@ -592,8 +603,6 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
__u8 type = usb_pipetype(urb->pipe);
struct usb_ctrlrequest *ctrlreq =
(struct usb_ctrlrequest *) urb->setup_packet;
struct vhci_device *vdev =
port_to_vdev(the_controller->pending_port);
if (type != PIPE_CONTROL || !ctrlreq) {
dev_err(dev, "invalid request to devnum 0\n");
......@@ -607,7 +616,9 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
dev_info(dev, "SetAddress Request (%d) to port %d\n",
ctrlreq->wValue, vdev->rhport);
vdev->udev = urb->dev;
if (vdev->udev)
usb_put_dev(vdev->udev);
vdev->udev = usb_get_dev(urb->dev);
spin_lock(&vdev->ud.lock);
vdev->ud.status = VDEV_ST_USED;
......@@ -627,8 +638,9 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
"Get_Descriptor to device 0 "
"(get max pipe size)\n");
/* FIXME: reference count? (usb_get_dev()) */
vdev->udev = urb->dev;
if (vdev->udev)
usb_put_dev(vdev->udev);
vdev->udev = usb_get_dev(urb->dev);
goto out;
default:
......@@ -805,7 +817,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
return 0;
}
static void vhci_device_unlink_cleanup(struct vhci_device *vdev)
{
struct vhci_unlink *unlink, *tmp;
......@@ -813,11 +824,34 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev)
spin_lock(&vdev->priv_lock);
list_for_each_entry_safe(unlink, tmp, &vdev->unlink_tx, list) {
usbip_uinfo("unlink cleanup tx %lu\n", unlink->unlink_seqnum);
list_del(&unlink->list);
kfree(unlink);
}
list_for_each_entry_safe(unlink, tmp, &vdev->unlink_rx, list) {
struct urb *urb;
/* give back URB of unanswered unlink request */
usbip_uinfo("unlink cleanup rx %lu\n", unlink->unlink_seqnum);
urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum);
if (!urb) {
usbip_uinfo("the urb (seqnum %lu) was already given back\n",
unlink->unlink_seqnum);
list_del(&unlink->list);
kfree(unlink);
continue;
}
urb->status = -ENODEV;
spin_lock(&the_controller->lock);
usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb);
spin_unlock(&the_controller->lock);
usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status);
list_del(&unlink->list);
kfree(unlink);
}
......@@ -887,6 +921,10 @@ static void vhci_device_reset(struct usbip_device *ud)
vdev->speed = 0;
vdev->devid = 0;
if (vdev->udev)
usb_put_dev(vdev->udev);
vdev->udev = NULL;
ud->tcp_socket = NULL;
ud->status = VDEV_ST_NULL;
......
......@@ -23,16 +23,14 @@
#include "vhci.h"
/* get URB from transmitted urb queue */
static struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev,
/* get URB from transmitted urb queue. caller must hold vdev->priv_lock */
struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev,
__u32 seqnum)
{
struct vhci_priv *priv, *tmp;
struct urb *urb = NULL;
int status;
spin_lock(&vdev->priv_lock);
list_for_each_entry_safe(priv, tmp, &vdev->priv_rx, list) {
if (priv->seqnum == seqnum) {
urb = priv->urb;
......@@ -63,8 +61,6 @@ static struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev,
}
}
spin_unlock(&vdev->priv_lock);
return urb;
}
......@@ -74,9 +70,11 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev,
struct usbip_device *ud = &vdev->ud;
struct urb *urb;
spin_lock(&vdev->priv_lock);
urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum);
spin_unlock(&vdev->priv_lock);
if (!urb) {
usbip_uerr("cannot find a urb of seqnum %u\n",
......@@ -161,7 +159,12 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,
return;
}
spin_lock(&vdev->priv_lock);
urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum);
spin_unlock(&vdev->priv_lock);
if (!urb) {
/*
* I get the result of a unlink request. But, it seems that I
......@@ -190,6 +193,19 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,
return;
}
static int vhci_priv_tx_empty(struct vhci_device *vdev)
{
int empty = 0;
spin_lock(&vdev->priv_lock);
empty = list_empty(&vdev->priv_rx);
spin_unlock(&vdev->priv_lock);
return empty;
}
/* recv a pdu */
static void vhci_rx_pdu(struct usbip_device *ud)
{
......@@ -202,11 +218,29 @@ static void vhci_rx_pdu(struct usbip_device *ud)
memset(&pdu, 0, sizeof(pdu));
/* 1. receive a pdu header */
ret = usbip_xmit(0, ud->tcp_socket, (char *) &pdu, sizeof(pdu), 0);
if (ret < 0) {
if (ret == -ECONNRESET)
usbip_uinfo("connection reset by peer\n");
else if (ret == -EAGAIN) {
/* ignore if connection was idle */
if (vhci_priv_tx_empty(vdev))
return;
usbip_uinfo("connection timed out with pending urbs\n");
} else if (ret != -ERESTARTSYS)
usbip_uinfo("xmit failed %d\n", ret);
usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
return;
}
if (ret == 0) {
usbip_uinfo("connection closed");
usbip_event_add(ud, VDEV_EVENT_DOWN);
return;
}
if (ret != sizeof(pdu)) {
usbip_uerr("receiving pdu failed! size is %d, should be %d\n",
usbip_uerr("received pdu size is %d, should be %d\n",
ret, (unsigned int)sizeof(pdu));
usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
return;
......
......@@ -3954,8 +3954,8 @@ void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo)
{
if ((((pVBInfo->VBInfo & SetCRT2ToLCD) | SetCRT2ToLCDA))
&& (pVBInfo->LCDInfo & SetLCDDualLink)) /* shampoo0129 */
if ((pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) &&
(pVBInfo->LCDInfo & SetLCDDualLink)) /* shampoo0129 */
return 1;
return 0;
......@@ -8773,7 +8773,7 @@ unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
if (pVBInfo->IF_DEF_LVDS == 0) {
CRT2Index = CRT2Index >> 6; /* for LCD */
if (((pVBInfo->VBInfo & SetCRT2ToLCD) | SetCRT2ToLCDA)) { /*301b*/
if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /*301b*/
if (pVBInfo->LCDResInfo != Panel1024x768)
VCLKIndex = LCDXlat2VCLK[CRT2Index];
else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册