summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-02-12 14:13:19 -0800
committerColin Cross <ccross@android.com>2011-02-12 14:13:19 -0800
commit87666eb18a15ffecfbd6108a9e2cb0d54e33ec99 (patch)
treeca3cdf277886299212f52471dcae6fa9b683802e
parentfd4194e5c3ab51f0eacdc115eeead02dbf8f4d88 (diff)
parent1cd64ef5c1becb1c70c432bdcae98fdb686a8173 (diff)
Merge branch 'android-2.6.36' into android-tegra-2.6.36
-rw-r--r--drivers/base/power/main.c2
-rw-r--r--drivers/mmc/core/mmc.c7
-rw-r--r--drivers/net/wireless/bcm4329/bcmsdh_linux.c12
-rw-r--r--drivers/net/wireless/bcm4329/bcmsdh_sdmmc_linux.c10
-rw-r--r--drivers/net/wireless/bcm4329/dhd_linux.c10
-rw-r--r--drivers/net/wireless/bcm4329/wl_iw.c1
-rw-r--r--drivers/usb/gadget/android.c32
-rw-r--r--drivers/usb/gadget/f_mtp.c32
-rw-r--r--include/linux/mmc/mmc.h1
-rw-r--r--include/linux/usb/android_composite.h7
10 files changed, 69 insertions, 45 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 4ff491f49ee4..1ba3de8015b5 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -881,7 +881,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
data.dev = dev;
data.tsk = get_current();
init_timer_on_stack(&timer);
- timer.expires = jiffies + HZ * 3;
+ timer.expires = jiffies + HZ * 12;
timer.function = dpm_drv_timeout;
timer.data = (unsigned long)&data;
add_timer(&timer);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 45055c46d954..6909a54c39be 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -253,13 +253,8 @@ static int mmc_read_ext_csd(struct mmc_card *card)
ext_csd[EXT_CSD_SEC_CNT + 3] << 24;
/* Cards with density > 2GiB are sector addressed */
- if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512) {
- unsigned boot_sectors;
- /* size is in 256K chunks, i.e. 512 sectors each */
- boot_sectors = ext_csd[EXT_CSD_BOOT_SIZE_MULTI] * 512;
- card->ext_csd.sectors -= boot_sectors;
+ if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512)
mmc_card_set_blockaddr(card);
- }
}
switch (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK) {
diff --git a/drivers/net/wireless/bcm4329/bcmsdh_linux.c b/drivers/net/wireless/bcm4329/bcmsdh_linux.c
index 3b7da4263fd8..1e33555b0531 100644
--- a/drivers/net/wireless/bcm4329/bcmsdh_linux.c
+++ b/drivers/net/wireless/bcm4329/bcmsdh_linux.c
@@ -301,7 +301,7 @@ int bcmsdh_remove(struct device *dev)
MFREE(osh, sdhc, sizeof(bcmsdh_hc_t));
osl_detach(osh);
-#if !defined(BCMLXSDMMC)
+#if !defined(BCMLXSDMMC) || defined(OOB_INTR_ONLY)
dev_set_drvdata(dev, NULL);
#endif /* !defined(BCMLXSDMMC) */
@@ -647,10 +647,12 @@ void bcmsdh_unregister_oob_intr(void)
{
SDLX_MSG(("%s: Enter\n", __FUNCTION__));
- set_irq_wake(sdhcinfo->oob_irq, 0);
- disable_irq(sdhcinfo->oob_irq); /* just in case.. */
- free_irq(sdhcinfo->oob_irq, NULL);
- sdhcinfo->oob_irq_registered = FALSE;
+ if (sdhcinfo->oob_irq_registered) {
+ set_irq_wake(sdhcinfo->oob_irq, 0);
+ disable_irq(sdhcinfo->oob_irq); /* just in case.. */
+ free_irq(sdhcinfo->oob_irq, NULL);
+ sdhcinfo->oob_irq_registered = FALSE;
+ }
}
#endif /* defined(OOB_INTR_ONLY) */
/* Module parameters specific to each host-controller driver */
diff --git a/drivers/net/wireless/bcm4329/bcmsdh_sdmmc_linux.c b/drivers/net/wireless/bcm4329/bcmsdh_sdmmc_linux.c
index 8992a4267f9f..5a1a46c93571 100644
--- a/drivers/net/wireless/bcm4329/bcmsdh_sdmmc_linux.c
+++ b/drivers/net/wireless/bcm4329/bcmsdh_sdmmc_linux.c
@@ -82,7 +82,6 @@ PBCMSDH_SDMMC_INSTANCE gInstance;
extern int bcmsdh_probe(struct device *dev);
extern int bcmsdh_remove(struct device *dev);
-struct device sdmmc_dev;
static int bcmsdh_sdmmc_probe(struct sdio_func *func,
const struct sdio_device_id *id)
@@ -102,7 +101,7 @@ static int bcmsdh_sdmmc_probe(struct sdio_func *func,
if(func->device == 0x4) { /* 4318 */
gInstance->func[2] = NULL;
sd_trace(("NIC found, calling bcmsdh_probe...\n"));
- ret = bcmsdh_probe(&sdmmc_dev);
+ ret = bcmsdh_probe(&func->dev);
}
}
@@ -110,7 +109,7 @@ static int bcmsdh_sdmmc_probe(struct sdio_func *func,
if (func->num == 2) {
sd_trace(("F2 found, calling bcmsdh_probe...\n"));
- ret = bcmsdh_probe(&sdmmc_dev);
+ ret = bcmsdh_probe(&func->dev);
}
return ret;
@@ -126,7 +125,7 @@ static void bcmsdh_sdmmc_remove(struct sdio_func *func)
if (func->num == 2) {
sd_trace(("F2 found, calling bcmsdh_remove...\n"));
- bcmsdh_remove(&sdmmc_dev);
+ bcmsdh_remove(&func->dev);
}
}
@@ -250,10 +249,8 @@ int sdio_function_init(void)
if (!gInstance)
return -ENOMEM;
- bzero(&sdmmc_dev, sizeof(sdmmc_dev));
error = sdio_register_driver(&bcmsdh_sdmmc_driver);
-
return error;
}
@@ -265,7 +262,6 @@ void sdio_function_cleanup(void)
{
sd_trace(("%s Enter\n", __FUNCTION__));
-
sdio_unregister_driver(&bcmsdh_sdmmc_driver);
if (gInstance)
diff --git a/drivers/net/wireless/bcm4329/dhd_linux.c b/drivers/net/wireless/bcm4329/dhd_linux.c
index c7ef3edd908f..dc0ec1602cd0 100644
--- a/drivers/net/wireless/bcm4329/dhd_linux.c
+++ b/drivers/net/wireless/bcm4329/dhd_linux.c
@@ -2185,12 +2185,15 @@ dhd_bus_start(dhd_pub_t *dhdp)
DHD_TRACE(("%s: \n", __FUNCTION__));
+ dhd_os_sdlock(dhdp);
+
/* try to download image and nvram to the dongle */
if (dhd->pub.busstate == DHD_BUS_DOWN) {
if (!(dhd_bus_download_firmware(dhd->pub.bus, dhd->pub.osh,
fw_path, nv_path))) {
DHD_ERROR(("%s: dhdsdio_probe_download failed. firmware = %s nvram = %s\n",
__FUNCTION__, fw_path, nv_path));
+ dhd_os_sdunlock(dhdp);
return -1;
}
}
@@ -2200,8 +2203,9 @@ dhd_bus_start(dhd_pub_t *dhdp)
dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms);
/* Bring up the bus */
- if ((ret = dhd_bus_init(&dhd->pub, TRUE)) != 0) {
+ if ((ret = dhd_bus_init(&dhd->pub, FALSE)) != 0) {
DHD_ERROR(("%s, dhd_bus_init failed %d\n", __FUNCTION__, ret));
+ dhd_os_sdunlock(dhdp);
return ret;
}
#if defined(OOB_INTR_ONLY)
@@ -2210,6 +2214,7 @@ dhd_bus_start(dhd_pub_t *dhdp)
dhd->wd_timer_valid = FALSE;
del_timer_sync(&dhd->timer);
DHD_ERROR(("%s Host failed to resgister for OOB\n", __FUNCTION__));
+ dhd_os_sdunlock(dhdp);
return -ENODEV;
}
@@ -2222,9 +2227,12 @@ dhd_bus_start(dhd_pub_t *dhdp)
dhd->wd_timer_valid = FALSE;
del_timer_sync(&dhd->timer);
DHD_ERROR(("%s failed bus is not ready\n", __FUNCTION__));
+ dhd_os_sdunlock(dhdp);
return -ENODEV;
}
+ dhd_os_sdunlock(dhdp);
+
#ifdef EMBEDDED_PLATFORM
bcm_mkiovar("event_msgs", dhdp->eventmask, WL_EVENTING_MASK_LEN, iovbuf, sizeof(iovbuf));
dhdcdc_query_ioctl(dhdp, 0, WLC_GET_VAR, iovbuf, sizeof(iovbuf));
diff --git a/drivers/net/wireless/bcm4329/wl_iw.c b/drivers/net/wireless/bcm4329/wl_iw.c
index 8460804c945a..00222196f6e4 100644
--- a/drivers/net/wireless/bcm4329/wl_iw.c
+++ b/drivers/net/wireless/bcm4329/wl_iw.c
@@ -3686,6 +3686,7 @@ wl_iw_handle_scanresults_ies(char **event_p, char *end,
wpa_snprintf_hex(buf + 10, 2+1, &(ie->len), 1);
wpa_snprintf_hex(buf + 12, 2*ie->len+1, ie->data, ie->len);
event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, buf);
+ kfree(buf);
#endif
break;
}
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index 213e8a2d7825..8e6cafc851cb 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -65,6 +65,7 @@ struct android_dev {
int num_functions;
char **functions;
+ int vendor_id;
int product_id;
int version;
};
@@ -255,6 +256,22 @@ static int product_matches_functions(struct android_usb_product *p)
return 1;
}
+static int get_vendor_id(struct android_dev *dev)
+{
+ struct android_usb_product *p = dev->products;
+ int count = dev->num_products;
+ int i;
+
+ if (p) {
+ for (i = 0; i < count; i++, p++) {
+ if (p->vendor_id && product_matches_functions(p))
+ return p->vendor_id;
+ }
+ }
+ /* use default vendor ID */
+ return dev->vendor_id;
+}
+
static int get_product_id(struct android_dev *dev)
{
struct android_usb_product *p = dev->products;
@@ -275,7 +292,7 @@ static int android_bind(struct usb_composite_dev *cdev)
{
struct android_dev *dev = _android_dev;
struct usb_gadget *gadget = cdev->gadget;
- int gcnum, id, product_id, ret;
+ int gcnum, id, ret;
printk(KERN_INFO "android_bind\n");
@@ -325,8 +342,8 @@ static int android_bind(struct usb_composite_dev *cdev)
usb_gadget_set_selfpowered(gadget);
dev->cdev = cdev;
- product_id = get_product_id(dev);
- device_desc.idProduct = __constant_cpu_to_le16(product_id);
+ device_desc.idVendor = __constant_cpu_to_le16(get_vendor_id(dev));
+ device_desc.idProduct = __constant_cpu_to_le16(get_product_id(dev));
cdev->desc.idProduct = device_desc.idProduct;
return 0;
@@ -396,7 +413,6 @@ void android_enable_function(struct usb_function *f, int enable)
{
struct android_dev *dev = _android_dev;
int disable = !enable;
- int product_id;
if (!!f->disabled != disable) {
usb_function_set_enabled(f, !disable);
@@ -418,8 +434,8 @@ void android_enable_function(struct usb_function *f, int enable)
update_dev_desc(dev);
- product_id = get_product_id(dev);
- device_desc.idProduct = __constant_cpu_to_le16(product_id);
+ device_desc.idVendor = __constant_cpu_to_le16(get_vendor_id(dev));
+ device_desc.idProduct = __constant_cpu_to_le16(get_product_id(dev));
if (dev->cdev)
dev->cdev->desc.idProduct = device_desc.idProduct;
usb_composite_force_reset(dev->cdev);
@@ -438,9 +454,11 @@ static int android_probe(struct platform_device *pdev)
dev->num_products = pdata->num_products;
dev->functions = pdata->functions;
dev->num_functions = pdata->num_functions;
- if (pdata->vendor_id)
+ if (pdata->vendor_id) {
+ dev->vendor_id = pdata->vendor_id;
device_desc.idVendor =
__constant_cpu_to_le16(pdata->vendor_id);
+ }
if (pdata->product_id) {
dev->product_id = pdata->product_id;
device_desc.idProduct =
diff --git a/drivers/usb/gadget/f_mtp.c b/drivers/usb/gadget/f_mtp.c
index e07224fd9f89..8128b203e76f 100644
--- a/drivers/usb/gadget/f_mtp.c
+++ b/drivers/usb/gadget/f_mtp.c
@@ -92,7 +92,6 @@ struct mtp_dev {
wait_queue_head_t read_wq;
wait_queue_head_t write_wq;
- wait_queue_head_t intr_wq;
struct usb_request *rx_req[RX_REQ_MAX];
struct usb_request *intr_req;
int rx_done;
@@ -373,12 +372,11 @@ static void mtp_complete_intr(struct usb_ep *ep, struct usb_request *req)
{
struct mtp_dev *dev = _mtp_dev;
- DBG(dev->cdev, "mtp_complete_intr status: %d actual: %d\n", req->status, req->actual);
+ DBG(dev->cdev, "mtp_complete_intr status: %d actual: %d\n",
+ req->status, req->actual);
dev->intr_busy = 0;
if (req->status != 0)
dev->state = STATE_ERROR;
-
- wake_up(&dev->intr_wq);
}
static int __init create_bulk_endpoints(struct mtp_dev *dev,
@@ -662,6 +660,10 @@ static void send_file_work(struct work_struct *data) {
ret = wait_event_interruptible(dev->write_wq,
(req = req_get(dev, &dev->tx_idle))
|| dev->state != STATE_BUSY);
+ if (dev->state == STATE_CANCELED) {
+ r = -ECANCELED;
+ break;
+ }
if (!req) {
r = ret;
break;
@@ -794,13 +796,15 @@ static int mtp_send_event(struct mtp_dev *dev, struct mtp_event *event)
if (length < 0 || length > INTR_BUFFER_SIZE)
return -EINVAL;
-
- /* wait for a request to complete */
- ret = wait_event_interruptible(dev->intr_wq, !dev->intr_busy || dev->state == STATE_OFFLINE);
- if (ret < 0)
- return ret;
if (dev->state == STATE_OFFLINE)
return -ENODEV;
+ /* unfortunately an interrupt request might hang indefinitely if the host
+ * is not listening on the interrupt endpoint, so instead of waiting,
+ * we just fail if the endpoint is busy.
+ */
+ if (dev->intr_busy)
+ return -EBUSY;
+
req = dev->intr_req;
if (copy_from_user(req->buf, (void __user *)event->data, length))
return -EFAULT;
@@ -1012,7 +1016,6 @@ mtp_function_unbind(struct usb_configuration *c, struct usb_function *f)
mtp_request_free(dev->intr_req, dev->ep_intr);
dev->state = STATE_OFFLINE;
spin_unlock_irq(&dev->lock);
- wake_up(&dev->intr_wq);
misc_deregister(&mtp_device);
kfree(_mtp_dev);
@@ -1098,14 +1101,13 @@ static int mtp_function_setup(struct usb_function *f,
/* device status is "busy" until we report
* the cancelation to userspace
*/
- if (dev->state == STATE_BUSY
- || dev->state == STATE_CANCELED)
+ if (dev->state == STATE_CANCELED)
status->wCode =
__cpu_to_le16(MTP_RESPONSE_DEVICE_BUSY);
else
status->wCode =
__cpu_to_le16(MTP_RESPONSE_OK);
- spin_unlock_irqrestore(&dev->lock, flags);
+ spin_unlock_irqrestore(&dev->lock, flags);
value = sizeof(*status);
}
}
@@ -1177,7 +1179,6 @@ static void mtp_function_disable(struct usb_function *f)
/* readers may be blocked waiting for us to go online */
wake_up(&dev->read_wq);
- wake_up(&dev->intr_wq);
VDBG(cdev, "%s disabled\n", dev->function.name);
}
@@ -1185,7 +1186,7 @@ static void mtp_function_disable(struct usb_function *f)
static int mtp_bind_config(struct usb_configuration *c)
{
struct mtp_dev *dev;
- int ret;
+ int ret = 0;
printk(KERN_INFO "mtp_bind_config\n");
@@ -1205,7 +1206,6 @@ static int mtp_bind_config(struct usb_configuration *c)
spin_lock_init(&dev->lock);
init_waitqueue_head(&dev->read_wq);
init_waitqueue_head(&dev->write_wq);
- init_waitqueue_head(&dev->intr_wq);
atomic_set(&dev->open_excl, 0);
atomic_set(&dev->ioctl_excl, 0);
INIT_LIST_HEAD(&dev->tx_idle);
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index a5d765c01281..5b35987e691b 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -267,7 +267,6 @@ struct _mmc_csd {
#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */
#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */
#define EXT_CSD_TRIM_MULT 232 /* RO */
-#define EXT_CSD_BOOT_SIZE_MULTI 226 /* RO */
/*
* EXT_CSD field definitions
diff --git a/include/linux/usb/android_composite.h b/include/linux/usb/android_composite.h
index 62e72e3bd2b6..7f9000711f4e 100644
--- a/include/linux/usb/android_composite.h
+++ b/include/linux/usb/android_composite.h
@@ -27,7 +27,12 @@ struct android_usb_function {
};
struct android_usb_product {
- /* Default product ID. */
+ /* Vendor ID for this set of functions.
+ * Default vendor_id in platform data will be used if this is zero.
+ */
+ __u16 vendor_id;
+
+ /* Product ID for this set of functions. */
__u16 product_id;
/* List of function names associated with this product.