Commit 67779e1b authored by Dennis Rassmann's avatar Dennis Rassmann

Merge remote-tracking branch 'origin/android-msm-mako-3.4-lollipop-mr1' into exp

parents 6b6539b4 99f5b2bd
......@@ -49,12 +49,14 @@
#define DEVICE_NAME "smdpkt"
#define WAKELOCK_TIMEOUT (2*HZ)
#define SMD_PKT_MAGIC (0xDEADBAAD)
struct smd_pkt_dev {
struct cdev cdev;
struct device *devicep;
void *pil;
char pdriver_name[PDRIVER_NAME_MAX_SIZE];
int magic;
struct platform_driver driver;
struct smd_channel *ch;
......@@ -826,8 +828,6 @@ int smd_pkt_open(struct inode *inode, struct file *file)
}
D_STATUS("Begin %s on smd_pkt_dev id:%d\n", __func__, smd_pkt_devp->i);
file->private_data = smd_pkt_devp;
mutex_lock(&smd_pkt_devp->ch_lock);
if (smd_pkt_devp->ch == 0) {
wake_lock_init(&smd_pkt_devp->pa_wake_lock, WAKE_LOCK_SUSPEND,
......@@ -942,6 +942,8 @@ release_pd:
platform_driver_unregister(&smd_pkt_devp->driver);
smd_pkt_devp->driver.probe = NULL;
}
else if (r == 0)
file->private_data = smd_pkt_devp;
out:
if (!smd_pkt_devp->ch)
wake_lock_destroy(&smd_pkt_devp->pa_wake_lock);
......@@ -976,8 +978,14 @@ int smd_pkt_release(struct inode *inode, struct file *file)
smd_pkt_devp->ch = 0;
smd_pkt_devp->blocking_write = 0;
smd_pkt_devp->poll_mode = 0;
platform_driver_unregister(&smd_pkt_devp->driver);
smd_pkt_devp->driver.probe = NULL;
if (smd_pkt_devp->driver.probe) {
platform_driver_unregister(&smd_pkt_devp->driver);
smd_pkt_devp->driver.probe = NULL;
} else {
pr_err("%s: invalid unregister dev id:%d magic %x\n",
__func__, smd_pkt_devp->i,
smd_pkt_devp->magic);
}
if (smd_pkt_devp->pil)
pil_put(smd_pkt_devp->pil);
smd_pkt_devp->has_reset = 0;
......@@ -1044,6 +1052,7 @@ static int __init smd_pkt_init(void)
smd_pkt_devp[i]->is_open = 0;
smd_pkt_devp[i]->poll_mode = 0;
smd_pkt_devp[i]->wakelock_locked = 0;
smd_pkt_devp[i]->magic = SMD_PKT_MAGIC;
init_waitqueue_head(&smd_pkt_devp[i]->ch_opened_wait_queue);
spin_lock_init(&smd_pkt_devp[i]->pa_spinlock);
......@@ -1117,6 +1126,7 @@ static void __exit smd_pkt_cleanup(void)
for (i = 0; i < NUM_SMD_PKT_PORTS; ++i) {
cdev_del(&smd_pkt_devp[i]->cdev);
smd_pkt_devp[i]->magic = 0;
kfree(smd_pkt_devp[i]);
device_destroy(smd_pkt_classp,
MKDEV(MAJOR(smd_pkt_number), i));
......
ARCH=arm
BRANCH=android-msm-mako-3.4-lmp-mr1
CROSS_COMPILE=arm-eabi-
DEFCONFIG=mako_defconfig
EXTRA_CMDS=''
KERNEL_DIR=private/msm-lge
LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin
FILES="
arch/arm/boot/zImage
vmlinux
System.map
"
......@@ -625,7 +625,14 @@ void *idr_get_next(struct idr *idp, int *nextidp)
return p;
}
id += 1 << n;
/*
* Proceed to the next layer at the current level. Unlike
* idr_for_each(), @id isn't guaranteed to be aligned to
* layer boundary at this point and adding 1 << n may
* incorrectly skip IDs. Make sure we jump to the
* beginning of the next layer using round_up().
*/
id = round_up(id + 1, 1 << n);
while (n < fls(id)) {
n += IDR_BITS;
p = *--paa;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment